diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-04-18 00:57:01 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-04-18 00:57:01 +0000 |
commit | 77e53cbe847393fef0621d6595961655728830da (patch) | |
tree | a66191cd63de3538c7a102cdaa84d6fd52898a94 /clang/lib/Lex/Pragma.cpp | |
parent | e867e98314ef5546f4eb2c9c6249f24b739f38ac (diff) | |
download | bcm5719-llvm-77e53cbe847393fef0621d6595961655728830da.tar.gz bcm5719-llvm-77e53cbe847393fef0621d6595961655728830da.zip |
Add '#pragma clang __debug module_map module.name' to dump the module
map being used for the module 'module.name'.
llvm-svn: 358632
Diffstat (limited to 'clang/lib/Lex/Pragma.cpp')
-rw-r--r-- | clang/lib/Lex/Pragma.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp index 1c87f3ecc09..ba1b73e7f4b 100644 --- a/clang/lib/Lex/Pragma.cpp +++ b/clang/lib/Lex/Pragma.cpp @@ -1010,7 +1010,7 @@ struct PragmaDebugHandler : public PragmaHandler { PragmaDebugHandler() : PragmaHandler("__debug") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &DepToken) override { + Token &DebugToken) override { Token Tok; PP.LexUnexpandedToken(Tok); if (Tok.isNot(tok::identifier)) { @@ -1072,6 +1072,22 @@ struct PragmaDebugHandler : public PragmaHandler { else PP.Diag(MacroName, diag::warn_pragma_debug_missing_argument) << II->getName(); + } else if (II->isStr("module_map")) { + llvm::SmallVector<std::pair<IdentifierInfo *, SourceLocation>, 8> + ModuleName; + if (LexModuleName(PP, Tok, ModuleName)) + return; + ModuleMap &MM = PP.getHeaderSearchInfo().getModuleMap(); + Module *M = nullptr; + for (auto IIAndLoc : ModuleName) { + M = MM.lookupModuleQualified(IIAndLoc.first->getName(), M); + if (!M) { + PP.Diag(IIAndLoc.second, diag::warn_pragma_debug_unknown_module) + << IIAndLoc.first; + return; + } + } + M->dump(); } else if (II->isStr("overflow_stack")) { DebugOverflowStack(); } else if (II->isStr("handle_crash")) { |