aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
diff options
context:
space:
mode:
authorBalazs Benics <balazs.benics@sigmatechnology.se>2022-02-02 11:44:27 +0100
committerBalazs Benics <balazs.benics@sigmatechnology.se>2022-02-02 11:44:27 +0100
commite99abc5d8a3a730915933e9725fe585a46f51b18 (patch)
tree48b78cd7b1703e786fc8fd623e1e97aac847e3ee /clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
parentf8f55f7e0343634e8cf0892883ce7132b7a0dc50 (diff)
downloadllvm-e99abc5d8a3a730915933e9725fe585a46f51b18.zip
llvm-e99abc5d8a3a730915933e9725fe585a46f51b18.tar.gz
llvm-e99abc5d8a3a730915933e9725fe585a46f51b18.tar.bz2
Revert "[analyzer] Prevent misuses of -analyze-function"
This reverts commit 9d6a6159730171bc0faf78d7f109d6543f4c93c2. Exit Code: 1 Command Output (stderr): -- /scratch/buildbot/bothome/clang-ve-ninja/llvm-project/clang/test/Analysis/analyze-function-guide.cpp:53:21: error: CHECK-EMPTY-NOT: excluded string found in input // CHECK-EMPTY-NOT: Every top-level function was skipped. ^ <stdin>:1:1: note: found here Every top-level function was skipped. ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Input file: <stdin> Check file: /scratch/buildbot/bothome/clang-ve-ninja/llvm-project/clang/test/Analysis/analyze-function-guide.cpp -dump-input=help explains the following input dump. Input was: <<<<<< 1: Every top-level function was skipped. not:53 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match expected 2: Pass the -analyzer-display-progress for tracking which functions are analyzed. >>>>>>
Diffstat (limited to 'clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp30
1 files changed, 0 insertions, 30 deletions
diff --git a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
index 222a96e..b152f9d 100644
--- a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -501,28 +501,6 @@ static bool fileContainsString(StringRef Substring, ASTContext &C) {
return Buffer.contains(Substring);
}
-static void reportAnalyzerFunctionMisuse(const AnalyzerOptions &Opts,
- const ASTContext &Ctx) {
- llvm::errs() << "Every top-level function was skipped.\n";
-
- if (!Opts.AnalyzerDisplayProgress)
- llvm::errs() << "Pass the -analyzer-display-progress for tracking which "
- "functions are analyzed.\n";
-
- bool HasBrackets =
- Opts.AnalyzeSpecificFunction.find("(") != std::string::npos;
-
- if (Ctx.getLangOpts().CPlusPlus && !HasBrackets) {
- llvm::errs()
- << "For analyzing C++ code you need to pass the function parameter "
- "list: -analyze-function=\"foobar(int, _Bool)\"\n";
- } else if (!Ctx.getLangOpts().CPlusPlus && HasBrackets) {
- llvm::errs() << "For analyzing C code you shouldn't pass the function "
- "parameter list, only the name of the function: "
- "-analyze-function=foobar\n";
- }
-}
-
void AnalysisConsumer::runAnalysisOnTranslationUnit(ASTContext &C) {
BugReporter BR(*Mgr);
TranslationUnitDecl *TU = C.getTranslationUnitDecl();
@@ -559,14 +537,6 @@ void AnalysisConsumer::runAnalysisOnTranslationUnit(ASTContext &C) {
BR.FlushReports();
RecVisitorBR = nullptr;
-
- // If the user wanted to analyze a specific function and the number of basic
- // blocks analyzed is zero, than the user might not specified the function
- // name correctly.
- // FIXME: The user might have analyzed the requested function in Syntax mode,
- // but we are unaware of that.
- if (!Opts->AnalyzeSpecificFunction.empty() && NumFunctionsAnalyzed == 0)
- reportAnalyzerFunctionMisuse(*Opts, *Ctx);
}
void AnalysisConsumer::reportAnalyzerProgress(StringRef S) {