[cfe-commits] r62044 - /cfe/trunk/Driver/PrintPreprocessedOutput.cpp
Chris Lattner
sabre at nondot.org
Sun Jan 11 11:48:19 PST 2009
Author: lattner
Date: Sun Jan 11 13:48:19 2009
New Revision: 62044
URL: http://llvm.org/viewvc/llvm-project?rev=62044&view=rev
Log:
make paste avoidance avoid pasting digraphs and :: only when digraphs or c++ is enabled
respectively. Inspired by a patch by Dan Villiom Podlaski Christiansen.
Modified:
cfe/trunk/Driver/PrintPreprocessedOutput.cpp
Modified: cfe/trunk/Driver/PrintPreprocessedOutput.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/PrintPreprocessedOutput.cpp?rev=62044&r1=62043&r2=62044&view=diff
==============================================================================
--- cfe/trunk/Driver/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/Driver/PrintPreprocessedOutput.cpp Sun Jan 11 13:48:19 2009
@@ -438,7 +438,8 @@
return isalnum(FirstChar) || Tok.is(tok::numeric_constant) ||
FirstChar == '+' || FirstChar == '-' || FirstChar == '.';
case tok::period: // ..., .*, .1234
- return FirstChar == '.' || FirstChar == '*' || isdigit(FirstChar);
+ return FirstChar == '.' || isdigit(FirstChar) ||
+ (FirstChar == '*' && PP.getLangOptions().CPlusPlus);
case tok::amp: // &&
return FirstChar == '&';
case tok::plus: // ++
@@ -454,9 +455,11 @@
case tok::pipe: // ||
return FirstChar == '|';
case tok::percent: // %>, %:
- return FirstChar == '>' || FirstChar == ':';
+ return (FirstChar == '>' || FirstChar == ':') &&
+ PP.getLangOptions().Digraphs;
case tok::colon: // ::, :>
- return FirstChar == ':' || FirstChar == '>';
+ return (FirstChar == ':' && PP.getLangOptions().CPlusPlus) ||
+ (FirstChar == '>' && PP.getLangOptions().Digraphs);
case tok::hash: // ##, #@, %:%:
return FirstChar == '#' || FirstChar == '@' || FirstChar == '%';
case tok::arrow: // ->*
More information about the cfe-commits
mailing list