Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 81685b2

Browse files
author
Erich Keane
committed
Revert r318669/318694
Broke some libclang tests, so reverting for now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318698 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 7a1263f commit 81685b2

23 files changed

+56
-152
lines changed

include/clang/Driver/CC1Options.td

-2
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,6 @@ def token_cache : Separate<["-"], "token-cache">, MetaVarName<"<path>">,
769769
HelpText<"Use specified token cache file">;
770770
def detailed_preprocessing_record : Flag<["-"], "detailed-preprocessing-record">,
771771
HelpText<"include a detailed record of preprocessing actions">;
772-
def fsystem_include_if_exists : Separate<["-"], "fsystem-include-if-exists">, MetaVarName<"<file>">,
773-
HelpText<"Include system file before parsing if file exists">;
774772

775773
//===----------------------------------------------------------------------===//
776774
// OpenCL Options

include/clang/Lex/PreprocessorOptions.h

-4
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ class PreprocessorOptions {
6060
/// \brief Headers that will be converted to chained PCHs in memory.
6161
std::vector<std::string> ChainedIncludes;
6262

63-
/// \brief System Headers that are pre-included if they exist.
64-
std::vector<std::string> FSystemIncludeIfExists;
65-
6663
/// \brief When true, disables most of the normal validation performed on
6764
/// precompiled headers.
6865
bool DisablePCHValidation;
@@ -193,7 +190,6 @@ class PreprocessorOptions {
193190
DumpDeserializedPCHDecls = false;
194191
ImplicitPCHInclude.clear();
195192
ImplicitPTHInclude.clear();
196-
FSystemIncludeIfExists.clear();
197193
TokenCache.clear();
198194
SingleFileParseMode = false;
199195
LexEditorPlaceholders = true;

lib/Driver/Job.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static bool skipArgs(const char *Flag, bool HaveCrashVFS, int &SkipNum,
6464
.Cases("-internal-externc-isystem", "-iprefix", true)
6565
.Cases("-iwithprefixbefore", "-isystem", "-iquote", true)
6666
.Cases("-isysroot", "-I", "-F", "-resource-dir", true)
67-
.Cases("-iframework", "-include-pch", "-fsystem-include-if-exists", true)
67+
.Cases("-iframework", "-include-pch", true)
6868
.Default(false);
6969
if (IsInclude)
7070
return HaveCrashVFS ? false : true;

lib/Driver/ToolChains/Linux.cpp

-13
Original file line numberDiff line numberDiff line change
@@ -710,8 +710,6 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
710710
addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/include");
711711

712712
addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include");
713-
714-
AddGnuIncludeArgs(DriverArgs, CC1Args);
715713
}
716714

717715
static std::string DetectLibcxxIncludePath(StringRef base) {
@@ -750,17 +748,6 @@ std::string Linux::findLibCxxIncludePath() const {
750748
return "";
751749
}
752750

753-
void Linux::AddGnuIncludeArgs(const llvm::opt::ArgList &DriverArgs,
754-
llvm::opt::ArgStringList &CC1Args) const {
755-
if (!DriverArgs.hasArg(options::OPT_ffreestanding)) {
756-
// For gcc compatibility, clang will preinclude <stdc-predef.h>
757-
// -ffreestanding suppresses this behavior.
758-
CC1Args.push_back("-fsystem-include-if-exists");
759-
CC1Args.push_back("stdc-predef.h");
760-
}
761-
}
762-
763-
764751
void Linux::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
765752
llvm::opt::ArgStringList &CC1Args) const {
766753
// We need a detected GCC installation on Linux to provide libstdc++'s

lib/Driver/ToolChains/Linux.h

-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ class LLVM_LIBRARY_VISIBILITY Linux : public Generic_ELF {
3131
void addLibStdCxxIncludePaths(
3232
const llvm::opt::ArgList &DriverArgs,
3333
llvm::opt::ArgStringList &CC1Args) const override;
34-
void AddGnuIncludeArgs(const llvm::opt::ArgList &DriverArgs,
35-
llvm::opt::ArgStringList &CC1Args) const;
3634
void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
3735
llvm::opt::ArgStringList &CC1Args) const override;
3836
void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,

lib/Frontend/CompilerInvocation.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -2594,10 +2594,6 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
25942594
for (const Arg *A : Args.filtered(OPT_chain_include))
25952595
Opts.ChainedIncludes.emplace_back(A->getValue());
25962596

2597-
// Add the ordered list of -fsystem-include-if-exists.
2598-
for (const Arg *A : Args.filtered(OPT_fsystem_include_if_exists))
2599-
Opts.FSystemIncludeIfExists.emplace_back(A->getValue());
2600-
26012597
for (const Arg *A : Args.filtered(OPT_remap_file)) {
26022598
std::pair<StringRef, StringRef> Split = StringRef(A->getValue()).split(';');
26032599

lib/Frontend/InitPreprocessor.cpp

-16
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,6 @@ static void AddImplicitInclude(MacroBuilder &Builder, StringRef File) {
7070
Builder.append(Twine("#include \"") + File + "\"");
7171
}
7272

73-
/// AddImplicitSystemIncludeIfExists - Add an implicit system \#include of the
74-
/// specified file to the predefines buffer: precheck with __has_include.
75-
static void AddImplicitSystemIncludeIfExists(MacroBuilder &Builder,
76-
StringRef File) {
77-
Builder.append(Twine("#if __has_include( <") + File + ">)");
78-
Builder.append(Twine("#include <") + File + ">");
79-
Builder.append(Twine("#endif"));
80-
}
81-
8273
static void AddImplicitIncludeMacros(MacroBuilder &Builder, StringRef File) {
8374
Builder.append(Twine("#__include_macros \"") + File + "\"");
8475
// Marker token to stop the __include_macros fetch loop.
@@ -1119,13 +1110,6 @@ void clang::InitializePreprocessor(
11191110
// Exit the command line and go back to <built-in> (2 is LC_LEAVE).
11201111
if (!PP.getLangOpts().AsmPreprocessor)
11211112
Builder.append("# 1 \"<built-in>\" 2");
1122-
1123-
// Process -fsystem-include-if-exists directives.
1124-
for (unsigned i = 0,
1125-
e = InitOpts.FSystemIncludeIfExists.size(); i != e; ++i) {
1126-
const std::string &Path = InitOpts.FSystemIncludeIfExists[i];
1127-
AddImplicitSystemIncludeIfExists(Builder, Path);
1128-
}
11291113

11301114
// If -imacros are specified, include them now. These are processed before
11311115
// any -include directives.

test/Driver/Inputs/stdc-predef/usr/include/stdc-predef.h

-12
This file was deleted.

test/Driver/crash-report-header.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: rm -rf %t
22
// RUN: mkdir %t
3-
// RUN: not env TMPDIR="%t" TEMP="%t" TMP="%t" RC_DEBUG_OPTIONS=1 %clang -ffreestanding -fsyntax-only %s 2>&1 | FileCheck %s
3+
// RUN: not env TMPDIR="%t" TEMP="%t" TMP="%t" RC_DEBUG_OPTIONS=1 %clang -fsyntax-only %s 2>&1 | FileCheck %s
44
// RUN: cat %t/crash-report-header-*.h | FileCheck --check-prefix=CHECKSRC "%s"
55
// RUN: cat %t/crash-report-header-*.sh | FileCheck --check-prefix=CHECKSH "%s"
66
// REQUIRES: crash-recovery

test/Driver/crash-report-spaces.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: rm -rf "%t"
22
// RUN: mkdir "%t"
33
// RUN: cp "%s" "%t/crash report spaces.c"
4-
// RUN: not env TMPDIR="%t" TEMP="%t" TMP="%t" RC_DEBUG_OPTIONS=1 %clang -ffreestanding -fsyntax-only "%t/crash report spaces.c" 2>&1 | FileCheck "%s"
4+
// RUN: not env TMPDIR="%t" TEMP="%t" TMP="%t" RC_DEBUG_OPTIONS=1 %clang -fsyntax-only "%t/crash report spaces.c" 2>&1 | FileCheck "%s"
55
// RUN: cat "%t/crash report spaces"-*.c | FileCheck --check-prefix=CHECKSRC "%s"
66
// RUN: cat "%t/crash report spaces"-*.sh | FileCheck --check-prefix=CHECKSH "%s"
77
// REQUIRES: crash-recovery

test/Driver/crash-report.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: mkdir %t
33
// RUN: not env TMPDIR=%t TEMP=%t TMP=%t RC_DEBUG_OPTIONS=1 \
44
// RUN: CC_PRINT_HEADERS=1 CC_LOG_DIAGNOSTICS=1 \
5-
// RUN: %clang -fsyntax-only -ffreestanding %s \
5+
// RUN: %clang -fsyntax-only %s \
66
// RUN: -F/tmp/ -I /tmp/ -idirafter /tmp/ -iquote /tmp/ -isystem /tmp/ \
77
// RUN: -iprefix /the/prefix -iwithprefix /tmp -iwithprefixbefore /tmp/ \
88
// RUN: -Xclang -internal-isystem -Xclang /tmp/ \
@@ -42,6 +42,5 @@ FOO
4242
// CHECKSH-NOT: "-iwithprefixbefore" "/tmp/"
4343
// CHECKSH-NOT: "-internal-isystem" "/tmp/"
4444
// CHECKSH-NOT: "-internal-externc-isystem" "/tmp/"
45-
// CHECKSH-NOT: "-fsystem-include-if-exists" "/tmp/"
4645
// CHECKSH-NOT: "-dwarf-debug-flags"
4746
// CHECKSH: "crash-report-{{[^ ]*}}.c"

test/Driver/rewrite-map-in-diagnostics.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: rm -rf "%t"
22
// RUN: mkdir -p "%t"
33
// RUN: not env TMPDIR="%t" TEMP="%t" TMP="%t" RC_DEBUG_OPTION=1 \
4-
// RUN: %clang -ffreestanding -fsyntax-only -frewrite-map-file %p/Inputs/rewrite.map %s 2>&1 \
4+
// RUN: %clang -fsyntax-only -frewrite-map-file %p/Inputs/rewrite.map %s 2>&1 \
55
// RUN: | FileCheck %s
66

77
#pragma clang __debug parser_crash

test/Driver/stdc-predef.c

-25
This file was deleted.

test/Driver/stdc-predef.i

-16
This file was deleted.

test/Index/IBOutletCollection.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ @interface Test {
55
}
66
@end
77

8-
// RUN: c-index-test -cursor-at=%s:4:24 -ffreestanding %s | FileCheck -check-prefix=CHECK-CURSOR %s
8+
// RUN: c-index-test -cursor-at=%s:4:24 %s | FileCheck -check-prefix=CHECK-CURSOR %s
99
// CHECK-CURSOR: ObjCClassRef=Test:3:12
1010

11-
// RUN: c-index-test -test-annotate-tokens=%s:4:1:5:1 -ffreestanding %s | FileCheck -check-prefix=CHECK-TOK %s
11+
// RUN: c-index-test -test-annotate-tokens=%s:4:1:5:1 %s | FileCheck -check-prefix=CHECK-TOK %s
1212
// CHECK-TOK: Identifier: "IBOutletCollection" [4:3 - 4:21] macro expansion=IBOutletCollection:1:9
1313
// FIXME: The following token should belong to the macro expansion cursor.
1414
// CHECK-TOK: Punctuation: "(" [4:21 - 4:22] attribute(iboutletcollection)= [IBOutletCollection=ObjCInterface]

test/Index/annotate-macro-args.m

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Test without PCH
2-
// RUN: c-index-test -test-annotate-tokens=%S/annotate-macro-args.h:9:1:10:1 %s -ffreestanding -include %S/annotate-macro-args.h | FileCheck -check-prefix=CHECK1 %s
3-
// RUN: c-index-test -test-annotate-tokens=%S/annotate-macro-args.h:15:1:16:1 %s -ffreestanding -include %S/annotate-macro-args.h | FileCheck -check-prefix=CHECK2 %s
2+
// RUN: c-index-test -test-annotate-tokens=%S/annotate-macro-args.h:9:1:10:1 %s -include %S/annotate-macro-args.h | FileCheck -check-prefix=CHECK1 %s
3+
// RUN: c-index-test -test-annotate-tokens=%S/annotate-macro-args.h:15:1:16:1 %s -include %S/annotate-macro-args.h | FileCheck -check-prefix=CHECK2 %s
44

55
// Test with PCH
6-
// RUN: c-index-test -write-pch %t.pch -x objective-c-header %S/annotate-macro-args.h -ffreestanding -Xclang -detailed-preprocessing-record
7-
// RUN: c-index-test -test-annotate-tokens=%S/annotate-macro-args.h:9:1:10:1 %s -ffreestanding -include-pch %t.pch | FileCheck -check-prefix=CHECK1 %s
8-
// RUN: c-index-test -test-annotate-tokens=%S/annotate-macro-args.h:15:1:16:1 %s -ffreestanding -include-pch %t.pch | FileCheck -check-prefix=CHECK2 %s
6+
// RUN: c-index-test -write-pch %t.pch -x objective-c-header %S/annotate-macro-args.h -Xclang -detailed-preprocessing-record
7+
// RUN: c-index-test -test-annotate-tokens=%S/annotate-macro-args.h:9:1:10:1 %s -include-pch %t.pch | FileCheck -check-prefix=CHECK1 %s
8+
// RUN: c-index-test -test-annotate-tokens=%S/annotate-macro-args.h:15:1:16:1 %s -include-pch %t.pch | FileCheck -check-prefix=CHECK2 %s
99

1010
// CHECK1: Identifier: "MACRO" [9:3 - 9:8] macro expansion=MACRO:6:9
1111
// CHECK1: Punctuation: "(" [9:8 - 9:9]

test/Index/annotate-tokens-pp.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ struct A
4242
#endif
4343
};
4444

45-
// RUN: c-index-test -test-annotate-tokens=%s:2:1:44:1 -I%S/Inputs -ffreestanding %s | FileCheck %s
46-
// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-annotate-tokens=%s:2:1:44:1 -I%S/Inputs -ffreestanding %s | FileCheck %s
45+
// RUN: c-index-test -test-annotate-tokens=%s:2:1:44:1 -I%S/Inputs %s | FileCheck %s
46+
// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-annotate-tokens=%s:2:1:44:1 -I%S/Inputs %s | FileCheck %s
4747
// CHECK: Punctuation: "#" [2:1 - 2:2] preprocessing directive=
4848
// CHECK: Identifier: "define" [2:2 - 2:8] preprocessing directive=
4949
// CHECK: Identifier: "STILL_NOTHING" [2:9 - 2:22] macro definition=STILL_NOTHING

test/Index/annotate-tokens.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void test() {
6868
reg.field = 1;
6969
}
7070

71-
// RUN: c-index-test -test-annotate-tokens=%s:4:1:37:1 -ffreestanding %s | FileCheck %s
71+
// RUN: c-index-test -test-annotate-tokens=%s:4:1:37:1 %s | FileCheck %s
7272
// CHECK: Identifier: "T" [4:3 - 4:4] TypeRef=T:1:13
7373
// CHECK: Punctuation: "*" [4:4 - 4:5] VarDecl=t_ptr:4:6 (Definition)
7474
// CHECK: Identifier: "t_ptr" [4:6 - 4:11] VarDecl=t_ptr:4:6 (Definition)
@@ -191,10 +191,10 @@ void test() {
191191
// CHECK: Punctuation: ")" [36:97 - 36:98] FunctionDecl=test:36:63 (unavailable) (always unavailable: "")
192192
// CHECK: Punctuation: ";" [36:98 - 36:99]
193193

194-
// RUN: c-index-test -test-annotate-tokens=%s:4:1:165:32 -ffreestanding %s | FileCheck %s
195-
// RUN: c-index-test -test-annotate-tokens=%s:4:1:165:38 -ffreestanding %s | FileCheck %s
194+
// RUN: c-index-test -test-annotate-tokens=%s:4:1:165:32 %s | FileCheck %s
195+
// RUN: c-index-test -test-annotate-tokens=%s:4:1:165:38 %s | FileCheck %s
196196

197-
// RUN: c-index-test -test-annotate-tokens=%s:50:1:55:1 -ffreestanding %s | FileCheck %s -check-prefix=CHECK-RANGE1
197+
// RUN: c-index-test -test-annotate-tokens=%s:50:1:55:1 %s | FileCheck %s -check-prefix=CHECK-RANGE1
198198
// CHECK-RANGE1: Keyword: "void" [50:1 - 50:5] FunctionDecl=func1:50:6
199199
// CHECK-RANGE1: Identifier: "func1" [50:6 - 50:11] FunctionDecl=func1:50:6
200200
// CHECK-RANGE1: Punctuation: "(" [50:11 - 50:12] FunctionDecl=func1:50:6
@@ -216,7 +216,7 @@ void test() {
216216
// CHECK-RANGE1: Literal: "1" [54:10 - 54:11] IntegerLiteral=
217217
// CHECK-RANGE1: Punctuation: "," [54:11 - 54:12] InitListExpr=
218218

219-
// RUN: c-index-test -test-annotate-tokens=%s:54:1:70:1 -ffreestanding %s | FileCheck %s -check-prefix=CHECK-RANGE2
219+
// RUN: c-index-test -test-annotate-tokens=%s:54:1:70:1 %s | FileCheck %s -check-prefix=CHECK-RANGE2
220220
// CHECK-RANGE2: Punctuation: "." [54:5 - 54:6] UnexposedExpr=
221221
// CHECK-RANGE2: Identifier: "y" [54:6 - 54:7] MemberRef=y:52:1
222222
// CHECK-RANGE2: Punctuation: "=" [54:8 - 54:9] UnexposedExpr=
@@ -240,6 +240,6 @@ void test() {
240240
// CHECK-RANGE2: Punctuation: "." [68:6 - 68:7] MemberRefExpr=field:62:9
241241
// CHECK-RANGE2: Identifier: "field" [68:7 - 68:12] MemberRefExpr=field:62:9
242242

243-
// RUN: c-index-test -test-annotate-tokens=%s:68:15:68:16 -ffreestanding %s | FileCheck %s -check-prefix=CHECK-RANGE3
243+
// RUN: c-index-test -test-annotate-tokens=%s:68:15:68:16 %s | FileCheck %s -check-prefix=CHECK-RANGE3
244244
// CHECK-RANGE3: Literal: "1" [68:15 - 68:16] IntegerLiteral=
245245
// CHECK-RANGE3-NOT: Punctuation: ";"

test/Index/c-index-getCursor-test.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: c-index-test -write-pch %t.ast -arch x86_64 -mmacosx-version-min=10.6 -fblocks -x objective-c %s -ffreestanding
2-
// RUN: c-index-test -test-file-scan %t.ast %s -ffreestanding > %t 2>&1 && FileCheck --input-file=%t %s
1+
// RUN: c-index-test -write-pch %t.ast -arch x86_64 -mmacosx-version-min=10.6 -fblocks -x objective-c %s
2+
// RUN: c-index-test -test-file-scan %t.ast %s > %t 2>&1 && FileCheck --input-file=%t %s
33
@interface Foo
44
{
55
}

test/Index/get-cursor-macro-args.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
// RUN: -cursor-at=%S/get-cursor-macro-args.h:9:22 \
66
// RUN: -cursor-at=%S/get-cursor-macro-args.h:15:12 \
77
// RUN: -cursor-at=%S/get-cursor-macro-args.h:15:20 \
8-
// RUN: %s -ffreestanding -include %S/get-cursor-macro-args.h | FileCheck %s
8+
// RUN: %s -include %S/get-cursor-macro-args.h | FileCheck %s
99

1010
// Test with PCH
11-
// RUN: c-index-test -write-pch %t.pch -x objective-c-header %S/get-cursor-macro-args.h -ffreestanding
11+
// RUN: c-index-test -write-pch %t.pch -x objective-c-header %S/get-cursor-macro-args.h
1212
// RUN: c-index-test -cursor-at=%S/get-cursor-macro-args.h:9:12 \
1313
// RUN: -cursor-at=%S/get-cursor-macro-args.h:9:21 \
1414
// RUN: -cursor-at=%S/get-cursor-macro-args.h:9:9 \
1515
// RUN: -cursor-at=%S/get-cursor-macro-args.h:9:22 \
1616
// RUN: -cursor-at=%S/get-cursor-macro-args.h:15:12 \
1717
// RUN: -cursor-at=%S/get-cursor-macro-args.h:15:20 \
18-
// RUN: %s -ffreestanding -include-pch %t.pch | FileCheck %s
18+
// RUN: %s -include-pch %t.pch | FileCheck %s
1919

2020
// CHECK: ObjCClassRef=MyClass:1:12
2121
// CHECK-NEXT: ObjCMessageExpr=meth:2:8

0 commit comments

Comments
 (0)