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

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 13 14:00:44 PDT 2025


================
@@ -2586,10 +2586,11 @@ static void UpdateAsmCallInst(llvm::CallBase &Result, bool HasSideEffect,
 
   // Slap the source location of the inline asm into a !srcloc metadata on the
   // call.
-  if (const auto *gccAsmStmt = dyn_cast<GCCAsmStmt>(&S))
-    Result.setMetadata("srcloc",
-                       getAsmSrcLocInfo(gccAsmStmt->getAsmString(), CGF));
-  else {
+  if (const auto *gccAsmStmt = dyn_cast<GCCAsmStmt>(&S)) {
+    if (const StringLiteral *SL =
+            dyn_cast<StringLiteral>(gccAsmStmt->getAsmStringExpr()))
+      Result.setMetadata("srcloc", getAsmSrcLocInfo(SL, CGF));
----------------
efriedma-quic wrote:

What do the diagnostics look like if you get a parse failure inside the inline asm?

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


More information about the cfe-commits mailing list