[PATCH] D126511: [ARM][AArch64] Change -mharden-sls= to use err_drv_unsupported_option_argument
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 26 17:34:59 PDT 2022
MaskRay created this revision.
MaskRay added reviewers: kristof.beyls, ostannard, nickdesaulniers, pengfei.
Herald added a subscriber: StephenFan.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Update the diagnostic in D81404 <https://reviews.llvm.org/D81404>: the convention is to use
err_drv_unsupported_option_argument instead of adding a new diagnostic for every
option.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D126511
Files:
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/lib/Driver/ToolChains/Arch/AArch64.cpp
clang/lib/Driver/ToolChains/Arch/ARM.cpp
clang/test/Driver/sls-hardening-options.c
Index: clang/test/Driver/sls-hardening-options.c
===================================================================
--- clang/test/Driver/sls-hardening-options.c
+++ clang/test/Driver/sls-hardening-options.c
@@ -99,7 +99,7 @@
// NOCOMDAT-OFF-NOT: "harden-sls-nocomdat"
// NOCOMDAT: "+harden-sls-nocomdat"
-// BAD-SLS-SPEC: invalid sls hardening option '{{[^']+}}' in '-mharden-sls=
+// BAD-SLS-SPEC: unsupported argument '{{[^']+}}' to option '-mharden-sls='
// RUN: %clang -target armv6a--none-eabi -c %s -### -mharden-sls=all 2>&1 | \
// RUN: FileCheck %s --check-prefix=SLS-NOT-SUPPORTED
Index: clang/lib/Driver/ToolChains/Arch/ARM.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Arch/ARM.cpp
+++ clang/lib/Driver/ToolChains/Arch/ARM.cpp
@@ -868,8 +868,8 @@
DisableComdat = true;
continue;
}
- D.Diag(diag::err_invalid_sls_hardening)
- << Scope << A->getAsString(Args);
+ D.Diag(diag::err_drv_unsupported_option_argument)
+ << A->getOption().getName() << Scope;
break;
}
}
Index: clang/lib/Driver/ToolChains/Arch/AArch64.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -324,8 +324,8 @@
DisableComdat = true;
continue;
}
- D.Diag(diag::err_invalid_sls_hardening)
- << Scope << A->getAsString(Args);
+ D.Diag(diag::err_drv_unsupported_option_argument)
+ << A->getOption().getName() << Scope;
break;
}
}
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -428,8 +428,6 @@
"invalid branch protection option '%0' in '%1'">;
def warn_unsupported_branch_protection: Warning <
"invalid branch protection option '%0' in '%1'">, InGroup<BranchProtection>;
-def err_invalid_sls_hardening : Error<
- "invalid sls hardening option '%0' in '%1'">;
def err_sls_hardening_arm_not_supported : Error<
"-mharden-sls is only supported on armv7-a or later">;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126511.432430.patch
Type: text/x-patch
Size: 2309 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220527/9a582d77/attachment-0001.bin>
More information about the cfe-commits
mailing list