mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user