https://bugs.llvm.org/show_bug.cgi?id=41127
Bug ID: 41127
Summary: AST dumping a function misbehaves with esoteric return
or parameter types
Product: clang
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: aa...@aaronballman.com
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
neeil...@live.com, richard-l...@metafoo.co.uk
Consider the following snippet of legal C code:
struct S { int x, y; } f(int i) {
return (struct S){1, 2};
}
The AST dump generated for that is:
TranslationUnitDecl
|-RecordDecl <line:1:1, col:22> col:8 struct S definition
| |-FieldDecl <col:12, col:16> col:16 referenced x 'int'
| `-FieldDecl <col:12, col:19> col:19 y 'int'
Note that the FunctionDecl is entirely missing. We have similarly bad behavior
when defining the type within the function parameter list in that it neglects
to print the structure.
void g(struct T { int x, y; } t) {
}
void h(struct { int x, y; } t) {
}
Results in:
TranslationUnitDecl
|-FunctionDecl <line:1:1, line:2:1> line:1:6 g 'void (struct T)'
| |-ParmVarDecl <col:8, col:31> col:31 t 'struct T':'struct T'
| `-CompoundStmt <col:34, line:2:1>
|-RecordDecl <line:4:8, col:27> col:8 struct definition
| |-FieldDecl <col:17, col:21> col:21 x 'int'
| `-FieldDecl <col:17, col:24> col:24 y 'int'
`-FunctionDecl <col:1, line:5:1> line:4:6 h 'void (struct (anonymous struct at
line:4:8))'
|-ParmVarDecl <col:8, col:29> col:29 t 'struct (anonymous struct at
line:4:8)':'struct (anonymous at line:4:8)'
`-CompoundStmt <col:32, line:5:1>
g() does not have the structure definition printed for it, and the anonymous
struct defined in h() looks like it's at TU scope (which may be okay given that
the anonymous struct cannot be named elsewhere anyway).
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs