[cfe-commits] r77945 - in /cfe/trunk: include/clang/Analysis/PathSensitive/AnalysisManager.h lib/Frontend/AnalysisConsumer.cpp
Ted Kremenek
kremenek at apple.com
Mon Aug 3 11:54:47 PDT 2009
Great! Thanks Zhongxing!
On Aug 2, 2009, at 8:27 PM, Zhongxing Xu wrote:
> Author: zhongxingxu
> Date: Sun Aug 2 22:27:37 2009
> New Revision: 77945
>
> URL: http://llvm.org/viewvc/llvm-project?rev=77945&view=rev
> Log:
> now we can let AnalysisManager to own the PathDiagnosticClient.
>
> Modified:
> cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisManager.h
> cfe/trunk/lib/Frontend/AnalysisConsumer.cpp
>
> Modified: cfe/trunk/include/clang/Analysis/PathSensitive/
> AnalysisManager.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisManager.h?rev=77945&r1=77944&r2=77945&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisManager.h
> (original)
> +++ cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisManager.h
> Sun Aug 2 22:27:37 2009
> @@ -29,8 +29,8 @@
> Diagnostic &Diags;
> const LangOptions &LangInfo;
>
> - PathDiagnosticClient *PD;
> -
> + llvm::OwningPtr<PathDiagnosticClient> PD;
> +
> // Configurable components creators.
> StoreManagerCreator CreateStoreMgr;
> ConstraintManagerCreator CreateConstraintMgr;
> @@ -127,7 +127,7 @@
> }
>
> virtual PathDiagnosticClient *getPathDiagnosticClient() {
> - return PD;
> + return PD.get();
> }
>
> bool shouldVisualizeGraphviz() const { return VisualizeEGDot; }
>
> Modified: cfe/trunk/lib/Frontend/AnalysisConsumer.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/AnalysisConsumer.cpp?rev=77945&r1=77944&r2=77945&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Frontend/AnalysisConsumer.cpp (original)
> +++ cfe/trunk/lib/Frontend/AnalysisConsumer.cpp Sun Aug 2 22:27:37
> 2009
> @@ -84,7 +84,10 @@
> const std::string OutDir;
> AnalyzerOptions Opts;
>
> - llvm::OwningPtr<PathDiagnosticClient> PD;
> +
> + // PD is owned by AnalysisManager.
> + PathDiagnosticClient *PD;
> +
> StoreManagerCreator CreateStoreMgr;
> ConstraintManagerCreator CreateConstraintMgr;
>
> @@ -107,7 +110,7 @@
> switch (Opts.AnalysisDiagOpt) {
> default:
> #define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATEFN,
> AUTOCREATE) \
> - case PD_##NAME: PD.reset(CREATEFN(OutDir, PP, PPF)); break;
> + case PD_##NAME: PD = CREATEFN(OutDir, PP, PPF); break;
> #include "clang/Frontend/Analyses.def"
> }
> }
> @@ -154,7 +157,7 @@
>
> virtual void Initialize(ASTContext &Context) {
> Ctx = &Context;
> - Mgr.reset(new AnalysisManager(*Ctx, Diags, LOpts, PD.get(),
> + Mgr.reset(new AnalysisManager(*Ctx, Diags, LOpts, PD,
> CreateStoreMgr,
> CreateConstraintMgr,
> Opts.AnalyzerDisplayProgress,
> Opts.VisualizeEGDot,
> Opts.VisualizeEGUbi,
> @@ -221,7 +224,6 @@
> }
>
> void AnalysisConsumer::HandleTranslationUnit(ASTContext &C) {
> -
> if(!TranslationUnitActions.empty()) {
> for (Actions::iterator I = TranslationUnitActions.begin(),
> E = TranslationUnitActions.end(); I != E; ++I)
> @@ -237,11 +239,11 @@
> if (ObjCImplementationDecl* ID =
> dyn_cast<ObjCImplementationDecl>(*I))
> HandleCode(ID, 0, ObjCImplementationActions);
> }
> -
> +
> // Explicitly destroy the PathDiagnosticClient. This will flush
> its output.
> // FIXME: This should be replaced with something that doesn't rely
> on
> // side-effects in PathDiagnosticClient's destructor.
> - PD.reset(NULL);
> + Mgr.reset(NULL);
> }
>
> void AnalysisConsumer::HandleCode(Decl* D, Stmt* Body, Actions&
> actions) {
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list