[PATCH] D133934: [clang][Interp] Handle sizeof() expressions

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 15 07:33:07 PDT 2022


erichkeane added inline comments.


================
Comment at: clang/lib/AST/Interp/Context.cpp:134
+llvm::Optional<size_t> Context::sizeofType(QualType T) const {
+  if (llvm::Optional<PrimType> ArgT = classify(T))
+    return primSize(*ArgT);
----------------
This function seems pretty large for something you should be able to pick up via `ASTContext::getTypeSize` or `ASTContext::getTypeSizeInChars` or `ASTContext::getTypeSizeInCharsIfKnown`.


================
Comment at: clang/lib/AST/Interp/Context.cpp:149
+
+  return {};
+}
----------------
Typically, I prefer we use llvm::None here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133934



More information about the cfe-commits mailing list