[cfe-commits] r122083 - /cfe/trunk/include/clang/AST/TemplateBase.h

Douglas Gregor dgregor at apple.com
Fri Dec 17 11:31:16 PST 2010


Author: dgregor
Date: Fri Dec 17 13:31:15 2010
New Revision: 122083

URL: http://llvm.org/viewvc/llvm-project?rev=122083&view=rev
Log:
Encapsulate TemplateArgument::Kind

Modified:
    cfe/trunk/include/clang/AST/TemplateBase.h

Modified: cfe/trunk/include/clang/AST/TemplateBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TemplateBase.h?rev=122083&r1=122082&r2=122083&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/TemplateBase.h (original)
+++ cfe/trunk/include/clang/AST/TemplateBase.h Fri Dec 17 13:31:15 2010
@@ -35,20 +35,8 @@
 /// \brief Represents a template argument within a class template
 /// specialization.
 class TemplateArgument {
-  union {
-    uintptr_t TypeOrValue;
-    struct {
-      char Value[sizeof(llvm::APSInt)];
-      void *Type;
-    } Integer;
-    struct {
-      TemplateArgument *Args;
-      unsigned NumArgs;
-    } Args;
-  };
-
 public:
-  /// \brief The type of template argument we're storing.
+  /// \brief The kind of template argument we're storing.
   enum ArgKind {
     /// \brief Represents an empty template argument, e.g., one that has not
     /// been deduced.
@@ -71,8 +59,25 @@
     /// The template argument is actually a parameter pack. Arguments are stored
     /// in the Args struct.
     Pack
-  } Kind;
+  };
+
+private:
+  /// \brief The kind of template argument we're storing.
+  unsigned Kind;
+
+  union {
+    uintptr_t TypeOrValue;
+    struct {
+      char Value[sizeof(llvm::APSInt)];
+      void *Type;
+    } Integer;
+    struct {
+      TemplateArgument *Args;
+      unsigned NumArgs;
+    } Args;
+  };
 
+public:
   /// \brief Construct an empty, invalid template argument.
   TemplateArgument() : TypeOrValue(0), Kind(Null) { }
 
@@ -177,7 +182,7 @@
   }
 
   /// \brief Return the kind of stored template argument.
-  ArgKind getKind() const { return Kind; }
+  ArgKind getKind() const { return (ArgKind)Kind; }
 
   /// \brief Determine whether this template argument has no value.
   bool isNull() const { return Kind == Null; }





More information about the cfe-commits mailing list