llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Qizhi Hu (jcsxky)

<details>
<summary>Changes</summary>



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


1 Files Affected:

- (modified) clang/lib/Parse/ParseDecl.cpp (+6-1) 


``````````diff
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index b60ae293ef8c20..9418ee305171c8 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -2637,7 +2637,7 @@ Decl 
*Parser::ParseDeclarationAfterDeclaratorAndAttributes(
     T.consumeOpen();
 
     ExprVector Exprs;
-
+    bool ValidBefore = !ThisDecl->isInvalidDecl();
     InitializerScopeRAII InitScope(*this, D, ThisDecl);
 
     auto ThisVarDecl = dyn_cast_or_null<VarDecl>(ThisDecl);
@@ -2670,6 +2670,11 @@ Decl 
*Parser::ParseDeclarationAfterDeclaratorAndAttributes(
         CalledSignatureHelp = true;
       }
       Actions.ActOnInitializerError(ThisDecl);
+      if (ValidBefore && ThisDecl->isInvalidDecl()) {
+        ThisDecl->setInvalidDecl(false);
+        InitScope.pop();
+        ThisDecl->setInvalidDecl();
+      }
       SkipUntil(tok::r_paren, StopAtSemi);
     } else {
       // Match the ')'.

``````````

</details>


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

Reply via email to