[cfe-commits] r120094 - in /cfe/trunk: include/clang/Checker/PathSensitive/GRExprEngine.h lib/Checker/GRCXXExprEngine.cpp test/Analysis/method-call.cpp

Zhongxing Xu xuzhongxing at gmail.com
Wed Nov 24 05:48:50 PST 2010


Author: zhongxingxu
Date: Wed Nov 24 07:48:50 2010
New Revision: 120094

URL: http://llvm.org/viewvc/llvm-project?rev=120094&view=rev
Log:
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

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

Modified: cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h?rev=120094&r1=120093&r2=120094&view=diff
==============================================================================
--- cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h (original)
+++ cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h Wed Nov 24 07:48:50 2010
@@ -462,6 +462,9 @@
   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, 

Modified: cfe/trunk/lib/Checker/GRCXXExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRCXXExprEngine.cpp?rev=120094&r1=120093&r2=120094&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/GRCXXExprEngine.cpp (original)
+++ cfe/trunk/lib/Checker/GRCXXExprEngine.cpp Wed Nov 24 07:48:50 2010
@@ -77,6 +77,12 @@
   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 @@
                                                     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) {

Modified: cfe/trunk/test/Analysis/method-call.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/method-call.cpp?rev=120094&r1=120093&r2=120094&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/method-call.cpp (original)
+++ cfe/trunk/test/Analysis/method-call.cpp Wed Nov 24 07:48:50 2010
@@ -3,7 +3,7 @@
 struct A {
   int x;
   A(int a) { x = a; }
-  int getx() { return x; }
+  int getx() const { return x; }
 };
 
 void f1() {





More information about the cfe-commits mailing list