@@ -219,7 +219,7 @@ expandFreestandingMacro(MacroDecl *macro,
219219 std::vector<unsigned > bufferIDs;
220220
221221 SmallString<32 > discriminator;
222- discriminator.append (" macro_ " );
222+ discriminator.append (" __syntactic_macro_ " );
223223 addExpansionDiscriminator (discriminator,
224224 expansion->getDeclContext ()->getParentSourceFile (),
225225 expansion->getPoundLoc ());
@@ -293,7 +293,9 @@ static Identifier getCustomAttrName(ASTContext &ctx, const CustomAttr *attr) {
293293 }
294294
295295 // If the attribute is not an identifier type, create an identifier with its
296- // textual representation.
296+ // textual representation. This is *not* expected to be reachable.
297+ // The only case is like `@Foo?` where the client should not send the
298+ // expansion request on this in the first place.
297299 SmallString<32 > name;
298300 llvm::raw_svector_ostream OS (name);
299301 tyR->print (OS);
@@ -406,7 +408,7 @@ class MacroExpansionFinder : public ASTWalker {
406408};
407409} // namespace
408410
409- bool SyntacticMacroExpansionInstance::getExpansion (
411+ void SyntacticMacroExpansionInstance::expand (
410412 SourceFile *SF, const MacroExpansionSpecifier &expansion,
411413 SourceEditConsumer &consumer) {
412414
@@ -417,7 +419,7 @@ bool SyntacticMacroExpansionInstance::getExpansion(
417419 SF->walk (expansionFinder);
418420 auto expansionNode = expansionFinder.getResult ();
419421 if (!expansionNode)
420- return true ;
422+ return ;
421423
422424 // Expand the macro.
423425 std::vector<unsigned > bufferIDs;
@@ -454,20 +456,16 @@ bool SyntacticMacroExpansionInstance::getExpansion(
454456 /* adjust=*/ false ,
455457 /* includeBufferName=*/ false );
456458 }
457-
458- return false ;
459459}
460460
461- bool SyntacticMacroExpansionInstance::getExpansions (
461+ void SyntacticMacroExpansionInstance::expandAll (
462462 llvm::MemoryBuffer *inputBuf, ArrayRef<MacroExpansionSpecifier> expansions,
463463 SourceEditConsumer &consumer) {
464464
465465 // Create a source file.
466466 SourceFile *SF = getSourceFile (inputBuf);
467467
468- bool hasError = false ;
469468 for (const auto &expansion : expansions) {
470- hasError |= getExpansion (SF, expansion, consumer);
469+ expand (SF, expansion, consumer);
471470 }
472- return hasError;
473471}
0 commit comments