232 changes: 122 additions & 110 deletions clang/lib/Frontend/PrintPreprocessedOutput.cpp

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions clang/test/Frontend/Inputs/dashE/dashE.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int dashE_1;
#include <a.h>
int dashE_2;
3 changes: 3 additions & 0 deletions clang/test/Frontend/Inputs/dashE/sys/a.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int a_1;
#include <b.h>
int a_2;
1 change: 1 addition & 0 deletions clang/test/Frontend/Inputs/dashE/sys/b.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
int b_1;
23 changes: 23 additions & 0 deletions clang/test/Frontend/dashE-sysincludes.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// RUN: mkdir %t.dir
// RUN: %clang_cc1 -E -fkeep-system-includes -I %S/Inputs/dashE -isystem %S/Inputs/dashE/sys %s | FileCheck %s

int main_1 = 1;
#include <a.h>
int main_2 = 1;
#include "dashE.h"
int main_3 = 1;

// CHECK: main_1
// CHECK: #include <a.h>
// CHECK-NOT: a_1
// CHECK-NOT: a_2
// CHECK-NOT: b.h
// CHECK: main_2
// CHECK-NOT: #include "dashE.h"
// CHECK: dashE_1
// CHECK: #include <a.h>
// CHECK-NOT: a_1
// CHECK-NOT: a_2
// CHECK-NOT: b.h
// CHECK: dashE_2
// CHECK: main_3
15 changes: 9 additions & 6 deletions clang/test/Preprocessor/minimize-whitespace-messages.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// RUN: not %clang -c -fminimize-whitespace %s 2>&1 | FileCheck %s --check-prefix=ON
// ON: error: invalid argument '-fminimize-whitespace' only allowed with '-E'
// RUN: not %clang -c -fminimize-whitespace %s 2>&1 | FileCheck %s --check-prefix=ON -DOPT=-fminimize-whitespace
// RUN: not %clang -c -fkeep-system-includes %s 2>&1 | FileCheck %s --check-prefix=ON -DOPT=-fkeep-system-includes
// ON: error: invalid argument '[[OPT]]' only allowed with '-E'

// RUN: not %clang -c -fno-minimize-whitespace %s 2>&1 | FileCheck %s --check-prefix=OFF
// OFF: error: invalid argument '-fno-minimize-whitespace' only allowed with '-E'
// RUN: not %clang -c -fno-minimize-whitespace %s 2>&1 | FileCheck %s --check-prefix=OFF -DOPT=-fno-minimize-whitespace
// RUN: not %clang -c -fno-keep-system-includes %s 2>&1 | FileCheck %s --check-prefix=OFF -DOPT=-fno-keep-system-includes
// OFF: error: invalid argument '[[OPT]]' only allowed with '-E'

// RUN: not %clang -E -fminimize-whitespace -x assembler-with-cpp %s 2>&1 | FileCheck %s --check-prefix=ASM
// ASM: error: '-fminimize-whitespace' invalid for input of type assembler-with-cpp
// RUN: not %clang -E -fminimize-whitespace -x assembler-with-cpp %s 2>&1 | FileCheck %s --check-prefix=ASM -DOPT=-fminimize-whitespace
// RUN: not %clang -E -fkeep-system-includes -x assembler-with-cpp %s 2>&1 | FileCheck %s --check-prefix=ASM -DOPT=-fkeep-system-includes
// ASM: error: '[[OPT]]' invalid for input of type assembler-with-cpp