Peter marked an inline comment as done.
Peter added inline comments.

================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:5386
+      if (InitInt)
+        InitExpr = DBuilder.createConstantValueExpression(InitInt.value());
+    } else if (Init.isFloat())
----------------
efriedma wrote:
> I think we actually want the existing behavior here.  Values embedded in 
> debug info aren't really signed or unsigned; they're interpreted by the 
> debugger based on the type of the value.
> 
> Maybe it makes sense to add a new APSInt API for that?  Or I guess we could 
> explicitly write out `Init.getInt().isSigned() ? Init.getInt().getSExtValue() 
> : Init.getInt().getZExtValue();` if we can't think of a reasonable name for 
> the new API...
I have no problem with this proposed new API, we may even name it `uint64_t 
tryInt64Representaiton`. My main concern is that returning a value whose static 
type is unsigned while semantics can be signed OR unsigned is a bit inconsist.

I will use something like `Init.getInt().isSigned() ? 
Init.getInt().getSExtValue() : Init.getInt().getZExtValue();` for now.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140059/new/

https://reviews.llvm.org/D140059

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to