diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-11-20 01:35:11 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-11-20 01:35:11 +0000 |
commit | 6adb42e1ac111305fcba657e6c7fe02fcc9f83e2 (patch) | |
tree | e7858be68b73c0e52d710e985fd3bc1f445b500f /clang/lib/AST/ItaniumMangle.cpp | |
parent | cfb97aa62048d46065da8199bb69c2c53e021f05 (diff) | |
download | bcm5719-llvm-6adb42e1ac111305fcba657e6c7fe02fcc9f83e2.tar.gz bcm5719-llvm-6adb42e1ac111305fcba657e6c7fe02fcc9f83e2.zip |
When mangling member-expressions, skip implicit accesses of anonymous union
objects. This is consistent with GCC's behavior. Patch by Tomasz Miąsko!
llvm-svn: 222402
Diffstat (limited to 'clang/lib/AST/ItaniumMangle.cpp')
-rw-r--r-- | clang/lib/AST/ItaniumMangle.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index e6409ce4d87..9e9c1718d16 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -2532,6 +2532,18 @@ void CXXNameMangler::mangleMemberExpr(const Expr *base, // <expression> ::= dt <expression> <unresolved-name> // ::= pt <expression> <unresolved-name> if (base) { + + // Ignore member expressions involving anonymous unions. + while (const auto *RT = base->getType()->getAs<RecordType>()) { + if (!RT->getDecl()->isAnonymousStructOrUnion()) + break; + const auto *ME = dyn_cast<MemberExpr>(base); + if (!ME) + break; + base = ME->getBase(); + isArrow = ME->isArrow(); + } + if (base->isImplicitCXXThis()) { // Note: GCC mangles member expressions to the implicit 'this' as // *this., whereas we represent them as this->. The Itanium C++ ABI |