[llvm] r254952 - Simplify the error handling a bit. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 7 13:28:22 PST 2015


Author: rafael
Date: Mon Dec  7 15:28:22 2015
New Revision: 254952

URL: http://llvm.org/viewvc/llvm-project?rev=254952&view=rev
Log:
Simplify the error handling a bit. NFC.

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

Modified: llvm/trunk/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=254952&r1=254951&r2=254952&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Mon Dec  7 15:28:22 2015
@@ -1559,7 +1559,6 @@ bool ModuleLinker::linkModuleFlagsMetada
 
   // Merge in the flags from the source module, and also collect its set of
   // requirements.
-  bool HasErr = false;
   for (unsigned I = 0, E = SrcModFlags->getNumOperands(); I != E; ++I) {
     MDNode *SrcOp = SrcModFlags->getOperand(I);
     ConstantInt *SrcBehavior =
@@ -1597,8 +1596,8 @@ bool ModuleLinker::linkModuleFlagsMetada
       // Diagnose inconsistent flags which both have override behavior.
       if (SrcBehaviorValue == Module::Override &&
           SrcOp->getOperand(2) != DstOp->getOperand(2)) {
-        HasErr |= emitError("linking module flags '" + ID->getString() +
-                            "': IDs have conflicting override values");
+        emitError("linking module flags '" + ID->getString() +
+                  "': IDs have conflicting override values");
       }
       continue;
     } else if (SrcBehaviorValue == Module::Override) {
@@ -1610,8 +1609,8 @@ bool ModuleLinker::linkModuleFlagsMetada
 
     // Diagnose inconsistent merge behavior types.
     if (SrcBehaviorValue != DstBehaviorValue) {
-      HasErr |= emitError("linking module flags '" + ID->getString() +
-                          "': IDs have conflicting behaviors");
+      emitError("linking module flags '" + ID->getString() +
+                "': IDs have conflicting behaviors");
       continue;
     }
 
@@ -1630,8 +1629,8 @@ bool ModuleLinker::linkModuleFlagsMetada
     case Module::Error: {
       // Emit an error if the values differ.
       if (SrcOp->getOperand(2) != DstOp->getOperand(2)) {
-        HasErr |= emitError("linking module flags '" + ID->getString() +
-                            "': IDs have conflicting values");
+        emitError("linking module flags '" + ID->getString() +
+                  "': IDs have conflicting values");
       }
       continue;
     }
@@ -1676,13 +1675,13 @@ bool ModuleLinker::linkModuleFlagsMetada
 
     MDNode *Op = Flags[Flag].first;
     if (!Op || Op->getOperand(2) != ReqValue) {
-      HasErr |= emitError("linking module flags '" + Flag->getString() +
-                          "': does not have the required value");
+      emitError("linking module flags '" + Flag->getString() +
+                "': does not have the required value");
       continue;
     }
   }
 
-  return HasErr;
+  return HasError;
 }
 
 // This function returns true if the triples match.




More information about the llvm-commits mailing list