diff options
author | Daniel Grumberg <dgrumberg@apple.com> | 2024-08-27 13:50:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-27 13:50:41 +0100 |
commit | b1b24d751776d5fd2218a5cb43a8d103bf59fa32 (patch) | |
tree | dfa423c9fa89ed70234ad103e9be191ee8800333 /clang/lib/ExtractAPI/DeclarationFragments.cpp | |
parent | 4f33e7c683104ea72e013d4ddd104b711a25d620 (diff) | |
download | llvm-b1b24d751776d5fd2218a5cb43a8d103bf59fa32.zip llvm-b1b24d751776d5fd2218a5cb43a8d103bf59fa32.tar.gz llvm-b1b24d751776d5fd2218a5cb43a8d103bf59fa32.tar.bz2 |
[clang][ExtractAPI] Fix quirks in interaction with submodules (#105868)
Extension SGFs require the module system to be enabled in order to discover which module defines the extended external type.
This patch ensures the following:
- Associate symbols with their top level module name, and that only top level modules are considered as modules for emitting extension SGFs.
- Ensure we don't drop macro definitions that came from a submodule. To this end look at all defined macros in `PPCalbacks::EndOfMainFile` instead of relying on `PPCallbacks::MacroDefined` being called to detect a macro definition.
Diffstat (limited to 'clang/lib/ExtractAPI/DeclarationFragments.cpp')
-rw-r--r-- | clang/lib/ExtractAPI/DeclarationFragments.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/clang/lib/ExtractAPI/DeclarationFragments.cpp b/clang/lib/ExtractAPI/DeclarationFragments.cpp index 6b85c7d..d77bb1d 100644 --- a/clang/lib/ExtractAPI/DeclarationFragments.cpp +++ b/clang/lib/ExtractAPI/DeclarationFragments.cpp @@ -1327,14 +1327,12 @@ DeclarationFragmentsBuilder::getFragmentsForFunctionTemplateSpecialization( DeclarationFragments DeclarationFragmentsBuilder::getFragmentsForMacro(StringRef Name, - const MacroDirective *MD) { + const MacroInfo *MI) { DeclarationFragments Fragments; Fragments.append("#define", DeclarationFragments::FragmentKind::Keyword) .appendSpace(); Fragments.append(Name, DeclarationFragments::FragmentKind::Identifier); - auto *MI = MD->getMacroInfo(); - if (MI->isFunctionLike()) { Fragments.append("(", DeclarationFragments::FragmentKind::Text); unsigned numParameters = MI->getNumParams(); |