diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-06-22 23:55:50 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-06-22 23:55:50 +0000 |
commit | 72b3452c2b35b9c4c4163c1bb05a8aa60abd5cad (patch) | |
tree | a409ed062d382e9e0d66af2ca1a04e74803a61fa /clang/lib/StaticAnalyzer/Core/SValBuilder.cpp | |
parent | 9cb8e9fc89d347c7e1cfe19a832e45188166a2d5 (diff) | |
download | bcm5719-llvm-72b3452c2b35b9c4c4163c1bb05a8aa60abd5cad.tar.gz bcm5719-llvm-72b3452c2b35b9c4c4163c1bb05a8aa60abd5cad.zip |
Implement initial static analysis inlining support for C++ methods.
llvm-svn: 159047
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/SValBuilder.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/SValBuilder.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp b/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp index c391489beb1..d1936cd3603 100644 --- a/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp +++ b/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "clang/AST/ExprCXX.h" +#include "clang/AST/DeclCXX.h" #include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h" #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h" #include "clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h" @@ -204,6 +205,21 @@ DefinedSVal SValBuilder::getBlockPointer(const BlockDecl *block, return loc::MemRegionVal(BD); } +/// Return a memory region for the 'this' object reference. +loc::MemRegionVal SValBuilder::getCXXThis(const CXXMethodDecl *D, + const StackFrameContext *SFC) { + return loc::MemRegionVal(getRegionManager(). + getCXXThisRegion(D->getThisType(getContext()), SFC)); +} + +/// Return a memory region for the 'this' object reference. +loc::MemRegionVal SValBuilder::getCXXThis(const CXXRecordDecl *D, + const StackFrameContext *SFC) { + const Type *T = D->getTypeForDecl(); + QualType PT = getContext().getPointerType(QualType(T, 0)); + return loc::MemRegionVal(getRegionManager().getCXXThisRegion(PT, SFC)); +} + //===----------------------------------------------------------------------===// SVal SValBuilder::makeSymExprValNN(ProgramStateRef State, |