summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenTBAA.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2013-07-05 20:27:40 +0000
committerEli Friedman <eli.friedman@gmail.com>2013-07-05 20:27:40 +0000
commiteecc09a99c34526ab5afb8e8d870bd8870425feb (patch)
tree6951997f8d069e68e8a2d0e4c18a04e7c01596fb /clang/lib/CodeGen/CodeGenTBAA.cpp
parent784c012982b275577fb5b98b5fa93e39a6c4b004 (diff)
downloadbcm5719-llvm-eecc09a99c34526ab5afb8e8d870bd8870425feb.tar.gz
bcm5719-llvm-eecc09a99c34526ab5afb8e8d870bd8870425feb.zip
Don't use mangleCXXRTTIName in TBAA for C code.
This changes the TBAA code so it doesn't use mangleCXXRTTIName in C, because it doesn't really make sense there. Also, as sort of a defense-in-depth change, fix the mangler so it handles C RecordDecls correctly. No tests because I don't know the TBAA code well enough to write a test, and I don't know how else to trigger mangling a local struct in C. Fixes a crash with r185450 reported by Joerg Sonnenberger. llvm-svn: 185721
Diffstat (limited to 'clang/lib/CodeGen/CodeGenTBAA.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenTBAA.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CodeGenTBAA.cpp b/clang/lib/CodeGen/CodeGenTBAA.cpp
index f299481ffe3..0a8c293cb70 100644
--- a/clang/lib/CodeGen/CodeGenTBAA.cpp
+++ b/clang/lib/CodeGen/CodeGenTBAA.cpp
@@ -150,19 +150,11 @@ CodeGenTBAA::getTBAAInfo(QualType QTy) {
// Enum types are distinct types. In C++ they have "underlying types",
// however they aren't related for TBAA.
if (const EnumType *ETy = dyn_cast<EnumType>(Ty)) {
- // In C mode, two anonymous enums are compatible iff their members
- // are the same -- see C99 6.2.7p1. For now, be conservative. We could
- // theoretically implement this by combining information about all the
- // members into a single identifying MDNode.
- if (!Features.CPlusPlus &&
- ETy->getDecl()->getTypedefNameForAnonDecl())
- return MetadataCache[Ty] = getChar();
-
// In C++ mode, types have linkage, so we can rely on the ODR and
// on their mangled names, if they're external.
// TODO: Is there a way to get a program-wide unique name for a
// decl with local linkage or no linkage?
- if (Features.CPlusPlus && !ETy->getDecl()->isExternallyVisible())
+ if (!Features.CPlusPlus || !ETy->getDecl()->isExternallyVisible())
return MetadataCache[Ty] = getChar();
// TODO: This is using the RTTI name. Is there a better way to get
OpenPOWER on IntegriCloud