[PATCH] D156400: [clang][Interp] Implement __builtin_offsetof

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 3 05:04:45 PDT 2023


cor3ntin added inline comments.


================
Comment at: clang/lib/AST/Interp/Interp.h:1901
+inline bool OffsetOf(InterpState &S, CodePtr OpPC, const OffsetOfExpr *E) {
+  std::vector<int64_t> ArrayIndices;
+  for (unsigned I = 0; I != E->getNumExpressions(); ++I)
----------------
Might be useful to use a small vector here


================
Comment at: clang/lib/AST/Interp/InterpBuiltin.cpp:590
 
+bool InterpretOffsetOf(InterpState &S, CodePtr OpPC, const OffsetOfExpr *E,
+                       const std::vector<int64_t> &ArrayIndices,
----------------
This function is the same as `IntExprEvaluator::VisitOffsetOfExpr` - except for the array case. It's frustrating me but I don't have a good solution 


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

https://reviews.llvm.org/D156400



More information about the cfe-commits mailing list