Add explicit keywords.
authorDan Gohman <gohman@apple.com>
Wed, 20 Feb 2008 16:44:09 +0000 (16:44 +0000)
committerDan Gohman <gohman@apple.com>
Wed, 20 Feb 2008 16:44:09 +0000 (16:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47382 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 4a53ff59a99bb6082ad3bfce7298ff83f6b48414..2be1c1061690b2f08baa885d9e35546751168688 100644 (file)
@@ -43,7 +43,9 @@ class AnnotationID {
   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 @@ class Annotation {
   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
index 1392e334ac52811f35054c2ee7441dfe5bf09b37..0f804395c39240f2c30f7b0b59c76c375b28d414 100644 (file)
@@ -1316,7 +1316,7 @@ struct aliasopt {
 // exit is called.
 struct extrahelp {
   const char * morehelp;
-  extrahelp(const char* help);
+  explicit extrahelp(const char* help);
 };
 
 void PrintVersionMessage();
index 6fb56b3b2573ad263f2d497e17503a18a95cbd71..2e477cf899842677cacc417a4fbb1a4a2681c471 100644 (file)
@@ -44,7 +44,7 @@ class ConstantRange {
  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.
   ///
index d1de88b7e24e424baa4cdd45e06cc397411ed458..244dee393f609c77251fcff74aba79174fd8c21b 100644 (file)
@@ -262,7 +262,7 @@ class VISIBILITY_HIDDEN WorkListRemover :
   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);
index 9d5e5457d9a814afc622378152bbd05150412e91..3ecc42f782e23d2018f0b59c908386b8332b052f 100644 (file)
@@ -57,9 +57,9 @@ AnnotationID AnnotationManager::getID(const std::string &Name) {  // Name -> ID
   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
index 388071d1e9ac5bb33f7ed7f31b8c44f0c8dd4350..d0067b3302c627cdf8ce4b30b2bd8773bfbba91e 100644 (file)
@@ -1112,7 +1112,7 @@ namespace {
       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