mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Macros] Be deliberate about walking macro arguments vs. expansions
Provide ASTWalker with a customization point to specify whether to check macro arguments (which are type checked but never emitted), the macro expansion (which is the result of applying the macro and is actually emitted into the source), or both. Provide answers for the ~115 different ASTWalker visitors throughout the code base. Fixes rdar://104042945, which concerns checking of effects in macro arguments---which we shouldn't do.
This commit is contained in:
@@ -969,8 +969,9 @@ public:
|
||||
llvm::MutableArrayRef<TextEntity*> FuncEnts)
|
||||
: SM(SM), BufferID(BufferID), FuncEnts(FuncEnts) {}
|
||||
|
||||
bool shouldWalkMacroExpansions() override {
|
||||
return false;
|
||||
/// Only walk the arguments of a macro, to represent the source as written.
|
||||
MacroWalking getMacroWalkingBehavior() const override {
|
||||
return MacroWalking::ArgumentsAndExpansion;
|
||||
}
|
||||
|
||||
PreWalkAction walkToDeclPre(Decl *D) override {
|
||||
|
||||
Reference in New Issue
Block a user