[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)
Nick Desaulniers via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 29 11:05:32 PST 2024
================
@@ -109,38 +109,29 @@ class AArch64TargetCodeGenInfo : public TargetCodeGenInfo {
if (!FD)
return;
- const auto *TA = FD->getAttr<TargetAttr>();
- if (TA == nullptr)
- return;
-
- ParsedTargetAttr Attr =
- CGM.getTarget().parseTargetAttr(TA->getFeaturesStr());
- if (Attr.BranchProtection.empty())
- return;
-
- TargetInfo::BranchProtectionInfo BPI;
- StringRef Error;
- (void)CGM.getTarget().validateBranchProtection(Attr.BranchProtection,
- Attr.CPU, BPI, Error);
- assert(Error.empty());
-
+ TargetInfo::BranchProtectionInfo BPI(CGM.getLangOpts());
+
+ if (const auto *TA = FD->getAttr<TargetAttr>()) {
+ ParsedTargetAttr Attr =
+ CGM.getTarget().parseTargetAttr(TA->getFeaturesStr());
+ if (!Attr.BranchProtection.empty()) {
+ StringRef Error;
+ (void)CGM.getTarget().validateBranchProtection(Attr.BranchProtection,
+ Attr.CPU, BPI, Error);
+ assert(Error.empty());
+ }
+ }
----------------
nickdesaulniers wrote:
Should this all be in a `#ifndef NDEBUG` block? Seems like the return value and contents of error are not used otherwise?
https://github.com/llvm/llvm-project/pull/82819
More information about the cfe-commits
mailing list