forked from OSchip/llvm-project
Move CreateAnalysisConsumer into a separate header AnalysisConsumer.h.
Start moving things around in the direction of refactoring the command-line options out of AnalysisConsumer.cpp. llvm-svn: 72097
This commit is contained in:
parent
33cd03cd89
commit
2bd0f3964c
|
@ -11,7 +11,7 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang-cc.h"
|
||||
#include "AnalysisConsumer.h"
|
||||
#include "clang/Frontend/PathDiagnosticClients.h"
|
||||
#include "clang/Frontend/ManagerRegistry.h"
|
||||
#include "clang/AST/ASTConsumer.h"
|
||||
|
@ -44,13 +44,6 @@ static ExplodedNodeImpl::Auditor* CreateUbiViz();
|
|||
// Analyzer Options: available analyses.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// Analysis - Set of available source code analyses.
|
||||
enum Analyses {
|
||||
#define ANALYSIS(NAME, CMDFLAG, DESC, SCOPE) NAME,
|
||||
#include "Analyses.def"
|
||||
NumAnalyses
|
||||
};
|
||||
|
||||
static llvm::cl::list<Analyses>
|
||||
AnalysisList(llvm::cl::desc("Source Code Analysis - Checks and Analyses"),
|
||||
llvm::cl::values(
|
||||
|
@ -63,13 +56,6 @@ clEnumValEnd));
|
|||
// Analyzer Options: store model.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// AnalysisStores - Set of available analysis store models.
|
||||
enum AnalysisStores {
|
||||
#define ANALYSIS_STORE(NAME, CMDFLAG, DESC, CREATFN) NAME##Model,
|
||||
#include "Analyses.def"
|
||||
NumStores
|
||||
};
|
||||
|
||||
static llvm::cl::opt<AnalysisStores>
|
||||
AnalysisStoreOpt("analyzer-store",
|
||||
llvm::cl::desc("Source Code Analysis - Abstract Memory Store Models"),
|
||||
|
@ -84,13 +70,6 @@ clEnumValEnd));
|
|||
// Analyzer Options: constraint engines.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// AnalysisConstraints - Set of available constraint models.
|
||||
enum AnalysisConstraints {
|
||||
#define ANALYSIS_CONSTRAINTS(NAME, CMDFLAG, DESC, CREATFN) NAME##Model,
|
||||
#include "Analyses.def"
|
||||
NumConstraints
|
||||
};
|
||||
|
||||
static llvm::cl::opt<AnalysisConstraints>
|
||||
AnalysisConstraintsOpt("analyzer-constraints",
|
||||
llvm::cl::desc("Source Code Analysis - Symbolic Constraint Engines"),
|
||||
|
@ -105,14 +84,6 @@ clEnumValEnd));
|
|||
// Analyzer Options: diagnostic clients.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// AnalysisDiagClients - Set of available diagnostic clients for rendering
|
||||
/// analysis results.
|
||||
enum AnalysisDiagClients {
|
||||
#define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATFN, AUTOCREAT) PD_##NAME,
|
||||
#include "Analyses.def"
|
||||
NUM_ANALYSIS_DIAG_CLIENTS
|
||||
};
|
||||
|
||||
static llvm::cl::opt<AnalysisDiagClients>
|
||||
AnalysisDiagOpt("analyzer-output",
|
||||
llvm::cl::desc("Source Code Analysis - Output Options"),
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
//===--- AnalysisConsumer.h - Front-end hooks for the analysis engine------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This header contains the functions necessary for a front-end to run various
|
||||
// analyses.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace clang {
|
||||
class ASTConsumer;
|
||||
class Diagnostic;
|
||||
class Preprocessor;
|
||||
class PreprocessorFactory;
|
||||
class LangOptions;
|
||||
|
||||
/// Analysis - Set of available source code analyses.
|
||||
enum Analyses {
|
||||
#define ANALYSIS(NAME, CMDFLAG, DESC, SCOPE) NAME,
|
||||
#include "Analyses.def"
|
||||
NumAnalyses
|
||||
};
|
||||
|
||||
/// AnalysisStores - Set of available analysis store models.
|
||||
enum AnalysisStores {
|
||||
#define ANALYSIS_STORE(NAME, CMDFLAG, DESC, CREATFN) NAME##Model,
|
||||
#include "Analyses.def"
|
||||
NumStores
|
||||
};
|
||||
|
||||
/// AnalysisConstraints - Set of available constraint models.
|
||||
enum AnalysisConstraints {
|
||||
#define ANALYSIS_CONSTRAINTS(NAME, CMDFLAG, DESC, CREATFN) NAME##Model,
|
||||
#include "Analyses.def"
|
||||
NumConstraints
|
||||
};
|
||||
|
||||
/// AnalysisDiagClients - Set of available diagnostic clients for rendering
|
||||
/// analysis results.
|
||||
enum AnalysisDiagClients {
|
||||
#define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATFN, AUTOCREAT) PD_##NAME,
|
||||
#include "Analyses.def"
|
||||
NUM_ANALYSIS_DIAG_CLIENTS
|
||||
};
|
||||
|
||||
// FIXME: Use this instead of using command-line options directly.
|
||||
struct AnalyzerOptions {
|
||||
std::vector<Analyses> AnalysisList;
|
||||
AnalysisStores AnalysisStoreOpt;
|
||||
AnalysisConstraints AnalysisConstraintsOpt;
|
||||
AnalysisDiagClients AnalysisDiagOpt;
|
||||
bool VisualizeEGDot;
|
||||
bool VisualizeEGUbi;
|
||||
bool AnalyzeAll;
|
||||
bool AnalyzerDisplayProgress;
|
||||
bool PurgeDead;
|
||||
bool EagerlyAssume;
|
||||
std::string AnalyzeSpecificFunction;
|
||||
bool TrimGraph;
|
||||
};
|
||||
|
||||
/// CreateAnalysisConsumer - Creates an ASTConsumer to run various code
|
||||
/// analysis passes. (The set of analyses run is controlled by command-line
|
||||
/// options.)
|
||||
ASTConsumer* CreateAnalysisConsumer(Diagnostic &diags, Preprocessor *pp,
|
||||
PreprocessorFactory *ppf,
|
||||
const LangOptions &lopts,
|
||||
const std::string &output);
|
||||
|
||||
}
|
|
@ -23,6 +23,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang-cc.h"
|
||||
#include "AnalysisConsumer.h"
|
||||
#include "clang/Frontend/ASTConsumers.h"
|
||||
#include "clang/Frontend/CompileOptions.h"
|
||||
#include "clang/Frontend/FixItRewriter.h"
|
||||
|
|
|
@ -74,14 +74,6 @@ void AttachDependencyFileGen(Preprocessor *PP, llvm::raw_ostream *OS,
|
|||
/// a seekable stream.
|
||||
void CacheTokens(Preprocessor& PP, llvm::raw_fd_ostream* OS);
|
||||
|
||||
/// CreateAnalysisConsumer - Creates an ASTConsumer to run various code
|
||||
/// analysis passes. (The set of analyses run is controlled by command-line
|
||||
/// options.)
|
||||
ASTConsumer* CreateAnalysisConsumer(Diagnostic &diags, Preprocessor *pp,
|
||||
PreprocessorFactory *ppf,
|
||||
const LangOptions &lopts,
|
||||
const std::string &output);
|
||||
|
||||
} // end namespace clang
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue