Add an overload of Preprocessor::getSpelling which takes a SmallVector and
returns a StringRef. Use it to simplify some repetitive code. llvm-svn: 97322
This commit is contained in:
@@ -67,12 +67,7 @@ static void PrintMacroDefinition(const IdentifierInfo &II, const MacroInfo &MI,
|
||||
if (I->hasLeadingSpace())
|
||||
OS << ' ';
|
||||
|
||||
// Make sure we have enough space in the spelling buffer.
|
||||
if (I->getLength() > SpellingBuffer.size())
|
||||
SpellingBuffer.resize(I->getLength());
|
||||
const char *Buffer = SpellingBuffer.data();
|
||||
unsigned SpellingLen = PP.getSpelling(*I, Buffer);
|
||||
OS.write(Buffer, SpellingLen);
|
||||
OS << PP.getSpelling(*I, SpellingBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user