]> granicus.if.org Git - clang/commitdiff
Get the code decl from the initial location context.
authorZhongxing Xu <xuzhongxing@gmail.com>
Fri, 21 Aug 2009 03:05:36 +0000 (03:05 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Fri, 21 Aug 2009 03:05:36 +0000 (03:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79591 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/GRExprEngine.cpp

index 487b9764ce266a55865bccdd351349bde08620a4..3f59ba65249e1490c7b0941b64c77e13f95fd028 100644 (file)
@@ -209,7 +209,7 @@ const GRState* GRExprEngine::getInitialState(const LocationContext *InitLoc) {
   //  to be > 0.
   // FIXME: It would be nice if we had a more general mechanism to add
   // such preconditions.  Some day.
-  if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(&StateMgr.getCodeDecl()))
+  if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(InitLoc->getDecl()))
     if (strcmp(FD->getIdentifier()->getName(), "main") == 0 &&
         FD->getNumParams() > 0) {
       const ParmVarDecl *PD = FD->getParamDecl(0);