]> granicus.if.org Git - clang/commit
When importing classes and structs with anonymous structs, it is critical that
authorSean Callanan <scallanan@apple.com>
Thu, 14 Jul 2016 19:53:44 +0000 (19:53 +0000)
committerSean Callanan <scallanan@apple.com>
Thu, 14 Jul 2016 19:53:44 +0000 (19:53 +0000)
commitc0f3c387ce9b92d5fbd28a7f4f438935b547a2ce
tree64f595f909bb149c7f750efc0782f5050f436d4a
parent56d0aaf1e7d97762d51581c51853006c85cd2be1
When importing classes and structs with anonymous structs, it is critical that
distinct anonymous structs remain distinct despite having similar layout.

This is already ensured by distinguishing based on their placement in the parent
struct, using the function `findAnonymousStructOrUnionIndex`.

The problem is that this function only handles anonymous structs, like
```
class Foo { struct { int a; } }
```
and not untagged structs like
```
class Foo { struct { int a; } var; }
```
Both need to be handled, and this patch fixes that.  The test case ensures that this functionality doesn't regress.

Thanks to Manman Ren for review.

https://reviews.llvm.org/D22270

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275460 91177308-0d34-0410-b5e6-96231b3b80d8
lib/AST/ASTImporter.cpp
test/ASTMerge/Inputs/anonymous-fields1.cpp [new file with mode: 0644]
test/ASTMerge/Inputs/anonymous-fields2.cpp [new file with mode: 0644]
test/ASTMerge/anonymous-fields.cpp [new file with mode: 0644]