diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2013-01-09 03:16:42 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2013-01-09 03:16:42 +0000 |
commit | 086cc83a84bfab60685b69e3afa3e4500daebb4d (patch) | |
tree | a9c0fd6d7f557b4db273db367a2ce4f912f8fddb | |
parent | a0f2d02d166880e5d826074b6c2ecbf64f8ca70d (diff) |
Make sure clang puts tokens from different files on separate lines in "-E -P" mode. <rdar://problem/12774044>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171944 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Frontend/PrintPreprocessedOutput.cpp | 5 | ||||
-rw-r--r-- | test/Preprocessor/print_line_include.c | 6 | ||||
-rw-r--r-- | test/Preprocessor/print_line_include.h | 1 |
3 files changed, 11 insertions, 1 deletions
diff --git a/lib/Frontend/PrintPreprocessedOutput.cpp b/lib/Frontend/PrintPreprocessedOutput.cpp index afad0a9f5f..02da71bbbe 100644 --- a/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/lib/Frontend/PrintPreprocessedOutput.cpp @@ -268,7 +268,10 @@ void PrintPPOutputPPCallbacks::FileChanged(SourceLocation Loc, Lexer::Stringify(CurFilename); FileType = NewFileType; - if (DisableLineMarkers) return; + if (DisableLineMarkers) { + startNewLineIfNeeded(/*ShouldUpdateCurrentLine=*/false); + return; + } if (!Initialized) { WriteLineInfo(CurLine); diff --git a/test/Preprocessor/print_line_include.c b/test/Preprocessor/print_line_include.c new file mode 100644 index 0000000000..d65873cb73 --- /dev/null +++ b/test/Preprocessor/print_line_include.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -E -P %s | FileCheck %s +// CHECK: int x; +// CHECK-NEXT: int x; + +#include "print_line_include.h" +#include "print_line_include.h" diff --git a/test/Preprocessor/print_line_include.h b/test/Preprocessor/print_line_include.h new file mode 100644 index 0000000000..6d1a0d47b7 --- /dev/null +++ b/test/Preprocessor/print_line_include.h @@ -0,0 +1 @@ +int x; |