[clang] [clang-c] introduce queries on GCC-style inline assembly statements (PR #143424)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 20 14:52:33 PDT 2025
================
@@ -8648,6 +8646,119 @@ void clang_annotateTokens(CXTranslationUnit TU, CXToken *Tokens,
}
}
+//===----------------------------------------------------------------------===//
+// Operations for querying information of a GCC inline assembly block under a
+// cursor.
+//===----------------------------------------------------------------------===//
+CXString clang_Cursor_getGCCAssemblyTemplate(CXCursor Cursor) {
+ if (!clang_isStatement(Cursor.kind))
+ return cxstring::createEmpty();
+ if (auto const *Stmt = dyn_cast_or_null<GCCAsmStmt>(getCursorStmt(Cursor))) {
+ auto const &C = getCursorContext(Cursor);
+ auto AsmTemplate = Stmt->generateAsmString(C);
+ return cxstring::createDup(AsmTemplate);
+ }
+ return cxstring::createEmpty();
+}
+
+unsigned clang_Cursor_isGCCAssemblyHasGoto(CXCursor Cursor) {
+ if (!clang_isStatement(Cursor.kind))
+ return 0;
+ if (auto const *Stmt = dyn_cast_or_null<GCCAsmStmt>(getCursorStmt(Cursor))) {
+ return Stmt->isAsmGoto();
+ }
+ return 0;
+}
+
+unsigned clang_Cursor_getGCCAssemblyNumOutputs(CXCursor Cursor) {
+ if (!clang_isStatement(Cursor.kind))
+ return 0;
+ if (auto const *Stmt = dyn_cast_or_null<GCCAsmStmt>(getCursorStmt(Cursor))) {
+ return Stmt->getNumOutputs();
+ }
----------------
dingxiangfei2009 wrote:
Applied
https://github.com/llvm/llvm-project/pull/143424
More information about the cfe-commits
mailing list