[llvm-branch-commits] [cfe-branch] r71473 - /cfe/branches/Apple/objective-rewrite/tools/clang/Driver/PrintPreprocessedOutput.cpp

Steve Naroff snaroff at apple.com
Mon May 11 14:04:56 PDT 2009


Author: snaroff
Date: Mon May 11 16:04:56 2009
New Revision: 71473

URL: http://llvm.org/viewvc/llvm-project?rev=71473&view=rev
Log:
Fix <rdar://problem/6843495> rewriter emits line number format indigestible by Microsoft compiler.

Since the MS #line directive doesn't support the "isSystemHeader" info (a GNU line directive feature), clang won't ignore definitions that occur in system headers. This should not occur on Windows.


Modified:
    cfe/branches/Apple/objective-rewrite/tools/clang/Driver/PrintPreprocessedOutput.cpp

Modified: cfe/branches/Apple/objective-rewrite/tools/clang/Driver/PrintPreprocessedOutput.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/objective-rewrite/tools/clang/Driver/PrintPreprocessedOutput.cpp?rev=71473&r1=71472&r2=71473&view=diff

==============================================================================
--- cfe/branches/Apple/objective-rewrite/tools/clang/Driver/PrintPreprocessedOutput.cpp (original)
+++ cfe/branches/Apple/objective-rewrite/tools/clang/Driver/PrintPreprocessedOutput.cpp Mon May 11 16:04:56 2009
@@ -86,17 +86,23 @@
     EmittedTokensOnThisLine = false;
   }
 
-  OS << '#' << ' ' << LineNo << ' ' << '"';
+  OS << '#';
+  if (PP.getLangOptions().Microsoft)
+    OS << "line";
+  OS << ' ' << LineNo << ' ' << '"';
+  
   OS.write(&CurFilename[0], CurFilename.size());
   OS << '"';
-  
-  if (ExtraLen)
-    OS.write(Extra, ExtraLen);
 
-  if (FileType == SrcMgr::C_System)
-    OS.write(" 3", 2);
-  else if (FileType == SrcMgr::C_ExternCSystem)
-    OS.write(" 3 4", 4);
+  if (!PP.getLangOptions().Microsoft) {
+    if (ExtraLen)
+      OS.write(Extra, ExtraLen);
+
+    if (FileType == SrcMgr::C_System)
+      OS.write(" 3", 2);
+    else if (FileType == SrcMgr::C_ExternCSystem)
+      OS.write(" 3 4", 4);
+  }
   OS << '\n';
 }
 





More information about the llvm-branch-commits mailing list