Skip to content

Commit 367a847

Browse files
committed
Replace a macro-specific hack in addMemberSilently with new APIs
Another place where we where using `isBeforeInBuffer` + a hack for macros, which can be replaced with the new `isAtOrBefore`.
1 parent 79e31a8 commit 367a847

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

lib/AST/DeclContext.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,16 +1026,7 @@ void IterableDeclContext::addMemberSilently(Decl *member, Decl *hint,
10261026
assert(nextStart.isValid() &&
10271027
"Only implicit decls can have invalid source location");
10281028

1029-
if (getASTContext().SourceMgr.isBeforeInBuffer(prevEnd, nextStart))
1030-
return;
1031-
1032-
// Synthesized member macros can add new members in a macro expansion buffer.
1033-
SourceFile *memberSourceFile = member->getLoc()
1034-
? member->getModuleContext()
1035-
->getSourceFileContainingLocation(member->getLoc())
1036-
: member->getInnermostDeclContext()->getParentSourceFile();
1037-
if (memberSourceFile->getFulfilledMacroRole() == MacroRole::Member ||
1038-
memberSourceFile->getFulfilledMacroRole() == MacroRole::Peer)
1029+
if (getASTContext().SourceMgr.isAtOrBefore(prevEnd, nextStart))
10391030
return;
10401031

10411032
llvm::errs() << "Source ranges out of order in addMember():\n";

0 commit comments

Comments
 (0)