Added "CheckASTConsumer", a function that generalizes
"CheckDiagnostics" (used for -parse-ast-check) to check the
diagnostics of any ASTConsumer.
Reimplemented CheckDiagnostics to use CheckASTConsumer instead.
Added driver option -warn-dead-stores-check, which checks the
diagnostics generated by the DeadStores checker. This is implemented
using CheckASTConsumer.111
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42310 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index 77a568a..6ff5580 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -59,6 +59,7 @@
ParseCFGView, // Parse ASTS. Build CFGs. View CFGs.
AnalysisLiveVariables, // Print results of live-variable analysis.
WarnDeadStores, // Run DeadStores checker on parsed ASTs.
+ WarnDeadStoresCheck, // Check diagnostics for "DeadStores".
WarnUninitVals, // Run UnitializedVariables checker.
ParsePrintCallbacks, // Parse and print each callback.
ParseSyntaxOnly, // Parse and perform semantic analysis.
@@ -102,6 +103,8 @@
"Print results of live variable analysis."),
clEnumValN(WarnDeadStores, "warn-dead-stores",
"Flag warnings of stores to dead variables."),
+ clEnumValN(WarnDeadStoresCheck, "warn-dead-stores-check",
+ "Check diagnostics emitted by --warn-dead-stores."),
clEnumValN(WarnUninitVals, "warn-uninit-values",
"Flag warnings of uses of unitialized variables."),
clEnumValN(EmitLLVM, "emit-llvm",
@@ -881,6 +884,12 @@
ParseAST(PP, MainFileID, *C.get(), Stats);
break;
}
+ case WarnDeadStoresCheck: {
+ std::auto_ptr<ASTConsumer> C(CreateDeadStoreChecker(PP.getDiagnostics()));
+ exit (CheckASTConsumer(PP, MainFileID, C));
+ break;
+ }
+
case WarnUninitVals: {
std::auto_ptr<ASTConsumer> C(CreateUnitValsChecker(PP.getDiagnostics()));
ParseAST(PP, MainFileID, *C.get(), Stats);