diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-26 22:08:10 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-26 22:08:10 +0000 |
commit | 678eaa90ab68d2cfff010a473eae4f26743c8cac (patch) | |
tree | ff6ec2f91dfd95de6236e4baf544dcd99a3e8e24 /clang/lib/Frontend/InitPreprocessor.cpp | |
parent | 0103d67f9816a758faf56ad7796d13d47ddc2aed (diff) | |
download | bcm5719-llvm-678eaa90ab68d2cfff010a473eae4f26743c8cac.tar.gz bcm5719-llvm-678eaa90ab68d2cfff010a473eae4f26743c8cac.zip |
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.
llvm-svn: 102391
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r-- | clang/lib/Frontend/InitPreprocessor.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index ea0f8c08779..e035afd7077 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -501,7 +501,11 @@ void clang::InitializePreprocessor(Preprocessor &PP, 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 @@ 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 \"<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 @@ void clang::InitializePreprocessor(Preprocessor &PP, } // 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()); |