[llvm-commits] [llvm] r44234 - in /llvm/trunk: include/llvm/ADT/StringMap.h include/llvm/Analysis/ScalarEvolutionExpressions.h include/llvm/Bitcode/Serialize.h lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriterPass.cpp lib/Transforms/Scalar/CorrelatedExprs.cpp

Dan Gohman djg at cray.com
Mon Nov 19 07:30:21 PST 2007


Author: djg
Date: Mon Nov 19 09:30:20 2007
New Revision: 44234

URL: http://llvm.org/viewvc/llvm-project?rev=44234&view=rev
Log:
Add explicit keywords.

Modified:
    llvm/trunk/include/llvm/ADT/StringMap.h
    llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h
    llvm/trunk/include/llvm/Bitcode/Serialize.h
    llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
    llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp
    llvm/trunk/lib/Transforms/Scalar/CorrelatedExprs.cpp

Modified: llvm/trunk/include/llvm/ADT/StringMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringMap.h?rev=44234&r1=44233&r2=44234&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/StringMap.h (original)
+++ llvm/trunk/include/llvm/ADT/StringMap.h Mon Nov 19 09:30:20 2007
@@ -28,7 +28,7 @@
 class StringMapEntryBase {
   unsigned StrLen;
 public:
-  StringMapEntryBase(unsigned Len) : StrLen(Len) {}
+  explicit StringMapEntryBase(unsigned Len) : StrLen(Len) {}
   
   unsigned getKeyLength() const { return StrLen; }
 };
@@ -55,7 +55,7 @@
   unsigned NumTombstones;
   unsigned ItemSize;
 protected:
