[Lldb-commits] [PATCH] D81471: [lldb] Add support for using integral const static data members in the expression evaluator

Andy Yankovsky via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 4 11:23:32 PDT 2022


werat marked an inline comment as done.
werat added a comment.

Reviving the patch and taking over.

@jankratochvil @shafik @labath can you please take another look? Thanks!



================
Comment at: lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp:172
+  // Find the min/max values for 'int' on the current host target.
+  const int64_t int_max = std::numeric_limits<int>::max();
+  const int64_t int_min = std::numeric_limits<int>::min();
----------------
shafik wrote:
> shafik wrote:
> > Why not use `int32_t` although this should never affect us `int` can be `64 bit`, so `int32_t` is a better reflection of your intent.
> You can also use `constexpr` here since `numeric_limits` methods are all `constexpr` as well.
The tests verify whether the value fits into the type, so the value itself needs to be large to fit things that can't be represented in int32

For example, this will pass if `int_min` is `int32_t`:
```
EXPECT_THAT_EXPECTED(ExtractS(ast.IntTy, int_min - 2), llvm::Failed());
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81471



More information about the lldb-commits mailing list