File tree Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -1120,10 +1120,14 @@ void FrontendAction::EndSourceFile() {
1120
1120
1121
1121
if (CI.getFrontendOpts ().ShowStats ) {
1122
1122
llvm::errs () << " \n STATISTICS FOR '" << getCurrentFileOrBufferName () << " ':\n " ;
1123
- CI.getPreprocessor ().PrintStats ();
1124
- CI.getPreprocessor ().getIdentifierTable ().PrintStats ();
1125
- CI.getPreprocessor ().getHeaderSearchInfo ().PrintStats ();
1126
- CI.getSourceManager ().PrintStats ();
1123
+ if (CI.hasPreprocessor ()) {
1124
+ CI.getPreprocessor ().PrintStats ();
1125
+ CI.getPreprocessor ().getIdentifierTable ().PrintStats ();
1126
+ CI.getPreprocessor ().getHeaderSearchInfo ().PrintStats ();
1127
+ }
1128
+ if (CI.hasSourceManager ()) {
1129
+ CI.getSourceManager ().PrintStats ();
1130
+ }
1127
1131
llvm::errs () << " \n " ;
1128
1132
}
1129
1133
Original file line number Diff line number Diff line change
1
+ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -print-stats \
2
+ // RUN: -emit-llvm -x ir /dev/null -o - 2>&1 | FileCheck %s --check-prefix=CHECK-IR
3
+ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -print-stats \
4
+ // RUN: -emit-llvm -x c /dev/null -o - 2>&1 | FileCheck %s --check-prefix=CHECK-C
5
+
6
+ // CHECK-IR: *** Source Manager Stats
7
+ // CHECK-IR: *** File Manager Stats
8
+ // CHECK-IR: *** Virtual File System Stats
9
+
10
+ // CHECK-C: *** Semantic Analysis Stats
11
+ // CHECK-C: *** Analysis Based Warnings Stats
12
+ // CHECK-C: *** AST Context Stats
13
+ // CHECK-C: *** Decl Stats
14
+ // CHECK-C: *** Stmt/Expr Stats
15
+ // CHECK-C: *** Preprocessor Stats
16
+ // CHECK-C: *** Identifier Table Stats
17
+ // CHECK-C: *** HeaderSearch Stats
18
+ // CHECK-C: *** Source Manager Stats
19
+ // CHECK-C: *** File Manager Stats
20
+ // CHECK-C: *** Virtual File System Stats
You can’t perform that action at this time.
0 commit comments