Author: Sean Perry Date: 2024-09-25T10:51:55-04:00 New Revision: 97189492a1a75d39c09b0a54982f2a028c9bd652
URL: https://github.com/llvm/llvm-project/commit/97189492a1a75d39c09b0a54982f2a028c9bd652 DIFF: https://github.com/llvm/llvm-project/commit/97189492a1a75d39c09b0a54982f2a028c9bd652.diff LOG: The real option name and not the alias used is displayed in msgs when using a config file (#107613) An example of this is the -mpure-code option. Without a config file being used, an error message will print `-mpure-code`. But if a config file is used, the error message will print `-mexecute-only`. Added: Modified: clang/lib/Driver/Driver.cpp clang/test/Driver/arm-execute-only.c Removed: ################################################################################ diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 44548fa9d706fb..d0c8bdba0ede95 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -1005,6 +1005,17 @@ static void appendOneArg(InputArgList &Args, const Arg *Opt, Copy->setOwnsValues(Opt->getOwnsValues()); Opt->setOwnsValues(false); Args.append(Copy); + if (Opt->getAlias()) { + const Arg *Alias = Opt->getAlias(); + unsigned Index = Args.MakeIndex(Alias->getSpelling()); + auto AliasCopy = std::make_unique<Arg>(Alias->getOption(), + Args.getArgString(Index), Index); + AliasCopy->getValues() = Alias->getValues(); + AliasCopy->setOwnsValues(false); + if (Alias->isClaimed()) + AliasCopy->claim(); + Copy->setAlias(std::move(AliasCopy)); + } } bool Driver::readConfigFile(StringRef FileName, diff --git a/clang/test/Driver/arm-execute-only.c b/clang/test/Driver/arm-execute-only.c index a9bf1656fd27e5..d654ec364a87f5 100644 --- a/clang/test/Driver/arm-execute-only.c +++ b/clang/test/Driver/arm-execute-only.c @@ -19,6 +19,9 @@ // RUN: not %clang -### --target=arm-arm-none-eabi -march=armv8-m.main -mpure-code -mno-movt %s 2>&1 \ // RUN: | FileCheck %s -check-prefix CHECK-PURE-CODE-NO-MOVT +// RUN: echo "-DABC" > %t.cfg +// RUN: not %clang -### --target=arm-arm-none-eabi -march=armv8-m.main -mpure-code -mno-movt --config %t.cfg %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix CHECK-PURE-CODE-NO-MOVT // CHECK-PURE-CODE-NO-MOVT: error: option '-mpure-code' cannot be specified with '-mno-movt' // RUN: not %clang -### --target=arm-arm-none-eabi -march=armv6-m -mexecute-only -fropi %s 2>&1 \ _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits