diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2010-11-24 13:48:50 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2010-11-24 13:48:50 +0000 |
commit | 8be65a792ff56526e8937340ab620f75524b1de7 (patch) | |
tree | bb2fb31ccf8f55d2c5256a1fa2a0e0145b5a9b58 | |
parent | a1a9ba11b78509dd11a2b69dae0c6049118f245c (diff) | |
download | bcm5719-llvm-8be65a792ff56526e8937340ab620f75524b1de7.tar.gz bcm5719-llvm-8be65a792ff56526e8937340ab620f75524b1de7.zip |
When getting CXXThisRegion from CXXMethodDecl, use the qualifiers. This is
to be consistent with the type of 'this' expr in the method.
此行及以下内容将会被忽略--
M test/Analysis/method-call.cpp
M include/clang/Checker/PathSensitive/GRExprEngine.h
M lib/Checker/GRCXXExprEngine.cpp
llvm-svn: 120094
-rw-r--r-- | clang/include/clang/Checker/PathSensitive/GRExprEngine.h | 3 | ||||
-rw-r--r-- | clang/lib/Checker/GRCXXExprEngine.cpp | 8 | ||||
-rw-r--r-- | clang/test/Analysis/method-call.cpp | 2 |
3 files changed, 11 insertions, 2 deletions
diff --git a/clang/include/clang/Checker/PathSensitive/GRExprEngine.h b/clang/include/clang/Checker/PathSensitive/GRExprEngine.h index 4e97b8ee2e5..519a3e4c6fc 100644 --- a/clang/include/clang/Checker/PathSensitive/GRExprEngine.h +++ b/clang/include/clang/Checker/PathSensitive/GRExprEngine.h @@ -462,6 +462,9 @@ public: const CXXThisRegion *getCXXThisRegion(const CXXRecordDecl *RD, const StackFrameContext *SFC); + const CXXThisRegion *getCXXThisRegion(const CXXMethodDecl *decl, + const StackFrameContext *frameCtx); + /// Evaluate arguments with a work list algorithm. void EvalArguments(ConstExprIterator AI, ConstExprIterator AE, const FunctionProtoType *FnType, diff --git a/clang/lib/Checker/GRCXXExprEngine.cpp b/clang/lib/Checker/GRCXXExprEngine.cpp index 4a0fdc66ed8..2dd03b2782c 100644 --- a/clang/lib/Checker/GRCXXExprEngine.cpp +++ b/clang/lib/Checker/GRCXXExprEngine.cpp @@ -77,6 +77,12 @@ const CXXThisRegion *GRExprEngine::getCXXThisRegion(const CXXRecordDecl *D, return ValMgr.getRegionManager().getCXXThisRegion(PT, SFC); } +const CXXThisRegion *GRExprEngine::getCXXThisRegion(const CXXMethodDecl *decl, + const StackFrameContext *frameCtx) { + return ValMgr.getRegionManager(). + getCXXThisRegion(decl->getThisType(getContext()), frameCtx); +} + void GRExprEngine::CreateCXXTemporaryObject(const Expr *Ex, ExplodedNode *Pred, ExplodedNodeSet &Dst) { ExplodedNodeSet Tmp; @@ -242,7 +248,7 @@ void GRExprEngine::EvalMethodCall(const CallExpr *MCE, const CXXMethodDecl *MD, MCE, false, Builder->getBlock(), Builder->getIndex()); - const CXXThisRegion *ThisR = getCXXThisRegion(MD->getParent(), SFC); + const CXXThisRegion *ThisR = getCXXThisRegion(MD, SFC); CallEnter Loc(MCE, SFC, Pred->getLocationContext()); for (ExplodedNodeSet::iterator I = PreVisitChecks.begin(), E = PreVisitChecks.end(); I != E; ++I) { diff --git a/clang/test/Analysis/method-call.cpp b/clang/test/Analysis/method-call.cpp index a766da9aae2..6cfbda895de 100644 --- a/clang/test/Analysis/method-call.cpp +++ b/clang/test/Analysis/method-call.cpp @@ -3,7 +3,7 @@ struct A { int x; A(int a) { x = a; } - int getx() { return x; } + int getx() const { return x; } }; void f1() { |