[cfe-commits] r51896 - /cfe/trunk/Driver/RewriteMacros.cpp

Chris Lattner sabre at nondot.org
Mon Jun 2 23:10:17 PDT 2008


Author: lattner
Date: Tue Jun  3 01:10:17 2008
New Revision: 51896

URL: http://llvm.org/viewvc/llvm-project?rev=51896&view=rev
Log:
make rewrite macros insert a space when commenting out macros where the token didn't
lead with a space.

Modified:
    cfe/trunk/Driver/RewriteMacros.cpp

Modified: cfe/trunk/Driver/RewriteMacros.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteMacros.cpp?rev=51896&r1=51895&r2=51896&view=diff

==============================================================================
--- cfe/trunk/Driver/RewriteMacros.cpp (original)
+++ cfe/trunk/Driver/RewriteMacros.cpp Tue Jun  3 01:10:17 2008
@@ -115,8 +115,9 @@
     // deleted.  Comment out the raw token.
     if (RawOffs <= PPOffs) {
       // Comment out a whole run of tokens instead of bracketing each one with
-      // comments.
-      RB.InsertTextAfter(RawOffs, "/*", 2);
+      // comments.  Add a leading space if RawTok didn't have one.
+      bool HasSpace = RawTok.hasLeadingSpace();
+      RB.InsertTextAfter(RawOffs, " /*"+HasSpace, 2+!HasSpace);
       unsigned EndPos;
 
       // Switch on comment lexing.  If we get a comment, we don't want to





More information about the cfe-commits mailing list