[llvm-commits] [llvm] r47382 - in /llvm/trunk: include/llvm/Support/Annotation.h include/llvm/Support/CommandLine.h include/llvm/Support/ConstantRange.h lib/CodeGen/SelectionDAG/DAGCombiner.cpp lib/Support/Annotation.cpp lib/Transforms/Scalar/PredicateSimplifier.cpp

Dan Gohman gohman at apple.com
Wed Feb 20 08:44:12 PST 2008


Author: djg
Date: Wed Feb 20 10:44:09 2008
New Revision: 47382

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

Modified:
    llvm/trunk/include/llvm/Support/Annotation.h
    llvm/trunk/include/llvm/Support/CommandLine.h
    llvm/trunk/include/llvm/Support/ConstantRange.h
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    llvm/trunk/lib/Support/Annotation.cpp
    llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp

Modified: llvm/trunk/include/llvm/Support/Annotation.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Annotation.h?rev=47382&r1=47381&r2=47382&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/Annotation.h (original)
+++ llvm/trunk/include/llvm/Support/Annotation.h Wed Feb 20 10:44:09 2008
@@ -43,7 +43,9 @@
   unsigned ID;
 
   AnnotationID();                             // Default ctor is disabled
-  inline AnnotationID(unsigned i) : ID(i) {}  // Only creatable from AnnMgr
+
+  // AnnotationID is only creatable from AnnMgr.
+  explicit inline AnnotationID(unsigned i) : ID(i) {}
 public:
   inline AnnotationID(const AnnotationID &A) : ID(A.ID) {}
 
@@ -67,7 +69,7 @@
   AnnotationID ID;         // ID number, as obtained from AnnotationManager
   Annotation *Next;        // The next annotation in the linked list
 public:
-  inline Annotation(AnnotationID id) : ID(id), Next(0) {}
+  explicit inline Annotation(AnnotationID id) : ID(id), Next(0) {}
   virtual ~Annotation();  // Designed to be subclassed
 
   // getID - Return the unique ID# of this annotation

Modified: llvm/trunk/include/llvm/Support/CommandLine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CommandLine.h?rev=47382&r1=47381&r2=47382&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/CommandLine.h (original)
+++ llvm/trunk/include/llvm/Support/CommandLine.h Wed Feb 20 10:44:09 2008
@@ -1316,7 +1316,7 @@
 // exit is called.
 struct extrahelp {
   const char * morehelp;
-  extrahelp(const char* help);
+  explicit extrahelp(const char* help);
 };
 
 void PrintVersionMessage();

Modified: llvm/trunk/include/llvm/Support/ConstantRange.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ConstantRange.h?rev=47382&r1=47381&r2=47382&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/ConstantRange.h (original)
+++ llvm/trunk/include/llvm/Support/ConstantRange.h Wed Feb 20 10:44:09 2008
@@ -44,7 +44,7 @@
  public:
   /// Initialize a full (the default) or empty set for the specified bit width.
   ///
-  ConstantRange(uint32_t BitWidth, bool isFullSet = true);
+  explicit ConstantRange(uint32_t BitWidth, bool isFullSet = true);
 
   /// Initialize a range to hold the single specified value.
   ///

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=47382&r1=47381&r2=47382&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Feb 20 10:44:09 2008
@@ -262,7 +262,7 @@
   public SelectionDAG::DAGUpdateListener {
   DAGCombiner &DC;
 public:
-  WorkListRemover(DAGCombiner &dc) : DC(dc) {}
+  explicit WorkListRemover(DAGCombiner &dc) : DC(dc) {}
   
   virtual void NodeDeleted(SDNode *N) {
     DC.removeFromWorkList(N);

Modified: llvm/trunk/lib/Support/Annotation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Annotation.cpp?rev=47382&r1=47381&r2=47382&view=diff

==============================================================================
--- llvm/trunk/lib/Support/Annotation.cpp (original)
+++ llvm/trunk/lib/Support/Annotation.cpp Wed Feb 20 10:44:09 2008
@@ -57,9 +57,9 @@
   IDMapType::iterator I = IDMap->find(Name);
   if (I == IDMap->end()) {
     (*IDMap)[Name] = IDCounter++;   // Add a new element
-    return IDCounter-1;
+    return AnnotationID(IDCounter-1);
   }
-  return I->second;
+  return AnnotationID(I->second);
 }
 
 // getID - Name -> ID + registration of a factory function for demand driven

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

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp Wed Feb 20 10:44:09 2008
@@ -1112,7 +1112,7 @@
       else if (isa<ConstantPointerNull>(V))
         return ConstantRange(APInt::getNullValue(typeToWidth(V->getType())));
       else
-        return typeToWidth(V->getType());
+        return ConstantRange(typeToWidth(V->getType()));
     }
 
     // typeToWidth - returns the number of bits necessary to store a value of





More information about the llvm-commits mailing list