aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/MemRegion.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2013-02-22 19:33:13 +0000
committerJordan Rose <jordan_rose@apple.com>2013-02-22 19:33:13 +0000
commitae7396c3891748762d01431e16541b3eb9125c4d (patch)
tree93129cef399c6865b1d692804cd767e26a652d52 /lib/StaticAnalyzer/Core/MemRegion.cpp
parent4c67aa96401b67b5200e701cff87485067ab0792 (diff)
[analyzer] Don't canonicalize the RecordDecl used in CXXBaseObjectRegion.
This Decl shouldn't be the canonical Decl; it should be the Decl used by the CXXBaseSpecifier in the subclass. Unfortunately, that means continuing to throw getCanonicalDecl() on all comparisons. This fixes MemRegion::getAsOffset's use of ASTRecordLayout when redeclarations are involved. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175913 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/MemRegion.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/MemRegion.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/StaticAnalyzer/Core/MemRegion.cpp b/lib/StaticAnalyzer/Core/MemRegion.cpp
index e67297d86b..a3e42eaa46 100644
--- a/lib/StaticAnalyzer/Core/MemRegion.cpp
+++ b/lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -892,6 +892,8 @@ MemRegionManager::getCXXTempObjectRegion(Expr const *E,
static bool isValidBaseClass(const CXXRecordDecl *BaseClass,
const TypedValueRegion *Super,
bool IsVirtual) {
+ BaseClass = BaseClass->getCanonicalDecl();
+
const CXXRecordDecl *Class = Super->getValueType()->getAsCXXRecordDecl();
if (!Class)
return true;
@@ -913,8 +915,6 @@ const CXXBaseObjectRegion *
MemRegionManager::getCXXBaseObjectRegion(const CXXRecordDecl *RD,
const MemRegion *Super,
bool IsVirtual) {
- RD = RD->getCanonicalDecl();
-
if (isa<TypedValueRegion>(Super)) {
assert(isValidBaseClass(RD, dyn_cast<TypedValueRegion>(Super), IsVirtual));
(void)isValidBaseClass;