amilendra updated this revision to Diff 393917.
amilendra added a comment.

Address review comment.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115501/new/

https://reviews.llvm.org/D115501

Files:
  clang/lib/Basic/Targets/ARM.cpp
  clang/lib/CodeGen/TargetInfo.cpp


Index: clang/lib/CodeGen/TargetInfo.cpp
===================================================================
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -6403,7 +6403,8 @@
         // If the Branch Protection attribute is missing, validate the target
         // Architecture attribute against Branch Protection command line
         // settings.
-        if 
(!CGM.getTarget().isBranchProtectionSupportedArch(Attr.Architecture))
+        if (!Attr.Architecture.empty() &&
+            
!CGM.getTarget().isBranchProtectionSupportedArch(Attr.Architecture))
           CGM.getDiags().Report(
               D->getLocation(),
               diag::warn_target_unsupported_branch_protection_attribute)
Index: clang/lib/Basic/Targets/ARM.cpp
===================================================================
--- clang/lib/Basic/Targets/ARM.cpp
+++ clang/lib/Basic/Targets/ARM.cpp
@@ -369,7 +369,7 @@
 
 bool ARMTargetInfo::isBranchProtectionSupportedArch(StringRef Arch) const {
   if (Arch.empty())
-    return true;
+    return false;
 
   llvm::ARM::ArchKind ArchKind = llvm::ARM::parseCPUArch(Arch);
   if (ArchKind != llvm::ARM::ArchKind::ARMV8_1MMainline &&
@@ -388,7 +388,7 @@
   if (!llvm::ARM::parseBranchProtection(Spec, PBP, Err))
     return false;
 
-  if (!isBranchProtectionSupportedArch(Arch))
+  if (!Arch.empty() && !isBranchProtectionSupportedArch(Arch))
     return false;
 
   BPI.SignReturnAddr =


Index: clang/lib/CodeGen/TargetInfo.cpp
===================================================================
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -6403,7 +6403,8 @@
         // If the Branch Protection attribute is missing, validate the target
         // Architecture attribute against Branch Protection command line
         // settings.
-        if (!CGM.getTarget().isBranchProtectionSupportedArch(Attr.Architecture))
+        if (!Attr.Architecture.empty() &&
+            !CGM.getTarget().isBranchProtectionSupportedArch(Attr.Architecture))
           CGM.getDiags().Report(
               D->getLocation(),
               diag::warn_target_unsupported_branch_protection_attribute)
Index: clang/lib/Basic/Targets/ARM.cpp
===================================================================
--- clang/lib/Basic/Targets/ARM.cpp
+++ clang/lib/Basic/Targets/ARM.cpp
@@ -369,7 +369,7 @@
 
 bool ARMTargetInfo::isBranchProtectionSupportedArch(StringRef Arch) const {
   if (Arch.empty())
-    return true;
+    return false;
 
   llvm::ARM::ArchKind ArchKind = llvm::ARM::parseCPUArch(Arch);
   if (ArchKind != llvm::ARM::ArchKind::ARMV8_1MMainline &&
@@ -388,7 +388,7 @@
   if (!llvm::ARM::parseBranchProtection(Spec, PBP, Err))
     return false;
 
-  if (!isBranchProtectionSupportedArch(Arch))
+  if (!Arch.empty() && !isBranchProtectionSupportedArch(Arch))
     return false;
 
   BPI.SignReturnAddr =
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to