File tree Expand file tree Collapse file tree 3 files changed +30
-4
lines changed Expand file tree Collapse file tree 3 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -389,6 +389,8 @@ Miscellaneous Bug Fixes
389
389
Miscellaneous Clang Crashes Fixed
390
390
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
391
391
392
+ - Fixed crash when ``-print-stats `` is enabled in compiling IR files. (#GH131608)
393
+
392
394
OpenACC Specific Changes
393
395
------------------------
394
396
Original file line number Diff line number Diff line change @@ -1074,10 +1074,14 @@ void FrontendAction::EndSourceFile() {
1074
1074
1075
1075
if (CI.getFrontendOpts ().ShowStats ) {
1076
1076
llvm::errs () << " \n STATISTICS FOR '" << getCurrentFileOrBufferName () << " ':\n " ;
1077
- CI.getPreprocessor ().PrintStats ();
1078
- CI.getPreprocessor ().getIdentifierTable ().PrintStats ();
1079
- CI.getPreprocessor ().getHeaderSearchInfo ().PrintStats ();
1080
- CI.getSourceManager ().PrintStats ();
1077
+ if (CI.hasPreprocessor ()) {
1078
+ CI.getPreprocessor ().PrintStats ();
1079
+ CI.getPreprocessor ().getIdentifierTable ().PrintStats ();
1080
+ CI.getPreprocessor ().getHeaderSearchInfo ().PrintStats ();
1081
+ }
1082
+ if (CI.hasSourceManager ()) {
1083
+ CI.getSourceManager ().PrintStats ();
1084
+ }
1081
1085
llvm::errs () << " \n " ;
1082
1086
}
1083
1087
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