From: Bruno Cardoso Lopes Date: Fri, 6 May 2016 23:21:50 +0000 (+0000) Subject: [CrashReproducer] Change module map callback signature. NFC X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2962536fe8229580324afa5d7ff3002b8a9c55a4;p=clang [CrashReproducer] Change module map callback signature. NFC Use a StringRef instead of a FileEntry in the moduleMapAddHeader callback to allow more flexibility on what to collect on further patches. This changes the interface I introduced in r264971. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268819 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Lex/ModuleMap.h b/include/clang/Lex/ModuleMap.h index b8cfb8faa8..313cfbe766 100644 --- a/include/clang/Lex/ModuleMap.h +++ b/include/clang/Lex/ModuleMap.h @@ -54,7 +54,7 @@ public: /// \brief Called when a header is added during module map parsing. /// /// \param File The header file itself. - virtual void moduleMapAddHeader(const FileEntry &File) {} + virtual void moduleMapAddHeader(StringRef Filename) {} }; class ModuleMap { diff --git a/lib/Frontend/ModuleDependencyCollector.cpp b/lib/Frontend/ModuleDependencyCollector.cpp index 02d3c515ef..4ef3b1ee2e 100644 --- a/lib/Frontend/ModuleDependencyCollector.cpp +++ b/lib/Frontend/ModuleDependencyCollector.cpp @@ -44,8 +44,7 @@ struct ModuleDependencyMMCallbacks : public ModuleMapCallbacks { ModuleDependencyMMCallbacks(ModuleDependencyCollector &Collector) : Collector(Collector) {} - void moduleMapAddHeader(const FileEntry &File) override { - StringRef HeaderPath = File.getName(); + void moduleMapAddHeader(StringRef HeaderPath) override { if (llvm::sys::path::is_absolute(HeaderPath)) Collector.addFile(HeaderPath); } diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp index 467ae7ec51..39ded6f613 100644 --- a/lib/Lex/ModuleMap.cpp +++ b/lib/Lex/ModuleMap.cpp @@ -809,7 +809,7 @@ void ModuleMap::addHeader(Module *Mod, Module::Header Header, // Notify callbacks that we just added a new header. for (const auto &Cb : Callbacks) - Cb->moduleMapAddHeader(*Header.Entry); + Cb->moduleMapAddHeader(Header.Entry->getName()); } void ModuleMap::excludeHeader(Module *Mod, Module::Header Header) {