Skip to content

Commit 7f58e00

Browse files
committed
Add time-trace scope for removeDead
1 parent 8d20431 commit 7f58e00

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

clang/lib/StaticAnalyzer/Core/ExprEngine.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
#include "llvm/Support/ErrorHandling.h"
7575
#include "llvm/Support/GraphWriter.h"
7676
#include "llvm/Support/SaveAndRestore.h"
77+
#include "llvm/Support/TimeProfiler.h"
7778
#include "llvm/Support/raw_ostream.h"
7879
#include <cassert>
7980
#include <cstdint>
@@ -1031,6 +1032,7 @@ void ExprEngine::removeDead(ExplodedNode *Pred, ExplodedNodeSet &Out,
10311032
const LocationContext *LC,
10321033
const Stmt *DiagnosticStmt,
10331034
ProgramPoint::Kind K) {
1035+
llvm::TimeTraceScope TimeScope("ExprEngine::removeDead");
10341036
assert((K == ProgramPoint::PreStmtPurgeDeadSymbolsKind ||
10351037
ReferenceStmt == nullptr || isa<ReturnStmt>(ReferenceStmt))
10361038
&& "PostStmt is not generally supported by the SymbolReaper yet");
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// RUN: %clang_analyze_cc1 -analyzer-checker=core %s -ftime-trace=%t.raw.json -ftime-trace-granularity=0 -verify
2+
// RUN: %python -c 'import json, sys; print(json.dumps(json.load(sys.stdin), indent=4))' < %t.raw.json > %t.formatted.json
3+
// RUN: FileCheck --input-file=%t.formatted.json --check-prefix=CHECK %s
4+
5+
// The trace file is rather large, but it should contain at least one scope for removeDead:
6+
//
7+
// CHECK: "name": "ExprEngine::removeDead"
8+
9+
bool coin();
10+
int f() {
11+
int x = 0;
12+
int y = 0;
13+
while (coin()) {
14+
x = 1;
15+
}
16+
return x / y; // expected-warning{{Division by zero}}
17+
}

0 commit comments

Comments
 (0)