TPPPP72 wrote:

Instead of bypassing the assertion, we should consider why the incorrect 
attribute is being generated here.

So I think this is a correct fix:

```diff
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 55b6cbcbba57..70f948fd77f9 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -7508,6 +7508,9 @@ ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, 
const ParsedAttr &AL,
   if (S.checkCommonAttributeFeatures(D, AL, MustDelayArgs))
     return;

+  if (S.getDiagnostics().hasFatalErrorOccurred() && AL.getNumArgs() > 0)
+    return;
+
   if (MustDelayArgs) {
     AL.handleAttrWithDelayedArgs(S, D);
     return;
```

When a fatal error occurs and there is an incorrect expression that might be 
evaluated, we should stop handling its Attr.

@AaronBallman CC

https://github.com/llvm/llvm-project/pull/197647
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to