llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: None (camc)

<details>
<summary>Changes</summary>

Resolves #<!-- -->157075 

This was causing an assertion failure on `_attribute__((swift_name("")))`. Fix 
ensures this case shows the warn_attr_swift_name_function diagnostic as 
expected.

---
Full diff: https://github.com/llvm/llvm-project/pull/157139.diff


1 Files Affected:

- (modified) clang/lib/Sema/SemaSwift.cpp (+1-1) 


``````````diff
diff --git a/clang/lib/Sema/SemaSwift.cpp b/clang/lib/Sema/SemaSwift.cpp
index d21d79344d5c7..f0c9cc8620af9 100644
--- a/clang/lib/Sema/SemaSwift.cpp
+++ b/clang/lib/Sema/SemaSwift.cpp
@@ -352,7 +352,7 @@ static bool validateSwiftFunctionName(Sema &S, const 
ParsedAttr &AL,
   else if (Name.consume_front("setter:"))
     IsSetter = true;
 
-  if (Name.back() != ')') {
+  if (Name.empty() || Name.back() != ')') {
     S.Diag(Loc, diag::warn_attr_swift_name_function) << AL;
     return false;
   }

``````````

</details>


https://github.com/llvm/llvm-project/pull/157139
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to