[PATCH] D123295: [clang][extract-api] Use dedicated API to check for macro equality
Daniel Grumberg via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 7 11:11:10 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG101559225189: [clang][extract-api][NFC] Use dedicated API to check for macro equality (authored by dang).
Changed prior to commit:
https://reviews.llvm.org/D123295?vs=421147&id=421290#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123295/new/
https://reviews.llvm.org/D123295
Files:
clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
Index: clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
===================================================================
--- clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
+++ clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
@@ -649,8 +649,9 @@
class MacroCallback : public PPCallbacks {
public:
- MacroCallback(const SourceManager &SM, LocationFileChecker &LCF, APISet &API)
- : SM(SM), LCF(LCF), API(API) {}
+ MacroCallback(const SourceManager &SM, LocationFileChecker &LCF, APISet &API,
+ Preprocessor &PP)
+ : SM(SM), LCF(LCF), API(API), PP(PP) {}
void MacroDefined(const Token &MacroNameToken,
const MacroDirective *MD) override {
@@ -677,9 +678,9 @@
if (!Undef)
return;
- llvm::erase_if(PendingMacros, [&MD](const PendingMacro &PM) {
- return MD.getMacroInfo()->getDefinitionLoc() ==
- PM.MD->getMacroInfo()->getDefinitionLoc();
+ llvm::erase_if(PendingMacros, [&MD, this](const PendingMacro &PM) {
+ return MD.getMacroInfo()->isIdenticalTo(*PM.MD->getMacroInfo(), PP,
+ /*Syntactically*/ false);
});
}
@@ -719,6 +720,7 @@
const SourceManager &SM;
LocationFileChecker &LCF;
APISet &API;
+ Preprocessor &PP;
llvm::SmallVector<PendingMacro> PendingMacros;
};
@@ -741,9 +743,8 @@
auto LCF = std::make_unique<LocationFileChecker>(CI.getSourceManager(),
KnownInputFiles);
- // Register preprocessor callbacks that will add macro definitions to API.
- CI.getPreprocessor().addPPCallbacks(
- std::make_unique<MacroCallback>(CI.getSourceManager(), *LCF, *API));
+ CI.getPreprocessor().addPPCallbacks(std::make_unique<MacroCallback>(
+ CI.getSourceManager(), *LCF, *API, CI.getPreprocessor()));
return std::make_unique<ExtractAPIConsumer>(CI.getASTContext(),
std::move(LCF), *API);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123295.421290.patch
Type: text/x-patch
Size: 1961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220407/af6be9e2/attachment-0001.bin>
More information about the cfe-commits
mailing list