-  StringMapImpl(unsigned itemSize) : ItemSize(itemSize) {
+  explicit StringMapImpl(unsigned itemSize) : ItemSize(itemSize) {
     // Initialize the map with zero buckets to allocation.
     TheTable = 0;
     NumBuckets = 0;
@@ -115,7 +115,7 @@
 class StringMapEntry : public StringMapEntryBase {
   ValueTy Val;
 public:
-  StringMapEntry(unsigned StrLen)
+  explicit StringMapEntry(unsigned StrLen)
     : StringMapEntryBase(StrLen), Val() {}
   StringMapEntry(unsigned StrLen, const ValueTy &V)
     : StringMapEntryBase(StrLen), Val(V) {}
@@ -204,7 +204,7 @@
   typedef StringMapEntry<ValueTy> MapEntryTy;
 public:
   StringMap() : StringMapImpl(sizeof(MapEntryTy)) {}
-  StringMap(unsigned InitialSize)
+  explicit StringMap(unsigned InitialSize)
     : StringMapImpl(InitialSize, sizeof(MapEntryTy)) {}
   
   AllocatorTy &getAllocator() { return Allocator; }
@@ -314,8 +314,8 @@
 protected:
   StringMapImpl::ItemBucket *Ptr;
 public:
-  StringMapConstIterator(StringMapImpl::ItemBucket *Bucket,
-                         bool NoAdvance = false)
+  explicit StringMapConstIterator(StringMapImpl::ItemBucket *Bucket,
+                                  bool NoAdvance = false)
   : Ptr(Bucket) {
     if (!NoAdvance) AdvancePastEmptyBuckets();
   }

Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h?rev=44234&r1=44233&r2=44234&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h Mon Nov 19 09:30:20 2007
@@ -285,7 +285,7 @@
   class SCEVAddExpr : public SCEVCommutativeExpr {
     friend class ScalarEvolution;
 
-    SCEVAddExpr(const std::vector<SCEVHandle> &ops)
+    explicit SCEVAddExpr(const std::vector<SCEVHandle> &ops)
       : SCEVCommutativeExpr(scAddExpr, ops) {
     }
 
@@ -305,7 +305,7 @@
   class SCEVMulExpr : public SCEVCommutativeExpr {
     friend class ScalarEvolution;
 
-    SCEVMulExpr(const std::vector<SCEVHandle> &ops)
+    explicit SCEVMulExpr(const std::vector<SCEVHandle> &ops)
       : SCEVCommutativeExpr(scMulExpr, ops) {
     }
 
@@ -468,7 +468,7 @@
     friend class ScalarEvolution;
 
     Value *V;
-    SCEVUnknown(Value *v) : SCEV(scUnknown), V(v) {}
+    explicit SCEVUnknown(Value *v) : SCEV(scUnknown), V(v) {}
 
   protected:
     ~SCEVUnknown();

Modified: llvm/trunk/include/llvm/Bitcode/Serialize.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Serialize.h?rev=44234&r1=44233&r2=44234&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Bitcode/Serialize.h (original)
+++ llvm/trunk/include/llvm/Bitcode/Serialize.h Mon Nov 19 09:30:20 2007
@@ -31,7 +31,7 @@
   MapTy PtrMap;
   
 public:
-  Serializer(BitstreamWriter& stream);
+  explicit Serializer(BitstreamWriter& stream);
   ~Serializer();
   
   template <typename T>

Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=44234&r1=44233&r2=44234&view=diff

==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Mon Nov 19 09:30:20 2007
@@ -123,7 +123,7 @@
     void operator=(const ConstantPlaceHolder &); // DO NOT IMPLEMENT
   public:
     Use Op;
-    ConstantPlaceHolder(const Type *Ty)
+    explicit ConstantPlaceHolder(const Type *Ty)
       : ConstantExpr(Ty, Instruction::UserOp1, &Op, 1),
         Op(UndefValue::get(Type::Int32Ty), this) {
     }

Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp?rev=44234&r1=44233&r2=44234&view=diff

==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp Mon Nov 19 09:30:20 2007
@@ -20,7 +20,8 @@
     std::ostream &Out;                 // ostream to print on
   public:
     static char ID; // Pass identifcation, replacement for typeid
-    WriteBitcodePass(std::ostream &o) : ModulePass((intptr_t) &ID), Out(o) {}
+    explicit WriteBitcodePass(std::ostream &o)
+      : ModulePass((intptr_t) &ID), Out(o) {}
     
     const char *getPassName() const { return "Bitcode Writer"; }
     

Modified: llvm/trunk/lib/Transforms/Scalar/CorrelatedExprs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CorrelatedExprs.cpp?rev=44234&r1=44233&r2=44234&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/CorrelatedExprs.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/CorrelatedExprs.cpp Mon Nov 19 09:30:20 2007
@@ -57,7 +57,7 @@
     Value *Val;          // Relation to what value?
     unsigned Rel;        // SetCC or ICmp relation, or Add if no information
   public:
-    Relation(Value *V) : Val(V), Rel(Instruction::Add) {}
+    explicit Relation(Value *V) : Val(V), Rel(Instruction::Add) {}
     bool operator<(const Relation &R) const { return Val < R.Val; }
     Value *getValue() const { return Val; }
     unsigned getRelation() const { return Rel; }
@@ -112,7 +112,7 @@
     //
     Value *Replacement;
   public:
-    ValueInfo(const Type *Ty)
+    explicit ValueInfo(const Type *Ty)
       : Bounds(Ty->isInteger() ? cast<IntegerType>(Ty)->getBitWidth()  : 32), 
                Replacement(0) {}
 
@@ -146,7 +146,7 @@
         return *I;
 
       // Insert and return the new relationship...
-      return *Relationships.insert(I, V);
+      return *Relationships.insert(I, Relation(V));
     }
 
     const Relation *requestRelation(Value *V) const {
@@ -176,7 +176,7 @@
     typedef std::map<Value*, ValueInfo> ValueMapTy;
     ValueMapTy ValueMap;
   public:
-    RegionInfo(BasicBlock *bb) : BB(bb) {}
+    explicit RegionInfo(BasicBlock *bb) : BB(bb) {}
 
     // getEntryBlock - Return the block that dominates all of the members of
     // this region.





More information about the llvm-commits mailing list