[AST] Allow ignoring macro expansions

Various requests expect to be walking over the current source file.
While we could add checks to all these to skip decls outside of the
current buffer, it's a little nicer to handle this during the walk
instead.

Allow ignoring nodes that are from macro expansions and add that flag to
the various walks that expect it.

Also add a new `getOriginalAttrs` that filters out attributes in
generated source.
This commit is contained in:
Ben Barham
2023-02-14 11:17:44 -08:00
parent 00af28cd6e
commit 0c3f538822
20 changed files with 186 additions and 51 deletions

View File

@@ -969,6 +969,10 @@ public:
llvm::MutableArrayRef<TextEntity*> FuncEnts)
: SM(SM), BufferID(BufferID), FuncEnts(FuncEnts) {}
bool shouldWalkMacroExpansions() override {
return false;
}
PreWalkAction walkToDeclPre(Decl *D) override {
if (D->isImplicit())
return Action::SkipChildren(); // Skip body.