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
389389Miscellaneous Clang Crashes Fixed
390390^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
391391
392+ - Fixed crash when ``-print-stats `` is enabled in compiling IR files. (#GH131608)
393+
392394OpenACC Specific Changes
393395------------------------
394396
Original file line number Diff line number Diff line change @@ -1074,10 +1074,14 @@ void FrontendAction::EndSourceFile() {
10741074
10751075 if (CI.getFrontendOpts ().ShowStats ) {
10761076 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+ }
10811085 llvm::errs () << " \n " ;
10821086 }
10831087
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