]> granicus.if.org Git - clang/commitdiff
Calculate size of buffer instead of using a magic value.
authorPaul Robinson <paul.robinson@sony.com>
Wed, 3 Jan 2018 20:29:49 +0000 (20:29 +0000)
committerPaul Robinson <paul.robinson@sony.com>
Wed, 3 Jan 2018 20:29:49 +0000 (20:29 +0000)
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

lib/Frontend/PrintPreprocessedOutput.cpp

index 2e023294f1e8e8a43fe6cf57cf81d34984d64c22..36ecdada0c8b5050ac0a98360eecd21d471fdcfd 100644 (file)
@@ -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);