[clang] [clang][DebugInfo] Attach DW_AT_const_value to static data-member definitions if available (PR #72730)

J. Ryan Stinnett via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 18 05:34:50 PST 2023


================
@@ -5503,11 +5516,17 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var,
     }
     AppendAddressSpaceXDeref(AddressSpace, Expr);
 
+    llvm::DIExpression *E = nullptr;
+    if (Expr.empty()) {
+      if (auto const *InitVal = evaluateConstantInitializer(D))
+        E = createConstantValueExpression(D, *InitVal);
+    } else
----------------
jryans wrote:

I believe code style says this else block should use braces because the if block has them.

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


More information about the cfe-commits mailing list