Skip to content

Commit

Permalink
[analyzer] do not crash with assertion on processing locations of bod…
Browse files Browse the repository at this point in the history
…yfarmed functions

This addresses an issue introduced in r183451: since
`removePiecesWithInvalidLocations` is called *after* `adjustCallLocations`,
it is not necessary, and in fact harmful, to have this assertion in
adjustCallLocations.

Addresses rdar://36170689

Differential Revision: https://reviews.llvm.org/D41680

llvm-svn: 321682
  • Loading branch information
George Karpenkov committed Jan 2, 2018
1 parent 30d927a commit 96625fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion clang/lib/StaticAnalyzer/Core/BugReporter.cpp
Expand Up @@ -229,7 +229,6 @@ adjustCallLocations(PathPieces &Pieces,
PathDiagnosticCallPiece *Call = dyn_cast<PathDiagnosticCallPiece>(I->get());

if (!Call) {
assert((*I)->getLocation().asLocation().isValid());
continue;
}

Expand Down
9 changes: 5 additions & 4 deletions clang/test/Analysis/call_once.cpp
@@ -1,10 +1,11 @@
// RUN: %clang_analyze_cc1 -std=c++11 -fblocks -analyzer-checker=core,debug.ExprInspection -verify %s
// RUN: %clang_analyze_cc1 -std=c++11 -fblocks -analyzer-checker=core,debug.ExprInspection -DEMULATE_LIBSTDCPP -verify %s
// RUN: %clang_analyze_cc1 -std=c++11 -fblocks -analyzer-checker=core,debug.ExprInspection -verify %s -o %t.report
// RUN: %clang_analyze_cc1 -std=c++11 -fblocks -analyzer-checker=core,debug.ExprInspection -DEMULATE_LIBSTDCPP -verify %s -o %t.report

// We do NOT model libcxx03 implementation, but the analyzer should still
// not crash.
// RUN: %clang_analyze_cc1 -std=c++11 -fblocks -analyzer-checker=core,debug.ExprInspection -DEMULATE_LIBCXX03 -verify %s
// RUN: %clang_analyze_cc1 -std=c++11 -fblocks -analyzer-checker=core,debug.ExprInspection -DEMULATE_LIBCXX03 -DEMULATE_LIBSTDCPP -verify %s
// RUN: %clang_analyze_cc1 -std=c++11 -fblocks -analyzer-checker=core,debug.ExprInspection -DEMULATE_LIBCXX03 -verify %s -o %t.report
// RUN: %clang_analyze_cc1 -std=c++11 -fblocks -analyzer-checker=core,debug.ExprInspection -DEMULATE_LIBCXX03 -DEMULATE_LIBSTDCPP -verify %s -o %t.report
// RUN: rm -rf %t.report

void clang_analyzer_eval(bool);

Expand Down

0 comments on commit 96625fd

Please sign in to comment.