diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1096,13 +1096,13 @@ Group, Alias; def fno_auto_profile_accurate : Flag<["-"], "fno-auto-profile-accurate">, Group, Alias; -def fdebug_compilation_dir : Separate<["-"], "fdebug-compilation-dir">, +def fdebug_compilation_dir_EQ : Joined<["-"], "fdebug-compilation-dir=">, Group, Flags<[CC1Option, CC1AsOption, CoreOption]>, - HelpText<"The compilation directory to embed in the debug info.">, + HelpText<"The compilation directory to embed in the debug info">, MarshallingInfoString>; -def fdebug_compilation_dir_EQ : Joined<["-"], "fdebug-compilation-dir=">, +def fdebug_compilation_dir : Separate<["-"], "fdebug-compilation-dir">, Group, Flags<[CC1Option, CC1AsOption, CoreOption]>, - Alias; + Alias; defm debug_info_for_profiling : BoolFOption<"debug-info-for-profiling", CodeGenOpts<"DebugInfoForProfiling">, DefaultFalse, PosFlag, @@ -1122,8 +1122,6 @@ Group, Flags<[CC1Option, CoreOption]>, MetaVarName<"">, HelpText<"Use the remappings described in to match the profile data against names in the program">, MarshallingInfoString>; -def fprofile_remapping_file : Separate<["-"], "fprofile-remapping-file">, - Group, Flags<[CoreOption]>, Alias; defm coverage_mapping : BoolFOption<"coverage-mapping", CodeGenOpts<"CoverageMapping">, DefaultFalse, PosFlag, @@ -1654,13 +1652,10 @@ PosFlag, BothFlags<[CoreOption]>>; -def frewrite_map_file : Separate<["-"], "frewrite-map-file">, - Group, - Flags<[ NoXarchOption, CC1Option ]>, - MarshallingInfoStringVector>; def frewrite_map_file_EQ : Joined<["-"], "frewrite-map-file=">, Group, - Flags<[NoXarchOption]>; + Flags<[NoXarchOption, CC1Option]>, + MarshallingInfoStringVector>; defm use_line_directives : BoolFOption<"use-line-directives", PreprocessorOutputOpts<"UseLineDirectives">, DefaultFalse, @@ -1984,7 +1979,6 @@ Flags<[NoXarchOption,CC1Option]>, MetaVarName<"">, HelpText<"Specify the name of the module to build">, MarshallingInfoString>; -def fmodule_name : Separate<["-"], "fmodule-name">, Alias; def fmodule_implementation_of : Separate<["-"], "fmodule-implementation-of">, Flags<[CC1Option]>, Alias; def fsystem_module : Flag<["-"], "fsystem-module">, Flags<[CC1Option]>, diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -1484,8 +1484,7 @@ } } - for (const auto &A : C.getArgs().filtered(options::OPT_frewrite_map_file, - options::OPT_frewrite_map_file_EQ)) + for (const auto &A : C.getArgs().filtered(options::OPT_frewrite_map_file_EQ)) Diag(clang::diag::note_drv_command_failed_diag_msg) << A->getValue(); Diag(clang::diag::note_drv_command_failed_diag_msg) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -617,13 +617,11 @@ /// Add a CC1 option to specify the debug compilation directory. static void addDebugCompDirArg(const ArgList &Args, ArgStringList &CmdArgs, const llvm::vfs::FileSystem &VFS) { - if (Arg *A = Args.getLastArg(options::OPT_fdebug_compilation_dir)) { - CmdArgs.push_back("-fdebug-compilation-dir"); - CmdArgs.push_back(A->getValue()); + if (Arg *A = Args.getLastArg(options::OPT_fdebug_compilation_dir_EQ)) { + A->render(Args, CmdArgs); } else if (llvm::ErrorOr CWD = VFS.getCurrentWorkingDirectory()) { - CmdArgs.push_back("-fdebug-compilation-dir"); - CmdArgs.push_back(Args.MakeArgString(*CWD)); + CmdArgs.push_back(Args.MakeArgString("-fdebug-compilation-dir=" + *CWD)); } } @@ -4674,18 +4672,13 @@ // LLVM Code Generator Options. - if (Args.hasArg(options::OPT_frewrite_map_file) || - Args.hasArg(options::OPT_frewrite_map_file_EQ)) { - for (const Arg *A : Args.filtered(options::OPT_frewrite_map_file, - options::OPT_frewrite_map_file_EQ)) { - StringRef Map = A->getValue(); - if (!llvm::sys::fs::exists(Map)) { - D.Diag(diag::err_drv_no_such_file) << Map; - } else { - CmdArgs.push_back("-frewrite-map-file"); - CmdArgs.push_back(A->getValue()); - A->claim(); - } + for (const Arg *A : Args.filtered(options::OPT_frewrite_map_file_EQ)) { + StringRef Map = A->getValue(); + if (!llvm::sys::fs::exists(Map)) { + D.Diag(diag::err_drv_no_such_file) << Map; + } else { + A->render(Args, CmdArgs); + A->claim(); } } diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -1011,7 +1011,7 @@ } else { // Use the compilation dir. SmallString<128> T( - Args.getLastArgValue(options::OPT_fdebug_compilation_dir)); + Args.getLastArgValue(options::OPT_fdebug_compilation_dir_EQ)); SmallString<128> F(llvm::sys::path::stem(Input.getBaseInput())); AddPostfix(F); T += F; diff --git a/clang/test/Driver/clang_f_opts.c b/clang/test/Driver/clang_f_opts.c --- a/clang/test/Driver/clang_f_opts.c +++ b/clang/test/Driver/clang_f_opts.c @@ -99,7 +99,7 @@ // RUN: %clang -### -S -fcoverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-COVERAGE-AND-GEN %s // RUN: %clang -### -S -fcoverage-mapping -fno-coverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-COVERAGE %s // RUN: %clang -### -S -fprofile-instr-generate -fcoverage-mapping -fno-coverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-COVERAGE %s -// RUN: %clang -### -S -fprofile-remapping-file foo/bar.txt %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-REMAP %s +// RUN: %clang -### -S -fprofile-remapping-file=foo/bar.txt %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-REMAP %s // RUN: %clang -### -S -forder-file-instrumentation %s 2>&1 | FileCheck -check-prefix=CHECK-ORDERFILE-INSTR %s // RUN: %clang -### -flto -forder-file-instrumentation %s 2>&1 | FileCheck -check-prefix=CHECK-ORDERFILE-INSTR-LTO %s // CHECK-PROFILE-GENERATE: "-fprofile-instrument=clang" @@ -504,7 +504,7 @@ // RUN: %clang -### -S -fdebug-compilation-dir=. %s 2>&1 | FileCheck -check-prefix=CHECK-DEBUG-COMPILATION-DIR %s // RUN: %clang -### -fdebug-compilation-dir . -x assembler %s 2>&1 | FileCheck -check-prefix=CHECK-DEBUG-COMPILATION-DIR %s // RUN: %clang -### -fdebug-compilation-dir=. -x assembler %s 2>&1 | FileCheck -check-prefix=CHECK-DEBUG-COMPILATION-DIR %s -// CHECK-DEBUG-COMPILATION-DIR: "-fdebug-compilation-dir" "." +// CHECK-DEBUG-COMPILATION-DIR: "-fdebug-compilation-dir=." // RUN: %clang -### -S -fdiscard-value-names %s 2>&1 | FileCheck -check-prefix=CHECK-DISCARD-NAMES %s // RUN: %clang -### -S -fno-discard-value-names %s 2>&1 | FileCheck -check-prefix=CHECK-NO-DISCARD-NAMES %s diff --git a/clang/test/Driver/debug-comp-dir.S b/clang/test/Driver/debug-comp-dir.S --- a/clang/test/Driver/debug-comp-dir.S +++ b/clang/test/Driver/debug-comp-dir.S @@ -1,2 +1,3 @@ // RUN: cd %S && %clang -### -g %s -c 2>&1 | FileCheck -check-prefix=CHECK-PWD %s -// CHECK-PWD: {{"-fdebug-compilation-dir" ".*Driver.*"}} +// RUN: cd %S && %clang -x c -### -g %s -c 2>&1 | FileCheck -check-prefix=CHECK-PWD %s +// CHECK-PWD: "-fdebug-compilation-dir={{.*Driver.*}}" diff --git a/clang/test/Driver/debug.c b/clang/test/Driver/debug.c deleted file mode 100644 --- a/clang/test/Driver/debug.c +++ /dev/null @@ -1,2 +0,0 @@ -// RUN: cd %S && %clang -### -g %s -c 2>&1 | FileCheck -check-prefix=CHECK-PWD %s -// CHECK-PWD: {{"-fdebug-compilation-dir" ".*Driver.*"}} diff --git a/clang/test/Driver/rewrite-map-files.c b/clang/test/Driver/rewrite-map-files.c --- a/clang/test/Driver/rewrite-map-files.c +++ b/clang/test/Driver/rewrite-map-files.c @@ -1,2 +1,2 @@ -// RUN: %clang -### -frewrite-map-file %t.map -c %s -o /dev/null 2>&1 | FileCheck %s +// RUN: %clang -### -frewrite-map-file=%t.map -c %s -o /dev/null 2>&1 | FileCheck %s // CHECK: error: no such file or directory: diff --git a/clang/test/Driver/rewrite-map-in-diagnostics.c b/clang/test/Driver/rewrite-map-in-diagnostics.c --- a/clang/test/Driver/rewrite-map-in-diagnostics.c +++ b/clang/test/Driver/rewrite-map-in-diagnostics.c @@ -1,7 +1,7 @@ // RUN: rm -rf "%t" // RUN: mkdir -p "%t" // RUN: env TMPDIR="%t" TEMP="%t" TMP="%t" RC_DEBUG_OPTION=1 \ -// RUN: not %clang -fsyntax-only -frewrite-map-file %p/Inputs/rewrite.map %s 2>&1 \ +// RUN: not %clang -fsyntax-only -frewrite-map-file=%p/Inputs/rewrite.map %s 2>&1 \ // RUN: | FileCheck %s #pragma clang __debug parser_crash diff --git a/clang/test/Driver/symbol-rewriter.c b/clang/test/Driver/symbol-rewriter.c --- a/clang/test/Driver/symbol-rewriter.c +++ b/clang/test/Driver/symbol-rewriter.c @@ -1,21 +1,7 @@ -// RUN: %clang -frewrite-map-file %S/Inputs/rewrite.map -### %s 2>&1 | FileCheck %s -check-prefix CHECK-SINGLE +// RUN: %clang -frewrite-map-file=%S/Inputs/rewrite.map -### %s 2>&1 | FileCheck %s -check-prefix CHECK-SINGLE -// CHECK-SINGLE: "-frewrite-map-file" "{{.*[\\/]}}rewrite.map" +// CHECK-SINGLE: "-frewrite-map-file={{.*[\\/]}}rewrite.map" -// RUN: %clang -frewrite-map-file %S/Inputs/rewrite-1.map -frewrite-map-file %S/Inputs/rewrite-2.map -### %s 2>&1 | FileCheck %s -check-prefix CHECK-MULTIPLE - -// CHECK-MULTIPLE: "-frewrite-map-file" "{{.*[\\/]}}rewrite-1.map" "-frewrite-map-file" "{{.*[\\/]}}rewrite-2.map" - -// RUN: %clang -frewrite-map-file=%S/Inputs/rewrite.map -### %s 2>&1 | FileCheck %s -check-prefix CHECK-SINGLE-EQ - -// CHECK-SINGLE-EQ: "-frewrite-map-file" "{{.*[\\/]}}rewrite.map" - -// RUN: %clang -frewrite-map-file=%S/Inputs/rewrite-1.map -frewrite-map-file=%S/Inputs/rewrite-2.map -### %s 2>&1 | FileCheck %s -check-prefix CHECK-MULTIPLE-EQ - -// CHECK-MULTIPLE-EQ: "-frewrite-map-file" "{{.*[\\/]}}rewrite-1.map" -// CHECK-MULTIPLE-EQ: "-frewrite-map-file" "{{.*[\\/]}}rewrite-2.map" - -// RUN: %clang -frewrite-map-file %S/Inputs/rewrite-1.map -frewrite-map-file=%S/Inputs/rewrite-2.map -### %s 2>&1 | FileCheck %s -check-prefix CHECK-MIXED - -// CHECK-MIXED: "-frewrite-map-file" "{{.*[\\/]}}rewrite-1.map" "-frewrite-map-file" "{{.*[\\/]}}rewrite-2.map" +// RUN: %clang -frewrite-map-file=%S/Inputs/rewrite-1.map -frewrite-map-file=%S/Inputs/rewrite-2.map -### %s 2>&1 | FileCheck %s -check-prefix CHECK-MULTIPLE +// CHECK-MULTIPLE: "-frewrite-map-file={{.*[\\/]}}rewrite-1.map" "-frewrite-map-file={{.*[\\/]}}rewrite-2.map" diff --git a/clang/test/Driver/working-directory.c b/clang/test/Driver/working-directory.c --- a/clang/test/Driver/working-directory.c +++ b/clang/test/Driver/working-directory.c @@ -8,4 +8,4 @@ // CHECK_WORKS: "-coverage-notes-file" "{{[^"]+}}test{{/|\\\\}}Driver{{/|\\\\}}Inputs{{/|\\\\}}pchfile.gcno" // CHECK_WORKS: "-working-directory" "{{[^"]+}}test{{/|\\\\}}Driver{{/|\\\\}}Inputs" -// CHECK_WORKS: "-fdebug-compilation-dir" "{{[^"]+}}test{{/|\\\\}}Driver{{/|\\\\}}Inputs" +// CHECK_WORKS: "-fdebug-compilation-dir={{[^"]+}}test{{/|\\\\}}Driver{{/|\\\\}}Inputs"