Skip to content

Commit e99abc5

Browse files
author
Balazs Benics
committed
Revert "[analyzer] Prevent misuses of -analyze-function"
This reverts commit 9d6a615. 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. >>>>>>
1 parent f8f55f7 commit e99abc5

File tree

2 files changed

+0
-104
lines changed

2 files changed

+0
-104
lines changed

clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -501,28 +501,6 @@ static bool fileContainsString(StringRef Substring, ASTContext &C) {
501501
return Buffer.contains(Substring);
502502
}
503503

504-
static void reportAnalyzerFunctionMisuse(const AnalyzerOptions &Opts,
505-
const ASTContext &Ctx) {
506-
llvm::errs() << "Every top-level function was skipped.\n";
507-
508-
if (!Opts.AnalyzerDisplayProgress)
509-
llvm::errs() << "Pass the -analyzer-display-progress for tracking which "
510-
"functions are analyzed.\n";
511-
512-
bool HasBrackets =
513-
Opts.AnalyzeSpecificFunction.find("(") != std::string::npos;
514-
515-
if (Ctx.getLangOpts().CPlusPlus && !HasBrackets) {
516-
llvm::errs()
517-
<< "For analyzing C++ code you need to pass the function parameter "
518-
"list: -analyze-function=\"foobar(int, _Bool)\"\n";
519-
} else if (!Ctx.getLangOpts().CPlusPlus && HasBrackets) {
520-
llvm::errs() << "For analyzing C code you shouldn't pass the function "
521-
"parameter list, only the name of the function: "
522-
"-analyze-function=foobar\n";
523-
}
524-
}
525-
526504
void AnalysisConsumer::runAnalysisOnTranslationUnit(ASTContext &C) {
527505
BugReporter BR(*Mgr);
528506
TranslationUnitDecl *TU = C.getTranslationUnitDecl();
@@ -559,14 +537,6 @@ void AnalysisConsumer::runAnalysisOnTranslationUnit(ASTContext &C) {
559537

560538
BR.FlushReports();
561539
RecVisitorBR = nullptr;
562-
563-
// If the user wanted to analyze a specific function and the number of basic
564-
// blocks analyzed is zero, than the user might not specified the function
565-
// name correctly.
566-
// FIXME: The user might have analyzed the requested function in Syntax mode,
567-
// but we are unaware of that.
568-
if (!Opts->AnalyzeSpecificFunction.empty() && NumFunctionsAnalyzed == 0)
569-
reportAnalyzerFunctionMisuse(*Opts, *Ctx);
570540
}
571541

572542
void AnalysisConsumer::reportAnalyzerProgress(StringRef S) {

clang/test/Analysis/analyze-function-guide.cpp

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)