[PATCH] D106915: Add a DIExpression const-folder to prevent silly expressions

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 3 09:52:25 PDT 2021


probinson marked 2 inline comments as done.
probinson added inline comments.


================
Comment at: llvm/unittests/IR/MetadataTest.cpp:2912
+  Expr = DIExpression::get(Context, {dwarf::DW_OP_deref});
+  EXPECT_EXPR_FOLD(32, 117, 32, 117, 1);
+  EXPECT_EQ(NewExpr, Expr);
----------------
probinson wrote:
> aprantl wrote:
> > Thanks! Assuming these are dwarf expression ops, could spell them out here using the Dwarf.def enums? Or does that mess with the macro? If so, maybe we could at least add a comment expanding the raw numbers.
> The values are parameters to the APInt ctor, meaning 32-bits wide with value 117 as input, and 32-bits wide with value 117 as output, and 1 element remaining in the expression afterward.  I don't pass the APInt directly because the macro expansion needs to know the bit-width of the result independently.  I suppose it could become
> `EXPECT_EXPR_FOLD(APInt(32, 117), APInt(32, 117), 32, 1)`
> if that would be easier to read?
Changed the macro name, in case that helps.  Let me know if APInt arguments would make it clearer.


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

https://reviews.llvm.org/D106915



More information about the llvm-commits mailing list