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

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


erichkeane added inline comments.


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:289
+    QualType ArgType = E->getTypeOfArgument();
+    return this->emitConst(E, Ctx.getASTContext().getTypeSize(ArgType));
+  }
----------------
You probably want `getTypeSizeInChars`. `getTypeSize` returns it in bits, so this would give the wrong answer.  You should probably add some tests to make sure the values you are getting back are sane (like `char` is 1, etc).


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

https://reviews.llvm.org/D133934



More information about the cfe-commits mailing list