From d2dd52d1df034f6060a06604d2be1743285cfcae Mon Sep 17 00:00:00 2001 From: Erich Keane <erich.keane@intel.com> Date: Mon, 11 Dec 2017 18:14:51 +0000 Subject: [PATCH] Revert 320391: Certain targets are failing, pulling back to diagnose. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320398 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Driver/CC1Options.td | 2 - include/clang/Lex/PreprocessorOptions.h | 4 -- lib/Driver/Job.cpp | 2 +- lib/Driver/ToolChains/Linux.cpp | 12 ----- lib/Driver/ToolChains/Linux.h | 2 - lib/Frontend/CompilerInvocation.cpp | 4 -- lib/Frontend/InitPreprocessor.cpp | 16 ------ .../stdc-predef/usr/include/stdc-predef.h | 12 ----- test/Driver/crash-report-header.h | 2 +- test/Driver/crash-report-spaces.c | 2 +- test/Driver/crash-report.c | 3 +- test/Driver/rewrite-map-in-diagnostics.c | 2 +- test/Driver/stdc-predef.c | 25 --------- test/Driver/stdc-predef.i | 16 ------ test/Index/IBOutletCollection.m | 4 +- test/Index/annotate-macro-args.m | 10 ++-- test/Index/annotate-tokens-pp.c | 4 +- test/Index/annotate-tokens.c | 12 ++--- test/Index/c-index-getCursor-test.m | 4 +- test/Index/get-cursor-macro-args.m | 6 +-- test/Index/get-cursor.cpp | 54 +++++++++---------- test/Preprocessor/ignore-pragmas.c | 10 ++-- unittests/Tooling/TestVisitor.h | 1 - unittests/libclang/LibclangTest.cpp | 4 +- 24 files changed, 58 insertions(+), 155 deletions(-) delete mode 100644 test/Driver/Inputs/stdc-predef/usr/include/stdc-predef.h delete mode 100644 test/Driver/stdc-predef.c delete mode 100644 test/Driver/stdc-predef.i diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td index 59da3d4e47..4f980c202b 100644 --- a/include/clang/Driver/CC1Options.td +++ b/include/clang/Driver/CC1Options.td @@ -769,8 +769,6 @@ def token_cache : Separate<["-"], "token-cache">, MetaVarName<"<path>">, HelpText<"Use specified token cache file">; def detailed_preprocessing_record : Flag<["-"], "detailed-preprocessing-record">, HelpText<"include a detailed record of preprocessing actions">; -def fsystem_include_if_exists : Separate<["-"], "fsystem-include-if-exists">, MetaVarName<"<file>">, - HelpText<"Include system file before parsing if file exists">; //===----------------------------------------------------------------------===// // OpenCL Options diff --git a/include/clang/Lex/PreprocessorOptions.h b/include/clang/Lex/PreprocessorOptions.h index 4e785cb860..55fc305dc2 100644 --- a/include/clang/Lex/PreprocessorOptions.h +++ b/include/clang/Lex/PreprocessorOptions.h @@ -60,9 +60,6 @@ public: /// \brief Headers that will be converted to chained PCHs in memory. std::vector<std::string> ChainedIncludes; - /// \brief System Headers that are pre-included if they exist. - std::vector<std::string> FSystemIncludeIfExists; - /// \brief When true, disables most of the normal validation performed on /// precompiled headers. bool DisablePCHValidation = false; @@ -186,7 +183,6 @@ public: DumpDeserializedPCHDecls = false; ImplicitPCHInclude.clear(); ImplicitPTHInclude.clear(); - FSystemIncludeIfExists.clear(); TokenCache.clear(); SingleFileParseMode = false; LexEditorPlaceholders = true; diff --git a/lib/Driver/Job.cpp b/lib/Driver/Job.cpp index b494bc7528..765c05752d 100644 --- a/lib/Driver/Job.cpp +++ b/lib/Driver/Job.cpp @@ -64,7 +64,7 @@ static bool skipArgs(const char *Flag, bool HaveCrashVFS, int &SkipNum, .Cases("-internal-externc-isystem", "-iprefix", true) .Cases("-iwithprefixbefore", "-isystem", "-iquote", true) .Cases("-isysroot", "-I", "-F", "-resource-dir", true) - .Cases("-iframework", "-include-pch", "-fsystem-include-if-exists", true) + .Cases("-iframework", "-include-pch", true) .Default(false); if (IsInclude) return HaveCrashVFS ? false : true; diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp index 5c3697391d..1301cdf114 100644 --- a/lib/Driver/ToolChains/Linux.cpp +++ b/lib/Driver/ToolChains/Linux.cpp @@ -710,8 +710,6 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs, addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/include"); addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include"); - - AddGnuIncludeArgs(DriverArgs, CC1Args); } static std::string DetectLibcxxIncludePath(StringRef base) { @@ -750,16 +748,6 @@ std::string Linux::findLibCxxIncludePath() const { return ""; } -void Linux::AddGnuIncludeArgs(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const { - if (!DriverArgs.hasArg(options::OPT_ffreestanding)) { - // For gcc compatibility, clang will preinclude <stdc-predef.h> - // -ffreestanding suppresses this behavior. - CC1Args.push_back("-fsystem-include-if-exists"); - CC1Args.push_back("stdc-predef.h"); - } -} - void Linux::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const { // We need a detected GCC installation on Linux to provide libstdc++'s diff --git a/lib/Driver/ToolChains/Linux.h b/lib/Driver/ToolChains/Linux.h index 8b7e2e2ad5..9778c1832c 100644 --- a/lib/Driver/ToolChains/Linux.h +++ b/lib/Driver/ToolChains/Linux.h @@ -31,8 +31,6 @@ public: void addLibStdCxxIncludePaths( const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override; - void AddGnuIncludeArgs(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const; void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override; void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs, diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 60802da921..2ebdc2a62a 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -2611,10 +2611,6 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args, for (const Arg *A : Args.filtered(OPT_chain_include)) Opts.ChainedIncludes.emplace_back(A->getValue()); - // Add the ordered list of -fsystem-include-if-exists. - for (const Arg *A : Args.filtered(OPT_fsystem_include_if_exists)) - Opts.FSystemIncludeIfExists.emplace_back(A->getValue()); - for (const Arg *A : Args.filtered(OPT_remap_file)) { std::pair<StringRef, StringRef> Split = StringRef(A->getValue()).split(';'); diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index 45760ae15e..d398904943 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/lib/Frontend/InitPreprocessor.cpp @@ -70,15 +70,6 @@ static void AddImplicitInclude(MacroBuilder &Builder, StringRef File) { Builder.append(Twine("#include \"") + File + "\""); } -/// AddImplicitSystemIncludeIfExists - Add an implicit system \#include of the -/// specified file to the predefines buffer: precheck with __has_include. -static void AddImplicitSystemIncludeIfExists(MacroBuilder &Builder, - StringRef File) { - Builder.append(Twine("#if __has_include( <") + File + ">)"); - Builder.append(Twine("#include <") + File + ">"); - Builder.append(Twine("#endif")); -} - static void AddImplicitIncludeMacros(MacroBuilder &Builder, StringRef File) { Builder.append(Twine("#__include_macros \"") + File + "\""); // Marker token to stop the __include_macros fetch loop. @@ -1142,13 +1133,6 @@ void clang::InitializePreprocessor( if (!PP.getLangOpts().AsmPreprocessor) Builder.append("# 1 \"<built-in>\" 2"); - // Process -fsystem-include-if-exists directives. - for (unsigned i = 0, - e = InitOpts.FSystemIncludeIfExists.size(); i != e; ++i) { - const std::string &Path = InitOpts.FSystemIncludeIfExists[i]; - AddImplicitSystemIncludeIfExists(Builder, Path); - } - // If -imacros are specified, include them now. These are processed before // any -include directives. for (unsigned i = 0, e = InitOpts.MacroIncludes.size(); i != e; ++i) diff --git a/test/Driver/Inputs/stdc-predef/usr/include/stdc-predef.h b/test/Driver/Inputs/stdc-predef/usr/include/stdc-predef.h deleted file mode 100644 index ddf0103bec..0000000000 --- a/test/Driver/Inputs/stdc-predef/usr/include/stdc-predef.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _STDC_PREDEF_H -#define _STDC_PREDEF_H 1 - -#define DUMMY_STDC_PREDEF 1 - -#endif -#ifndef _STDC_PREDEF_H -#define _STDC_PREDEF_H 1 - -#define DUMMY_STDC_PREDEF 1 - -#endif diff --git a/test/Driver/crash-report-header.h b/test/Driver/crash-report-header.h index 97dcdf9348..e0193cbe45 100644 --- a/test/Driver/crash-report-header.h +++ b/test/Driver/crash-report-header.h @@ -1,6 +1,6 @@ // RUN: rm -rf %t // RUN: mkdir %t -// RUN: not env TMPDIR="%t" TEMP="%t" TMP="%t" RC_DEBUG_OPTIONS=1 %clang -ffreestanding -fsyntax-only %s 2>&1 | FileCheck %s +// RUN: not env TMPDIR="%t" TEMP="%t" TMP="%t" RC_DEBUG_OPTIONS=1 %clang -fsyntax-only %s 2>&1 | FileCheck %s // RUN: cat %t/crash-report-header-*.h | FileCheck --check-prefix=CHECKSRC "%s" // RUN: cat %t/crash-report-header-*.sh | FileCheck --check-prefix=CHECKSH "%s" // REQUIRES: crash-recovery diff --git a/test/Driver/crash-report-spaces.c b/test/Driver/crash-report-spaces.c index 8433884ff9..3e95a0de25 100644 --- a/test/Driver/crash-report-spaces.c +++ b/test/Driver/crash-report-spaces.c @@ -1,7 +1,7 @@ // RUN: rm -rf "%t" // RUN: mkdir "%t" // RUN: cp "%s" "%t/crash report spaces.c" -// 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" +// 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" // RUN: cat "%t/crash report spaces"-*.c | FileCheck --check-prefix=CHECKSRC "%s" // RUN: cat "%t/crash report spaces"-*.sh | FileCheck --check-prefix=CHECKSH "%s" // REQUIRES: crash-recovery diff --git a/test/Driver/crash-report.c b/test/Driver/crash-report.c index af7b245e62..a3f1f9e72a 100644 --- a/test/Driver/crash-report.c +++ b/test/Driver/crash-report.c @@ -2,7 +2,7 @@ // RUN: mkdir %t // RUN: not env TMPDIR=%t TEMP=%t TMP=%t RC_DEBUG_OPTIONS=1 \ // RUN: CC_PRINT_HEADERS=1 CC_LOG_DIAGNOSTICS=1 \ -// RUN: %clang -fsyntax-only -ffreestanding %s \ +// RUN: %clang -fsyntax-only %s \ // RUN: -F/tmp/ -I /tmp/ -idirafter /tmp/ -iquote /tmp/ -isystem /tmp/ \ // RUN: -iprefix /the/prefix -iwithprefix /tmp -iwithprefixbefore /tmp/ \ // RUN: -Xclang -internal-isystem -Xclang /tmp/ \ @@ -42,6 +42,5 @@ FOO // CHECKSH-NOT: "-iwithprefixbefore" "/tmp/" // CHECKSH-NOT: "-internal-isystem" "/tmp/" // CHECKSH-NOT: "-internal-externc-isystem" "/tmp/" -// CHECKSH-NOT: "-fsystem-include-if-exists" "/tmp/" // CHECKSH-NOT: "-dwarf-debug-flags" // CHECKSH: "crash-report-{{[^ ]*}}.c" diff --git a/test/Driver/rewrite-map-in-diagnostics.c b/test/Driver/rewrite-map-in-diagnostics.c index cb08830ef2..4aea0ec031 100644 --- a/test/Driver/rewrite-map-in-diagnostics.c +++ b/test/Driver/rewrite-map-in-diagnostics.c @@ -1,7 +1,7 @@ // RUN: rm -rf "%t" // RUN: mkdir -p "%t" // RUN: not env TMPDIR="%t" TEMP="%t" TMP="%t" RC_DEBUG_OPTION=1 \ -// RUN: %clang -ffreestanding -fsyntax-only -frewrite-map-file %p/Inputs/rewrite.map %s 2>&1 \ +// RUN: %clang -fsyntax-only -frewrite-map-file %p/Inputs/rewrite.map %s 2>&1 \ // RUN: | FileCheck %s #pragma clang __debug parser_crash diff --git a/test/Driver/stdc-predef.c b/test/Driver/stdc-predef.c deleted file mode 100644 index 48dce2448f..0000000000 --- a/test/Driver/stdc-predef.c +++ /dev/null @@ -1,25 +0,0 @@ -// Test that clang preincludes stdc-predef.h, if the include file is available -// -// RUN: %clang %s -### -c 2>&1 \ -// RUN: --sysroot=%S/Inputs/stdc-predef \ -// RUN: | FileCheck -check-prefix CHECK-PREDEF %s -// RUN: %clang %s -### -c -ffreestanding 2>&1 \ -// RUN: --sysroot=%S/Inputs/stdc-predef \ -// RUN: | FileCheck --implicit-check-not "stdc-predef.h" %s -// RUN: %clang %s -c -E 2>&1 \ -// RUN: --sysroot=%S/Inputs/basic_linux_tree \ -// RUN: | FileCheck --implicit-check-not "stdc-predef.h" %s -// RUN: %clang -c %s -Xclang -verify -DCHECK_DUMMY=1 \ -// RUN: --sysroot=%S/Inputs/stdc-predef -// expected-no-diagnostics -// RUN: %clang -x cpp-output %s -### -c 2>&1 \ -// RUN: --sysroot=%S/Inputs/stdc-predef \ -// RUN: | FileCheck --implicit-check-not "stdc-predef.h" %s - -// CHECK-PREDEF: "-fsystem-include-if-exists" "stdc-predef.h" -int i; -#if CHECK_DUMMY -#if !DUMMY_STDC_PREDEF - #error "Expected macro symbol DUMMY_STDC_PREDEF is not defined." -#endif -#endif diff --git a/test/Driver/stdc-predef.i b/test/Driver/stdc-predef.i deleted file mode 100644 index 63ed3d275b..0000000000 --- a/test/Driver/stdc-predef.i +++ /dev/null @@ -1,16 +0,0 @@ -// The automatic preinclude of stdc-predef.h should not occur if -// the source filename indicates a preprocessed file. -// -// RUN: %clang %s -### -c 2>&1 \ -// RUN: --sysroot=%S/Inputs/stdc-predef \ -// RUN: | FileCheck --implicit-check-not "stdc-predef.h" %s - -int i; -// The automatic preinclude of stdc-predef.h should not occur if -// the source filename indicates a preprocessed file. -// -// RUN: %clang %s -### -c 2>&1 \ -// RUN: --sysroot=%S/Inputs/stdc-predef \ -// RUN: | FileCheck --implicit-check-not "stdc-predef.h" %s - -int i; diff --git a/test/Index/IBOutletCollection.m b/test/Index/IBOutletCollection.m index 63ab26a812..1b5d62c7ae 100644 --- a/test/Index/IBOutletCollection.m +++ b/test/Index/IBOutletCollection.m @@ -5,10 +5,10 @@ } @end -// RUN: c-index-test -cursor-at=%s:4:24 -ffreestanding %s | FileCheck -check-prefix=CHECK-CURSOR %s +// RUN: c-index-test -cursor-at=%s:4:24 %s | FileCheck -check-prefix=CHECK-CURSOR %s // CHECK-CURSOR: ObjCClassRef=Test:3:12 -// RUN: c-index-test -test-annotate-tokens=%s:4:1:5:1 -ffreestanding %s | FileCheck -check-prefix=CHECK-TOK %s +// RUN: c-index-test -test-annotate-tokens=%s:4:1:5:1 %s | FileCheck -check-prefix=CHECK-TOK %s // CHECK-TOK: Identifier: "IBOutletCollection" [4:3 - 4:21] macro expansion=IBOutletCollection:1:9 // FIXME: The following token should belong to the macro expansion cursor. // CHECK-TOK: Punctuation: "(" [4:21 - 4:22] attribute(iboutletcollection)= [IBOutletCollection=ObjCInterface] diff --git a/test/Index/annotate-macro-args.m b/test/Index/annotate-macro-args.m index aef5460c3e..7d56523ce4 100644 --- a/test/Index/annotate-macro-args.m +++ b/test/Index/annotate-macro-args.m @@ -1,11 +1,11 @@ // Test without PCH -// 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 -// 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 +// 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 +// 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 // Test with PCH -// RUN: c-index-test -write-pch %t.pch -x objective-c-header %S/annotate-macro-args.h -ffreestanding -Xclang -detailed-preprocessing-record -// 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 -// 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 +// RUN: c-index-test -write-pch %t.pch -x objective-c-header %S/annotate-macro-args.h -Xclang -detailed-preprocessing-record +// 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 +// 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 // CHECK1: Identifier: "MACRO" [9:3 - 9:8] macro expansion=MACRO:6:9 // CHECK1: Punctuation: "(" [9:8 - 9:9] diff --git a/test/Index/annotate-tokens-pp.c b/test/Index/annotate-tokens-pp.c index 03ef07d894..7da2d6f582 100644 --- a/test/Index/annotate-tokens-pp.c +++ b/test/Index/annotate-tokens-pp.c @@ -42,8 +42,8 @@ struct A #endif }; -// RUN: c-index-test -test-annotate-tokens=%s:2:1:44:1 -I%S/Inputs -ffreestanding %s | FileCheck %s -// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-annotate-tokens=%s:2:1:44:1 -I%S/Inputs -ffreestanding %s | FileCheck %s +// RUN: c-index-test -test-annotate-tokens=%s:2:1:44:1 -I%S/Inputs %s | FileCheck %s +// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-annotate-tokens=%s:2:1:44:1 -I%S/Inputs %s | FileCheck %s // CHECK: Punctuation: "#" [2:1 - 2:2] preprocessing directive= // CHECK: Identifier: "define" [2:2 - 2:8] preprocessing directive= // CHECK: Identifier: "STILL_NOTHING" [2:9 - 2:22] macro definition=STILL_NOTHING diff --git a/test/Index/annotate-tokens.c b/test/Index/annotate-tokens.c index 282d285a79..08e7a9a02f 100644 --- a/test/Index/annotate-tokens.c +++ b/test/Index/annotate-tokens.c @@ -68,7 +68,7 @@ void test() { reg.field = 1; } -// RUN: c-index-test -test-annotate-tokens=%s:4:1:37:1 -ffreestanding %s | FileCheck %s +// RUN: c-index-test -test-annotate-tokens=%s:4:1:37:1 %s | FileCheck %s // CHECK: Identifier: "T" [4:3 - 4:4] TypeRef=T:1:13 // CHECK: Punctuation: "*" [4:4 - 4:5] VarDecl=t_ptr:4:6 (Definition) // CHECK: Identifier: "t_ptr" [4:6 - 4:11] VarDecl=t_ptr:4:6 (Definition) @@ -191,10 +191,10 @@ void test() { // CHECK: Punctuation: ")" [36:97 - 36:98] FunctionDecl=test:36:63 (unavailable) (always unavailable: "") // CHECK: Punctuation: ";" [36:98 - 36:99] -// RUN: c-index-test -test-annotate-tokens=%s:4:1:165:32 -ffreestanding %s | FileCheck %s -// RUN: c-index-test -test-annotate-tokens=%s:4:1:165:38 -ffreestanding %s | FileCheck %s +// RUN: c-index-test -test-annotate-tokens=%s:4:1:165:32 %s | FileCheck %s +// RUN: c-index-test -test-annotate-tokens=%s:4:1:165:38 %s | FileCheck %s -// RUN: c-index-test -test-annotate-tokens=%s:50:1:55:1 -ffreestanding %s | FileCheck %s -check-prefix=CHECK-RANGE1 +// RUN: c-index-test -test-annotate-tokens=%s:50:1:55:1 %s | FileCheck %s -check-prefix=CHECK-RANGE1 // CHECK-RANGE1: Keyword: "void" [50:1 - 50:5] FunctionDecl=func1:50:6 // CHECK-RANGE1: Identifier: "func1" [50:6 - 50:11] FunctionDecl=func1:50:6 // CHECK-RANGE1: Punctuation: "(" [50:11 - 50:12] FunctionDecl=func1:50:6 @@ -216,7 +216,7 @@ void test() { // CHECK-RANGE1: Literal: "1" [54:10 - 54:11] IntegerLiteral= // CHECK-RANGE1: Punctuation: "," [54:11 - 54:12] InitListExpr= -// RUN: c-index-test -test-annotate-tokens=%s:54:1:70:1 -ffreestanding %s | FileCheck %s -check-prefix=CHECK-RANGE2 +// RUN: c-index-test -test-annotate-tokens=%s:54:1:70:1 %s | FileCheck %s -check-prefix=CHECK-RANGE2 // CHECK-RANGE2: Punctuation: "." [54:5 - 54:6] UnexposedExpr= // CHECK-RANGE2: Identifier: "y" [54:6 - 54:7] MemberRef=y:52:1 // CHECK-RANGE2: Punctuation: "=" [54:8 - 54:9] UnexposedExpr= @@ -240,6 +240,6 @@ void test() { // CHECK-RANGE2: Punctuation: "." [68:6 - 68:7] MemberRefExpr=field:62:9 // CHECK-RANGE2: Identifier: "field" [68:7 - 68:12] MemberRefExpr=field:62:9 -// RUN: c-index-test -test-annotate-tokens=%s:68:15:68:16 -ffreestanding %s | FileCheck %s -check-prefix=CHECK-RANGE3 +// RUN: c-index-test -test-annotate-tokens=%s:68:15:68:16 %s | FileCheck %s -check-prefix=CHECK-RANGE3 // CHECK-RANGE3: Literal: "1" [68:15 - 68:16] IntegerLiteral= // CHECK-RANGE3-NOT: Punctuation: ";" diff --git a/test/Index/c-index-getCursor-test.m b/test/Index/c-index-getCursor-test.m index d379904c80..2361af62ab 100644 --- a/test/Index/c-index-getCursor-test.m +++ b/test/Index/c-index-getCursor-test.m @@ -1,5 +1,5 @@ -// RUN: c-index-test -write-pch %t.ast -arch x86_64 -mmacosx-version-min=10.6 -fblocks -x objective-c %s -ffreestanding -// RUN: c-index-test -test-file-scan %t.ast %s -ffreestanding > %t 2>&1 && FileCheck --input-file=%t %s +// RUN: c-index-test -write-pch %t.ast -arch x86_64 -mmacosx-version-min=10.6 -fblocks -x objective-c %s +// RUN: c-index-test -test-file-scan %t.ast %s > %t 2>&1 && FileCheck --input-file=%t %s @interface Foo { } diff --git a/test/Index/get-cursor-macro-args.m b/test/Index/get-cursor-macro-args.m index 697f8f8771..d5ab72878f 100644 --- a/test/Index/get-cursor-macro-args.m +++ b/test/Index/get-cursor-macro-args.m @@ -5,17 +5,17 @@ // RUN: -cursor-at=%S/get-cursor-macro-args.h:9:22 \ // RUN: -cursor-at=%S/get-cursor-macro-args.h:15:12 \ // RUN: -cursor-at=%S/get-cursor-macro-args.h:15:20 \ -// RUN: %s -ffreestanding -include %S/get-cursor-macro-args.h | FileCheck %s +// RUN: %s -include %S/get-cursor-macro-args.h | FileCheck %s // Test with PCH -// RUN: c-index-test -write-pch %t.pch -x objective-c-header %S/get-cursor-macro-args.h -ffreestanding +// RUN: c-index-test -write-pch %t.pch -x objective-c-header %S/get-cursor-macro-args.h // RUN: c-index-test -cursor-at=%S/get-cursor-macro-args.h:9:12 \ // RUN: -cursor-at=%S/get-cursor-macro-args.h:9:21 \ // RUN: -cursor-at=%S/get-cursor-macro-args.h:9:9 \ // RUN: -cursor-at=%S/get-cursor-macro-args.h:9:22 \ // RUN: -cursor-at=%S/get-cursor-macro-args.h:15:12 \ // RUN: -cursor-at=%S/get-cursor-macro-args.h:15:20 \ -// RUN: %s -ffreestanding -include-pch %t.pch | FileCheck %s +// RUN: %s -include-pch %t.pch | FileCheck %s // CHECK: ObjCClassRef=MyClass:1:12 // CHECK-NEXT: ObjCMessageExpr=meth:2:8 diff --git a/test/Index/get-cursor.cpp b/test/Index/get-cursor.cpp index 7acacf2208..e997fc493d 100644 --- a/test/Index/get-cursor.cpp +++ b/test/Index/get-cursor.cpp @@ -157,71 +157,71 @@ struct Z { EnumType e = Enumerator; }; -// RUN: c-index-test -cursor-at=%s:6:4 -ffreestanding %s | FileCheck -check-prefix=CHECK-COMPLETION-1 %s +// RUN: c-index-test -cursor-at=%s:6:4 %s | FileCheck -check-prefix=CHECK-COMPLETION-1 %s // CHECK-COMPLETION-1: CXXConstructor=X:6:3 // CHECK-COMPLETION-1-NEXT: Completion string: {TypedText X}{LeftParen (}{Placeholder int}{Comma , }{Placeholder int}{RightParen )} -// RUN: c-index-test -cursor-at=%s:31:16 -ffreestanding %s | FileCheck -check-prefix=CHECK-COMPLETION-2 %s +// RUN: c-index-test -cursor-at=%s:31:16 %s | FileCheck -check-prefix=CHECK-COMPLETION-2 %s // CHECK-COMPLETION-2: CXXMethod=getAnotherX:31:5 (Definition) // CHECK-COMPLETION-2-NEXT: Completion string: {ResultType X}{TypedText getAnotherX}{LeftParen (}{RightParen )} -// RUN: c-index-test -cursor-at=%s:12:20 -ffreestanding %s | FileCheck -check-prefix=CHECK-VALUE-REF %s -// RUN: c-index-test -cursor-at=%s:13:21 -ffreestanding %s | FileCheck -check-prefix=CHECK-VALUE-REF %s -// RUN: c-index-test -cursor-at=%s:13:28 -ffreestanding %s | FileCheck -check-prefix=CHECK-VALUE-REF %s -// RUN: c-index-test -cursor-at=%s:14:23 -ffreestanding %s | FileCheck -check-prefix=CHECK-VALUE-REF %s +// RUN: c-index-test -cursor-at=%s:12:20 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s +// RUN: c-index-test -cursor-at=%s:13:21 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s +// RUN: c-index-test -cursor-at=%s:13:28 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s +// RUN: c-index-test -cursor-at=%s:14:23 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s // CHECK-VALUE-REF: DeclRefExpr=value:10:12 -// RUN: c-index-test -cursor-at=%s:12:18 -ffreestanding %s | FileCheck -check-prefix=CHECK-CONSTRUCTOR1 %s -// RUN: c-index-test -cursor-at=%s:13:18 -ffreestanding %s | FileCheck -check-prefix=CHECK-CONSTRUCTOR2 %s -// RUN: c-index-test -cursor-at=%s:14:19 -ffreestanding %s | FileCheck -check-prefix=CHECK-CONSTRUCTOR1 %s -// RUN: c-index-test -cursor-at=%s:17:10 -ffreestanding %s | FileCheck -check-prefix=CHECK-CONSTRUCTOR3 %s +// RUN: c-index-test -cursor-at=%s:12:18 %s | FileCheck -check-prefix=CHECK-CONSTRUCTOR1 %s +// RUN: c-index-test -cursor-at=%s:13:18 %s | FileCheck -check-prefix=CHECK-CONSTRUCTOR2 %s +// RUN: c-index-test -cursor-at=%s:14:19 %s | FileCheck -check-prefix=CHECK-CONSTRUCTOR1 %s +// RUN: c-index-test -cursor-at=%s:17:10 %s | FileCheck -check-prefix=CHECK-CONSTRUCTOR3 %s // CHECK-TYPE-REF: TypeRef=struct X:3:8 // CHECK-CONSTRUCTOR1: CallExpr=X:5:3 // CHECK-CONSTRUCTOR2: CallExpr=X:6:3 // CHECK-CONSTRUCTOR3: CallExpr=X:4:3 -// RUN: c-index-test -cursor-at=%s:23:3 -ffreestanding %s | FileCheck -check-prefix=CHECK-RETTYPE %s -// RUN: c-index-test -cursor-at=%s:26:1 -ffreestanding %s | FileCheck -check-prefix=CHECK-RETTYPE %s +// RUN: c-index-test -cursor-at=%s:23:3 %s | FileCheck -check-prefix=CHECK-RETTYPE %s +// RUN: c-index-test -cursor-at=%s:26:1 %s | FileCheck -check-prefix=CHECK-RETTYPE %s // CHECK-RETTYPE: TypeRef=struct X:3:8 -// RUN: c-index-test -cursor-at=%s:23:7 -ffreestanding %s | FileCheck -check-prefix=CHECK-MEMFUNC-DECL %s +// RUN: c-index-test -cursor-at=%s:23:7 %s | FileCheck -check-prefix=CHECK-MEMFUNC-DECL %s // CHECK-MEMFUNC-DECL: CXXMethod=getX:23:5 -// RUN: c-index-test -cursor-at=%s:26:7 -ffreestanding %s | FileCheck -check-prefix=CHECK-MEMFUNC-DEF %s +// RUN: c-index-test -cursor-at=%s:26:7 %s | FileCheck -check-prefix=CHECK-MEMFUNC-DEF %s // CHECK-MEMFUNC-DEF: CXXMethod=getX:26:6 -// RUN: c-index-test -cursor-at=%s:26:3 -ffreestanding %s | FileCheck -check-prefix=CHECK-TYPEREF-Y %s +// RUN: c-index-test -cursor-at=%s:26:3 %s | FileCheck -check-prefix=CHECK-TYPEREF-Y %s // CHECK-TYPEREF-Y: TypeRef=struct Y:20:8 -// RUN: c-index-test -cursor-at=%s:27:10 -ffreestanding %s | FileCheck -check-prefix=CHECK-IMPLICIT-MEMREF %s -// RUN: c-index-test -cursor-at=%s:31:28 -ffreestanding %s | FileCheck -check-prefix=CHECK-IMPLICIT-MEMREF %s +// RUN: c-index-test -cursor-at=%s:27:10 %s | FileCheck -check-prefix=CHECK-IMPLICIT-MEMREF %s +// RUN: c-index-test -cursor-at=%s:31:28 %s | FileCheck -check-prefix=CHECK-IMPLICIT-MEMREF %s // CHECK-IMPLICIT-MEMREF: MemberRefExpr=member:21:7 -// RUN: c-index-test -cursor-at=%s:35:5 -ffreestanding %s | FileCheck -check-prefix=CHECK-DECL %s +// RUN: c-index-test -cursor-at=%s:35:5 %s | FileCheck -check-prefix=CHECK-DECL %s // CHECK-DECL: VarDecl=foo:35:5 -// RUN: c-index-test -cursor-at=%s:21:3 -ffreestanding %s | FileCheck -check-prefix=CHECK-MEMBER %s +// RUN: c-index-test -cursor-at=%s:21:3 %s | FileCheck -check-prefix=CHECK-MEMBER %s // CHECK-MEMBER: FieldDecl=member:21:7 (Definition) // CHECK-MEMBER-NEXT: Completion string: {ResultType int}{TypedText member} -// RUN: c-index-test -cursor-at=%s:38:12 -cursor-at=%s:39:5 -ffreestanding %s | FileCheck -check-prefix=CHECK-CXXCATCH %s +// RUN: c-index-test -cursor-at=%s:38:12 -cursor-at=%s:39:5 %s | FileCheck -check-prefix=CHECK-CXXCATCH %s // CHECK-CXXCATCH: TypeRef=struct X:3:8 // CHECK-CXXCATCH-NEXT: TypeRef=struct X:3:8 -// RUN: c-index-test -test-load-source-usrs local -ffreestanding %s | FileCheck -check-prefix=CHECK-USR %s +// RUN: c-index-test -test-load-source-usrs local %s | FileCheck -check-prefix=CHECK-USR %s // CHECK-USR: get-cursor.cpp c:get-cursor.cpp@472@F@test#@e Extent=[38:12 - 38:15] // CHECK-USR: get-cursor.cpp c:get-cursor.cpp@483@F@test#@x Extent=[39:5 - 39:8] -// RUN: c-index-test -cursor-at=%s:45:9 -ffreestanding %s | FileCheck -check-prefix=CHECK-LOCALCLASS %s +// RUN: c-index-test -cursor-at=%s:45:9 %s | FileCheck -check-prefix=CHECK-LOCALCLASS %s // CHECK-LOCALCLASS: 45:9 DeclRefExpr=x:44:11 Extent=[45:9 - 45:10] Spelling=x ([45:9 - 45:10]) -// RUN: c-index-test -cursor-at=%s:50:23 -cursor-at=%s:55:23 -ffreestanding %s | FileCheck -check-prefix=CHECK-TEMPLPARAM %s +// RUN: c-index-test -cursor-at=%s:50:23 -cursor-at=%s:55:23 %s | FileCheck -check-prefix=CHECK-TEMPLPARAM %s // CHECK-TEMPLPARAM: 50:23 TypeRef=struct X:3:8 Extent=[50:23 - 50:24] Spelling=struct X ([50:23 - 50:24]) // CHECK-TEMPLPARAM: 55:23 TypeRef=struct X:3:8 Extent=[55:23 - 55:24] Spelling=struct X ([55:23 - 55:24]) -// RUN: c-index-test -cursor-at=%s:66:23 -ffreestanding %s | FileCheck -check-prefix=CHECK-TEMPLSPEC %s +// RUN: c-index-test -cursor-at=%s:66:23 %s | FileCheck -check-prefix=CHECK-TEMPLSPEC %s // CHECK-TEMPLSPEC: 66:23 ClassDecl=TC:66:23 (Definition) [Specialization of TC:59:7] Extent=[66:1 - 66:31] Spelling=TC ([66:23 - 66:25]) -// RUN: c-index-test -cursor-at=%s:69:3 -cursor-at=%s:70:11 -cursor-at=%s:73:6 -cursor-at=%s:74:6 -cursor-at=%s:77:8 -cursor-at=%s:78:8 -cursor-at=%s:79:8 -cursor-at=%s:80:8 -cursor-at=%s:81:8 -cursor-at=%s:82:8 -cursor-at=%s:85:6 -cursor-at=%s:86:6 -cursor-at=%s:87:6 -cursor-at=%s:88:6 -cursor-at=%s:91:5 -cursor-at=%s:92:5 -cursor-at=%s:93:5 -cursor-at=%s:94:5 -cursor-at=%s:95:5 -cursor-at=%s:96:5 -cursor-at=%s:97:5 -cursor-at=%s:98:5 -cursor-at=%s:100:5 -cursor-at=%s:101:5 -cursor-at=%s:104:6 -cursor-at=%s:105:6 -cursor-at=%s:106:6 -cursor-at=%s:107:6 -cursor-at=%s:108:6 -cursor-at=%s:109:6 -cursor-at=%s:110:6 -cursor-at=%s:111:6 -cursor-at=%s:113:6 -cursor-at=%s:114:6 -cursor-at=%s:117:8 -cursor-at=%s:118:8 -cursor-at=%s:120:8 -cursor-at=%s:121:8 -cursor-at=%s:122:8 -cursor-at=%s:123:8 -cursor-at=%s:124:8 -cursor-at=%s:125:8 -cursor-at=%s:128:6 -cursor-at=%s:129:6 -cursor-at=%s:130:6 -cursor-at=%s:132:3 -cursor-at=%s:146:15 -cursor-at=%s:149:6 -cursor-at=%s:150:25 -cursor-at=%s:151:6 -cursor-at=%s:152:6 -cursor-at=%s:153:6 -std=c++11 -ffreestanding %s | FileCheck -check-prefix=CHECK-SPELLING %s +// RUN: c-index-test -cursor-at=%s:69:3 -cursor-at=%s:70:11 -cursor-at=%s:73:6 -cursor-at=%s:74:6 -cursor-at=%s:77:8 -cursor-at=%s:78:8 -cursor-at=%s:79:8 -cursor-at=%s:80:8 -cursor-at=%s:81:8 -cursor-at=%s:82:8 -cursor-at=%s:85:6 -cursor-at=%s:86:6 -cursor-at=%s:87:6 -cursor-at=%s:88:6 -cursor-at=%s:91:5 -cursor-at=%s:92:5 -cursor-at=%s:93:5 -cursor-at=%s:94:5 -cursor-at=%s:95:5 -cursor-at=%s:96:5 -cursor-at=%s:97:5 -cursor-at=%s:98:5 -cursor-at=%s:100:5 -cursor-at=%s:101:5 -cursor-at=%s:104:6 -cursor-at=%s:105:6 -cursor-at=%s:106:6 -cursor-at=%s:107:6 -cursor-at=%s:108:6 -cursor-at=%s:109:6 -cursor-at=%s:110:6 -cursor-at=%s:111:6 -cursor-at=%s:113:6 -cursor-at=%s:114:6 -cursor-at=%s:117:8 -cursor-at=%s:118:8 -cursor-at=%s:120:8 -cursor-at=%s:121:8 -cursor-at=%s:122:8 -cursor-at=%s:123:8 -cursor-at=%s:124:8 -cursor-at=%s:125:8 -cursor-at=%s:128:6 -cursor-at=%s:129:6 -cursor-at=%s:130:6 -cursor-at=%s:132:3 -cursor-at=%s:146:15 -cursor-at=%s:149:6 -cursor-at=%s:150:25 -cursor-at=%s:151:6 -cursor-at=%s:152:6 -cursor-at=%s:153:6 -std=c++11 %s | FileCheck -check-prefix=CHECK-SPELLING %s // CHECK-SPELLING: 69:3 CXXConstructor=A:69:3 (default constructor) Extent=[69:3 - 69:6] Spelling=A ([69:3 - 69:4]) // CHECK-SPELLING: 70:11 CXXDestructor=~A:70:11 (virtual) Extent=[70:3 - 70:15] Spelling=~A ([70:11 - 70:13]) // CHECK-SPELLING: 73:6 CXXMethod=operator=:73:6 Extent=[73:3 - 73:25] Spelling=operator= ([73:6 - 73:15]) @@ -275,11 +275,11 @@ struct Z { // CHECK-SPELLING: 152:6 FunctionDecl=f_dynamic_noexcept:152:6 (noexcept dynamic) Extent=[152:1 - 152:37] Spelling=f_dynamic_noexcept ([152:6 - 152:24]) // CHECK-SPELLING: 153:6 FunctionDecl=f_dynamic_noexcept_any:153:6 (noexcept dynamic any) Extent=[153:1 - 153:41] Spelling=f_dynamic_noexcept_any ([153:6 - 153:28]) -// RUN: c-index-test -cursor-at=%s:141:13 -cursor-at=%s:141:18 -cursor-at=%s:142:11 -std=c++11 -ffreestanding %s | FileCheck -check-prefix=CHECK-FORRANGE %s +// RUN: c-index-test -cursor-at=%s:141:13 -cursor-at=%s:141:18 -cursor-at=%s:142:11 -std=c++11 %s | FileCheck -check-prefix=CHECK-FORRANGE %s // CHECK-FORRANGE: 141:13 VarDecl=lv:141:13 (Definition) Extent=[141:8 - 141:17] Spelling=lv ([141:13 - 141:15]) // CHECK-FORRANGE: 141:18 DeclRefExpr=coll:140:20 Extent=[141:18 - 141:22] Spelling=coll ([141:18 - 141:22]) // CHECK-FORRANGE: 142:11 DeclRefExpr=lv:141:13 Extent=[142:11 - 142:13] Spelling=lv ([142:11 - 142:13]) -// RUN: c-index-test -cursor-at=%s:157:18 -std=c++11 -ffreestanding %s | FileCheck -check-prefix=CHECK-INCLASSINITIALIZER %s +// RUN: c-index-test -cursor-at=%s:157:18 -std=c++11 %s | FileCheck -check-prefix=CHECK-INCLASSINITIALIZER %s // CHECK-INCLASSINITIALIZER: 157:18 DeclRefExpr=Enumerator:155:17 Extent=[157:18 - 157:28] Spelling=Enumerator ([157:18 - 157:28]) diff --git a/test/Preprocessor/ignore-pragmas.c b/test/Preprocessor/ignore-pragmas.c index 965b23e8ab..e2f9ef3dfa 100644 --- a/test/Preprocessor/ignore-pragmas.c +++ b/test/Preprocessor/ignore-pragmas.c @@ -1,8 +1,8 @@ -// RUN: %clang_cc1 -E %s -Wall -ffreestanding -verify -// RUN: %clang_cc1 -Eonly %s -Wall -ffreestanding -verify -// RUN: %clang -M -Wall -ffreestanding %s -Xclang -verify -// RUN: %clang -E -frewrite-includes %s -Wall -ffreestanding -Xclang -verify -// RUN: %clang -E -dD -dM %s -Wall -ffreestanding -Xclang -verify +// RUN: %clang_cc1 -E %s -Wall -verify +// RUN: %clang_cc1 -Eonly %s -Wall -verify +// RUN: %clang -M -Wall %s -Xclang -verify +// RUN: %clang -E -frewrite-includes %s -Wall -Xclang -verify +// RUN: %clang -E -dD -dM %s -Wall -Xclang -verify // expected-no-diagnostics #pragma GCC visibility push (default) diff --git a/unittests/Tooling/TestVisitor.h b/unittests/Tooling/TestVisitor.h index e7e57d184e..fb6a76ccad 100644 --- a/unittests/Tooling/TestVisitor.h +++ b/unittests/Tooling/TestVisitor.h @@ -52,7 +52,6 @@ public: /// \brief Runs the current AST visitor over the given code. bool runOver(StringRef Code, Language L = Lang_CXX) { std::vector<std::string> Args; - Args.push_back("-ffreestanding"); switch (L) { case Lang_C: Args.push_back("-x"); diff --git a/unittests/libclang/LibclangTest.cpp b/unittests/libclang/LibclangTest.cpp index 98c2ad16a3..f2a96d6be6 100644 --- a/unittests/libclang/LibclangTest.cpp +++ b/unittests/libclang/LibclangTest.cpp @@ -434,10 +434,8 @@ TEST_F(LibclangParseTest, AllSkippedRanges) { "#ifdef KIWIS\n" "printf(\"mmm!!\");\n" "#endif"); - const char *Args[] = { "-ffreestanding" }; - int NumArgs = sizeof(Args) / sizeof(Args[0]); - ClangTU = clang_parseTranslationUnit(Index, Main.c_str(), Args, NumArgs, + ClangTU = clang_parseTranslationUnit(Index, Main.c_str(), nullptr, 0, nullptr, 0, TUFlags); CXSourceRangeList *Ranges = clang_getAllSkippedRanges(ClangTU); -- 2.40.0