diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-02-27 13:44:12 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-02-27 13:44:12 +0000 |
commit | 0a1abd4088b3d8d42567301fda17a37b1cd7b8d6 (patch) | |
tree | ddf0f69ad36c259b8901d7925f66bf5bb8707561 /clang/lib/Frontend/PrintPreprocessedOutput.cpp | |
parent | 09597b461d806e7853aee6506a7bb5303dd5f24c (diff) | |
download | llvm-0a1abd4088b3d8d42567301fda17a37b1cd7b8d6.zip llvm-0a1abd4088b3d8d42567301fda17a37b1cd7b8d6.tar.gz llvm-0a1abd4088b3d8d42567301fda17a37b1cd7b8d6.tar.bz2 |
Add an overload of Preprocessor::getSpelling which takes a SmallVector and
returns a StringRef. Use it to simplify some repetitive code.
llvm-svn: 97322
Diffstat (limited to 'clang/lib/Frontend/PrintPreprocessedOutput.cpp')
-rw-r--r-- | clang/lib/Frontend/PrintPreprocessedOutput.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp index 43deaee..774372c 100644 --- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp @@ -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); } } |