[llvm] r278756 - Linker: Avoid some ridiculous indentation by using a temporary. NFC

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 15 15:41:42 PDT 2016


Author: bogner
Date: Mon Aug 15 17:41:42 2016
New Revision: 278756

URL: http://llvm.org/viewvc/llvm-project?rev=278756&view=rev
Log:
Linker: Avoid some ridiculous indentation by using a temporary. NFC

This was indented really awkwardly, and clang-format didn't seem to
know how to do any better. Avoid the issue with a temporary variable.

Modified:
    llvm/trunk/lib/Linker/IRMover.cpp

Modified: llvm/trunk/lib/Linker/IRMover.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/IRMover.cpp?rev=278756&r1=278755&r2=278756&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/IRMover.cpp (original)
+++ llvm/trunk/lib/Linker/IRMover.cpp Mon Aug 15 17:41:42 2016
@@ -805,18 +805,17 @@ IRLinker::linkAppendingVarProto(GlobalVa
   SmallVector<Constant *, 16> SrcElements;
   getArrayElements(SrcGV->getInitializer(), SrcElements);
 
-  if (IsNewStructor)
-    SrcElements.erase(
-        remove_if(SrcElements,
-                  [this](Constant *E) {
-                    auto *Key = dyn_cast<GlobalValue>(
-                        E->getAggregateElement(2)->stripPointerCasts());
-                    if (!Key)
-                      return false;
-                    GlobalValue *DGV = getLinkedToGlobal(Key);
-                    return !shouldLink(DGV, *Key);
-                  }),
-        SrcElements.end());
+  if (IsNewStructor) {
+    auto It = remove_if(SrcElements, [this](Constant *E) {
+      auto *Key =
+          dyn_cast<GlobalValue>(E->getAggregateElement(2)->stripPointerCasts());
+      if (!Key)
+        return false;
+      GlobalValue *DGV = getLinkedToGlobal(Key);
+      return !shouldLink(DGV, *Key);
+    });
+    SrcElements.erase(It, SrcElements.end());
+  }
   uint64_t NewSize = DstNumElements + SrcElements.size();
   ArrayType *NewType = ArrayType::get(EltTy, NewSize);
 




More information about the llvm-commits mailing list