File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
tools/SourceKit/lib/SwiftLang Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -422,7 +422,15 @@ unsigned Decl::getAttachedMacroDiscriminator(
422
422
foundDiscriminator = discriminator;
423
423
});
424
424
425
- return *foundDiscriminator;
425
+ if (foundDiscriminator)
426
+ return *foundDiscriminator;
427
+
428
+ // If that failed, conjure up a discriminator.
429
+ ASTContext &ctx = getASTContext ();
430
+ assert (ctx.Diags .hadAnyError ());
431
+ return ctx.getNextMacroDiscriminator (
432
+ MacroDiscriminatorContext::getParentOf (getLoc (), getDeclContext ()),
433
+ DeclBaseName ());
426
434
}
427
435
428
436
const Decl *Decl::getInnermostDeclWithAvailability () const {
Original file line number Diff line number Diff line change @@ -2398,6 +2398,10 @@ class RelatedIdScanner : public SourceEntityWalker {
2398
2398
}
2399
2399
2400
2400
bool passId (CharSourceRange Range) {
2401
+ // FIXME: Ignore things that don't come from this buffer.
2402
+ if (!SourceMgr.getRangeForBuffer (BufferID).contains (Range.getStart ()))
2403
+ return !Cancelled;
2404
+
2401
2405
unsigned Offset = SourceMgr.getLocOffsetInBuffer (Range.getStart (),BufferID);
2402
2406
Ranges.insert ({Offset, Range.getByteLength ()});
2403
2407
return !Cancelled;
You can’t perform that action at this time.
0 commit comments