[cfe-commits] r126608 - in /cfe/trunk: include/clang/Driver/CC1Options.td include/clang/Frontend/AnalyzerOptions.h lib/Frontend/CompilerInvocation.cpp lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp lib/StaticAnalyzer/Checkers/Checkers.td lib/StaticAnalyzer/Checkers/ExperimentalChecks.h lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp test/Analysis/analyzer-stats.c
Argyrios Kyrtzidis
akyrtzi at gmail.com
Sun Feb 27 17:26:50 PST 2011
Author: akirtzidis
Date: Sun Feb 27 19:26:50 2011
New Revision: 126608
URL: http://llvm.org/viewvc/llvm-project?rev=126608&view=rev
Log:
[analyzer] Turn -analyzer-stats into -analyzer-checker=debug.Stats
Removed:
cfe/trunk/lib/StaticAnalyzer/Checkers/ExperimentalChecks.h
Modified:
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Frontend/AnalyzerOptions.h
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
cfe/trunk/test/Analysis/analyzer-stats.c
Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=126608&r1=126607&r2=126608&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Sun Feb 27 19:26:50 2011
@@ -46,8 +46,6 @@
HelpText<"Warn about uses of uninitialized variables">;
def analysis_ObjCMemChecker : Flag<"-analyzer-check-objc-mem">,
HelpText<"Run the [Core] Foundation reference count checker">;
-def analysis_AnalyzerStats : Flag<"-analyzer-stats">,
- HelpText<"Emit warnings with analyzer statistics">;
def analysis_WarnBufferOverflows : Flag<"-analyzer-check-buffer-overflows">,
HelpText<"Warn about buffer overflows">;
Modified: cfe/trunk/include/clang/Frontend/AnalyzerOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/AnalyzerOptions.h?rev=126608&r1=126607&r2=126608&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/AnalyzerOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/AnalyzerOptions.h Sun Feb 27 19:26:50 2011
@@ -68,7 +68,6 @@
unsigned AnalyzeAll : 1;
unsigned AnalyzerDisplayProgress : 1;
unsigned AnalyzeNestedBlocks : 1;
- unsigned AnalyzerStats : 1;
unsigned EagerlyAssume : 1;
unsigned BufferOverflows : 1;
unsigned PurgeDead : 1;
@@ -90,7 +89,6 @@
AnalyzeAll = 0;
AnalyzerDisplayProgress = 0;
AnalyzeNestedBlocks = 0;
- AnalyzerStats = 0;
EagerlyAssume = 0;
BufferOverflows = 0;
PurgeDead = 1;
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=126608&r1=126607&r2=126608&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sun Feb 27 19:26:50 2011
@@ -102,8 +102,6 @@
Res.push_back("-analyzer-display-progress");
if (Opts.AnalyzeNestedBlocks)
Res.push_back("-analyzer-opt-analyze-nested-blocks");
- if (Opts.AnalyzerStats)
- Res.push_back("-analyzer-stats");
if (Opts.EagerlyAssume)
Res.push_back("-analyzer-eagerly-assume");
if (!Opts.PurgeDead)
@@ -866,7 +864,6 @@
Opts.AnalyzerDisplayProgress = Args.hasArg(OPT_analyzer_display_progress);
Opts.AnalyzeNestedBlocks =
Args.hasArg(OPT_analyzer_opt_analyze_nested_blocks);
- Opts.AnalyzerStats = Args.hasArg(OPT_analysis_AnalyzerStats);
Opts.PurgeDead = !Args.hasArg(OPT_analyzer_no_purge_dead);
Opts.EagerlyAssume = Args.hasArg(OPT_analyzer_eagerly_assume);
Opts.AnalyzeSpecificFunction = Args.getLastArgValue(OPT_analyze_function);
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp?rev=126608&r1=126607&r2=126608&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp Sun Feb 27 19:26:50 2011
@@ -9,13 +9,13 @@
// This file reports various statistics about analyzer visitation.
//===----------------------------------------------------------------------===//
-#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerVisitor.h"
+#include "ClangSACheckers.h"
+#include "clang/StaticAnalyzer/Core/CheckerV2.h"
+#include "clang/StaticAnalyzer/Core/CheckerManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"
#include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"
-// FIXME: Restructure checker registration.
-#include "ExperimentalChecks.h"
-
#include "clang/Basic/SourceManager.h"
#include "llvm/ADT/SmallPtrSet.h"
@@ -23,32 +23,20 @@
using namespace ento;
namespace {
-class AnalyzerStatsChecker : public CheckerVisitor<AnalyzerStatsChecker> {
+class AnalyzerStatsChecker : public CheckerV2<check::EndAnalysis> {
public:
- static void *getTag();
- void VisitEndAnalysis(ExplodedGraph &G, BugReporter &B, ExprEngine &Eng);
-
-private:
- llvm::SmallPtrSet<const CFGBlock*, 256> reachable;
+ void checkEndAnalysis(ExplodedGraph &G, BugReporter &B,ExprEngine &Eng) const;
};
}
-void *AnalyzerStatsChecker::getTag() {
- static int x = 0;
- return &x;
-}
-
-void ento::RegisterAnalyzerStatsChecker(ExprEngine &Eng) {
- Eng.registerCheck(new AnalyzerStatsChecker());
-}
-
-void AnalyzerStatsChecker::VisitEndAnalysis(ExplodedGraph &G,
+void AnalyzerStatsChecker::checkEndAnalysis(ExplodedGraph &G,
BugReporter &B,
- ExprEngine &Eng) {
+ ExprEngine &Eng) const {
const CFG *C = 0;
const Decl *D = 0;
const LocationContext *LC = 0;
const SourceManager &SM = B.getSourceManager();
+ llvm::SmallPtrSet<const CFGBlock*, 256> reachable;
// Iterate over explodedgraph
for (ExplodedGraph::node_iterator I = G.nodes_begin();
@@ -121,3 +109,7 @@
"stopped analyzing at this point", CS->getStmt()->getLocStart());
}
}
+
+void ento::registerAnalyzerStatsChecker(CheckerManager &mgr) {
+ mgr.registerChecker<AnalyzerStatsChecker>();
+}
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td?rev=126608&r1=126607&r2=126608&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td Sun Feb 27 19:26:50 2011
@@ -123,6 +123,11 @@
HelpText<"Display Control-Flow Graphs">,
DescFile<"DebugCheckers.cpp">;
+def AnalyzerStatsChecker : Checker<"Stats">,
+ InPackage<Debug>,
+ HelpText<"Emit warnings with analyzer statistics">,
+ DescFile<"AnalyzerStatsChecker.cpp">;
+
//===----------------------------------------------------------------------===//
// Hidden experimental checkers.
//===----------------------------------------------------------------------===//
Removed: cfe/trunk/lib/StaticAnalyzer/Checkers/ExperimentalChecks.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/ExperimentalChecks.h?rev=126607&view=auto
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/ExperimentalChecks.h (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/ExperimentalChecks.h (removed)
@@ -1,30 +0,0 @@
-//=-- ExperimentalChecks.h ----------------------------------------*- C++ -*-=//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines functions to instantiate and register experimental
-// checks in ExprEngine.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_GR_ExprEngine_EXPERIMENTAL_CHECKS
-#define LLVM_CLANG_GR_ExprEngine_EXPERIMENTAL_CHECKS
-
-namespace clang {
-
-namespace ento {
-
-class ExprEngine;
-
-void RegisterAnalyzerStatsChecker(ExprEngine &Eng);
-
-} // end GR namespace
-
-} // end clang namespace
-
-#endif
Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp?rev=126608&r1=126607&r2=126608&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp Sun Feb 27 19:26:50 2011
@@ -31,8 +31,6 @@
#include "clang/StaticAnalyzer/Core/PathDiagnosticClients.h"
// FIXME: Restructure checker registration.
-#include "../Checkers/ClangSACheckers.h"
-#include "../Checkers/ExperimentalChecks.h"
#include "../Checkers/InternalChecks.h"
#include "../Checkers/BasicObjCFoundationChecks.h"
@@ -345,10 +343,6 @@
if (C.Opts.BufferOverflows)
RegisterArrayBoundCheckerV2(Eng);
- // Enable AnalyzerStatsChecker if it was given as an argument
- if (C.Opts.AnalyzerStats)
- RegisterAnalyzerStatsChecker(Eng);
-
// Set the graph auditor.
llvm::OwningPtr<ExplodedNode::Auditor> Auditor;
if (mgr.shouldVisualizeUbigraph()) {
Modified: cfe/trunk/test/Analysis/analyzer-stats.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/analyzer-stats.c?rev=126608&r1=126607&r2=126608&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/analyzer-stats.c (original)
+++ cfe/trunk/test/Analysis/analyzer-stats.c Sun Feb 27 19:26:50 2011
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-checker=core.DeadStores -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks -analyzer-stats %s
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-checker=core.DeadStores,debug.Stats -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
int foo();
More information about the cfe-commits
mailing list