mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Teach the related-id checker to ignore things from other buffers
This commit is contained in:
@@ -422,7 +422,15 @@ unsigned Decl::getAttachedMacroDiscriminator(
|
||||
foundDiscriminator = discriminator;
|
||||
});
|
||||
|
||||
if (foundDiscriminator)
|
||||
return *foundDiscriminator;
|
||||
|
||||
// If that failed, conjure up a discriminator.
|
||||
ASTContext &ctx = getASTContext();
|
||||
assert(ctx.Diags.hadAnyError());
|
||||
return ctx.getNextMacroDiscriminator(
|
||||
MacroDiscriminatorContext::getParentOf(getLoc(), getDeclContext()),
|
||||
DeclBaseName());
|
||||
}
|
||||
|
||||
const Decl *Decl::getInnermostDeclWithAvailability() const {
|
||||
|
||||
@@ -2398,6 +2398,10 @@ private:
|
||||
}
|
||||
|
||||
bool passId(CharSourceRange Range) {
|
||||
// FIXME: Ignore things that don't come from this buffer.
|
||||
if (!SourceMgr.getRangeForBuffer(BufferID).contains(Range.getStart()))
|
||||
return !Cancelled;
|
||||
|
||||
unsigned Offset = SourceMgr.getLocOffsetInBuffer(Range.getStart(),BufferID);
|
||||
Ranges.insert({Offset, Range.getByteLength()});
|
||||
return !Cancelled;
|
||||
|
||||
Reference in New Issue
Block a user