[cfe-commits] r102391 - /cfe/trunk/lib/Frontend/InitPreprocessor.cpp

Chris Lattner sabre at nondot.org
Mon Apr 26 15:08:10 PDT 2010


Author: lattner
Date: Mon Apr 26 17:08:10 2010
New Revision: 102391

URL: http://llvm.org/viewvc/llvm-project?rev=102391&view=rev
Log:
fix PR6936: don't generate line marker directives when preprocessing
.S files.  "# 123" is passed through as-is, not treated as a line
marker in this mode.  No testcase, because it would be nasty and isn't
worth it.

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

Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=102391&r1=102390&r2=102391&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Mon Apr 26 17:08:10 2010
@@ -501,7 +501,11 @@
   InitializeFileRemapping(PP.getDiagnostics(), PP.getSourceManager(),
                           PP.getFileManager(), InitOpts);
 
-  Builder.append("# 1 \"<built-in>\" 3");
+  // Emit line markers for various builtin sections of the file.  We don't do
+  // this in asm preprocessor mode, because "# 4" is not a line marker directive
+  // in this mode.
+  if (!PP.getLangOptions().AsmPreprocessor)
+    Builder.append("# 1 \"<built-in>\" 3");
 
   // Install things like __POWERPC__, __GNUC__, etc into the macro table.
   if (InitOpts.UsePredefines)
@@ -510,7 +514,8 @@
 
   // Add on the predefines from the driver.  Wrap in a #line directive to report
   // that they come from the command line.
-  Builder.append("# 1 \"<command line>\" 1");
+  if (!PP.getLangOptions().AsmPreprocessor)
+    Builder.append("# 1 \"<command line>\" 1");
 
   // Process #define's and #undef's in the order they are given.
   for (unsigned i = 0, e = InitOpts.Macros.size(); i != e; ++i) {
@@ -536,7 +541,8 @@
   }
 
   // Exit the command line and go back to <built-in> (2 is LC_LEAVE).
-  Builder.append("# 1 \"<built-in>\" 2");
+  if (!PP.getLangOptions().AsmPreprocessor)
+    Builder.append("# 1 \"<built-in>\" 2");
 
   // Copy PredefinedBuffer into the Preprocessor.
   PP.setPredefines(Predefines.str());





More information about the cfe-commits mailing list