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(
422422 foundDiscriminator = discriminator;
423423 });
424424
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 ());
426434}
427435
428436const Decl *Decl::getInnermostDeclWithAvailability () const {
Original file line number Diff line number Diff line change @@ -2398,6 +2398,10 @@ class RelatedIdScanner : public SourceEntityWalker {
23982398 }
23992399
24002400 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+
24012405 unsigned Offset = SourceMgr.getLocOffsetInBuffer (Range.getStart (),BufferID);
24022406 Ranges.insert ({Offset, Range.getByteLength ()});
24032407 return !Cancelled;
You can’t perform that action at this time.
0 commit comments