[clang] [Clang] Constant Expressions inside of GCC' asm strings (PR #131003)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 14 07:50:04 PDT 2025


================
@@ -328,20 +328,20 @@ void StmtProfiler::VisitGCCAsmStmt(const GCCAsmStmt *S) {
   VisitStmt(S);
   ID.AddBoolean(S->isVolatile());
   ID.AddBoolean(S->isSimple());
-  VisitStringLiteral(S->getAsmString());
+  VisitExpr(S->getAsmStringExpr());
----------------
erichkeane wrote:

Typically we would just put all `Stmt*` nodes in the children (which doesn't require trailing storage, just a contiguous storage).
 
Looking closer:  `AsmStmt` seems to keep a list of `Expr*` (via `Expr**`) which was intended for this, but it seems that `GCCAsmStmt` actually completely ignores and instead allocates the clobbers and constraints in their own places instead of putting them all into `Exprs` as it seems was intended.

I guess I'm OK leaving this like this now that I've looked at it, if you can create a bug to have someone spend time refactoring the `AsmStmt` derived classes to be more coherently designed, and to better use `children`.

https://github.com/llvm/llvm-project/pull/131003


More information about the cfe-commits mailing list