Point people to ConstantExpr and ConstantFolding,
[oota-llvm.git] / include / llvm / Support / Annotation.h
index 4325836c29083526b0ed36d86589adfa1d73269e..2be1c1061690b2f08baa885d9e35546751168688 100644 (file)
@@ -1,10 +1,10 @@
 //===-- llvm/Support/Annotation.h - Annotation classes ----------*- C++ -*-===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
 //===----------------------------------------------------------------------===//
 //
 // This file contains the declarations for two classes: Annotation & Annotable.
@@ -30,7 +30,7 @@ namespace llvm {
 class AnnotationID;
 class Annotation;
 class Annotable;
-class AnnotationManager;
+struct AnnotationManager;
 
 //===----------------------------------------------------------------------===//
 //
@@ -39,11 +39,13 @@ class AnnotationManager;
 // freely around and passed byvalue with little or no overhead.
 //
 class AnnotationID {
-  friend class AnnotationManager;
+  friend struct AnnotationManager;
   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
@@ -81,8 +83,7 @@ public:
 //===----------------------------------------------------------------------===//
 //
 // Annotable - This class is used as a base class for all objects that would
-// like to have annotation capability.  One notable subclass is Value, which 
-// means annotations can be attached to almost everything in LLVM.
+// like to have annotation capability.
 //
 // Annotable objects keep their annotation list sorted as annotations are
 // inserted and deleted.  This is used to ensure that annotations with identical
@@ -132,10 +133,10 @@ public:
   inline Annotation *unlinkAnnotation(AnnotationID ID) const {
     for (Annotation **A = &AnnotationList; *A; A = &((*A)->Next))
       if ((*A)->getID() == ID) {
-       Annotation *Ret = *A;
-       *A = Ret->Next;
-       Ret->Next = 0;
-       return Ret;
+        Annotation *Ret = *A;
+        *A = Ret->Next;
+        Ret->Next = 0;
+        return Ret;
       }
     return 0;
   }
@@ -157,13 +158,13 @@ public:
 // one-to-one mapping between string Annotation names and Annotation ID numbers.
 //
 // Compared to the rest of the Annotation system, these mapping methods are
-// relatively slow, so they should be avoided by locally caching Annotation 
+// relatively slow, so they should be avoided by locally caching Annotation
 // ID #'s.  These methods are safe to call at any time, even by static ctors, so
 // they should be used by static ctors most of the time.
 //
 // This class also provides support for annotations that are created on demand
 // by the Annotable::getOrCreateAnnotation method.  To get this to work, simply
-// register an annotation handler 
+// register an annotation handler
 //
 struct AnnotationManager {
   typedef Annotation *(*Factory)(AnnotationID, const Annotable *, void*);
@@ -183,11 +184,11 @@ struct AnnotationManager {
   // Annotation creation on demand support...
 
   // registerAnnotationFactory - This method is used to register a callback
-  // function used to create an annotation on demand if it is needed by the 
+  // function used to create an annotation on demand if it is needed by the
   // Annotable::getOrCreateAnnotation method.
   //
   static void registerAnnotationFactory(AnnotationID ID, Factory Func,
-                                       void *ExtraData = 0);
+                                        void *ExtraData = 0);
 
   // createAnnotation - Create an annotation of the specified ID for the
   // specified object, using a register annotation creation function.