r337048 - Make BuiltinType constructor private, and befriend ASTContext.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 13 14:29:31 PDT 2018
Author: rsmith
Date: Fri Jul 13 14:29:31 2018
New Revision: 337048
URL: http://llvm.org/viewvc/llvm-project?rev=337048&view=rev
Log:
Make BuiltinType constructor private, and befriend ASTContext.
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.
Modified:
cfe/trunk/include/clang/AST/Type.h
Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=337048&r1=337047&r2=337048&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Fri Jul 13 14:29:31 2018
@@ -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;
More information about the cfe-commits
mailing list