diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2013-09-27 07:57:34 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2013-09-27 07:57:34 +0000 |
| commit | 68c880b5f9f95c1225338905ae63a5487b118f15 (patch) | |
| tree | f58c060a5787c4739f8252afcccadb9a919a0587 /clang | |
| parent | 69bd8fb79a44f9173f98ae478735f58d7bb940f4 (diff) | |
| download | bcm5719-llvm-68c880b5f9f95c1225338905ae63a5487b118f15.tar.gz bcm5719-llvm-68c880b5f9f95c1225338905ae63a5487b118f15.zip | |
AST: Handle multidimensional arrays inside of __uuidof()
We previously handled one-dimensional arrays but didn't consider the
general case. The fix is simple: keep going through subsequent
dimensions until we get to the base element.
llvm-svn: 191493
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/AST/ExprCXX.cpp | 2 | ||||
| -rw-r--r-- | clang/test/Parser/MicrosoftExtensions.cpp | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp index c7d2f78104b..a13d6f79c86 100644 --- a/clang/lib/AST/ExprCXX.cpp +++ b/clang/lib/AST/ExprCXX.cpp @@ -62,7 +62,7 @@ UuidAttr *CXXUuidofExpr::GetUuidAttrOfType(QualType QT, if (QT->isPointerType() || QT->isReferenceType()) Ty = QT->getPointeeType().getTypePtr(); else if (QT->isArrayType()) - Ty = cast<ArrayType>(QT)->getElementType().getTypePtr(); + Ty = Ty->getBaseElementTypeUnsafe(); // Loop all record redeclaration looking for an uuid attribute. CXXRecordDecl *RD = Ty->getAsCXXRecordDecl(); diff --git a/clang/test/Parser/MicrosoftExtensions.cpp b/clang/test/Parser/MicrosoftExtensions.cpp index ef873d64306..0327499f272 100644 --- a/clang/test/Parser/MicrosoftExtensions.cpp +++ b/clang/test/Parser/MicrosoftExtensions.cpp @@ -72,6 +72,10 @@ int uuid_sema_test() __uuidof(struct_without_uuid); // expected-error {{cannot call operator __uuidof on a type with no GUID}} __uuidof(struct_with_uuid*); __uuidof(struct_without_uuid*); // expected-error {{cannot call operator __uuidof on a type with no GUID}} + __uuidof(struct_with_uuid[1]); + __uuidof(struct_with_uuid*[1]); // expected-error {{cannot call operator __uuidof on a type with no GUID}} + __uuidof(const struct_with_uuid[1][1]); + __uuidof(const struct_with_uuid*[1][1]); // expected-error {{cannot call operator __uuidof on a type with no GUID}} __uuidof(var_with_uuid); __uuidof(var_without_uuid);// expected-error {{cannot call operator __uuidof on a type with no GUID}} |

