[clang] [clang][DebugInfo][NFC] Add createConstantValueExpression helper (PR #70674)

Felipe de Azevedo Piovezan via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 30 08:58:15 PDT 2023


================
@@ -5935,3 +5918,28 @@ llvm::DINode::DIFlags CGDebugInfo::getCallSiteRelatedAttrs() const {
 
   return llvm::DINode::FlagAllCallsDescribed;
 }
+
+llvm::DIExpression *
+CGDebugInfo::createConstantValueExpression(clang::ValueDecl const *VD,
+                                           const APValue &Val) {
+  llvm::DIExpression *ValExpr = nullptr;
----------------
felipepiovezan wrote:

I know this is how the original code was written, but since we are making a separate function we are now in a position where we can delete this line, early-return on the `if` and replace all assignments to `ValExpr` with return statements.

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


More information about the cfe-commits mailing list