if (PM)
addParentsForSyntheticStmts(cfg.get(), *PM);
+
+ // The Obersver should only observe one build of the CFG.
+ getCFGBuildOptions().Observer = 0;
}
return cfg.get();
}
if (PM)
addParentsForSyntheticStmts(completeCFG.get(), *PM);
+
+ // The Obersver should only observe one build of the CFG.
+ getCFGBuildOptions().Observer = 0;
}
return completeCFG.get();
}
.setAlwaysAdd(Stmt::AttributedStmtClass);
}
+ // Install the logical handler for -Wtautological-overlap-compare
+ std::unique_ptr<LogicalErrorHandler> LEH;
if (Diags.getDiagnosticLevel(diag::warn_tautological_overlap_comparison,
D->getLocStart())) {
- LogicalErrorHandler LEH(S);
- AC.getCFGBuildOptions().Observer = &LEH;
- AC.getCFG();
- AC.getCFGBuildOptions().Observer = 0;
+ LEH.reset(new LogicalErrorHandler(S));
+ AC.getCFGBuildOptions().Observer = LEH.get();
}
// Emit delayed diagnostics.
}
}
+ // If none of the previous checks caused a CFG build, trigger one here
+ // for -Wtautological-overlap-compare
+ if (Diags.getDiagnosticLevel(diag::warn_tautological_overlap_comparison,
+ D->getLocStart())) {
+ AC.getCFG();
+ }
+
// Collect statistics about the CFG if it was built.
if (S.CollectStats && AC.isCFGBuilt()) {
++NumFunctionsAnalyzed;
if (x == (mydefine + 1) && x > 3) { }
}
+// Don't generate a warning here.
+void array_out_of_bounds() {
+ int x;
+ int buffer[4];
+ x = (-7 > 0) ? (buffer[-7]) : 0;
+}