aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/lib/APINotes/APINotesManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/lib/APINotes/APINotesManager.cpp')
-rw-r--r--contrib/llvm-project/clang/lib/APINotes/APINotesManager.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/contrib/llvm-project/clang/lib/APINotes/APINotesManager.cpp b/contrib/llvm-project/clang/lib/APINotes/APINotesManager.cpp
index d3aef09dac91..039d09fa7cf5 100644
--- a/contrib/llvm-project/clang/lib/APINotes/APINotesManager.cpp
+++ b/contrib/llvm-project/clang/lib/APINotes/APINotesManager.cpp
@@ -12,6 +12,7 @@
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/LangOptions.h"
+#include "clang/Basic/Module.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/SourceMgrAdapter.h"
#include "clang/Basic/Version.h"
@@ -221,10 +222,11 @@ APINotesManager::getCurrentModuleAPINotes(Module *M, bool LookInModule,
ArrayRef<std::string> SearchPaths) {
FileManager &FM = SM.getFileManager();
auto ModuleName = M->getTopLevelModuleName();
+ auto ExportedModuleName = M->getTopLevelModule()->ExportAsModule;
llvm::SmallVector<FileEntryRef, 2> APINotes;
// First, look relative to the module itself.
- if (LookInModule) {
+ if (LookInModule && M->Directory) {
// Local function to try loading an API notes file in the given directory.
auto tryAPINotes = [&](DirectoryEntryRef Dir, bool WantPublic) {
if (auto File = findAPINotesFile(Dir, ModuleName, WantPublic)) {
@@ -233,6 +235,10 @@ APINotesManager::getCurrentModuleAPINotes(Module *M, bool LookInModule,
APINotes.push_back(*File);
}
+ // If module FooCore is re-exported through module Foo, try Foo.apinotes.
+ if (!ExportedModuleName.empty())
+ if (auto File = findAPINotesFile(Dir, ExportedModuleName, WantPublic))
+ APINotes.push_back(*File);
};
if (M->IsFramework) {