[cfe-commits] r114056 - in /cfe/trunk: include/clang/Analysis/CFG.h include/clang/Analysis/FlowSensitive/DataflowSolver.h include/clang/Analysis/ProgramPoint.h include/clang/Checker/PathSensitive/GRCoreEngine.h lib/Analysis/CFG.cpp lib/Analysis/CFGStmtMap.cpp lib/Analysis/ReachableCode.cpp lib/Checker/BugReporter.cpp lib/Checker/GRExprEngine.cpp lib/Checker/UnreachableCodeChecker.cpp lib/Sema/AnalysisBasedWarnings.cpp

John McCall rjmccall at apple.com
Wed Sep 15 20:28:05 PDT 2010


On Sep 15, 2010, at 6:25 PM, Zhongxing Xu wrote:
> Modified: cfe/trunk/include/clang/Analysis/FlowSensitive/DataflowSolver.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/FlowSensitive/DataflowSolver.h?rev=114056&r1=114055&r2=114056&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Analysis/FlowSensitive/DataflowSolver.h (original)
> +++ cfe/trunk/include/clang/Analysis/FlowSensitive/DataflowSolver.h Wed Sep 15 20:25:47 2010
> @@ -273,8 +273,11 @@
>   void ProcessBlock(const CFGBlock* B, bool recordStmtValues,
>                     dataflow::forward_analysis_tag) {
> 
> -    for (StmtItr I=ItrTraits::StmtBegin(B), E=ItrTraits::StmtEnd(B); I!=E;++I)
> -      ProcessStmt(*I, recordStmtValues, AnalysisDirTag());
> +    for (StmtItr I=ItrTraits::StmtBegin(B), E=ItrTraits::StmtEnd(B); I!=E;++I) {
> +      CFGElement E = *I;
> +      if (CFGStmt S = E.getAs<CFGStmt>())
> +        ProcessStmt(S, recordStmtValues, AnalysisDirTag());
> +    }
> 
>     TF.VisitTerminator(const_cast<CFGBlock*>(B));
>   }
> @@ -284,8 +287,11 @@
> 
>     TF.VisitTerminator(const_cast<CFGBlock*>(B));
> 
> -    for (StmtItr I=ItrTraits::StmtBegin(B), E=ItrTraits::StmtEnd(B); I!=E;++I)
> -      ProcessStmt(*I, recordStmtValues, AnalysisDirTag());
> +    for (StmtItr I=ItrTraits::StmtBegin(B), E=ItrTraits::StmtEnd(B); I!=E;++I) {
> +      CFGElement E = *I;
> +      if (CFGStmt S = E.getAs<CFGStmt>())
> +        ProcessStmt(S, recordStmtValues, AnalysisDirTag());
> +    }
>   }

C++ forbids this sort of immediate redeclaration of names that were introduced in a 'for' scope ("E" in both cases);  basically, it's all treated as the same scope according to the standard.  This was causing build failures, which I fixed for you in r114059, but please watch out for this in the future.

John.



More information about the cfe-commits mailing list