Struct-path aware TBAA: enable struct-path aware TBAA for classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180795 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CodeGenTBAA.cpp b/lib/CodeGen/CodeGenTBAA.cpp
index 54e0de6..5ff1560 100644
--- a/lib/CodeGen/CodeGenTBAA.cpp
+++ b/lib/CodeGen/CodeGenTBAA.cpp
@@ -255,9 +255,11 @@
static bool isTBAAPathStruct(QualType QTy) {
if (const RecordType *TTy = QTy->getAs<RecordType>()) {
const RecordDecl *RD = TTy->getDecl()->getDefinition();
+ if (RD->hasFlexibleArrayMember())
+ return false;
// RD can be struct, union, class, interface or enum.
- // For now, we only handle struct.
- if (RD->isStruct() && !RD->hasFlexibleArrayMember())
+ // For now, we only handle struct and class.
+ if (RD->isStruct() || RD->isClass())
return true;
}
return false;