================
@@ -950,6 +953,76 @@ static bool isStackProtectorOn(const LangOptions &LangOpts,
   return LangOpts.getStackProtector() == Mode;
 }
 
+// Emit module flags for symbols and symvers defined in global inline
+// assembly. This allows LLVM IR tools to build a symbol table for an
+// IR module without knowing exact CPU and Features required to parse
+// its global inline assembly.
+static void emitGlobalAsmSymbols(llvm::Module &M, StringRef CPU,
+                                 StringRef Features) {
+  llvm::LLVMContext &Ctx = M.getContext();
+  bool HaveErrors = false;
+
+  auto DiagHandler = [&](const llvm::DiagnosticInfo &DI) {
+    // Ignore diagnostics from the assembly parser.
+    //
+    // Errors in assembly mean that we cannot build a symbol table
+    // from it. However, we do not diagnose them here in Clang,
+    // because we don't know if the Module is ever going to actually
+    // reach CodeGen where this would matter.
+    if (DI.getSeverity() == llvm::DS_Error) {
----------------
mysterymath wrote:

nit: single line `if`'s don't get braces in LLVM style. Here and elsewhere.

https://github.com/llvm/llvm-project/pull/174995
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to