File tree Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -718,6 +718,8 @@ def warn_pragma_debug_unexpected_command : Warning<
718
718
"unexpected debug command '%0'">, InGroup<IgnoredPragmas>;
719
719
def warn_pragma_debug_unknown_module : Warning<
720
720
"unknown module '%0'">, InGroup<IgnoredPragmas>;
721
+ def warn_pragma_debug_unable_to_find_module : Warning<
722
+ "unable to find module '%0'">, InGroup<IgnoredPragmas>;
721
723
// #pragma module
722
724
def err_pp_expected_module_name : Error<
723
725
"expected %select{identifier after '.' in |}0module name">;
Original file line number Diff line number Diff line change @@ -1119,11 +1119,27 @@ struct PragmaDebugHandler : public PragmaHandler {
1119
1119
M = MM.lookupModuleQualified (IIAndLoc.first ->getName (), M);
1120
1120
if (!M) {
1121
1121
PP.Diag (IIAndLoc.second , diag::warn_pragma_debug_unknown_module)
1122
- << IIAndLoc.first ;
1122
+ << IIAndLoc.first -> getName () ;
1123
1123
return ;
1124
1124
}
1125
1125
}
1126
1126
M->dump ();
1127
+ } else if (II->isStr (" module_lookup" )) {
1128
+ Token MName;
1129
+ PP.LexUnexpandedToken (MName);
1130
+ auto *MNameII = MName.getIdentifierInfo ();
1131
+ if (!MNameII) {
1132
+ PP.Diag (MName, diag::warn_pragma_debug_missing_argument)
1133
+ << II->getName ();
1134
+ return ;
1135
+ }
1136
+ Module *M = PP.getHeaderSearchInfo ().lookupModule (MNameII->getName ());
1137
+ if (!M) {
1138
+ PP.Diag (MName, diag::warn_pragma_debug_unable_to_find_module)
1139
+ << MNameII->getName ();
1140
+ return ;
1141
+ }
1142
+ M->dump ();
1127
1143
} else if (II->isStr (" overflow_stack" )) {
1128
1144
if (!PP.getPreprocessorOpts ().DisablePragmaDebugCrash )
1129
1145
DebugOverflowStack ();
Original file line number Diff line number Diff line change
1
+ // RUN: rm -rf %t
2
+ // RUN: split-file %s %t
3
+ // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -I%t %t/tu.c -fsyntax-only \
4
+ // RUN: -verify 2>&1 | FileCheck %s
5
+
6
+ //--- module.modulemap
7
+
8
+ module A {
9
+ header "A.h"
10
+ }
11
+
12
+ //--- A.h
13
+
14
+ //--- tu.c
15
+
16
+ #pragma clang __debug module_map A // expected-warning{{unknown module 'A'}}
17
+ #pragma clang __debug module_lookup B // expected-warning{{unable to find module 'B'}}
18
+ #pragma clang __debug module_lookup A // does header search for A
19
+ #pragma clang __debug module_map A // now finds module A
20
+
21
+ // CHECK: module A
22
+ // CHECK: module A
You can’t perform that action at this time.
0 commit comments