]> granicus.if.org Git - clang/commitdiff
When getting CXXThisRegion from CXXMethodDecl, use the qualifiers. This is
authorZhongxing Xu <xuzhongxing@gmail.com>
Wed, 24 Nov 2010 13:48:50 +0000 (13:48 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Wed, 24 Nov 2010 13:48:50 +0000 (13:48 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120094 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Checker/PathSensitive/GRExprEngine.h
lib/Checker/GRCXXExprEngine.cpp
test/Analysis/method-call.cpp

index 4e97b8ee2e575e46fe5678040dd3af6259fb1c1e..519a3e4c6fce854319508f1b9179081e109c951b 100644 (file)
@@ -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, 
index 4a0fdc66ed8e05c483c148dd1bb38d4021801094..2dd03b2782c3b7da8c819c9f6a651efea06e32fe 100644 (file)
@@ -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) {
index a766da9aae2f4c1874d0d993d8b16a6c5366ef7e..6cfbda895dec00463512a0aeffcda995ea6aa537 100644 (file)
@@ -3,7 +3,7 @@
 struct A {
   int x;
   A(int a) { x = a; }
-  int getx() { return x; }
+  int getx() const { return x; }
 };
 
 void f1() {