Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings.
authorAnton Korobeynikov <asl@math.spbu.ru>
Wed, 20 Feb 2008 11:08:44 +0000 (11:08 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Wed, 20 Feb 2008 11:08:44 +0000 (11:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47367 91177308-0d34-0410-b5e6-96231b3b80d8

48 files changed:
include/llvm/ADT/BitVector.h
include/llvm/ADT/DenseMap.h
include/llvm/ADT/ilist
include/llvm/Analysis/LoopInfo.h
include/llvm/Analysis/ScalarEvolutionExpressions.h
include/llvm/CodeGen/MachineRegisterInfo.h
include/llvm/CodeGen/SelectionDAGNodes.h
include/llvm/Target/SubtargetFeature.h
include/llvm/Target/TargetJITInfo.h
lib/Analysis/Analysis.cpp
lib/Analysis/IPA/Andersens.cpp
lib/Analysis/IPA/GlobalsModRef.cpp
lib/Analysis/ScalarEvolution.cpp
lib/Archive/Archive.cpp
lib/Archive/ArchiveInternals.h
lib/AsmParser/LLLexer.cpp
lib/AsmParser/Parser.cpp
lib/Bitcode/Reader/BitReader.cpp
lib/CodeGen/MachOWriter.cpp
lib/ExecutionEngine/ExecutionEngine.cpp
lib/ExecutionEngine/ExecutionEngineBindings.cpp
lib/ExecutionEngine/Interpreter/Execution.cpp
lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
lib/ExecutionEngine/Interpreter/Interpreter.cpp
lib/ExecutionEngine/JIT/JITMemoryManager.cpp
lib/Support/CommandLine.cpp
lib/Support/FileUtilities.cpp
lib/Support/FoldingSet.cpp
lib/Support/Statistic.cpp
lib/Support/StringExtras.cpp
lib/Target/Sparc/SparcAsmPrinter.cpp
lib/Target/X86/X86JITInfo.cpp
lib/Transforms/IPO/SimplifyLibCalls.cpp
lib/Transforms/Scalar/LoopUnroll.cpp
lib/VMCore/AutoUpgrade.cpp
lib/VMCore/ConstantFold.cpp
lib/VMCore/Core.cpp
lib/VMCore/Instructions.cpp
lib/VMCore/Value.cpp
tools/llvm-ld/llvm-ld.cpp
tools/llvm-upgrade/UpgradeInternals.h
tools/llvmc/llvmc.cpp
utils/PerfectShuffle/PerfectShuffle.cpp
utils/TableGen/AsmWriterEmitter.cpp
utils/TableGen/CodeGenDAGPatterns.cpp
utils/TableGen/CodeGenRegisters.h
utils/TableGen/DAGISelEmitter.cpp
utils/TableGen/TGLexer.cpp

index 3ff2441637ce0fc1a7178925745940ac4cf04222..a3a8920186468ebf5f48044752fa0dde6ad4d4bd 100644 (file)
@@ -16,8 +16,9 @@
 
 #include "llvm/Support/MathExtras.h"
 #include <algorithm>
-#include <cstdlib>
 #include <cassert>
+#include <cstdlib>
+#include <cstring>
 
 namespace llvm {
 
index fdfb3294ea3d2553524aafca9e51b893228029e3..b29c69156277cc0ea5a52702430d837d37761d65 100644 (file)
@@ -313,7 +313,7 @@ private:
     NumEntries = 0;
     NumTombstones = 0;
     NumBuckets = InitBuckets;
-    assert(InitBuckets && (InitBuckets & InitBuckets-1) == 0 &&
+    assert(InitBuckets && (InitBuckets & (InitBuckets-1)) == 0 &&
            "# initial buckets must be a power of two!");
     Buckets = reinterpret_cast<BucketT*>(new char[sizeof(BucketT)*InitBuckets]);
     // Initialize all the keys to EmptyKey.
index d58db80a0adb0feb94baaaac1ace966eb48346b4..fe55f5ced9c8549f7fe8b8fbef9eb9e56333ba42 100644 (file)
@@ -40,6 +40,7 @@
 
 #include "llvm/ADT/iterator"
 #include <cassert>
+#include <cstdlib>
 
 namespace llvm {
 
index 4cb03fbd8e71c6dfb7d461243c85b635e3cda908..789b9048578b8fa39e9dbccd63d0104d1ef1f2ef 100644 (file)
@@ -404,13 +404,14 @@ public:
     if (BranchInst *BI = dyn_cast<BranchInst>(BackedgeBlock->getTerminator()))
       if (BI->isConditional()) {
         if (ICmpInst *ICI = dyn_cast<ICmpInst>(BI->getCondition())) {
-          if (ICI->getOperand(0) == Inc)
+          if (ICI->getOperand(0) == Inc) {
             if (BI->getSuccessor(0) == getHeader()) {
               if (ICI->getPredicate() == ICmpInst::ICMP_NE)
                 return ICI->getOperand(1);
             } else if (ICI->getPredicate() == ICmpInst::ICMP_EQ) {
               return ICI->getOperand(1);
             }
+          }
         }
       }
 
index 905493a4af81240e9fb27312192a1577aefd79f8..39b083d5fac3fa22b07f0801c77c24d479c9a8b4 100644 (file)
@@ -253,11 +253,12 @@ namespace llvm {
     virtual bool hasComputableLoopEvolution(const Loop *L) const {
       bool HasVarying = false;
       for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
-        if (!getOperand(i)->isLoopInvariant(L))
+        if (!getOperand(i)->isLoopInvariant(L)) {
           if (getOperand(i)->hasComputableLoopEvolution(L))
             HasVarying = true;
           else
             return false;
+        }
       return HasVarying;
     }
 
index 453fe2c8343b7e07547a0117f11fb443ae33bc6f..48e8e55b296e118ff3a4057aea01897ce00a4772 100644 (file)
@@ -211,8 +211,8 @@ public:
       // If the first node isn't one we're interested in, advance to one that
       // we are interested in.
       if (op) {
-        if (!ReturnUses && op->isUse() || 
-            !ReturnDefs && op->isDef())
+        if ((!ReturnUses && op->isUse()) ||
+            (!ReturnDefs && op->isDef()))
           ++*this;
       }
     }
@@ -240,8 +240,8 @@ public:
       Op = Op->getNextOperandForReg();
       
       // If this is an operand we don't care about, skip it.
-      while (Op && (!ReturnUses && Op->isUse() || 
-                    !ReturnDefs && Op->isDef()))
+      while (Op && ((!ReturnUses && Op->isUse()) || 
+                    (!ReturnDefs && Op->isDef())))
         Op = Op->getNextOperandForReg();
       
       return *this;
index d6a492d0c1906cc1c0a475440b021ac83a06c1ef..c1a50bb7dc7e2e4b3be7c5f8404ed15e53a76b25 100644 (file)
@@ -843,8 +843,8 @@ template<> struct DenseMapInfo<SDOperand> {
   static inline SDOperand getEmptyKey() { return SDOperand((SDNode*)-1, -1U); }
   static inline SDOperand getTombstoneKey() { return SDOperand((SDNode*)-1, 0);}
   static unsigned getHashValue(const SDOperand &Val) {
-    return (unsigned)((uintptr_t)Val.Val >> 4) ^
-           (unsigned)((uintptr_t)Val.Val >> 9) + Val.ResNo;
+    return ((unsigned)((uintptr_t)Val.Val >> 4) ^
+            (unsigned)((uintptr_t)Val.Val >> 9)) + Val.ResNo;
   }
   static bool isEqual(const SDOperand &LHS, const SDOperand &RHS) {
     return LHS == RHS;
index 98a589213a2bdebc1903ba89fdf14098f69ea9e5..d187daac0c89c71d926c3a42c6745639be9d1940 100644 (file)
@@ -21,6 +21,7 @@
 #include <string>
 #include <vector>
 #include <iosfwd>
+#include <cstring>
 #include "llvm/Support/DataTypes.h"
 
 namespace llvm {
index 1ad927b9b04d1220148d69abf472e6c1c4a4283d..98d17c409e5096ee274ba6118a2f6d6b75518937 100644 (file)
@@ -17,8 +17,9 @@
 #ifndef LLVM_TARGET_TARGETJITINFO_H
 #define LLVM_TARGET_TARGETJITINFO_H
 
-#include <cassert>
 #include <vector>
+#include <cassert>
+#include "llvm/Support/DataTypes.h"
 
 namespace llvm {
   class Function;
index 2c52dbd2ebbddbf35cc91eb47d72f880591ca26a..6b741bc5bdfcdb7369855e5393e212980331b7ad 100644 (file)
@@ -10,6 +10,7 @@
 #include "llvm-c/Analysis.h"
 #include "llvm/Analysis/Verifier.h"
 #include <fstream>
+#include <cstring>
 
 using namespace llvm;
 
index 037f33145a22ce8fa9bab4958638c430a6852efd..399ce1f45dfc878b4167108855b5dfae0fb4acd8 100644 (file)
@@ -139,7 +139,7 @@ namespace {
 
       Constraint(ConstraintType Ty, unsigned D, unsigned S, unsigned O = 0)
         : Type(Ty), Dest(D), Src(S), Offset(O) {
-        assert(Offset == 0 || Ty != AddressOf &&
+        assert((Offset == 0 || Ty != AddressOf) &&
                "Offset is illegal on addressof constraints");
       }
 
@@ -1931,7 +1931,7 @@ void Andersens::RewriteConstraints() {
 
     C.Src = FindEquivalentNode(RHSNode, RHSLabel);
     C.Dest = FindEquivalentNode(FindNode(LHSNode), LHSLabel);
-    if (C.Src == C.Dest && C.Type == Constraint::Copy
+    if ((C.Src == C.Dest && C.Type == Constraint::Copy)
         || Seen.count(C))
       continue;
 
index 880298ec020d62bed1826716d36069d80004aa11..9aafe375b42eb22fadc6eb41cb8b69e1e814bcda 100644 (file)
@@ -115,11 +115,12 @@ namespace {
     /// case the most generic behavior of this function should be returned.
     virtual ModRefBehavior getModRefBehavior(Function *F, CallSite CS,
                                          std::vector<PointerAccessInfo> *Info) {
-      if (FunctionRecord *FR = getFunctionInfo(F))
+      if (FunctionRecord *FR = getFunctionInfo(F)) {
         if (FR->FunctionEffect == 0)
           return DoesNotAccessMemory;
         else if ((FR->FunctionEffect & Mod) == 0)
           return OnlyReadsMemory;
+      }
       return AliasAnalysis::getModRefBehavior(F, CS, Info);
     }
 
index 7f1cac0f43d34f44ce409300975dc3ef9750536c..30cf950d571887ea7a0edd15897a0d4256838684 100644 (file)
@@ -2145,13 +2145,14 @@ static PHINode *getConstantEvolvingPHI(Value *V, const Loop *L) {
   Instruction *I = dyn_cast<Instruction>(V);
   if (I == 0 || !L->contains(I->getParent())) return 0;
 
-  if (PHINode *PN = dyn_cast<PHINode>(I))
+  if (PHINode *PN = dyn_cast<PHINode>(I)) {
     if (L->getHeader() == I->getParent())
       return PN;
     else
       // We don't currently keep track of the control flow needed to evaluate
       // PHIs, so we cannot handle PHIs inside of loops.
       return 0;
+  }
 
   // If we won't be able to constant fold this expression even if the operands
   // are constants, return early.
index 4eb9efbab8e5cb3d514800528d13c50223aa14a5..22934d51fe30456c0b9b06498978d1daf77170b1 100644 (file)
@@ -18,6 +18,8 @@
 #include "llvm/Module.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/System/Process.h"
+#include <memory>
+#include <cstring>
 using namespace llvm;
 
 // getMemberSize - compute the actual physical size of the file member as seen
index 2e16933830c67500fbe8be4c23ca86204956716a..7ba30244a2138084fcdeb360810ec6d9bd7f3aa3 100644 (file)
@@ -18,6 +18,8 @@
 #include "llvm/System/TimeValue.h"
 #include "llvm/ADT/StringExtras.h"
 
+#include <cstring>
+
 #define ARFILE_MAGIC "!<arch>\n"                   ///< magic string
 #define ARFILE_MAGIC_LEN (sizeof(ARFILE_MAGIC)-1)  ///< length of magic string
 #define ARFILE_SVR4_SYMTAB_NAME "/               " ///< SVR4 symtab entry name
index 7c79c613cf8fc3b6566686d6cddab00385914994..f78079b606268c899cd0dc114c0b31817cac7c95 100644 (file)
@@ -18,6 +18,8 @@
 
 #include <list>
 #include "llvmAsmParser.h"
+
+#include <cstring>
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//
index ba77a64ad820de22558921f7c8f541a89bad3693..157a43b1aa2a8b91ca50eaa2c00528b6dd74d121 100644 (file)
@@ -14,6 +14,7 @@
 #include "ParserInternals.h"
 #include "llvm/Module.h"
 #include "llvm/Support/MemoryBuffer.h"
+#include <cstring>
 using namespace llvm;
 
 
index 9a77c007ecf1fe1c85589f7061337624d8dcac78..52851cd142daca54f31329aed45cd37ae8326eed 100644 (file)
@@ -11,6 +11,7 @@
 #include "llvm/Bitcode/ReaderWriter.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include <string>
+#include <cstring>
 
 using namespace llvm;
 
index 92b3eb4311c348c4b72115baaf5aa827446236a6..d163df3c4fec3dc6975c8fa19758c956b6fa72e9 100644 (file)
@@ -38,6 +38,7 @@
 #include "llvm/Support/OutputBuffer.h"
 #include "llvm/Support/Streams.h"
 #include <algorithm>
+#include <cstring>
 using namespace llvm;
 
 /// AddMachOWriter - Concrete function to add the Mach-O writer to the function
index 9799f5085696be79ec7776968a93e03d973a840c..5e883917129a52ed0fb0fb4e3b6955a9086f5d0e 100644 (file)
@@ -26,7 +26,8 @@
 #include "llvm/System/DynamicLibrary.h"
 #include "llvm/System/Host.h"
 #include "llvm/Target/TargetData.h"
-#include <math.h>
+#include <cmath>
+#include <cstring>
 using namespace llvm;
 
 STATISTIC(NumInitBytes, "Number of bytes of global vars initialized");
index 26e0d4141662394ab47216a8afee504f9377d690..20ee78044cf76975146140c14489494aad35bf4d 100644 (file)
@@ -15,6 +15,7 @@
 #include "llvm-c/ExecutionEngine.h"
 #include "llvm/ExecutionEngine/GenericValue.h"
 #include "llvm/ExecutionEngine/ExecutionEngine.h"
+#include <cstring>
 
 using namespace llvm;
 
index f47f12853cf58eeabd8b3e88faa8043bd58bb0b5..3463edc5c45586fb83bd220dbdcc6282c963b575 100644 (file)
@@ -23,8 +23,9 @@
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/MathExtras.h"
-#include <cmath>
 #include <algorithm>
+#include <cmath>
+#include <cstring>
 using namespace llvm;
 
 STATISTIC(NumDynamicInsts, "Number of dynamic instructions executed");
index c6dde95149980f71813fdb2c1fc3ea9a3a6ca01c..b85f270f9e0a3663d89e5479dabd8e0596df76d8 100644 (file)
@@ -29,6 +29,7 @@
 #include <csignal>
 #include <map>
 #include <cmath>
+#include <cstring>
 
 #ifdef __linux__
 #include <cxxabi.h>
index 60e2897b819c03c35b40d55331ef511f251ac819..5d7f9018542c512792495da687d8bd6ffa7a97b1 100644 (file)
@@ -18,6 +18,7 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/Module.h"
 #include "llvm/ModuleProvider.h"
+#include <cstring>
 using namespace llvm;
 
 static struct RegisterInterp {
index 0bf42b80994b3ca26f139371063dd99691cbac2a..d5b2696269d9ba66a833e15e8ec0d182ca9d8046 100644 (file)
@@ -17,6 +17,8 @@
 #include <map>
 #include <vector>
 #include <cassert>
+#include <cstdlib>
+#include <cstring>
 using namespace llvm;
 
 
index 804af9577702bc022a7ebf0e85aba218c9a9e18c..c70ed0da0ccdf02f166082c63e89abfc728a1ae5 100644 (file)
@@ -29,6 +29,7 @@
 #include <cstdlib>
 #include <cerrno>
 #include <cstring>
+#include <climits>
 using namespace llvm;
 using namespace cl;
 
index 42083e46bd2f74341ba185bbbcdd1cd3ea72ec30..cde08d188cab7c875232548817fa9490b2bcbd4d 100644 (file)
@@ -16,6 +16,7 @@
 #include "llvm/System/Path.h"
 #include "llvm/System/MappedFile.h"
 #include "llvm/ADT/StringExtras.h"
+#include <cstdlib>
 #include <cstring>
 #include <cctype>
 using namespace llvm;
index 97d1f0d168957a27e2f04ab0926567f09203cca7..bf50ed43dfe178414e9eaa544f6acad3f52eb25c 100644 (file)
@@ -17,6 +17,7 @@
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/Support/MathExtras.h"
 #include <cassert>
+#include <cstring>
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//
index 10f13f554c0c800263a44f13b1025d694b6bd57a..e500b55f5f54f2c0823dc10bed3fc58a828d8b86 100644 (file)
@@ -28,6 +28,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include <algorithm>
 #include <ostream>
+#include <cstring>
 using namespace llvm;
 
 // GetLibSupportInfoOutputFile - Return a file stream to print our output on.
index ac17696dd7894fe236fdb0c19f58cd2662d3cc28..1fae4fae488186d313e427496d6ab33d797408d1 100644 (file)
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/ADT/StringExtras.h"
+#include <cstring>
 using namespace llvm;
 
 /// getToken - This function extracts one token from source, ignoring any
index b95acddc73865a961ab58aee8209d92144524804..cbbf4126dd8e2d664acae26c740b5e5f7ade582a 100644 (file)
@@ -31,6 +31,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/MathExtras.h"
 #include <cctype>
+#include <cstring>
 using namespace llvm;
 
 STATISTIC(EmittedInsts, "Number of machine instrs printed");
index de7a8e45fbdb412aff557c65f6956209bad37ff4..cb16c6c26b99201c2a064ff7fa8e467826debe53 100644 (file)
@@ -18,6 +18,7 @@
 #include "llvm/CodeGen/MachineCodeEmitter.h"
 #include "llvm/Config/alloca.h"
 #include <cstdlib>
+#include <cstring>
 using namespace llvm;
 
 #ifdef _MSC_VER
index f5252a02f1bb958fbfda193304e91bdf3072342b..a8f5a952bf21df508263fbb3dbd44cf76bc9498e 100644 (file)
@@ -30,6 +30,7 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Transforms/IPO.h"
+#include <cstring>
 using namespace llvm;
 
 /// This statistic keeps track of the total number of library calls that have
index b514156a1afcd4724c116f0c3483098fe0bf63e8..2140b22f2ff590cfc13097396ee414c7c89f2e09 100644 (file)
@@ -36,8 +36,9 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/IntrinsicInst.h"
-#include <cstdio>
 #include <algorithm>
+#include <climits>
+#include <cstdio>
 using namespace llvm;
 
 STATISTIC(NumCompletelyUnrolled, "Number of loops completely unrolled");
index 4d0eb1ca0b0f1a32ddd81d0452e796b95af509a2..53e97f4807f10a373a6548060ab371741fe7156c 100644 (file)
@@ -18,6 +18,7 @@
 #include "llvm/Instructions.h"
 #include "llvm/ParameterAttributes.h"
 #include "llvm/Intrinsics.h"
+#include <cstring>
 using namespace llvm;
 
 
index 06dc9dc89f7986a64cac9208efb7ffd7f680ac91..451190fc94a5715f154845c827c09a3151fdeb98 100644 (file)
@@ -660,25 +660,28 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
       case Instruction::Xor:
         return ConstantInt::get(C1V ^ C2V);
       case Instruction::Shl:
-        if (uint32_t shiftAmt = C2V.getZExtValue())
+        if (uint32_t shiftAmt = C2V.getZExtValue()) {
           if (shiftAmt < C1V.getBitWidth())
             return ConstantInt::get(C1V.shl(shiftAmt));
           else
             return UndefValue::get(C1->getType()); // too big shift is undef
+        }
         return const_cast<ConstantInt*>(CI1); // Zero shift is identity
       case Instruction::LShr:
-        if (uint32_t shiftAmt = C2V.getZExtValue())
+        if (uint32_t shiftAmt = C2V.getZExtValue()) {
           if (shiftAmt < C1V.getBitWidth())
             return ConstantInt::get(C1V.lshr(shiftAmt));
           else
             return UndefValue::get(C1->getType()); // too big shift is undef
+        }
         return const_cast<ConstantInt*>(CI1); // Zero shift is identity
       case Instruction::AShr:
-        if (uint32_t shiftAmt = C2V.getZExtValue())
+        if (uint32_t shiftAmt = C2V.getZExtValue()) {
           if (shiftAmt < C1V.getBitWidth())
             return ConstantInt::get(C1V.ashr(shiftAmt));
           else
             return UndefValue::get(C1->getType()); // too big shift is undef
+        }
         return const_cast<ConstantInt*>(CI1); // Zero shift is identity
       }
     }
@@ -1083,18 +1086,20 @@ static ICmpInst::Predicate evaluateICmpRelation(const Constant *V1,
             // Ok, we ran out of things they have in common.  If any leftovers
             // are non-zero then we have a difference, otherwise we are equal.
             for (; i < CE1->getNumOperands(); ++i)
-              if (!CE1->getOperand(i)->isNullValue())
+              if (!CE1->getOperand(i)->isNullValue()) {
                 if (isa<ConstantInt>(CE1->getOperand(i)))
                   return isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
                 else
                   return ICmpInst::BAD_ICMP_PREDICATE; // Might be equal.
+              }
 
             for (; i < CE2->getNumOperands(); ++i)
-              if (!CE2->getOperand(i)->isNullValue())
+              if (!CE2->getOperand(i)->isNullValue()) {
                 if (isa<ConstantInt>(CE2->getOperand(i)))
                   return isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
                 else
                   return ICmpInst::BAD_ICMP_PREDICATE; // Might be equal.
+              }
             return ICmpInst::ICMP_EQ;
           }
         }
@@ -1123,20 +1128,22 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
   if (C1->isNullValue()) {
     if (const GlobalValue *GV = dyn_cast<GlobalValue>(C2))
       // Don't try to evaluate aliases.  External weak GV can be null.
-      if (!isa<GlobalAlias>(GV) && !GV->hasExternalWeakLinkage())
+      if (!isa<GlobalAlias>(GV) && !GV->hasExternalWeakLinkage()) {
         if (pred == ICmpInst::ICMP_EQ)
           return ConstantInt::getFalse();
         else if (pred == ICmpInst::ICMP_NE)
           return ConstantInt::getTrue();
+      }
   // icmp eq/ne(GV,null) -> false/true
   } else if (C2->isNullValue()) {
     if (const GlobalValue *GV = dyn_cast<GlobalValue>(C1))
       // Don't try to evaluate aliases.  External weak GV can be null.
-      if (!isa<GlobalAlias>(GV) && !GV->hasExternalWeakLinkage())
+      if (!isa<GlobalAlias>(GV) && !GV->hasExternalWeakLinkage()) {
         if (pred == ICmpInst::ICMP_EQ)
           return ConstantInt::getFalse();
         else if (pred == ICmpInst::ICMP_NE)
           return ConstantInt::getTrue();
+      }
   }
 
   if (isa<ConstantInt>(C1) && isa<ConstantInt>(C2)) {
index 0c913ffbf73f799216d2b4ee0ae2a3dc491a09e9..c159bbc2f76af4792b8704726138e9fccf8c2fac 100644 (file)
@@ -22,6 +22,7 @@
 #include "llvm/Support/MemoryBuffer.h"
 #include <cassert>
 #include <cstdlib>
+#include <cstring>
 
 using namespace llvm;
 
index 959ac9b61740e2f2ea24d456d34cdb9ad81d0df9..65bc1830e5fe8138c7323ea801b5677e1898879f 100644 (file)
@@ -186,11 +186,12 @@ void PHINode::resizeOperands(unsigned NumOps) {
 ///
 Value *PHINode::hasConstantValue(bool AllowNonDominatingInstruction) const {
   // If the PHI node only has one incoming value, eliminate the PHI node...
-  if (getNumIncomingValues() == 1)
+  if (getNumIncomingValues() == 1) {
     if (getIncomingValue(0) != this)   // not  X = phi X
       return getIncomingValue(0);
     else
       return UndefValue::get(getType());  // Self cycle is dead.
+  }
       
   // Otherwise if all of the incoming values are the same for the PHI, replace
   // the PHI node with the incoming value.
@@ -198,13 +199,14 @@ Value *PHINode::hasConstantValue(bool AllowNonDominatingInstruction) const {
   Value *InVal = 0;
   bool HasUndefInput = false;
   for (unsigned i = 0, e = getNumIncomingValues(); i != e; ++i)
-    if (isa<UndefValue>(getIncomingValue(i)))
+    if (isa<UndefValue>(getIncomingValue(i))) {
       HasUndefInput = true;
-    else if (getIncomingValue(i) != this)  // Not the PHI node itself...
+    } else if (getIncomingValue(i) != this) { // Not the PHI node itself...
       if (InVal && getIncomingValue(i) != InVal)
         return 0;  // Not the same, bail out.
       else
         InVal = getIncomingValue(i);
+    }
   
   // The only case that could cause InVal to be null is if we have a PHI node
   // that only has entries for itself.  In this case, there is no entry into the
@@ -451,8 +453,8 @@ void InvokeInst::init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
     cast<FunctionType>(cast<PointerType>(Fn->getType())->getElementType());
   FTy = FTy;  // silence warning.
 
-  assert((NumArgs == FTy->getNumParams()) ||
-         (FTy->isVarArg() && NumArgs > FTy->getNumParams()) &&
+  assert(((NumArgs == FTy->getNumParams()) ||
+          (FTy->isVarArg() && NumArgs > FTy->getNumParams())) &&
          "Calling a function with bad signature");
 
   for (unsigned i = 0, e = NumArgs; i != e; i++) {
@@ -1037,12 +1039,13 @@ const Type* GetElementPtrInst::getIndexedType(const Type *Ptr,
   if (!isa<PointerType>(Ptr)) return 0;   // Type isn't a pointer type!
 
   // Handle the special case of the empty set index set...
-  if (NumIdx == 0)
+  if (NumIdx == 0) {
     if (AllowCompositeLeaf ||
         cast<PointerType>(Ptr)->getElementType()->isFirstClassType())
       return cast<PointerType>(Ptr)->getElementType();
     else
       return 0;
+  }
 
   unsigned CurIdx = 0;
   while (const CompositeType *CT = dyn_cast<CompositeType>(Ptr)) {
@@ -2329,7 +2332,7 @@ CmpInst::CmpInst(OtherOps op, unsigned short predicate, Value *LHS, Value *RHS,
     assert(Op0Ty == Op1Ty &&
           "Both operands to ICmp instruction are not of the same type!");
     // Check that the operands are the right type
-    assert(Op0Ty->isInteger() || isa<PointerType>(Op0Ty) &&
+    assert((Op0Ty->isInteger() || isa<PointerType>(Op0Ty)) &&
            "Invalid operand types for ICmp instruction");
     return;
   }
index 54ea5b7502f0b3bb48928ab84104465f72536c6f..7b9d7f02b37b963f6208e533505f31f46729773d 100644 (file)
@@ -307,7 +307,7 @@ void Value::replaceAllUsesWith(Value *New) {
 void User::replaceUsesOfWith(Value *From, Value *To) {
   if (From == To) return;   // Duh what?
 
-  assert(!isa<Constant>(this) || isa<GlobalValue>(this) &&
+  assert((!isa<Constant>(this) || isa<GlobalValue>(this)) &&
          "Cannot call User::replaceUsesofWith on a constant!");
 
   for (unsigned i = 0, E = getNumOperands(); i != E; ++i)
index 9d0d93fd8307d0da69b38312b676a9dc25a4efac..6657c7c7fd276ecbaa305018ccd95be266d9754c 100644 (file)
@@ -38,6 +38,7 @@
 #include "llvm/System/Signals.h"
 #include <fstream>
 #include <memory>
+#include <cstring>
 using namespace llvm;
 
 // Input/Output Options
index 199e5cfbb2381ff99e928bfc20b6e64214631ea5..c3d816bc13bec6bc4189f8e9721ae9eb550dfcd5 100644 (file)
@@ -22,7 +22,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include <list>
 #include <iostream>
-
+#include <cstring>
 
 // Global variables exported from the lexer.
 extern int yydebug;
index cf3bc09fb9b172c2ca13dca1415686676fe46498..2bb406924795a0bc245d9bc6a5f314ea7e172596 100644 (file)
@@ -21,6 +21,7 @@
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/System/Signals.h"
 #include <iostream>
+#include <cstring>
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//
index e7b9421a589e35d7498a6104183cdd548111cff8..26c4cf44c6e2e01824ba74415423391076ca3f42 100644 (file)
@@ -17,7 +17,7 @@
 #include <iostream>
 #include <vector>
 #include <cassert>
-
+#include <cstdlib>
 struct Operator;
 
 // Masks are 4-nibble hex numbers.  Values 0-7 in any nibble means that it takes
index 07ef2e5c8d0fe4d7e7cd652ff550e8819b2cab41..5a24b26422e36437304f7028b14a8bb1583236ab 100644 (file)
@@ -242,11 +242,12 @@ unsigned AsmWriterInst::MatchesAllButOneOp(const AsmWriterInst &Other)const{
 
   unsigned MismatchOperand = ~0U;
   for (unsigned i = 0, e = Operands.size(); i != e; ++i) {
-    if (Operands[i] != Other.Operands[i])
+    if (Operands[i] != Other.Operands[i]) {
       if (MismatchOperand != ~0U)  // Already have one mismatch?
         return ~1U;
       else
         MismatchOperand = i;
+    }
   }
   return MismatchOperand;
 }
index ddfaaac5782853047a18bbb6a42ae0ee4f2d769e..0faaa7284ac7c77d80c983e15a6c445718224575 100644 (file)
@@ -1342,14 +1342,14 @@ void CodeGenDAGPatterns::ParseDefaultOperands() {
         while (TPN->ApplyTypeConstraints(P, false))
           /* Resolve all types */;
       
-        if (TPN->ContainsUnresolvedType())
+        if (TPN->ContainsUnresolvedType()) {
           if (iter == 0)
             throw "Value #" + utostr(i) + " of PredicateOperand '" +
               DefaultOps[iter][i]->getName() + "' doesn't have a concrete type!";
           else
             throw "Value #" + utostr(i) + " of OptionalDefOperand '" +
               DefaultOps[iter][i]->getName() + "' doesn't have a concrete type!";
-      
+        }
         DefaultOpInfo.DefaultOps.push_back(TPN);
       }
 
index 4efae7842b09740c53df2ee178b6b2554ca33020..0f1b501fc14f5c87900d00c6cfdf15b26aff6052 100644 (file)
 #ifndef CODEGEN_REGISTERS_H
 #define CODEGEN_REGISTERS_H
 
+#include "llvm/CodeGen/ValueTypes.h"
 #include <string>
 #include <vector>
-#include "llvm/CodeGen/ValueTypes.h"
+#include <cstdlib>
 
 namespace llvm {
   class Record;
index bdf6b64205df6a7dde540e80fc026a2b82c839ef..6f562fad5928cb6c7d121001160ff93a9bc69833 100644 (file)
@@ -1123,7 +1123,7 @@ public:
           Code += "), 0";
         emitCode(Code2 + Code + ");");
 
-        if (NodeHasChain)
+        if (NodeHasChain) {
           // Remember which op produces the chain.
           if (!isRoot)
             emitCode(ChainName + " = SDOperand(" + NodeName +
@@ -1131,6 +1131,7 @@ public:
           else
             emitCode(ChainName + " = SDOperand(" + NodeName +
                      ", " + utostr(NumResults+NumDstRegs) + ");");
+        }
 
         if (!isRoot) {
           NodeOps.push_back("Tmp" + utostr(ResNo));
index 9fa696e8cbe2cc77d212dd0d50ebbb29ce6cadd1..2af35b05d6d834dbe00dfee8507432427be678d2 100644 (file)
@@ -17,6 +17,8 @@
 #include <ostream>
 #include "llvm/Config/config.h"
 #include <cctype>
+#include <cstdlib>
+#include <cstring>
 using namespace llvm;
 
 TGLexer::TGLexer(MemoryBuffer *StartBuf) : CurLineNo(1), CurBuf(StartBuf) {