r321757 - Calculate size of buffer instead of using a magic value.

Paul Robinson via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 3 12:29:49 PST 2018


Author: probinson
Date: Wed Jan  3 12:29:49 2018
New Revision: 321757

URL: http://llvm.org/viewvc/llvm-project?rev=321757&view=rev
Log:
Calculate size of buffer instead of using a magic value.

Patch by Matthew Davis!

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

Modified:
    cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp

Modified: cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp?rev=321757&r1=321756&r2=321757&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp Wed Jan  3 12:29:49 2018
@@ -752,7 +752,7 @@ static void PrintPreprocessedTokens(Prep
     } 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);




More information about the cfe-commits mailing list