[cfe-commits] r44742 - /cfe/trunk/Driver/PrintPreprocessedOutput.cpp

Chris Lattner sabre at nondot.org
Sun Dec 9 12:45:43 PST 2007


Author: lattner
Date: Sun Dec  9 14:45:43 2007
New Revision: 44742

URL: http://llvm.org/viewvc/llvm-project?rev=44742&view=rev
Log:
Fix a pretty big but subtle bug counting the number of newlines to emit.
This would cause us to emit different code (in -E mode) for these two files:

---
#define t(x) x

t(a
3)
---
#define t(x) x
t(a
3)
---

In one case, -E would print "a\n3", in the other it printed "a3".  Now
it prints "a3" for both.

This is part of PR1848.


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=44742&r1=44741&r2=44742&view=diff

==============================================================================
--- cfe/trunk/Driver/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/Driver/PrintPreprocessedOutput.cpp Sun Dec  9 14:45:43 2007
@@ -188,8 +188,8 @@
     else {
       const char *NewLines = "\n\n\n\n\n\n\n\n";
       OutputString(NewLines, LineNo-CurLine);
-      CurLine = LineNo;
     }
+    CurLine = LineNo;
   } else {
     if (EmittedTokensOnThisLine) {
       OutputChar('\n');





More information about the cfe-commits mailing list