diff options
author | Daniel Grumberg <dgrumberg@apple.com> | 2022-10-25 11:16:20 +0100 |
---|---|---|
committer | Daniel Grumberg <dgrumberg@apple.com> | 2022-11-07 13:12:34 +0000 |
commit | f63db9159bbbb0db98e13cb4440fdaa5c40e219b (patch) | |
tree | 0fecf72264c0718387e1fd820a1f5329a11aa234 /clang/lib/ExtractAPI/API.cpp | |
parent | 671709f0e7d49826fd0908be2c9aed07debf5bc9 (diff) | |
download | llvm-f63db9159bbbb0db98e13cb4440fdaa5c40e219b.zip llvm-f63db9159bbbb0db98e13cb4440fdaa5c40e219b.tar.gz llvm-f63db9159bbbb0db98e13cb4440fdaa5c40e219b.tar.bz2 |
Only add targetFallback if target is not in defined in current product
Diffstat (limited to 'clang/lib/ExtractAPI/API.cpp')
-rw-r--r-- | clang/lib/ExtractAPI/API.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/clang/lib/ExtractAPI/API.cpp b/clang/lib/ExtractAPI/API.cpp index 8ab03a8..4832202 100644 --- a/clang/lib/ExtractAPI/API.cpp +++ b/clang/lib/ExtractAPI/API.cpp @@ -197,6 +197,39 @@ TypedefRecord *APISet::addTypedef(StringRef Name, StringRef USR, Comment, Declaration, SubHeading, UnderlyingType); } +template <class RecordMap> +static APIRecord *getSymbolInRecordMapForUSR(StringRef USR, + const RecordMap &Records) { + auto It = Records.find(USR); + return (It != Records.end() ? It->second.get() : nullptr); +} + +APIRecord *APISet::getSymbolForUSR(StringRef USR) const { + if (USR.empty()) + return nullptr; + if (auto *Record = getSymbolInRecordMapForUSR(USR, ObjCProtocols)) + return Record; + if (auto *Record = getSymbolInRecordMapForUSR(USR, ObjCInterfaces)) + return Record; + if (auto *Record = getSymbolInRecordMapForUSR(USR, ObjCCategories)) + return Record; + if (auto *Record = getSymbolInRecordMapForUSR(USR, ObjCCategories)) + return Record; + if (auto *Record = getSymbolInRecordMapForUSR(USR, Structs)) + return Record; + if (auto *Record = getSymbolInRecordMapForUSR(USR, Enums)) + return Record; + if (auto *Record = getSymbolInRecordMapForUSR(USR, Typedefs)) + return Record; + if (auto *Record = getSymbolInRecordMapForUSR(USR, GlobalFunctions)) + return Record; + if (auto *Record = getSymbolInRecordMapForUSR(USR, GlobalVariables)) + return Record; + if (auto *Record = getSymbolInRecordMapForUSR(USR, Macros)) + return Record; + return nullptr; +} + StringRef APISet::recordUSR(const Decl *D) { SmallString<128> USR; index::generateUSRForDecl(D, USR); |