Don't construct two CFGs just to run -Wuninitialized. While this causes new warnings to be flagged under -Wconditional-uninitialized, this is something we
can improve over time.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127802 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp
index 3d00c7f..6522d95 100644
--- a/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/lib/Sema/AnalysisBasedWarnings.cpp
@@ -611,24 +611,7 @@
!= Diagnostic::Ignored ||
Diags.getDiagnosticLevel(diag::warn_maybe_uninit_var, D->getLocStart())
!= Diagnostic::Ignored) {
- ASTContext &ctx = D->getASTContext();
- llvm::OwningPtr<CFG> tmpCFG;
- bool useAlternateCFG = false;
- if (ctx.getLangOptions().CPlusPlus) {
- // Temporary workaround: implicit dtors in the CFG can confuse
- // the path-sensitivity in the uninitialized values analysis.
- // For now create (if necessary) a separate CFG without implicit dtors.
- // FIXME: We should not need to do this, as it results in multiple
- // CFGs getting constructed.
- CFG::BuildOptions B;
- B.AddEHEdges = false;
- B.AddImplicitDtors = false;
- B.AddInitializers = true;
- tmpCFG.reset(CFG::buildCFG(D, AC.getBody(), &ctx, B));
- useAlternateCFG = true;
- }
- CFG *cfg = useAlternateCFG ? tmpCFG.get() : AC.getCFG();
- if (cfg) {
+ if (CFG *cfg = AC.getCFG()) {
UninitValsDiagReporter reporter(S);
runUninitializedVariablesAnalysis(*cast<DeclContext>(D), *cfg, AC,
reporter);