@@ -519,24 +519,14 @@ swift::extractNearestSourceLoc(CustomRefCountingOperationDescriptor desc) {
519
519
// macros, because doing so trivially creates a cyclic dependency amongst the
520
520
// macro expansions that will be detected by the request-evaluator.
521
521
//
522
- // Our lookup requests don't always have enough information to answer the
523
- // question "is this part of an argument to a macro?", so we do a much simpler,
524
- // more efficient, and not-entirely-sound hack based on the request-evaluator.
525
- // Specifically, if we are in the process of resolving a macro (which is
526
- // determined by checking for the presence of a `ResolveMacroRequest` in the
527
- // request-evaluator stack), then we adjust the options used for the name
528
- // lookup request we are forming to exclude macro expansions. The evaluation
529
- // of that request will then avoid expanding any macros, and not produce any
530
- // results that involve entries in already-expanded macros. By adjusting the
531
- // request itself, we still distinguish between requests that can and cannot
532
- // look into macro expansions, so it doesn't break caching for those immediate
533
- // requests.
534
- //
535
- // Over time, we should seek to replace this heuristic with a location-based
536
- // check, where we use ASTScope to determine whether we are inside a macro
537
- // argument. This existing check might still be useful because it's going to
538
- // be faster than a location-based query, but the location-based query can be
539
- // fully correct.
522
+ // We use source locations to answer the question "is this part of an argument
523
+ // to a macro?" through `namelookup::isInMacroArgument`. If the answer is yes,
524
+ // then we adjust the options used for the name lookup request we are forming
525
+ // to exclude macro expansions. The evaluation of that request will then avoid
526
+ // expanding any macros, and not produce any results that involve entries in
527
+ // already-expanded macros. By adjusting the request itself, we still
528
+ // distinguish between requests that can and cannot look into macro expansions,
529
+ // so it doesn't break caching for those immediate requests.
540
530
541
531
// / Exclude macros in the unqualified lookup descriptor if we need to.
542
532
static UnqualifiedLookupDescriptor excludeMacrosIfNeeded (
0 commit comments