]> granicus.if.org Git - clang/commitdiff
Make BuiltinType constructor private, and befriend ASTContext.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 13 Jul 2018 21:29:31 +0000 (21:29 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 13 Jul 2018 21:29:31 +0000 (21:29 +0000)
This reflects the fact that only ASTContext should ever create an
instance of BuiltinType, and matches what we do for all the other Type
subclasses.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337048 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Type.h

index b21d9f41276585a6052eea56249c6c9a129e30c4..9e024c12ff88b5fa888730e8b27b957523f039ab 100644 (file)
@@ -2253,7 +2253,9 @@ public:
 #include "clang/AST/BuiltinTypes.def"
   };
 
-public:
+private:
+  friend class ASTContext; // ASTContext creates these.
+
   BuiltinType(Kind K)
       : Type(Builtin, QualType(), /*Dependent=*/(K == Dependent),
              /*InstantiationDependent=*/(K == Dependent),
@@ -2262,6 +2264,7 @@ public:
     BuiltinTypeBits.Kind = K;
   }
 
+public:
   Kind getKind() const { return static_cast<Kind>(BuiltinTypeBits.Kind); }
   StringRef getName(const PrintingPolicy &Policy) const;