llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang
            
<details>
<summary>Changes</summary>
Just ignore the attributes.
--
Full diff: https://github.com/llvm/llvm-project/pull/66495.diff

3 Files Affected:

- (modified) clang/lib/AST/Interp/ByteCodeStmtGen.cpp (+8) 
- (modified) clang/lib/AST/Interp/ByteCodeStmtGen.h (+1) 
- (modified) clang/test/AST/Interp/if.cpp (+7) 


<pre>
diff --git a/clang/lib/AST/Interp/ByteCodeStmtGen.cpp 
b/clang/lib/AST/Interp/ByteCodeStmtGen.cpp
index b7553d8963ff0ee..a0f50c3e69dd918 100644
--- a/clang/lib/AST/Interp/ByteCodeStmtGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeStmtGen.cpp
@@ -246,6 +246,8 @@ bool 
ByteCodeStmtGen&amp;lt;Emitter&amp;gt;::visitStmt(const Stmt *S) {
   case Stmt::GCCAsmStmtClass:
   case Stmt::MSAsmStmtClass:
     return visitAsmStmt(cast&amp;lt;AsmStmt&amp;gt;(S));
+  case Stmt::AttributedStmtClass:
+    return visitAttributedStmt(cast&amp;lt;AttributedStmt&amp;gt;(S));
   case Stmt::NullStmtClass:
     return true;
   default: {
@@ -628,6 +630,12 @@ bool 
ByteCodeStmtGen&amp;lt;Emitter&amp;gt;::visitAsmStmt(const AsmStmt *S) {
   return this-&amp;gt;emitInvalid(S);
 }
 
+template &amp;lt;class Emitter&amp;gt;
+bool ByteCodeStmtGen&amp;lt;Emitter&amp;gt;::visitAttributedStmt(const 
AttributedStmt *S) {
+  // Ignore all attributes.
+  return this-&amp;gt;visitStmt(S-&amp;gt;getSubStmt());
+}
+
 namespace clang {
 namespace interp {
 
diff --git a/clang/lib/AST/Interp/ByteCodeStmtGen.h 
b/clang/lib/AST/Interp/ByteCodeStmtGen.h
index 278e804a803c951..3bdcdd78f397e5b 100644
--- a/clang/lib/AST/Interp/ByteCodeStmtGen.h
+++ b/clang/lib/AST/Interp/ByteCodeStmtGen.h
@@ -68,6 +68,7 @@ class ByteCodeStmtGen final : public 
ByteCodeExprGen&amp;lt;Emitter&amp;gt; {
   bool visitCaseStmt(const CaseStmt *S);
   bool visitDefaultStmt(const DefaultStmt *S);
   bool visitAsmStmt(const AsmStmt *S);
+  bool visitAttributedStmt(const AttributedStmt *S);
 
   bool emitLambdaStaticInvokerBody(const CXXMethodDecl *MD);
 
diff --git a/clang/test/AST/Interp/if.cpp b/clang/test/AST/Interp/if.cpp
index 2449ace4dd6c6b5..86ae8de6f73ebb7 100644
--- a/clang/test/AST/Interp/if.cpp
+++ b/clang/test/AST/Interp/if.cpp
@@ -43,4 +43,11 @@ namespace InitDecl {
     return false;
   }
   static_assert(!f2(), &amp;quot;&amp;quot;);
+
+
+  constexpr int attrs() {
+    if (1) [[likely]] {}
+    return 1;
+  }
+  static_assert(attrs() == 1, &amp;quot;&amp;quot;);
 };
</pre>
</details>


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

Reply via email to