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

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 12 06:49:22 PDT 2019


lebedev.ri added a comment.

You probably want to wrap that entire function into `#ifndef NDEBUG`



================
Comment at: llvm/lib/IR/Globals.cpp:364-365
+  if(ConstantStruct *V = dyn_cast<ConstantStruct>(Value)) {
+    int n = V->getNumOperands();
+    while(n)
+      assertThatAllGlobalsAreIn(V->getOperand(--n), Correct);
----------------
The style is usually
```
for(int I = 0, N = V->getNumOperands(); I != N; ++I)
  assertThatAllGlobalsAreIn(V->getOperand(--n), Correct);
```


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