Browse Source

Calculate size of buffer instead of using a magic value.

Patch by Matthew Davis!

Differential Revision: https://reviews.llvm.org/D41421

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321757 91177308-0d34-0410-b5e6-96231b3b80d8
Paul Robinson 7 years ago
parent
commit
0e8934cb92
1 changed files with 1 additions and 1 deletions
  1. 1 1
      lib/Frontend/PrintPreprocessedOutput.cpp

+ 1 - 1
lib/Frontend/PrintPreprocessedOutput.cpp

@@ -752,7 +752,7 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok,
     } else if (Tok.isLiteral() && !Tok.needsCleaning() &&
                Tok.getLiteralData()) {
       OS.write(Tok.getLiteralData(), Tok.getLength());
-    } else if (Tok.getLength() < 256) {
+    } else if (Tok.getLength() < llvm::array_lengthof(Buffer)) {
       const char *TokPtr = Buffer;
       unsigned Len = PP.getSpelling(Tok, TokPtr);
       OS.write(TokPtr, Len);