blob: 2858d479bbbb31164b5768e1572bc6d875990a71 [file] [log] [blame]
Ted Kremenek4b7c9832008-09-05 17:16:31 +00001//===--- DeclCXX.cpp - C++ Declaration AST Node Implementation ------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the C++ related Decl classes.
11//
12//===----------------------------------------------------------------------===//
13
14#include "clang/AST/DeclCXX.h"
Douglas Gregord475b8d2009-03-25 21:17:03 +000015#include "clang/AST/DeclTemplate.h"
Ted Kremenek4b7c9832008-09-05 17:16:31 +000016#include "clang/AST/ASTContext.h"
Anders Carlssonfb311762009-03-14 00:25:26 +000017#include "clang/AST/Expr.h"
Douglas Gregor7d7e6722008-11-12 23:21:09 +000018#include "clang/Basic/IdentifierTable.h"
Douglas Gregorfdfab6b2008-12-23 21:31:30 +000019#include "llvm/ADT/STLExtras.h"
Ted Kremenek4b7c9832008-09-05 17:16:31 +000020using namespace clang;
21
22//===----------------------------------------------------------------------===//
23// Decl Allocation/Deallocation Method Implementations
24//===----------------------------------------------------------------------===//
Douglas Gregor72c3f312008-12-05 18:15:24 +000025
Douglas Gregor3e00bad2009-02-17 01:05:43 +000026CXXRecordDecl::CXXRecordDecl(Kind K, TagKind TK, DeclContext *DC,
Douglas Gregor7d7e6722008-11-12 23:21:09 +000027 SourceLocation L, IdentifierInfo *Id)
Douglas Gregor3e00bad2009-02-17 01:05:43 +000028 : RecordDecl(K, TK, DC, L, Id),
Douglas Gregor7d7e6722008-11-12 23:21:09 +000029 UserDeclaredConstructor(false), UserDeclaredCopyConstructor(false),
Sebastian Redl64b45f72009-01-05 20:52:13 +000030 UserDeclaredCopyAssignment(false), UserDeclaredDestructor(false),
Anders Carlsson67e4dd22009-03-22 01:52:17 +000031 Aggregate(true), PlainOldData(true), Polymorphic(false), Abstract(false),
Douglas Gregord475b8d2009-03-25 21:17:03 +000032 Bases(0), NumBases(0), Conversions(DC, DeclarationName()),
33 TemplateOrInstantiation() { }
Douglas Gregor7d7e6722008-11-12 23:21:09 +000034
Ted Kremenek4b7c9832008-09-05 17:16:31 +000035CXXRecordDecl *CXXRecordDecl::Create(ASTContext &C, TagKind TK, DeclContext *DC,
36 SourceLocation L, IdentifierInfo *Id,
37 CXXRecordDecl* PrevDecl) {
Douglas Gregor3e00bad2009-02-17 01:05:43 +000038 CXXRecordDecl* R = new (C) CXXRecordDecl(CXXRecord, TK, DC, L, Id);
Ted Kremenek4b7c9832008-09-05 17:16:31 +000039 C.getTypeDeclType(R, PrevDecl);
40 return R;
41}
42
Douglas Gregorf8268ae2008-10-22 17:49:05 +000043CXXRecordDecl::~CXXRecordDecl() {
Douglas Gregorf8268ae2008-10-22 17:49:05 +000044 delete [] Bases;
45}
46
Douglas Gregor57c856b2008-10-23 18:13:27 +000047void
48CXXRecordDecl::setBases(CXXBaseSpecifier const * const *Bases,
49 unsigned NumBases) {
Douglas Gregor64bffa92008-11-05 16:20:31 +000050 // C++ [dcl.init.aggr]p1:
51 // An aggregate is an array or a class (clause 9) with [...]
52 // no base classes [...].
53 Aggregate = false;
54
Douglas Gregor57c856b2008-10-23 18:13:27 +000055 if (this->Bases)
56 delete [] this->Bases;
57
Douglas Gregor2943aed2009-03-03 04:44:36 +000058 // FIXME: allocate using the ASTContext
Douglas Gregor57c856b2008-10-23 18:13:27 +000059 this->Bases = new CXXBaseSpecifier[NumBases];
60 this->NumBases = NumBases;
61 for (unsigned i = 0; i < NumBases; ++i)
62 this->Bases[i] = *Bases[i];
63}
64
Douglas Gregor396b7cd2008-11-03 17:51:48 +000065bool CXXRecordDecl::hasConstCopyConstructor(ASTContext &Context) const {
Sebastian Redl64b45f72009-01-05 20:52:13 +000066 QualType ClassType
67 = Context.getTypeDeclType(const_cast<CXXRecordDecl*>(this));
Douglas Gregor9e7d9de2008-12-15 21:24:18 +000068 DeclarationName ConstructorName
69 = Context.DeclarationNames.getCXXConstructorName(
70 Context.getCanonicalType(ClassType));
71 unsigned TypeQuals;
Douglas Gregorfdfab6b2008-12-23 21:31:30 +000072 DeclContext::lookup_const_iterator Con, ConEnd;
Steve Naroff0701bbb2009-01-08 17:28:14 +000073 for (llvm::tie(Con, ConEnd) = this->lookup(ConstructorName);
Douglas Gregorfdfab6b2008-12-23 21:31:30 +000074 Con != ConEnd; ++Con) {
Douglas Gregor396b7cd2008-11-03 17:51:48 +000075 if (cast<CXXConstructorDecl>(*Con)->isCopyConstructor(Context, TypeQuals) &&
Eli Friedmane8e32052008-12-16 20:06:41 +000076 (TypeQuals & QualType::Const) != 0)
Douglas Gregor396b7cd2008-11-03 17:51:48 +000077 return true;
78 }
Douglas Gregorfdfab6b2008-12-23 21:31:30 +000079
Douglas Gregor396b7cd2008-11-03 17:51:48 +000080 return false;
81}
82
Sebastian Redl64b45f72009-01-05 20:52:13 +000083bool CXXRecordDecl::hasConstCopyAssignment(ASTContext &Context) const {
84 QualType ClassType = Context.getCanonicalType(Context.getTypeDeclType(
85 const_cast<CXXRecordDecl*>(this)));
86 DeclarationName OpName =Context.DeclarationNames.getCXXOperatorName(OO_Equal);
87
88 DeclContext::lookup_const_iterator Op, OpEnd;
Steve Naroff0701bbb2009-01-08 17:28:14 +000089 for (llvm::tie(Op, OpEnd) = this->lookup(OpName);
Sebastian Redl64b45f72009-01-05 20:52:13 +000090 Op != OpEnd; ++Op) {
91 // C++ [class.copy]p9:
92 // A user-declared copy assignment operator is a non-static non-template
93 // member function of class X with exactly one parameter of type X, X&,
94 // const X&, volatile X& or const volatile X&.
95 const CXXMethodDecl* Method = cast<CXXMethodDecl>(*Op);
96 if (Method->isStatic())
97 continue;
98 // TODO: Skip templates? Or is this implicitly done due to parameter types?
Douglas Gregor72564e72009-02-26 23:50:07 +000099 const FunctionProtoType *FnType =
100 Method->getType()->getAsFunctionProtoType();
Sebastian Redl64b45f72009-01-05 20:52:13 +0000101 assert(FnType && "Overloaded operator has no prototype.");
102 // Don't assert on this; an invalid decl might have been left in the AST.
103 if (FnType->getNumArgs() != 1 || FnType->isVariadic())
104 continue;
105 bool AcceptsConst = true;
106 QualType ArgType = FnType->getArgType(0);
Sebastian Redl7c80bd62009-03-16 23:22:08 +0000107 if (const LValueReferenceType *Ref = ArgType->getAsLValueReferenceType()) {
Sebastian Redl64b45f72009-01-05 20:52:13 +0000108 ArgType = Ref->getPointeeType();
Douglas Gregor2ff44782009-03-20 20:21:37 +0000109 // Is it a non-const lvalue reference?
Sebastian Redl64b45f72009-01-05 20:52:13 +0000110 if (!ArgType.isConstQualified())
111 AcceptsConst = false;
112 }
113 if (Context.getCanonicalType(ArgType).getUnqualifiedType() != ClassType)
114 continue;
115
116 // We have a single argument of type cv X or cv X&, i.e. we've found the
117 // copy assignment operator. Return whether it accepts const arguments.
118 return AcceptsConst;
119 }
120 assert(isInvalidDecl() &&
121 "No copy assignment operator declared in valid code.");
122 return false;
123}
124
125void
Douglas Gregor9e7d9de2008-12-15 21:24:18 +0000126CXXRecordDecl::addedConstructor(ASTContext &Context,
127 CXXConstructorDecl *ConDecl) {
Douglas Gregor6b3945f2009-01-07 19:46:03 +0000128 if (!ConDecl->isImplicit()) {
Douglas Gregor030ff0c2008-10-31 20:25:05 +0000129 // Note that we have a user-declared constructor.
130 UserDeclaredConstructor = true;
131
Douglas Gregor64bffa92008-11-05 16:20:31 +0000132 // C++ [dcl.init.aggr]p1:
133 // An aggregate is an array or a class (clause 9) with no
134 // user-declared constructors (12.1) [...].
135 Aggregate = false;
136
Sebastian Redl64b45f72009-01-05 20:52:13 +0000137 // C++ [class]p4:
138 // A POD-struct is an aggregate class [...]
139 PlainOldData = false;
140
Douglas Gregor030ff0c2008-10-31 20:25:05 +0000141 // Note when we have a user-declared copy constructor, which will
142 // suppress the implicit declaration of a copy constructor.
143 if (ConDecl->isCopyConstructor(Context))
144 UserDeclaredCopyConstructor = true;
145 }
Douglas Gregor030ff0c2008-10-31 20:25:05 +0000146}
147
Sebastian Redl64b45f72009-01-05 20:52:13 +0000148void CXXRecordDecl::addedAssignmentOperator(ASTContext &Context,
149 CXXMethodDecl *OpDecl) {
150 // We're interested specifically in copy assignment operators.
151 // Unlike addedConstructor, this method is not called for implicit
152 // declarations.
Douglas Gregor72564e72009-02-26 23:50:07 +0000153 const FunctionProtoType *FnType = OpDecl->getType()->getAsFunctionProtoType();
Sebastian Redl64b45f72009-01-05 20:52:13 +0000154 assert(FnType && "Overloaded operator has no proto function type.");
155 assert(FnType->getNumArgs() == 1 && !FnType->isVariadic());
156 QualType ArgType = FnType->getArgType(0);
Sebastian Redl7c80bd62009-03-16 23:22:08 +0000157 if (const LValueReferenceType *Ref = ArgType->getAsLValueReferenceType())
Sebastian Redl64b45f72009-01-05 20:52:13 +0000158 ArgType = Ref->getPointeeType();
159
160 ArgType = ArgType.getUnqualifiedType();
161 QualType ClassType = Context.getCanonicalType(Context.getTypeDeclType(
162 const_cast<CXXRecordDecl*>(this)));
163
164 if (ClassType != Context.getCanonicalType(ArgType))
165 return;
166
167 // This is a copy assignment operator.
168 // Suppress the implicit declaration of a copy constructor.
169 UserDeclaredCopyAssignment = true;
170
171 // C++ [class]p4:
172 // A POD-struct is an aggregate class that [...] has no user-defined copy
173 // assignment operator [...].
174 PlainOldData = false;
175}
176
Douglas Gregor2f1bc522008-11-07 20:08:42 +0000177void CXXRecordDecl::addConversionFunction(ASTContext &Context,
178 CXXConversionDecl *ConvDecl) {
179 Conversions.addOverload(ConvDecl);
180}
181
Douglas Gregord475b8d2009-03-25 21:17:03 +0000182CXXRecordDecl *CXXRecordDecl::getInstantiatedFromMemberClass() {
183 if (TemplateOrInstantiation.getInt() == 1)
184 return cast_or_null<CXXRecordDecl>(TemplateOrInstantiation.getPointer());
185 return 0;
186}
187
188void CXXRecordDecl::setDescribedClassTemplate(ClassTemplateDecl *Template) {
189 TemplateOrInstantiation.setInt(0);
190 TemplateOrInstantiation.setPointer(Template);
191}
192
193ClassTemplateDecl *CXXRecordDecl::getDescribedClassTemplate() {
194 if (TemplateOrInstantiation.getInt() == 0)
195 return cast_or_null<ClassTemplateDecl>(
196 TemplateOrInstantiation.getPointer());
197 return 0;
198}
199
Ted Kremenek4b7c9832008-09-05 17:16:31 +0000200CXXMethodDecl *
201CXXMethodDecl::Create(ASTContext &C, CXXRecordDecl *RD,
Douglas Gregor10bd3682008-11-17 22:58:34 +0000202 SourceLocation L, DeclarationName N,
Douglas Gregor4afa39d2009-01-20 01:17:11 +0000203 QualType T, bool isStatic, bool isInline) {
Steve Naroff3e970492009-01-27 21:25:57 +0000204 return new (C) CXXMethodDecl(CXXMethod, RD, L, N, T, isStatic, isInline);
Ted Kremenek4b7c9832008-09-05 17:16:31 +0000205}
206
207QualType CXXMethodDecl::getThisType(ASTContext &C) const {
Argyrios Kyrtzidisb0d178d2008-10-24 22:28:18 +0000208 // C++ 9.3.2p1: The type of this in a member function of a class X is X*.
209 // If the member function is declared const, the type of this is const X*,
210 // if the member function is declared volatile, the type of this is
211 // volatile X*, and if the member function is declared const volatile,
212 // the type of this is const volatile X*.
213
Ted Kremenek4b7c9832008-09-05 17:16:31 +0000214 assert(isInstance() && "No 'this' for static methods!");
Douglas Gregor030ff0c2008-10-31 20:25:05 +0000215 QualType ClassTy = C.getTagDeclType(const_cast<CXXRecordDecl*>(getParent()));
Argyrios Kyrtzidis971c4fa2008-10-24 21:46:40 +0000216 ClassTy = ClassTy.getWithAdditionalQualifiers(getTypeQualifiers());
217 return C.getPointerType(ClassTy).withConst();
Ted Kremenek4b7c9832008-09-05 17:16:31 +0000218}
219
Douglas Gregor7ad83902008-11-05 04:29:56 +0000220CXXBaseOrMemberInitializer::
221CXXBaseOrMemberInitializer(QualType BaseType, Expr **Args, unsigned NumArgs)
222 : Args(0), NumArgs(0) {
223 BaseOrMember = reinterpret_cast<uintptr_t>(BaseType.getTypePtr());
224 assert((BaseOrMember & 0x01) == 0 && "Invalid base class type pointer");
225 BaseOrMember |= 0x01;
226
227 if (NumArgs > 0) {
228 this->NumArgs = NumArgs;
229 this->Args = new Expr*[NumArgs];
230 for (unsigned Idx = 0; Idx < NumArgs; ++Idx)
231 this->Args[Idx] = Args[Idx];
232 }
233}
234
235CXXBaseOrMemberInitializer::
Douglas Gregor44b43212008-12-11 16:49:14 +0000236CXXBaseOrMemberInitializer(FieldDecl *Member, Expr **Args, unsigned NumArgs)
Douglas Gregor7ad83902008-11-05 04:29:56 +0000237 : Args(0), NumArgs(0) {
238 BaseOrMember = reinterpret_cast<uintptr_t>(Member);
239 assert((BaseOrMember & 0x01) == 0 && "Invalid member pointer");
240
241 if (NumArgs > 0) {
242 this->NumArgs = NumArgs;
243 this->Args = new Expr*[NumArgs];
244 for (unsigned Idx = 0; Idx < NumArgs; ++Idx)
245 this->Args[Idx] = Args[Idx];
246 }
247}
248
249CXXBaseOrMemberInitializer::~CXXBaseOrMemberInitializer() {
250 delete [] Args;
251}
252
Douglas Gregorb48fe382008-10-31 09:07:45 +0000253CXXConstructorDecl *
254CXXConstructorDecl::Create(ASTContext &C, CXXRecordDecl *RD,
Douglas Gregor2e1cd422008-11-17 14:58:09 +0000255 SourceLocation L, DeclarationName N,
Douglas Gregorb48fe382008-10-31 09:07:45 +0000256 QualType T, bool isExplicit,
257 bool isInline, bool isImplicitlyDeclared) {
Douglas Gregor2e1cd422008-11-17 14:58:09 +0000258 assert(N.getNameKind() == DeclarationName::CXXConstructorName &&
259 "Name must refer to a constructor");
Steve Naroff3e970492009-01-27 21:25:57 +0000260 return new (C) CXXConstructorDecl(RD, L, N, T, isExplicit, isInline,
Douglas Gregorb48fe382008-10-31 09:07:45 +0000261 isImplicitlyDeclared);
262}
263
Douglas Gregor030ff0c2008-10-31 20:25:05 +0000264bool CXXConstructorDecl::isDefaultConstructor() const {
265 // C++ [class.ctor]p5:
Douglas Gregor64bffa92008-11-05 16:20:31 +0000266 // A default constructor for a class X is a constructor of class
267 // X that can be called without an argument.
Douglas Gregor030ff0c2008-10-31 20:25:05 +0000268 return (getNumParams() == 0) ||
Douglas Gregorf03d7c72008-11-05 15:29:30 +0000269 (getNumParams() > 0 && getParamDecl(0)->getDefaultArg() != 0);
Douglas Gregor030ff0c2008-10-31 20:25:05 +0000270}
271
272bool
273CXXConstructorDecl::isCopyConstructor(ASTContext &Context,
274 unsigned &TypeQuals) const {
275 // C++ [class.copy]p2:
Douglas Gregor64bffa92008-11-05 16:20:31 +0000276 // A non-template constructor for class X is a copy constructor
277 // if its first parameter is of type X&, const X&, volatile X& or
278 // const volatile X&, and either there are no other parameters
279 // or else all other parameters have default arguments (8.3.6).
Douglas Gregor030ff0c2008-10-31 20:25:05 +0000280 if ((getNumParams() < 1) ||
281 (getNumParams() > 1 && getParamDecl(1)->getDefaultArg() == 0))
282 return false;
283
284 const ParmVarDecl *Param = getParamDecl(0);
285
Sebastian Redl7c80bd62009-03-16 23:22:08 +0000286 // Do we have a reference type? Rvalue references don't count.
287 const LValueReferenceType *ParamRefType =
288 Param->getType()->getAsLValueReferenceType();
Douglas Gregor030ff0c2008-10-31 20:25:05 +0000289 if (!ParamRefType)
290 return false;
291
292 // Is it a reference to our class type?
293 QualType PointeeType
294 = Context.getCanonicalType(ParamRefType->getPointeeType());
295 QualType ClassTy
296 = Context.getTagDeclType(const_cast<CXXRecordDecl*>(getParent()));
297 if (PointeeType.getUnqualifiedType() != ClassTy)
298 return false;
299
300 // We have a copy constructor.
301 TypeQuals = PointeeType.getCVRQualifiers();
302 return true;
303}
304
Douglas Gregor60d62c22008-10-31 16:23:19 +0000305bool CXXConstructorDecl::isConvertingConstructor() const {
306 // C++ [class.conv.ctor]p1:
307 // A constructor declared without the function-specifier explicit
308 // that can be called with a single parameter specifies a
309 // conversion from the type of its first parameter to the type of
310 // its class. Such a constructor is called a converting
311 // constructor.
312 if (isExplicit())
313 return false;
314
315 return (getNumParams() == 0 &&
Douglas Gregor72564e72009-02-26 23:50:07 +0000316 getType()->getAsFunctionProtoType()->isVariadic()) ||
Douglas Gregor60d62c22008-10-31 16:23:19 +0000317 (getNumParams() == 1) ||
318 (getNumParams() > 1 && getParamDecl(1)->getDefaultArg() != 0);
319}
Douglas Gregorb48fe382008-10-31 09:07:45 +0000320
Douglas Gregor42a552f2008-11-05 20:51:48 +0000321CXXDestructorDecl *
322CXXDestructorDecl::Create(ASTContext &C, CXXRecordDecl *RD,
Douglas Gregor2e1cd422008-11-17 14:58:09 +0000323 SourceLocation L, DeclarationName N,
Douglas Gregor42a552f2008-11-05 20:51:48 +0000324 QualType T, bool isInline,
325 bool isImplicitlyDeclared) {
Douglas Gregor2e1cd422008-11-17 14:58:09 +0000326 assert(N.getNameKind() == DeclarationName::CXXDestructorName &&
327 "Name must refer to a destructor");
Steve Naroff3e970492009-01-27 21:25:57 +0000328 return new (C) CXXDestructorDecl(RD, L, N, T, isInline,
329 isImplicitlyDeclared);
Douglas Gregor42a552f2008-11-05 20:51:48 +0000330}
331
Douglas Gregor2f1bc522008-11-07 20:08:42 +0000332CXXConversionDecl *
333CXXConversionDecl::Create(ASTContext &C, CXXRecordDecl *RD,
Douglas Gregor2e1cd422008-11-17 14:58:09 +0000334 SourceLocation L, DeclarationName N,
Douglas Gregor2f1bc522008-11-07 20:08:42 +0000335 QualType T, bool isInline, bool isExplicit) {
Douglas Gregor2e1cd422008-11-17 14:58:09 +0000336 assert(N.getNameKind() == DeclarationName::CXXConversionFunctionName &&
337 "Name must refer to a conversion function");
Steve Naroff3e970492009-01-27 21:25:57 +0000338 return new (C) CXXConversionDecl(RD, L, N, T, isInline, isExplicit);
Douglas Gregor2f1bc522008-11-07 20:08:42 +0000339}
340
Douglas Gregor8e9bebd2008-10-21 16:13:35 +0000341OverloadedFunctionDecl *
342OverloadedFunctionDecl::Create(ASTContext &C, DeclContext *DC,
Douglas Gregor2e1cd422008-11-17 14:58:09 +0000343 DeclarationName N) {
Steve Naroff3e970492009-01-27 21:25:57 +0000344 return new (C) OverloadedFunctionDecl(DC, N);
Douglas Gregor8e9bebd2008-10-21 16:13:35 +0000345}
Chris Lattner21ef7ae2008-11-04 16:51:42 +0000346
347LinkageSpecDecl *LinkageSpecDecl::Create(ASTContext &C,
Douglas Gregor074149e2009-01-05 19:45:36 +0000348 DeclContext *DC,
Chris Lattner21ef7ae2008-11-04 16:51:42 +0000349 SourceLocation L,
Douglas Gregor074149e2009-01-05 19:45:36 +0000350 LanguageIDs Lang, bool Braces) {
Steve Naroff3e970492009-01-27 21:25:57 +0000351 return new (C) LinkageSpecDecl(DC, L, Lang, Braces);
Douglas Gregorf44515a2008-12-16 22:23:02 +0000352}
Douglas Gregor2a3009a2009-02-03 19:21:40 +0000353
354UsingDirectiveDecl *UsingDirectiveDecl::Create(ASTContext &C, DeclContext *DC,
355 SourceLocation L,
356 SourceLocation NamespaceLoc,
357 SourceLocation IdentLoc,
358 NamespaceDecl *Used,
359 DeclContext *CommonAncestor) {
360 return new (C) UsingDirectiveDecl(DC, L, NamespaceLoc, IdentLoc,
361 Used, CommonAncestor);
362}
363
Anders Carlsson68771c72009-03-28 22:58:02 +0000364NamespaceAliasDecl *NamespaceAliasDecl::Create(ASTContext &C, DeclContext *DC,
365 SourceLocation L,
366 SourceLocation AliasLoc,
367 IdentifierInfo *Alias,
368 SourceLocation IdentLoc,
369 NamedDecl *Namespace) {
370 return new (C) NamespaceAliasDecl(DC, L, AliasLoc, Alias, IdentLoc,
371 Namespace);
372}
373
Anders Carlssonfb311762009-03-14 00:25:26 +0000374StaticAssertDecl *StaticAssertDecl::Create(ASTContext &C, DeclContext *DC,
375 SourceLocation L, Expr *AssertExpr,
376 StringLiteral *Message) {
377 return new (C) StaticAssertDecl(DC, L, AssertExpr, Message);
378}
379
380void StaticAssertDecl::Destroy(ASTContext& C) {
381 AssertExpr->Destroy(C);
382 Message->Destroy(C);
383 this->~StaticAssertDecl();
384 C.Deallocate((void *)this);
385}
386
387StaticAssertDecl::~StaticAssertDecl() {
388}
389
Anders Carlsson05bf2c72009-03-26 23:46:50 +0000390static const char *getAccessName(AccessSpecifier AS) {
391 switch (AS) {
392 default:
393 case AS_none:
394 assert("Invalid access specifier!");
395 return 0;
396 case AS_public:
397 return "public";
398 case AS_private:
399 return "private";
400 case AS_protected:
401 return "protected";
402 }
403}
404
405const DiagnosticBuilder &clang::operator<<(const DiagnosticBuilder &DB,
406 AccessSpecifier AS) {
407 return DB << getAccessName(AS);
408}
409
410