[Lldb-commits] [PATCH] D82160: [lldb][PDB] Constexpr static member values as AST literals

Jack Andersen via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 22 21:29:31 PDT 2020


jackoalan marked 4 inline comments as done.
jackoalan added inline comments.


================
Comment at: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:7324-7331
+  // If the variable is an enum type, take the underlying integer type as
+  // the type of the integer literal.
+  if (const EnumType *enum_type = llvm::dyn_cast<EnumType>(qt.getTypePtr())) {
+    const EnumDecl *enum_decl = enum_type->getDecl();
+    qt = enum_decl->getIntegerType();
+  }
+  var->setInit(IntegerLiteral::Create(ast, init_value, qt.getUnqualifiedType(),
----------------
aleksandr.urakov wrote:
> teemperor wrote:
> > aleksandr.urakov wrote:
> > > I'm not sure, can we initialize a member this way if it has a scoped enum type?
> > (That code is from D81471 so I think I should answer that)
> > 
> > Well, it works and but it relies on CodeGen/Sema not double-checking that we get the enum type (and not the underlying int type). I can inject a CXXStaticCastExpr too and will update D81471. Thanks!
> Ok, thank you!
Added a test just in case


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82160





More information about the lldb-commits mailing list