From e36d3416abbd1eeb3567834a4c2b05d727a979da Mon Sep 17 00:00:00 2001 From: Manman Ren Date: Tue, 30 Apr 2013 17:38:09 +0000 Subject: Struct-path aware TBAA: enable struct-path aware TBAA for classes. llvm-svn: 180795 --- clang/lib/CodeGen/CodeGenTBAA.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenTBAA.cpp') diff --git a/clang/lib/CodeGen/CodeGenTBAA.cpp b/clang/lib/CodeGen/CodeGenTBAA.cpp index 54e0de6c129..5ff1560a488 100644 --- a/clang/lib/CodeGen/CodeGenTBAA.cpp +++ b/clang/lib/CodeGen/CodeGenTBAA.cpp @@ -255,9 +255,11 @@ CodeGenTBAA::getTBAAStructInfo(QualType QTy) { static bool isTBAAPathStruct(QualType QTy) { if (const RecordType *TTy = QTy->getAs()) { 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; -- cgit v1.2.3