[PATCH] D60613: Make setInitializer() assert that the entire initializer is usable.

Arnt Gulbrandsen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 1 03:29:07 PDT 2019


arnt marked 2 inline comments as done.
arnt added a comment.

I like colon-for.



================
Comment at: llvm/lib/IR/Globals.cpp:386
+#ifndef NDEBUG
+  if(ConstantStruct *V = dyn_cast<ConstantStruct>(Value)) {
+    for(int I = 0, N = V->getNumOperands(); I != N; ++I)
----------------
efriedma wrote:
> Please clang-format this.
> 
> Can you check for ConstantAggregate here, instead of checking ConstantStruct and ConstantArray separately?  Would it also make sense to check for ConstantExpr?
> 
> Can you use a for-range loop here?  (`for (auto *Op : V->operands())`)
Oooh, I can call constants() now. Someone has added that. (Might be a while ago, this isn't exactly new code. ;-)

I changed it to test ConstantAggregate, and added a passing unit test involving ConstantExpr.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D60613





More information about the llvm-commits mailing list