From fcaa9e787037b22a6833d4562fed3105c5b55f71 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 26 Apr 2010 22:08:10 +0000 Subject: 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102391 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/InitPreprocessor.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lib/Frontend/InitPreprocessor.cpp') diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index ea0f8c0877..e035afd707 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/lib/Frontend/InitPreprocessor.cpp @@ -501,7 +501,11 @@ void clang::InitializePreprocessor(Preprocessor &PP, InitializeFileRemapping(PP.getDiagnostics(), PP.getSourceManager(), PP.getFileManager(), InitOpts); - Builder.append("# 1 \"\" 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 \"\" 3"); // Install things like __POWERPC__, __GNUC__, etc into the macro table. if (InitOpts.UsePredefines) @@ -510,7 +514,8 @@ void clang::InitializePreprocessor(Preprocessor &PP, // Add on the predefines from the driver. Wrap in a #line directive to report // that they come from the command line. - Builder.append("# 1 \"\" 1"); + if (!PP.getLangOptions().AsmPreprocessor) + Builder.append("# 1 \"\" 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 @@ void clang::InitializePreprocessor(Preprocessor &PP, } // Exit the command line and go back to (2 is LC_LEAVE). - Builder.append("# 1 \"\" 2"); + if (!PP.getLangOptions().AsmPreprocessor) + Builder.append("# 1 \"\" 2"); // Copy PredefinedBuffer into the Preprocessor. PP.setPredefines(Predefines.str()); -- cgit v1.2.3-18-g5258