 |
|
 |
|
| Files: |
1 |
|
Branches Taken: |
33.3% |
1 / 3 |
| Generated: |
2010-02-10 01:31 |
|
Branches Executed: |
66.7% |
2 / 3 |
| |
|
Line Coverage: |
51.2% |
214 / 418 |
| |
 |
|
 |
1 : //===--- Action.h - Parser Action Interface ---------------------*- C++ -*-===//
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 defines the Action and EmptyAction interface.
11 : //
12 : //===----------------------------------------------------------------------===//
13 :
14 : #ifndef LLVM_CLANG_PARSE_ACTION_H
15 : #define LLVM_CLANG_PARSE_ACTION_H
16 :
17 : #include "clang/Basic/IdentifierTable.h"
18 : #include "clang/Basic/SourceLocation.h"
19 : #include "clang/Basic/Specifiers.h"
20 : #include "clang/Basic/TemplateKinds.h"
21 : #include "clang/Basic/TypeTraits.h"
22 : #include "clang/Parse/DeclSpec.h"
23 : #include "clang/Parse/Ownership.h"
24 : #include "llvm/Support/PrettyStackTrace.h"
25 : #include "llvm/ADT/PointerUnion.h"
26 :
27 : namespace clang {
28 : // Semantic.
29 : class DeclSpec;
30 : class ObjCDeclSpec;
31 : class CXXScopeSpec;
32 : class Declarator;
33 : class AttributeList;
34 : struct FieldDeclarator;
35 : // Parse.
36 : class Scope;
37 : class Action;
38 : class Selector;
39 : class Designation;
40 : class InitListDesignations;
41 : // Lex.
42 : class Preprocessor;
43 : class Token;
44 :
45 : // We can re-use the low bit of expression, statement, base, and
46 : // member-initializer pointers for the "invalid" flag of
47 : // ActionResult.
48 : template<> struct IsResultPtrLowBitFree<0> { static const bool value = true;};
49 : template<> struct IsResultPtrLowBitFree<1> { static const bool value = true;};
50 : template<> struct IsResultPtrLowBitFree<3> { static const bool value = true;};
51 : template<> struct IsResultPtrLowBitFree<4> { static const bool value = true;};
52 : template<> struct IsResultPtrLowBitFree<5> { static const bool value = true;};
53 :
54 : /// Action - As the parser reads the input file and recognizes the productions
55 : /// of the grammar, it invokes methods on this class to turn the parsed input
56 : /// into something useful: e.g. a parse tree.
57 : ///
58 : /// The callback methods that this class provides are phrased as actions that
59 : /// the parser has just done or is about to do when the method is called. They
60 : /// are not requests that the actions module do the specified action.
61 : ///
62 : /// All of the methods here are optional except getTypeName() and
63 : /// isCurrentClassName(), which must be specified in order for the
64 : /// parse to complete accurately. The MinimalAction class does this
65 : /// bare-minimum of tracking to implement this functionality.
66 2251: class Action : public ActionBase {
67 : public:
68 : /// Out-of-line virtual destructor to provide home for this class.
69 : virtual ~Action();
70 :
71 : // Types - Though these don't actually enforce strong typing, they document
72 : // what types are required to be identical for the actions.
73 : typedef ActionBase::ExprTy ExprTy;
74 : typedef ActionBase::StmtTy StmtTy;
75 :
76 : /// Expr/Stmt/Type/BaseResult - Provide a unique type to wrap
77 : /// ExprTy/StmtTy/TypeTy/BaseTy, providing strong typing and
78 : /// allowing for failure.
79 : typedef ActionResult<0> ExprResult;
80 : typedef ActionResult<1> StmtResult;
81 : typedef ActionResult<2> TypeResult;
82 : typedef ActionResult<3> BaseResult;
83 : typedef ActionResult<4> MemInitResult;
84 : typedef ActionResult<5, DeclPtrTy> DeclResult;
85 :
86 : /// Same, but with ownership.
87 : typedef ASTOwningResult<&ActionBase::DeleteExpr> OwningExprResult;
88 : typedef ASTOwningResult<&ActionBase::DeleteStmt> OwningStmtResult;
89 : // Note that these will replace ExprResult and StmtResult when the transition
90 : // is complete.
91 :
92 : /// Single expressions or statements as arguments.
93 : #if !defined(DISABLE_SMART_POINTERS)
94 : typedef ASTOwningResult<&ActionBase::DeleteExpr> ExprArg;
95 : typedef ASTOwningResult<&ActionBase::DeleteStmt> StmtArg;
96 : #else
97 : typedef ASTOwningPtr<&ActionBase::DeleteExpr> ExprArg;
98 : typedef ASTOwningPtr<&ActionBase::DeleteStmt> StmtArg;
99 : #endif
100 :
101 : /// Multiple expressions or statements as arguments.
102 : typedef ASTMultiPtr<&ActionBase::DeleteExpr> MultiExprArg;
103 : typedef ASTMultiPtr<&ActionBase::DeleteStmt> MultiStmtArg;
104 : typedef ASTMultiPtr<&ActionBase::DeleteTemplateParams> MultiTemplateParamsArg;
105 :
106 13094: class FullExprArg {
107 : public:
108 : // FIXME: The const_cast here is ugly. RValue references would make this
109 : // much nicer (or we could duplicate a bunch of the move semantics
110 : // emulation code from Ownership.h).
111 1929: FullExprArg(const FullExprArg& Other)
112 1929: : Expr(move(const_cast<FullExprArg&>(Other).Expr)) {}
113 :
114 2340: OwningExprResult release() {
115 2340: return move(Expr);
116 : }
117 :
118 8802: ExprArg* operator->() {
119 8802: return &Expr;
120 : }
121 :
122 : private:
123 : // FIXME: No need to make the entire Action class a friend when it's just
124 : // Action::FullExpr that needs access to the constructor below.
125 : friend class Action;
126 :
127 11165: explicit FullExprArg(ExprArg expr)
128 11165: : Expr(move(expr)) {}
129 :
130 : ExprArg Expr;
131 : };
132 :
133 : template<typename T>
134 11165: FullExprArg MakeFullExpr(T &Arg) {
135 11165: return FullExprArg(ActOnFinishFullExpr(move(Arg)));
136 : }
137 :
138 : // Utilities for Action implementations to return smart results.
139 :
140 1211: OwningExprResult ExprError() { return OwningExprResult(*this, true); }
141 350: OwningStmtResult StmtError() { return OwningStmtResult(*this, true); }
142 :
143 72: OwningExprResult ExprError(const DiagnosticBuilder&) { return ExprError(); }
144 43: OwningStmtResult StmtError(const DiagnosticBuilder&) { return StmtError(); }
145 :
146 500: OwningExprResult ExprEmpty() { return OwningExprResult(*this, false); }
147 288: OwningStmtResult StmtEmpty() { return OwningStmtResult(*this, false); }
148 :
149 : /// Statistics.
150 2: virtual void PrintStats() const {}
151 :
152 : /// getDeclName - Return a pretty name for the specified decl if possible, or
153 : /// an empty string if not. This is used for pretty crash reporting.
154 0: virtual std::string getDeclName(DeclPtrTy D) { return ""; }
155 :
156 : /// \brief Invoked for each comment in the source code, providing the source
157 : /// range that contains the comment.
158 73: virtual void ActOnComment(SourceRange Comment) { }
159 :
160 : //===--------------------------------------------------------------------===//
161 : // Declaration Tracking Callbacks.
162 : //===--------------------------------------------------------------------===//
163 :
164 : typedef uintptr_t ParsingDeclStackState;
165 :
166 : /// PushParsingDeclaration - Notes that the parser has begun
167 : /// processing a declaration of some sort. Guaranteed to be matched
168 : /// by a call to PopParsingDeclaration with the value returned by
169 : /// this method.
170 545: virtual ParsingDeclStackState PushParsingDeclaration() {
171 545: return ParsingDeclStackState();
172 : }
173 :
174 : /// PopParsingDeclaration - Notes that the parser has completed
175 : /// processing a declaration of some sort. The decl will be empty
176 : /// if the declaration didn't correspond to a full declaration (or
177 : /// if the actions module returned an empty decl for it).
178 545: virtual void PopParsingDeclaration(ParsingDeclStackState S, DeclPtrTy D) {
179 545: }
180 :
181 : /// ConvertDeclToDeclGroup - If the parser has one decl in a context where it
182 : /// needs a decl group, it calls this to convert between the two
183 : /// representations.
184 96: virtual DeclGroupPtrTy ConvertDeclToDeclGroup(DeclPtrTy Ptr) {
185 96: return DeclGroupPtrTy();
186 : }
187 :
188 : /// getTypeName - Return non-null if the specified identifier is a type name
189 : /// in the current scope.
190 : ///
191 : /// \param II the identifier for which we are performing name lookup
192 : ///
193 : /// \param NameLoc the location of the identifier
194 : ///
195 : /// \param S the scope in which this name lookup occurs
196 : ///
197 : /// \param SS if non-NULL, the C++ scope specifier that precedes the
198 : /// identifier
199 : ///
200 : /// \param isClassName whether this is a C++ class-name production, in
201 : /// which we can end up referring to a member of an unknown specialization
202 : /// that we know (from the grammar) is supposed to be a type. For example,
203 : /// this occurs when deriving from "std::vector<T>::allocator_type", where T
204 : /// is a template parameter.
205 : ///
206 : /// \param ObjectType if we're checking whether an identifier is a type
207 : /// within a C++ member access expression, this will be the type of the
208 : ///
209 : /// \returns the type referred to by this identifier, or NULL if the type
210 : /// does not name an identifier.
211 : virtual TypeTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
212 : Scope *S, const CXXScopeSpec *SS = 0,
213 : bool isClassName = false,
214 : TypeTy *ObjectType = 0) = 0;
215 :
216 : /// isTagName() - This method is called *for error recovery purposes only*
217 : /// to determine if the specified name is a valid tag name ("struct foo"). If
218 : /// so, this returns the TST for the tag corresponding to it (TST_enum,
219 : /// TST_union, TST_struct, TST_class). This is used to diagnose cases in C
220 : /// where the user forgot to specify the tag.
221 0: virtual DeclSpec::TST isTagName(IdentifierInfo &II, Scope *S) {
222 0: return DeclSpec::TST_unspecified;
223 : }
224 :
225 : /// \brief Action called as part of error recovery when the parser has
226 : /// determined that the given name must refer to a type, but
227 : /// \c getTypeName() did not return a result.
228 : ///
229 : /// This callback permits the action to give a detailed diagnostic when an
230 : /// unknown type name is encountered and, potentially, to try to recover
231 : /// by producing a new type in \p SuggestedType.
232 : ///
233 : /// \param II the name that should be a type.
234 : ///
235 : /// \param IILoc the location of the name in the source.
236 : ///
237 : /// \param S the scope in which name lookup was performed.
238 : ///
239 : /// \param SS if non-NULL, the C++ scope specifier that preceded the name.
240 : ///
241 : /// \param SuggestedType if the action sets this type to a non-NULL type,
242 : /// the parser will recovery by consuming the type name token and then
243 : /// pretending that the given type was the type it parsed.
244 : ///
245 : /// \returns true if a diagnostic was emitted, false otherwise. When false,
246 : /// the parser itself will emit a generic "unknown type name" diagnostic.
247 : virtual bool DiagnoseUnknownTypeName(const IdentifierInfo &II,
248 : SourceLocation IILoc,
249 : Scope *S,
250 : const CXXScopeSpec *SS,
251 0: TypeTy *&SuggestedType) {
252 0: return false;
253 : }
254 :
255 : /// isCurrentClassName - Return true if the specified name is the
256 : /// name of the innermost C++ class type currently being defined.
257 : virtual bool isCurrentClassName(const IdentifierInfo &II, Scope *S,
258 : const CXXScopeSpec *SS = 0) = 0;
259 :
260 : /// \brief Determine whether the given name refers to a template.
261 : ///
262 : /// This callback is used by the parser after it has seen a '<' to determine
263 : /// whether the given name refers to a template and, if so, what kind of
264 : /// template.
265 : ///
266 : /// \param S the scope in which the name occurs.
267 : ///
268 : /// \param SS the C++ nested-name-specifier that precedes the template name,
269 : /// if any.
270 : ///
271 : /// \param Name the name that we are querying to determine whether it is
272 : /// a template.
273 : ///
274 : /// \param ObjectType if we are determining whether the given name is a
275 : /// template name in the context of a member access expression (e.g.,
276 : /// \c p->X<int>), this is the type of the object referred to by the
277 : /// member access (e.g., \c p).
278 : ///
279 : /// \param EnteringContext whether we are potentially entering the context
280 : /// referred to by the nested-name-specifier \p SS, which allows semantic
281 : /// analysis to look into uninstantiated templates.
282 : ///
283 : /// \param Template if the name does refer to a template, the declaration
284 : /// of the template that the name refers to.
285 : ///
286 : /// \returns the kind of template that this name refers to.
287 : virtual TemplateNameKind isTemplateName(Scope *S,
288 : const CXXScopeSpec &SS,
289 : UnqualifiedId &Name,
290 : TypeTy *ObjectType,
291 : bool EnteringContext,
292 : TemplateTy &Template) = 0;
293 :
294 : /// \brief Action called as part of error recovery when the parser has
295 : /// determined that the given name must refer to a template, but
296 : /// \c isTemplateName() did not return a result.
297 : ///
298 : /// This callback permits the action to give a detailed diagnostic when an
299 : /// unknown template name is encountered and, potentially, to try to recover
300 : /// by producing a new template in \p SuggestedTemplate.
301 : ///
302 : /// \param II the name that should be a template.
303 : ///
304 : /// \param IILoc the location of the name in the source.
305 : ///
306 : /// \param S the scope in which name lookup was performed.
307 : ///
308 : /// \param SS the C++ scope specifier that preceded the name.
309 : ///
310 : /// \param SuggestedTemplate if the action sets this template to a non-NULL,
311 : /// template, the parser will recover by consuming the template name token
312 : /// and the template argument list that follows.
313 : ///
314 : /// \param SuggestedTemplateKind as input, the kind of template that we
315 : /// expect (e.g., \c TNK_Type_template or \c TNK_Function_template). If the
316 : /// action provides a suggested template, this should be set to the kind of
317 : /// template.
318 : ///
319 : /// \returns true if a diagnostic was emitted, false otherwise. When false,
320 : /// the parser itself will emit a generic "unknown template name" diagnostic.
321 : virtual bool DiagnoseUnknownTemplateName(const IdentifierInfo &II,
322 : SourceLocation IILoc,
323 : Scope *S,
324 : const CXXScopeSpec *SS,
325 : TemplateTy &SuggestedTemplate,
326 0: TemplateNameKind &SuggestedKind) {
327 0: return false;
328 : }
329 :
330 : /// ActOnCXXGlobalScopeSpecifier - Return the object that represents the
331 : /// global scope ('::').
332 : virtual CXXScopeTy *ActOnCXXGlobalScopeSpecifier(Scope *S,
333 0: SourceLocation CCLoc) {
334 0: return 0;
335 : }
336 :
337 : /// \brief Parsed an identifier followed by '::' in a C++
338 : /// nested-name-specifier.
339 : ///
340 : /// \param S the scope in which the nested-name-specifier was parsed.
341 : ///
342 : /// \param SS the nested-name-specifier that precedes the identifier. For
343 : /// example, if we are parsing "foo::bar::", \p SS will describe the "foo::"
344 : /// that has already been parsed.
345 : ///
346 : /// \param IdLoc the location of the identifier we have just parsed (e.g.,
347 : /// the "bar" in "foo::bar::".
348 : ///
349 : /// \param CCLoc the location of the '::' at the end of the
350 : /// nested-name-specifier.
351 : ///
352 : /// \param II the identifier that represents the scope that this
353 : /// nested-name-specifier refers to, e.g., the "bar" in "foo::bar::".
354 : ///
355 : /// \param ObjectType if this nested-name-specifier occurs as part of a
356 : /// C++ member access expression such as "x->Base::f", the type of the base
357 : /// object (e.g., *x in the example, if "x" were a pointer).
358 : ///
359 : /// \param EnteringContext if true, then we intend to immediately enter the
360 : /// context of this nested-name-specifier, e.g., for an out-of-line
361 : /// definition of a class member.
362 : ///
363 : /// \returns a CXXScopeTy* object representing the C++ scope.
364 : virtual CXXScopeTy *ActOnCXXNestedNameSpecifier(Scope *S,
365 : const CXXScopeSpec &SS,
366 : SourceLocation IdLoc,
367 : SourceLocation CCLoc,
368 : IdentifierInfo &II,
369 : TypeTy *ObjectType,
370 1: bool EnteringContext) {
371 1: return 0;
372 : }
373 :
374 : /// IsInvalidUnlessNestedName - This method is used for error recovery
375 : /// purposes to determine whether the specified identifier is only valid as
376 : /// a nested name specifier, for example a namespace name. It is
377 : /// conservatively correct to always return false from this method.
378 : ///
379 : /// The arguments are the same as those passed to ActOnCXXNestedNameSpecifier.
380 : virtual bool IsInvalidUnlessNestedName(Scope *S,
381 : const CXXScopeSpec &SS,
382 : IdentifierInfo &II,
383 : TypeTy *ObjectType,
384 0: bool EnteringContext) {
385 0: return false;
386 : }
387 :
388 : /// ActOnCXXNestedNameSpecifier - Called during parsing of a
389 : /// nested-name-specifier that involves a template-id, e.g.,
390 : /// "foo::bar<int, float>::", and now we need to build a scope
391 : /// specifier. \p SS is empty or the previously parsed nested-name
392 : /// part ("foo::"), \p Type is the already-parsed class template
393 : /// specialization (or other template-id that names a type), \p
394 : /// TypeRange is the source range where the type is located, and \p
395 : /// CCLoc is the location of the trailing '::'.
396 : virtual CXXScopeTy *ActOnCXXNestedNameSpecifier(Scope *S,
397 : const CXXScopeSpec &SS,
398 : TypeTy *Type,
399 : SourceRange TypeRange,
400 0: SourceLocation CCLoc) {
401 0: return 0;
402 : }
403 :
404 : /// ShouldEnterDeclaratorScope - Called when a C++ scope specifier
405 : /// is parsed as part of a declarator-id to determine whether a scope
406 : /// should be entered.
407 : ///
408 : /// \param S the current scope
409 : /// \param SS the scope being entered
410 : /// \param isFriendDeclaration whether this is a friend declaration
411 0: virtual bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
412 0: return false;
413 : }
414 :
415 : /// ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global
416 : /// scope or nested-name-specifier) is parsed as part of a declarator-id.
417 : /// After this method is called, according to [C++ 3.4.3p3], names should be
418 : /// looked up in the declarator-id's scope, until the declarator is parsed and
419 : /// ActOnCXXExitDeclaratorScope is called.
420 : /// The 'SS' should be a non-empty valid CXXScopeSpec.
421 : /// \returns true if an error occurred, false otherwise.
422 0: virtual bool ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
423 0: return false;
424 : }
425 :
426 : /// ActOnCXXExitDeclaratorScope - Called when a declarator that previously
427 : /// invoked ActOnCXXEnterDeclaratorScope(), is finished. 'SS' is the same
428 : /// CXXScopeSpec that was passed to ActOnCXXEnterDeclaratorScope as well.
429 : /// Used to indicate that names should revert to being looked up in the
430 : /// defining scope.
431 0: virtual void ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
432 0: }
433 :
434 : /// ActOnCXXEnterDeclInitializer - Invoked when we are about to parse an
435 : /// initializer for the declaration 'Dcl'.
436 : /// After this method is called, according to [C++ 3.4.1p13], if 'Dcl' is a
437 : /// static data member of class X, names should be looked up in the scope of
438 : /// class X.
439 0: virtual void ActOnCXXEnterDeclInitializer(Scope *S, DeclPtrTy Dcl) {
440 0: }
441 :
442 : /// ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an
443 : /// initializer for the declaration 'Dcl'.
444 0: virtual void ActOnCXXExitDeclInitializer(Scope *S, DeclPtrTy Dcl) {
445 0: }
446 :
447 : /// ActOnDeclarator - This callback is invoked when a declarator is parsed and
448 : /// 'Init' specifies the initializer if any. This is for things like:
449 : /// "int X = 4" or "typedef int foo".
450 : ///
451 0: virtual DeclPtrTy ActOnDeclarator(Scope *S, Declarator &D) {
452 0: return DeclPtrTy();
453 : }
454 :
455 : /// ActOnParamDeclarator - This callback is invoked when a parameter
456 : /// declarator is parsed. This callback only occurs for functions
457 : /// with prototypes. S is the function prototype scope for the
458 : /// parameters (C++ [basic.scope.proto]).
459 35: virtual DeclPtrTy ActOnParamDeclarator(Scope *S, Declarator &D) {
460 35: return DeclPtrTy();
461 : }
462 4: virtual void ActOnObjCCatchParam(DeclPtrTy D) {
463 4: }
464 :
465 : /// AddInitializerToDecl - This action is called immediately after
466 : /// ActOnDeclarator (when an initializer is present). The code is factored
467 : /// this way to make sure we are able to handle the following:
468 : /// void func() { int xx = xx; }
469 : /// This allows ActOnDeclarator to register "xx" prior to parsing the
470 : /// initializer. The declaration above should still result in a warning,
471 : /// since the reference to "xx" is uninitialized.
472 56: virtual void AddInitializerToDecl(DeclPtrTy Dcl, ExprArg Init) {
473 : return;
474 : }
475 :
476 : /// SetDeclDeleted - This action is called immediately after ActOnDeclarator
477 : /// if =delete is parsed. C++0x [dcl.fct.def]p10
478 : /// Note that this can be called even for variable declarations. It's the
479 : /// action's job to reject it.
480 0: virtual void SetDeclDeleted(DeclPtrTy Dcl, SourceLocation DelLoc) {
481 : return;
482 : }
483 :
484 : /// ActOnUninitializedDecl - This action is called immediately after
485 : /// ActOnDeclarator (when an initializer is *not* present).
486 : /// If TypeContainsUndeducedAuto is true, then the type of the declarator
487 : /// has an undeduced 'auto' type somewhere.
488 : virtual void ActOnUninitializedDecl(DeclPtrTy Dcl,
489 101: bool TypeContainsUndeducedAuto) {
490 : return;
491 : }
492 :
493 : /// FinalizeDeclaratorGroup - After a sequence of declarators are parsed, this
494 : /// gives the actions implementation a chance to process the group as a whole.
495 : virtual DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, const DeclSpec& DS,
496 : DeclPtrTy *Group,
497 102: unsigned NumDecls) {
498 102: return DeclGroupPtrTy();
499 : }
500 :
501 :
502 : /// @brief Indicates that all K&R-style parameter declarations have
503 : /// been parsed prior to a function definition.
504 : /// @param S The function prototype scope.
505 : /// @param D The function declarator.
506 : virtual void ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D,
507 5: SourceLocation LocAfterDecls) {
508 5: }
509 :
510 : /// ActOnStartOfFunctionDef - This is called at the start of a function
511 : /// definition, instead of calling ActOnDeclarator. The Declarator includes
512 : /// information about formal arguments that are part of this function.
513 28: virtual DeclPtrTy ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) {
514 : // Default to ActOnDeclarator.
515 : return ActOnStartOfFunctionDef(FnBodyScope,
516 28: ActOnDeclarator(FnBodyScope, D));
517 : }
518 :
519 : /// ActOnStartOfFunctionDef - This is called at the start of a function
520 : /// definition, after the FunctionDecl has already been created.
521 28: virtual DeclPtrTy ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclPtrTy D) {
522 28: return D;
523 : }
524 :
525 3: virtual void ActOnStartOfObjCMethodDef(Scope *FnBodyScope, DeclPtrTy D) {
526 : return;
527 : }
528 :
529 : /// ActOnFinishFunctionBody - This is called when a function body has
530 : /// completed parsing. Decl is returned by ParseStartOfFunctionDef.
531 31: virtual DeclPtrTy ActOnFinishFunctionBody(DeclPtrTy Decl, StmtArg Body) {
532 31: return Decl;
533 : }
534 :
535 : virtual DeclPtrTy ActOnFileScopeAsmDecl(SourceLocation Loc,
536 1: ExprArg AsmString) {
537 1: return DeclPtrTy();
538 : }
539 :
540 : /// ActOnPopScope - This callback is called immediately before the specified
541 : /// scope is popped and deleted.
542 0: virtual void ActOnPopScope(SourceLocation Loc, Scope *S) {}
543 :
544 : /// ActOnTranslationUnitScope - This callback is called once, immediately
545 : /// after creating the translation unit scope (in Parser::Initialize).
546 0: virtual void ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {}
547 :
548 : /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
549 : /// no declarator (e.g. "struct foo;") is parsed.
550 7: virtual DeclPtrTy ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) {
551 7: return DeclPtrTy();
552 : }
553 :
554 : /// ActOnStartLinkageSpecification - Parsed the beginning of a C++
555 : /// linkage specification, including the language and (if present)
556 : /// the '{'. ExternLoc is the location of the 'extern', LangLoc is
557 : /// the location of the language string literal, which is provided
558 : /// by Lang/StrSize. LBraceLoc, if valid, provides the location of
559 : /// the '{' brace. Otherwise, this linkage specification does not
560 : /// have any braces.
561 : virtual DeclPtrTy ActOnStartLinkageSpecification(Scope *S,
562 : SourceLocation ExternLoc,
563 : SourceLocation LangLoc,
564 : const char *Lang,
565 : unsigned StrSize,
566 0: SourceLocation LBraceLoc) {
567 0: return DeclPtrTy();
568 : }
569 :
570 : /// ActOnFinishLinkageSpecification - Completely the definition of
571 : /// the C++ linkage specification LinkageSpec. If RBraceLoc is
572 : /// valid, it's the position of the closing '}' brace in a linkage
573 : /// specification that uses braces.
574 : virtual DeclPtrTy ActOnFinishLinkageSpecification(Scope *S,
575 : DeclPtrTy LinkageSpec,
576 0: SourceLocation RBraceLoc) {
577 0: return LinkageSpec;
578 : }
579 :
580 : /// ActOnEndOfTranslationUnit - This is called at the very end of the
581 : /// translation unit when EOF is reached and all but the top-level scope is
582 : /// popped.
583 15: virtual void ActOnEndOfTranslationUnit() {}
584 :
585 : //===--------------------------------------------------------------------===//
586 : // Type Parsing Callbacks.
587 : //===--------------------------------------------------------------------===//
588 :
589 : /// ActOnTypeName - A type-name (type-id in C++) was parsed.
590 103: virtual TypeResult ActOnTypeName(Scope *S, Declarator &D) {
591 103: return TypeResult();
592 : }
593 :
594 : enum TagUseKind {
595 : TUK_Reference, // Reference to a tag: 'struct foo *X;'
596 : TUK_Declaration, // Fwd decl of a tag: 'struct foo;'
597 : TUK_Definition, // Definition of a tag: 'struct foo { int X; } Y;'
598 : TUK_Friend // Friend declaration: 'friend struct foo;'
599 : };
600 :
601 : /// \brief The parser has encountered a tag (e.g., "class X") that should be
602 : /// turned into a declaration by the action module.
603 : ///
604 : /// \param S the scope in which this tag occurs.
605 : ///
606 : /// \param TagSpec an instance of DeclSpec::TST, indicating what kind of tag
607 : /// this is (struct/union/enum/class).
608 : ///
609 : /// \param TUK how the tag we have encountered is being used, which
610 : /// can be a reference to a (possibly pre-existing) tag, a
611 : /// declaration of that tag, or the beginning of a definition of
612 : /// that tag.
613 : ///
614 : /// \param KWLoc the location of the "struct", "class", "union", or "enum"
615 : /// keyword.
616 : ///
617 : /// \param SS C++ scope specifier that precedes the name of the tag, e.g.,
618 : /// the "std::" in "class std::type_info".
619 : ///
620 : /// \param Name the name of the tag, e.g., "X" in "struct X". This parameter
621 : /// may be NULL, to indicate an anonymous class/struct/union/enum type.
622 : ///
623 : /// \param NameLoc the location of the name of the tag.
624 : ///
625 : /// \param Attr the set of attributes that appertain to the tag.
626 : ///
627 : /// \param AS when this tag occurs within a C++ class, provides the
628 : /// current access specifier (AS_public, AS_private, AS_protected).
629 : /// Otherwise, it will be AS_none.
630 : ///
631 : /// \param TemplateParameterLists the set of C++ template parameter lists
632 : /// that apply to this tag, if the tag is a declaration or definition (see
633 : /// the \p TK parameter). The action module is responsible for determining,
634 : /// based on the template parameter lists and the scope specifier, whether
635 : /// the declared tag is a class template or not.
636 : ///
637 : /// \param OwnedDecl the callee should set this flag true when the returned
638 : /// declaration is "owned" by this reference. Ownership is handled entirely
639 : /// by the action module.
640 : ///
641 : /// \returns the declaration to which this tag refers.
642 : virtual DeclPtrTy ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
643 : SourceLocation KWLoc, const CXXScopeSpec &SS,
644 : IdentifierInfo *Name, SourceLocation NameLoc,
645 : AttributeList *Attr, AccessSpecifier AS,
646 : MultiTemplateParamsArg TemplateParameterLists,
647 15: bool &OwnedDecl, bool &IsDependent) {
648 15: return DeclPtrTy();
649 : }
650 :
651 : /// Acts on a reference to a dependent tag name. This arises in
652 : /// cases like:
653 : ///
654 : /// template <class T> class A;
655 : /// template <class T> class B {
656 : /// friend class A<T>::M; // here
657 : /// };
658 : ///
659 : /// \param TagSpec an instance of DeclSpec::TST corresponding to the
660 : /// tag specifier.
661 : ///
662 : /// \param TUK the tag use kind (either TUK_Friend or TUK_Reference)
663 : ///
664 : /// \param SS the scope specifier (always defined)
665 : virtual TypeResult ActOnDependentTag(Scope *S,
666 : unsigned TagSpec,
667 : TagUseKind TUK,
668 : const CXXScopeSpec &SS,
669 : IdentifierInfo *Name,
670 : SourceLocation KWLoc,
671 0: SourceLocation NameLoc) {
672 0: return TypeResult();
673 : }
674 :
675 : /// Act on @defs() element found when parsing a structure. ClassName is the
676 : /// name of the referenced class.
677 : virtual void ActOnDefs(Scope *S, DeclPtrTy TagD, SourceLocation DeclStart,
678 : IdentifierInfo *ClassName,
679 1: llvm::SmallVectorImpl<DeclPtrTy> &Decls) {}
680 : virtual DeclPtrTy ActOnField(Scope *S, DeclPtrTy TagD,
681 : SourceLocation DeclStart,
682 12: Declarator &D, ExprTy *BitfieldWidth) {
683 12: return DeclPtrTy();
684 : }
685 :
686 : virtual DeclPtrTy ActOnIvar(Scope *S, SourceLocation DeclStart,
687 : DeclPtrTy IntfDecl,
688 : Declarator &D, ExprTy *BitfieldWidth,
689 3: tok::ObjCKeywordKind visibility) {
690 3: return DeclPtrTy();
691 : }
692 :
693 : virtual void ActOnFields(Scope* S, SourceLocation RecLoc, DeclPtrTy TagDecl,
694 : DeclPtrTy *Fields, unsigned NumFields,
695 : SourceLocation LBrac, SourceLocation RBrac,
696 11: AttributeList *AttrList) {}
697 :
698 : /// ActOnTagStartDefinition - Invoked when we have entered the
699 : /// scope of a tag's definition (e.g., for an enumeration, class,
700 : /// struct, or union).
701 19: virtual void ActOnTagStartDefinition(Scope *S, DeclPtrTy TagDecl) { }
702 :
703 : /// ActOnStartCXXMemberDeclarations - Invoked when we have parsed a
704 : /// C++ record definition's base-specifiers clause and are starting its
705 : /// member declarations.
706 : virtual void ActOnStartCXXMemberDeclarations(Scope *S, DeclPtrTy TagDecl,
707 0: SourceLocation LBraceLoc) { }
708 :
709 : /// ActOnTagFinishDefinition - Invoked once we have finished parsing
710 : /// the definition of a tag (enumeration, class, struct, or union).
711 : virtual void ActOnTagFinishDefinition(Scope *S, DeclPtrTy TagDecl,
712 19: SourceLocation RBraceLoc) { }
713 :
714 : virtual DeclPtrTy ActOnEnumConstant(Scope *S, DeclPtrTy EnumDecl,
715 : DeclPtrTy LastEnumConstant,
716 : SourceLocation IdLoc, IdentifierInfo *Id,
717 1: SourceLocation EqualLoc, ExprTy *Val) {
718 1: return DeclPtrTy();
719 : }
720 : virtual void ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
721 : SourceLocation RBraceLoc, DeclPtrTy EnumDecl,
722 : DeclPtrTy *Elements, unsigned NumElements,
723 1: Scope *S, AttributeList *AttrList) {}
724 :
725 : //===--------------------------------------------------------------------===//
726 : // Statement Parsing Callbacks.
727 : //===--------------------------------------------------------------------===//
728 :
729 10: virtual OwningStmtResult ActOnNullStmt(SourceLocation SemiLoc) {
730 10: return StmtEmpty();
731 : }
732 :
733 : virtual OwningStmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R,
734 : MultiStmtArg Elts,
735 46: bool isStmtExpr) {
736 46: return StmtEmpty();
737 : }
738 : virtual OwningStmtResult ActOnDeclStmt(DeclGroupPtrTy Decl,
739 : SourceLocation StartLoc,
740 76: SourceLocation EndLoc) {
741 76: return StmtEmpty();
742 : }
743 :
744 2: virtual void ActOnForEachDeclStmt(DeclGroupPtrTy Decl) {
745 2: }
746 :
747 39: virtual OwningStmtResult ActOnExprStmt(FullExprArg Expr) {
748 39: return OwningStmtResult(*this, Expr->release());
749 : }
750 :
751 : /// ActOnCaseStmt - Note that this handles the GNU 'case 1 ... 4' extension,
752 : /// which can specify an RHS value. The sub-statement of the case is
753 : /// specified in a separate action.
754 : virtual OwningStmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprArg LHSVal,
755 : SourceLocation DotDotDotLoc,
756 : ExprArg RHSVal,
757 2: SourceLocation ColonLoc) {
758 2: return StmtEmpty();
759 : }
760 :
761 : /// ActOnCaseStmtBody - This installs a statement as the body of a case.
762 4: virtual void ActOnCaseStmtBody(StmtTy *CaseStmt, StmtArg SubStmt) {}
763 :
764 : virtual OwningStmtResult ActOnDefaultStmt(SourceLocation DefaultLoc,
765 : SourceLocation ColonLoc,
766 1: StmtArg SubStmt, Scope *CurScope){
767 1: return StmtEmpty();
768 : }
769 :
770 : virtual OwningStmtResult ActOnLabelStmt(SourceLocation IdentLoc,
771 : IdentifierInfo *II,
772 : SourceLocation ColonLoc,
773 1: StmtArg SubStmt) {
774 1: return StmtEmpty();
775 : }
776 :
777 : /// \brief Parsed an "if" statement.
778 : ///
779 : /// \param IfLoc the location of the "if" keyword.
780 : ///
781 : /// \param CondVal if the "if" condition was parsed as an expression,
782 : /// the expression itself.
783 : ///
784 : /// \param CondVar if the "if" condition was parsed as a condition variable,
785 : /// the condition variable itself.
786 : ///
787 : /// \param ThenVal the "then" statement.
788 : ///
789 : /// \param ElseLoc the location of the "else" keyword.
790 : ///
791 : /// \param ElseVal the "else" statement.
792 : virtual OwningStmtResult ActOnIfStmt(SourceLocation IfLoc,
793 : FullExprArg CondVal,
794 : DeclPtrTy CondVar,
795 : StmtArg ThenVal,
796 : SourceLocation ElseLoc,
797 4: StmtArg ElseVal) {
798 4: return StmtEmpty();
799 : }
800 :
801 : /// \brief Parsed the start of a "switch" statement.
802 : ///
803 : /// \param Cond if the "switch" condition was parsed as an expression,
804 : /// the expression itself.
805 : ///
806 : /// \param CondVar if the "switch" condition was parsed as a condition
807 : /// variable, the condition variable itself.
808 : virtual OwningStmtResult ActOnStartOfSwitchStmt(FullExprArg Cond,
809 2: DeclPtrTy CondVar) {
810 2: return StmtEmpty();
811 : }
812 :
813 : /// ActOnSwitchBodyError - This is called if there is an error parsing the
814 : /// body of the switch stmt instead of ActOnFinishSwitchStmt.
815 : virtual void ActOnSwitchBodyError(SourceLocation SwitchLoc, StmtArg Switch,
816 1: StmtArg Body) {}
817 :
818 : virtual OwningStmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc,
819 1: StmtArg Switch, StmtArg Body) {
820 1: return StmtEmpty();
821 : }
822 :
823 : /// \brief Parsed a "while" statement.
824 : ///
825 : /// \param Cond if the "while" condition was parsed as an expression,
826 : /// the expression itself.
827 : ///
828 : /// \param CondVar if the "while" condition was parsed as a condition
829 : /// variable, the condition variable itself.
830 : ///
831 : /// \param Body the body of the "while" loop.
832 : virtual OwningStmtResult ActOnWhileStmt(SourceLocation WhileLoc,
833 : FullExprArg Cond, DeclPtrTy CondVar,
834 2: StmtArg Body) {
835 2: return StmtEmpty();
836 : }
837 : virtual OwningStmtResult ActOnDoStmt(SourceLocation DoLoc, StmtArg Body,
838 : SourceLocation WhileLoc,
839 : SourceLocation CondLParen,
840 : ExprArg Cond,
841 1: SourceLocation CondRParen) {
842 1: return StmtEmpty();
843 : }
844 :
845 : /// \brief Parsed a "for" statement.
846 : ///
847 : /// \param ForLoc the location of the "for" keyword.
848 : ///
849 : /// \param LParenLoc the location of the left parentheses.
850 : ///
851 : /// \param First the statement used to initialize the for loop.
852 : ///
853 : /// \param Second the condition to be checked during each iteration, if
854 : /// that condition was parsed as an expression.
855 : ///
856 : /// \param SecondArg the condition variable to be checked during each
857 : /// iterator, if that condition was parsed as a variable declaration.
858 : ///
859 : /// \param Third the expression that will be evaluated to "increment" any
860 : /// values prior to the next iteration.
861 : ///
862 : /// \param RParenLoc the location of the right parentheses.
863 : ///
864 : /// \param Body the body of the "body" loop.
865 : virtual OwningStmtResult ActOnForStmt(SourceLocation ForLoc,
866 : SourceLocation LParenLoc,
867 : StmtArg First, FullExprArg Second,
868 : DeclPtrTy SecondVar, FullExprArg Third,
869 : SourceLocation RParenLoc,
870 2: StmtArg Body) {
871 2: return StmtEmpty();
872 : }
873 :
874 : virtual OwningStmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc,
875 : SourceLocation LParenLoc,
876 : StmtArg First, ExprArg Second,
877 1: SourceLocation RParenLoc, StmtArg Body) {
878 1: return StmtEmpty();
879 : }
880 : virtual OwningStmtResult ActOnGotoStmt(SourceLocation GotoLoc,
881 : SourceLocation LabelLoc,
882 1: IdentifierInfo *LabelII) {
883 1: return StmtEmpty();
884 : }
885 : virtual OwningStmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc,
886 : SourceLocation StarLoc,
887 1: ExprArg DestExp) {
888 1: return StmtEmpty();
889 : }
890 : virtual OwningStmtResult ActOnContinueStmt(SourceLocation ContinueLoc,
891 1: Scope *CurScope) {
892 1: return StmtEmpty();
893 : }
894 : virtual OwningStmtResult ActOnBreakStmt(SourceLocation GotoLoc,
895 4: Scope *CurScope) {
896 4: return StmtEmpty();
897 : }
898 : virtual OwningStmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
899 6: ExprArg RetValExp) {
900 6: return StmtEmpty();
901 : }
902 : virtual OwningStmtResult ActOnAsmStmt(SourceLocation AsmLoc,
903 : bool IsSimple,
904 : bool IsVolatile,
905 : unsigned NumOutputs,
906 : unsigned NumInputs,
907 : IdentifierInfo **Names,
908 : MultiExprArg Constraints,
909 : MultiExprArg Exprs,
910 : ExprArg AsmString,
911 : MultiExprArg Clobbers,
912 : SourceLocation RParenLoc,
913 1: bool MSAsm = false) {
914 1: return StmtEmpty();
915 : }
916 :
917 : // Objective-c statements
918 : virtual OwningStmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
919 : SourceLocation RParen,
920 : DeclPtrTy Parm, StmtArg Body,
921 2: StmtArg CatchList) {
922 2: return StmtEmpty();
923 : }
924 :
925 : virtual OwningStmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
926 1: StmtArg Body) {
927 1: return StmtEmpty();
928 : }
929 :
930 : virtual OwningStmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc,
931 : StmtArg Try, StmtArg Catch,
932 1: StmtArg Finally) {
933 1: return StmtEmpty();
934 : }
935 :
936 : virtual OwningStmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
937 : ExprArg Throw,
938 2: Scope *CurScope) {
939 2: return StmtEmpty();
940 : }
941 :
942 : virtual OwningStmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
943 : ExprArg SynchExpr,
944 1: StmtArg SynchBody) {
945 1: return StmtEmpty();
946 : }
947 :
948 : // C++ Statements
949 0: virtual DeclPtrTy ActOnExceptionDeclarator(Scope *S, Declarator &D) {
950 0: return DeclPtrTy();
951 : }
952 :
953 : virtual OwningStmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc,
954 : DeclPtrTy ExceptionDecl,
955 0: StmtArg HandlerBlock) {
956 0: return StmtEmpty();
957 : }
958 :
959 : virtual OwningStmtResult ActOnCXXTryBlock(SourceLocation TryLoc,
960 : StmtArg TryBlock,
961 0: MultiStmtArg Handlers) {
962 0: return StmtEmpty();
963 : }
964 :
965 : //===--------------------------------------------------------------------===//
966 : // Expression Parsing Callbacks.
967 : //===--------------------------------------------------------------------===//
968 :
969 : /// \brief Describes how the expressions currently being parsed are
970 : /// evaluated at run-time, if at all.
971 : enum ExpressionEvaluationContext {
972 : /// \brief The current expression and its subexpressions occur within an
973 : /// unevaluated operand (C++0x [expr]p8), such as a constant expression
974 : /// or the subexpression of \c sizeof, where the type or the value of the
975 : /// expression may be significant but no code will be generated to evaluate
976 : /// the value of the expression at run time.
977 : Unevaluated,
978 :
979 : /// \brief The current expression is potentially evaluated at run time,
980 : /// which means that code may be generated to evaluate the value of the
981 : /// expression at run time.
982 : PotentiallyEvaluated,
983 :
984 : /// \brief The current expression may be potentially evaluated or it may
985 : /// be unevaluated, but it is impossible to tell from the lexical context.
986 : /// This evaluation context is used primary for the operand of the C++
987 : /// \c typeid expression, whose argument is potentially evaluated only when
988 : /// it is an lvalue of polymorphic class type (C++ [basic.def.odr]p2).
989 : PotentiallyPotentiallyEvaluated
990 : };
991 :
992 : /// \brief The parser is entering a new expression evaluation context.
993 : ///
994 : /// \param NewContext is the new expression evaluation context.
995 : virtual void
996 13: PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext) { }
997 :
998 : /// \brief The parser is exiting an expression evaluation context.
999 : virtual void
1000 13: PopExpressionEvaluationContext() { }
1001 :
1002 : // Primary Expressions.
1003 :
1004 : /// \brief Retrieve the source range that corresponds to the given
1005 : /// expression.
1006 0: virtual SourceRange getExprRange(ExprTy *E) const {
1007 0: return SourceRange();
1008 : }
1009 :
1010 : /// \brief Parsed an id-expression (C++) or identifier (C) in expression
1011 : /// context, e.g., the expression "x" that refers to a variable named "x".
1012 : ///
1013 : /// \param S the scope in which this id-expression or identifier occurs.
1014 : ///
1015 : /// \param SS the C++ nested-name-specifier that qualifies the name of the
1016 : /// value, e.g., "std::" in "std::sort".
1017 : ///
1018 : /// \param Name the name to which the id-expression refers. In C, this will
1019 : /// always be an identifier. In C++, it may also be an overloaded operator,
1020 : /// destructor name (if there is a nested-name-specifier), or template-id.
1021 : ///
1022 : /// \param HasTrailingLParen whether the next token following the
1023 : /// id-expression or identifier is a left parentheses ('(').
1024 : ///
1025 : /// \param IsAddressOfOperand whether the token that precedes this
1026 : /// id-expression or identifier was an ampersand ('&'), indicating that
1027 : /// we will be taking the address of this expression.
1028 : virtual OwningExprResult ActOnIdExpression(Scope *S,
1029 : const CXXScopeSpec &SS,
1030 : UnqualifiedId &Name,
1031 : bool HasTrailingLParen,
1032 173: bool IsAddressOfOperand) {
1033 173: return ExprEmpty();
1034 : }
1035 :
1036 : virtual OwningExprResult ActOnPredefinedExpr(SourceLocation Loc,
1037 7: tok::TokenKind Kind) {
1038 7: return ExprEmpty();
1039 : }
1040 1: virtual OwningExprResult ActOnCharacterConstant(const Token &) {
1041 1: return ExprEmpty();
1042 : }
1043 95: virtual OwningExprResult ActOnNumericConstant(const Token &) {
1044 95: return ExprEmpty();
1045 : }
1046 :
1047 : /// ActOnStringLiteral - The specified tokens were lexed as pasted string
1048 : /// fragments (e.g. "foo" "bar" L"baz").
1049 : virtual OwningExprResult ActOnStringLiteral(const Token *Toks,
1050 7: unsigned NumToks) {
1051 7: return ExprEmpty();
1052 : }
1053 :
1054 : virtual OwningExprResult ActOnParenExpr(SourceLocation L, SourceLocation R,
1055 16: ExprArg Val) {
1056 16: return move(Val); // Default impl returns operand.
1057 : }
1058 :
1059 : virtual OwningExprResult ActOnParenOrParenListExpr(SourceLocation L,
1060 : SourceLocation R,
1061 : MultiExprArg Val,
1062 0: TypeTy *TypeOfCast=0) {
1063 0: return ExprEmpty();
1064 : }
1065 :
1066 : // Postfix Expressions.
1067 : virtual OwningExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc,
1068 : tok::TokenKind Kind,
1069 1: ExprArg Input) {
1070 1: return ExprEmpty();
1071 : }
1072 : virtual OwningExprResult ActOnArraySubscriptExpr(Scope *S, ExprArg Base,
1073 : SourceLocation LLoc,
1074 : ExprArg Idx,
1075 5: SourceLocation RLoc) {
1076 5: return ExprEmpty();
1077 : }
1078 :
1079 : /// \brief Parsed a member access expresion (C99 6.5.2.3, C++ [expr.ref])
1080 : /// of the form \c x.m or \c p->m.
1081 : ///
1082 : /// \param S the scope in which the member access expression occurs.
1083 : ///
1084 : /// \param Base the class or pointer to class into which this member
1085 : /// access expression refers, e.g., \c x in \c x.m.
1086 : ///
1087 : /// \param OpLoc the location of the "." or "->" operator.
1088 : ///
1089 : /// \param OpKind the kind of member access operator, which will be either
1090 : /// tok::arrow ("->") or tok::period (".").
1091 : ///
1092 : /// \param SS in C++, the nested-name-specifier that precedes the member
1093 : /// name, if any.
1094 : ///
1095 : /// \param Member the name of the member that we are referring to. In C,
1096 : /// this will always store an identifier; in C++, we may also have operator
1097 : /// names, conversion function names, destructors, and template names.
1098 : ///
1099 : /// \param ObjCImpDecl the Objective-C implementation declaration.
1100 : /// FIXME: Do we really need this?
1101 : ///
1102 : /// \param HasTrailingLParen whether this member name is immediately followed
1103 : /// by a left parentheses ('(').
1104 : virtual OwningExprResult ActOnMemberAccessExpr(Scope *S, ExprArg Base,
1105 : SourceLocation OpLoc,
1106 : tok::TokenKind OpKind,
1107 : const CXXScopeSpec &SS,
1108 : UnqualifiedId &Member,
1109 : DeclPtrTy ObjCImpDecl,
1110 18: bool HasTrailingLParen) {
1111 18: return ExprEmpty();
1112 : }
1113 :
1114 : /// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
1115 : /// This provides the location of the left/right parens and a list of comma
1116 : /// locations. There are guaranteed to be one fewer commas than arguments,
1117 : /// unless there are zero arguments.
1118 : virtual OwningExprResult ActOnCallExpr(Scope *S, ExprArg Fn,
1119 : SourceLocation LParenLoc,
1120 : MultiExprArg Args,
1121 : SourceLocation *CommaLocs,
1122 11: SourceLocation RParenLoc) {
1123 11: return ExprEmpty();
1124 : }
1125 :
1126 : // Unary Operators. 'Tok' is the token for the operator.
1127 : virtual OwningExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
1128 18: tok::TokenKind Op, ExprArg Input) {
1129 18: return ExprEmpty();
1130 : }
1131 : virtual OwningExprResult
1132 : ActOnSizeOfAlignOfExpr(SourceLocation OpLoc, bool isSizeof, bool isType,
1133 6: void *TyOrEx, const SourceRange &ArgRange) {
1134 6: return ExprEmpty();
1135 : }
1136 :
1137 : virtual OwningExprResult ActOnCompoundLiteral(SourceLocation LParen,
1138 : TypeTy *Ty,
1139 : SourceLocation RParen,
1140 0: ExprArg Op) {
1141 0: return ExprEmpty();
1142 : }
1143 : virtual OwningExprResult ActOnInitList(SourceLocation LParenLoc,
1144 : MultiExprArg InitList,
1145 8: SourceLocation RParenLoc) {
1146 8: return ExprEmpty();
1147 : }
1148 : /// @brief Parsed a C99 designated initializer.
1149 : ///
1150 : /// @param Desig Contains the designation with one or more designators.
1151 : ///
1152 : /// @param Loc The location of the '=' or ':' prior to the
1153 : /// initialization expression.
1154 : ///
1155 : /// @param GNUSyntax If true, then this designated initializer used
1156 : /// the deprecated GNU syntax @c fieldname:foo or @c [expr]foo rather
1157 : /// than the C99 syntax @c .fieldname=foo or @c [expr]=foo.
1158 : ///
1159 : /// @param Init The value that the entity (or entities) described by
1160 : /// the designation will be initialized with.
1161 : virtual OwningExprResult ActOnDesignatedInitializer(Designation &Desig,
1162 : SourceLocation Loc,
1163 : bool GNUSyntax,
1164 4: OwningExprResult Init) {
1165 4: return ExprEmpty();
1166 : }
1167 :
1168 : virtual OwningExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
1169 : TypeTy *Ty, SourceLocation RParenLoc,
1170 5: ExprArg Op) {
1171 5: return ExprEmpty();
1172 : }
1173 :
1174 0: virtual bool TypeIsVectorType(TypeTy *Ty) {
1175 0: return false;
1176 : }
1177 :
1178 : virtual OwningExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc,
1179 : tok::TokenKind Kind,
1180 40: ExprArg LHS, ExprArg RHS) {
1181 40: return ExprEmpty();
1182 : }
1183 :
1184 : /// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
1185 : /// in the case of a the GNU conditional expr extension.
1186 : virtual OwningExprResult ActOnConditionalOp(SourceLocation QuestionLoc,
1187 : SourceLocation ColonLoc,
1188 : ExprArg Cond, ExprArg LHS,
1189 5: ExprArg RHS) {
1190 5: return ExprEmpty();
1191 : }
1192 :
1193 : //===---------------------- GNU Extension Expressions -------------------===//
1194 :
1195 : virtual OwningExprResult ActOnAddrLabel(SourceLocation OpLoc,
1196 : SourceLocation LabLoc,
1197 1: IdentifierInfo *LabelII) { // "&&foo"
1198 1: return ExprEmpty();
1199 : }
1200 :
1201 : virtual OwningExprResult ActOnStmtExpr(SourceLocation LPLoc, StmtArg SubStmt,
1202 0: SourceLocation RPLoc) { // "({..})"
1203 0: return ExprEmpty();
1204 : }
1205 :
1206 : // __builtin_offsetof(type, identifier(.identifier|[expr])*)
1207 290: struct OffsetOfComponent {
1208 : SourceLocation LocStart, LocEnd;
1209 : bool isBrackets; // true if [expr], false if .ident
1210 : union {
1211 : IdentifierInfo *IdentInfo;
1212 : ExprTy *E;
1213 : } U;
1214 : };
1215 :
1216 : virtual OwningExprResult ActOnBuiltinOffsetOf(Scope *S,
1217 : SourceLocation BuiltinLoc,
1218 : SourceLocation TypeLoc,
1219 : TypeTy *Arg1,
1220 : OffsetOfComponent *CompPtr,
1221 : unsigned NumComponents,
1222 2: SourceLocation RParenLoc) {
1223 2: return ExprEmpty();
1224 : }
1225 :
1226 : // __builtin_types_compatible_p(type1, type2)
1227 : virtual OwningExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
1228 : TypeTy *arg1, TypeTy *arg2,
1229 1: SourceLocation RPLoc) {
1230 1: return ExprEmpty();
1231 : }
1232 : // __builtin_choose_expr(constExpr, expr1, expr2)
1233 : virtual OwningExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
1234 : ExprArg cond, ExprArg expr1,
1235 0: ExprArg expr2, SourceLocation RPLoc){
1236 0: return ExprEmpty();
1237 : }
1238 :
1239 : // __builtin_va_arg(expr, type)
1240 : virtual OwningExprResult ActOnVAArg(SourceLocation BuiltinLoc,
1241 : ExprArg expr, TypeTy *type,
1242 1: SourceLocation RPLoc) {
1243 1: return ExprEmpty();
1244 : }
1245 :
1246 : /// ActOnGNUNullExpr - Parsed the GNU __null expression, the token
1247 : /// for which is at position TokenLoc.
1248 0: virtual OwningExprResult ActOnGNUNullExpr(SourceLocation TokenLoc) {
1249 0: return ExprEmpty();
1250 : }
1251 :
1252 : //===------------------------- "Block" Extension ------------------------===//
1253 :
1254 : /// ActOnBlockStart - This callback is invoked when a block literal is
1255 : /// started. The result pointer is passed into the block finalizers.
1256 1: virtual void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope) {}
1257 :
1258 : /// ActOnBlockArguments - This callback allows processing of block arguments.
1259 : /// If there are no arguments, this is still invoked.
1260 1: virtual void ActOnBlockArguments(Declarator &ParamInfo, Scope *CurScope) {}
1261 :
1262 : /// ActOnBlockError - If there is an error parsing a block, this callback
1263 : /// is invoked to pop the information about the block from the action impl.
1264 0: virtual void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope) {}
1265 :
1266 : /// ActOnBlockStmtExpr - This is called when the body of a block statement
1267 : /// literal was successfully completed. ^(int x){...}
1268 : virtual OwningExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc,
1269 : StmtArg Body,
1270 1: Scope *CurScope) {
1271 1: return ExprEmpty();
1272 : }
1273 :
1274 : //===------------------------- C++ Declarations -------------------------===//
1275 :
1276 : /// ActOnStartNamespaceDef - This is called at the start of a namespace
1277 : /// definition.
1278 : virtual DeclPtrTy ActOnStartNamespaceDef(Scope *S, SourceLocation IdentLoc,
1279 : IdentifierInfo *Ident,
1280 : SourceLocation LBrace,
1281 0: AttributeList *AttrList) {
1282 0: return DeclPtrTy();
1283 : }
1284 :
1285 : /// ActOnFinishNamespaceDef - This callback is called after a namespace is
1286 : /// exited. Decl is returned by ActOnStartNamespaceDef.
1287 0: virtual void ActOnFinishNamespaceDef(DeclPtrTy Dcl, SourceLocation RBrace) {
1288 : return;
1289 : }
1290 :
1291 : /// ActOnUsingDirective - This is called when using-directive is parsed.
1292 : virtual DeclPtrTy ActOnUsingDirective(Scope *CurScope,
1293 : SourceLocation UsingLoc,
1294 : SourceLocation NamespcLoc,
1295 : const CXXScopeSpec &SS,
1296 : SourceLocation IdentLoc,
1297 : IdentifierInfo *NamespcName,
1298 : AttributeList *AttrList);
1299 :
1300 : /// ActOnNamespaceAliasDef - This is called when a namespace alias definition
1301 : /// is parsed.
1302 : virtual DeclPtrTy ActOnNamespaceAliasDef(Scope *CurScope,
1303 : SourceLocation NamespaceLoc,
1304 : SourceLocation AliasLoc,
1305 : IdentifierInfo *Alias,
1306 : const CXXScopeSpec &SS,
1307 : SourceLocation IdentLoc,
1308 1: IdentifierInfo *Ident) {
1309 1: return DeclPtrTy();
1310 : }
1311 :
1312 : /// \brief Parsed a C++ using-declaration.
1313 : ///
1314 : /// This callback will be invoked when the parser has parsed a C++
1315 : /// using-declaration, e.g.,
1316 : ///
1317 : /// \code
1318 : /// namespace std {
1319 : /// template<typename T, typename Alloc> class vector;
1320 : /// }
1321 : ///
1322 : /// using std::vector; // using-declaration here
1323 : /// \endcode
1324 : ///
1325 : /// \param CurScope the scope in which this using declaration was parsed.
1326 : ///
1327 : /// \param AS the currently-active access specifier.
1328 : ///
1329 : /// \param HasUsingKeyword true if this was declared with an
1330 : /// explicit 'using' keyword (i.e. if this is technically a using
1331 : /// declaration, not an access declaration)
1332 : ///
1333 : /// \param UsingLoc the location of the 'using' keyword.
1334 : ///
1335 : /// \param SS the nested-name-specifier that precedes the name.
1336 : ///
1337 : /// \param Name the name to which the using declaration refers.
1338 : ///
1339 : /// \param AttrList attributes applied to this using declaration, if any.
1340 : ///
1341 : /// \param IsTypeName whether this using declaration started with the
1342 : /// 'typename' keyword. FIXME: This will eventually be split into a
1343 : /// separate action.
1344 : ///
1345 : /// \param TypenameLoc the location of the 'typename' keyword, if present
1346 : ///
1347 : /// \returns a representation of the using declaration.
1348 : virtual DeclPtrTy ActOnUsingDeclaration(Scope *CurScope,
1349 : AccessSpecifier AS,
1350 : bool HasUsingKeyword,
1351 : SourceLocation UsingLoc,
1352 : const CXXScopeSpec &SS,
1353 : UnqualifiedId &Name,
1354 : AttributeList *AttrList,
1355 : bool IsTypeName,
1356 : SourceLocation TypenameLoc);
1357 :
1358 : /// ActOnParamDefaultArgument - Parse default argument for function parameter
1359 : virtual void ActOnParamDefaultArgument(DeclPtrTy param,
1360 : SourceLocation EqualLoc,
1361 0: ExprArg defarg) {
1362 0: }
1363 :
1364 : /// ActOnParamUnparsedDefaultArgument - We've seen a default
1365 : /// argument for a function parameter, but we can't parse it yet
1366 : /// because we're inside a class definition. Note that this default
1367 : /// argument will be parsed later.
1368 : virtual void ActOnParamUnparsedDefaultArgument(DeclPtrTy param,
1369 : SourceLocation EqualLoc,
1370 0: SourceLocation ArgLoc) { }
1371 :
1372 : /// ActOnParamDefaultArgumentError - Parsing or semantic analysis of
1373 : /// the default argument for the parameter param failed.
1374 0: virtual void ActOnParamDefaultArgumentError(DeclPtrTy param) { }
1375 :
1376 : /// AddCXXDirectInitializerToDecl - This action is called immediately after
1377 : /// ActOnDeclarator, when a C++ direct initializer is present.
1378 : /// e.g: "int x(1);"
1379 : virtual void AddCXXDirectInitializerToDecl(DeclPtrTy Dcl,
1380 : SourceLocation LParenLoc,
1381 : MultiExprArg Exprs,
1382 : SourceLocation *CommaLocs,
1383 0: SourceLocation RParenLoc) {
1384 : return;
1385 : }
1386 :
1387 : /// \brief Called when we re-enter a template parameter scope.
1388 : ///
1389 : /// This action occurs when we are going to parse an member
1390 : /// function's default arguments or inline definition after the
1391 : /// outermost class definition has been completed, and when one or
1392 : /// more of the class definitions enclosing the member function is a
1393 : /// template. The "entity" in the given scope will be set as it was
1394 : /// when we entered the scope of the template initially, and should
1395 : /// be used to, e.g., reintroduce the names of template parameters
1396 : /// into the current scope so that they can be found by name lookup.
1397 : ///
1398 : /// \param S The (new) template parameter scope.
1399 : ///
1400 : /// \param Template the class template declaration whose template
1401 : /// parameters should be reintroduced into the current scope.
1402 0: virtual void ActOnReenterTemplateScope(Scope *S, DeclPtrTy Template) {
1403 0: }
1404 :
1405 : /// ActOnStartDelayedMemberDeclarations - We have completed parsing
1406 : /// a C++ class, and we are about to start parsing any parts of
1407 : /// member declarations that could not be parsed earlier. Enter
1408 : /// the appropriate record scope.
1409 : virtual void ActOnStartDelayedMemberDeclarations(Scope *S,
1410 0: DeclPtrTy Record) {
1411 0: }
1412 :
1413 : /// ActOnStartDelayedCXXMethodDeclaration - We have completed
1414 : /// parsing a top-level (non-nested) C++ class, and we are now
1415 : /// parsing those parts of the given Method declaration that could
1416 : /// not be parsed earlier (C++ [class.mem]p2), such as default
1417 : /// arguments. This action should enter the scope of the given
1418 : /// Method declaration as if we had just parsed the qualified method
1419 : /// name. However, it should not bring the parameters into scope;
1420 : /// that will be performed by ActOnDelayedCXXMethodParameter.
1421 : virtual void ActOnStartDelayedCXXMethodDeclaration(Scope *S,
1422 0: DeclPtrTy Method) {
1423 0: }
1424 :
1425 : /// ActOnDelayedCXXMethodParameter - We've already started a delayed
1426 : /// C++ method declaration. We're (re-)introducing the given
1427 : /// function parameter into scope for use in parsing later parts of
1428 : /// the method declaration. For example, we could see an
1429 : /// ActOnParamDefaultArgument event for this parameter.
1430 0: virtual void ActOnDelayedCXXMethodParameter(Scope *S, DeclPtrTy Param) {
1431 0: }
1432 :
1433 : /// ActOnFinishDelayedCXXMethodDeclaration - We have finished
1434 : /// processing the delayed method declaration for Method. The method
1435 : /// declaration is now considered finished. There may be a separate
1436 : /// ActOnStartOfFunctionDef action later (not necessarily
1437 : /// immediately!) for this method, if it was also defined inside the
1438 : /// class body.
1439 : virtual void ActOnFinishDelayedCXXMethodDeclaration(Scope *S,
1440 0: DeclPtrTy Method) {
1441 0: }
1442 :
1443 : /// ActOnFinishDelayedMemberDeclarations - We have finished parsing
1444 : /// a C++ class, and we are about to start parsing any parts of
1445 : /// member declarations that could not be parsed earlier. Enter the
1446 : /// appropriate record scope.
1447 : virtual void ActOnFinishDelayedMemberDeclarations(Scope *S,
1448 0: DeclPtrTy Record) {
1449 0: }
1450 :
1451 : /// ActOnStaticAssertDeclaration - Parse a C++0x static_assert declaration.
1452 : virtual DeclPtrTy ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
1453 : ExprArg AssertExpr,
1454 0: ExprArg AssertMessageExpr) {
1455 0: return DeclPtrTy();
1456 : }
1457 :
1458 : /// ActOnFriendFunctionDecl - Parsed a friend function declarator.
1459 : /// The name is actually a slight misnomer, because the declarator
1460 : /// is not necessarily a function declarator.
1461 : virtual DeclPtrTy ActOnFriendFunctionDecl(Scope *S,
1462 : Declarator &D,
1463 : bool IsDefinition,
1464 0: MultiTemplateParamsArg TParams) {
1465 0: return DeclPtrTy();
1466 : }
1467 :
1468 : /// ActOnFriendTypeDecl - Parsed a friend type declaration.
1469 : virtual DeclPtrTy ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
1470 0: MultiTemplateParamsArg TParams) {
1471 0: return DeclPtrTy();
1472 : }
1473 :
1474 : //===------------------------- C++ Expressions --------------------------===//
1475 :
1476 : /// ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const}_cast's.
1477 : virtual OwningExprResult ActOnCXXNamedCast(SourceLocation OpLoc,
1478 : tok::TokenKind Kind,
1479 : SourceLocation LAngleBracketLoc,
1480 : TypeTy *Ty,
1481 : SourceLocation RAngleBracketLoc,
1482 : SourceLocation LParenLoc,
1483 : ExprArg Op,
1484 0: SourceLocation RParenLoc) {
1485 0: return ExprEmpty();
1486 : }
1487 :
1488 : /// ActOnCXXTypeidOfType - Parse typeid( type-id ).
1489 : virtual OwningExprResult ActOnCXXTypeid(SourceLocation OpLoc,
1490 : SourceLocation LParenLoc, bool isType,
1491 : void *TyOrExpr,
1492 0: SourceLocation RParenLoc) {
1493 0: return ExprEmpty();
1494 : }
1495 :
1496 : /// ActOnCXXThis - Parse the C++ 'this' pointer.
1497 0: virtual OwningExprResult ActOnCXXThis(SourceLocation ThisLoc) {
1498 0: return ExprEmpty();
1499 : }
1500 :
1501 : /// ActOnCXXBoolLiteral - Parse {true,false} literals.
1502 : virtual OwningExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc,
1503 0: tok::TokenKind Kind) {
1504 0: return ExprEmpty();
1505 : }
1506 :
1507 : /// ActOnCXXNullPtrLiteral - Parse 'nullptr'.
1508 0: virtual OwningExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc) {
1509 0: return ExprEmpty();
1510 : }
1511 :
1512 : /// ActOnCXXThrow - Parse throw expressions.
1513 0: virtual OwningExprResult ActOnCXXThrow(SourceLocation OpLoc, ExprArg Op) {
1514 0: return ExprEmpty();
1515 : }
1516 :
1517 : /// ActOnCXXTypeConstructExpr - Parse construction of a specified type.
1518 : /// Can be interpreted either as function-style casting ("int(x)")
1519 : /// or class type construction ("ClassType(x,y,z)")
1520 : /// or creation of a value-initialized type ("int()").
1521 : virtual OwningExprResult ActOnCXXTypeConstructExpr(SourceRange TypeRange,
1522 : TypeTy *TypeRep,
1523 : SourceLocation LParenLoc,
1524 : MultiExprArg Exprs,
1525 : SourceLocation *CommaLocs,
1526 0: SourceLocation RParenLoc) {
1527 0: return ExprEmpty();
1528 : }
1529 :
1530 : /// \brief Parsed a condition declaration in a C++ if, switch, or while
1531 : /// statement.
1532 : ///
1533 : /// This callback will be invoked after parsing the declaration of "x" in
1534 : ///
1535 : /// \code
1536 : /// if (int x = f()) {
1537 : /// // ...
1538 : /// }
1539 : /// \endcode
1540 : ///
1541 : /// \param S the scope of the if, switch, or while statement.
1542 : ///
1543 : /// \param D the declarator that that describes the variable being declared.
1544 5: virtual DeclResult ActOnCXXConditionDeclaration(Scope *S, Declarator &D) {
1545 5: return DeclResult();
1546 : }
1547 :
1548 : /// ActOnCXXNew - Parsed a C++ 'new' expression. UseGlobal is true if the
1549 : /// new was qualified (::new). In a full new like
1550 : /// @code new (p1, p2) type(c1, c2) @endcode
1551 : /// the p1 and p2 expressions will be in PlacementArgs and the c1 and c2
1552 : /// expressions in ConstructorArgs. The type is passed as a declarator.
1553 : virtual OwningExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
1554 : SourceLocation PlacementLParen,
1555 : MultiExprArg PlacementArgs,
1556 : SourceLocation PlacementRParen,
1557 : bool ParenTypeId, Declarator &D,
1558 : SourceLocation ConstructorLParen,
1559 : MultiExprArg ConstructorArgs,
1560 0: SourceLocation ConstructorRParen) {
1561 0: return ExprEmpty();
1562 : }
1563 :
1564 : /// ActOnCXXDelete - Parsed a C++ 'delete' expression. UseGlobal is true if
1565 : /// the delete was qualified (::delete). ArrayForm is true if the array form
1566 : /// was used (delete[]).
1567 : virtual OwningExprResult ActOnCXXDelete(SourceLocation StartLoc,
1568 : bool UseGlobal, bool ArrayForm,
1569 0: ExprArg Operand) {
1570 0: return ExprEmpty();
1571 : }
1572 :
1573 : virtual OwningExprResult ActOnUnaryTypeTrait(UnaryTypeTrait OTT,
1574 : SourceLocation KWLoc,
1575 : SourceLocation LParen,
1576 : TypeTy *Ty,
1577 0: SourceLocation RParen) {
1578 0: return ExprEmpty();
1579 : }
1580 :
1581 : /// \brief Invoked when the parser is starting to parse a C++ member access
1582 : /// expression such as x.f or x->f.
1583 : ///
1584 : /// \param S the scope in which the member access expression occurs.
1585 : ///
1586 : /// \param Base the expression in which a member is being accessed, e.g., the
1587 : /// "x" in "x.f".
1588 : ///
1589 : /// \param OpLoc the location of the member access operator ("." or "->")
1590 : ///
1591 : /// \param OpKind the kind of member access operator ("." or "->")
1592 : ///
1593 : /// \param ObjectType originally NULL. The action should fill in this type
1594 : /// with the type into which name lookup should look to find the member in
1595 : /// the member access expression.
1596 : ///
1597 : /// \returns the (possibly modified) \p Base expression
1598 : virtual OwningExprResult ActOnStartCXXMemberReference(Scope *S,
1599 : ExprArg Base,
1600 : SourceLocation OpLoc,
1601 : tok::TokenKind OpKind,
1602 0: TypeTy *&ObjectType) {
1603 0: return ExprEmpty();
1604 : }
1605 :
1606 : /// ActOnFinishFullExpr - Called whenever a full expression has been parsed.
1607 : /// (C++ [intro.execution]p12).
1608 77: virtual OwningExprResult ActOnFinishFullExpr(ExprArg Expr) {
1609 77: return move(Expr);
1610 : }
1611 :
1612 : //===---------------------------- C++ Classes ---------------------------===//
1613 : /// ActOnBaseSpecifier - Parsed a base specifier
1614 : virtual BaseResult ActOnBaseSpecifier(DeclPtrTy classdecl,
1615 : SourceRange SpecifierRange,
1616 : bool Virtual, AccessSpecifier Access,
1617 : TypeTy *basetype,
1618 0: SourceLocation BaseLoc) {
1619 0: return BaseResult();
1620 : }
1621 :
1622 : virtual void ActOnBaseSpecifiers(DeclPtrTy ClassDecl, BaseTy **Bases,
1623 0: unsigned NumBases) {
1624 0: }
1625 :
1626 : /// ActOnCXXMemberDeclarator - This is invoked when a C++ class member
1627 : /// declarator is parsed. 'AS' is the access specifier, 'BitfieldWidth'
1628 : /// specifies the bitfield width if there is one and 'Init' specifies the
1629 : /// initializer if any. 'Deleted' is true if there's a =delete
1630 : /// specifier on the function.
1631 : virtual DeclPtrTy ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS,
1632 : Declarator &D,
1633 : MultiTemplateParamsArg TemplateParameterLists,
1634 : ExprTy *BitfieldWidth,
1635 : ExprTy *Init,
1636 : bool IsDefinition,
1637 0: bool Deleted = false) {
1638 0: return DeclPtrTy();
1639 : }
1640 :
1641 : virtual MemInitResult ActOnMemInitializer(DeclPtrTy ConstructorDecl,
1642 : Scope *S,
1643 : const CXXScopeSpec &SS,
1644 : IdentifierInfo *MemberOrBase,
1645 : TypeTy *TemplateTypeTy,
1646 : SourceLocation IdLoc,
1647 : SourceLocation LParenLoc,
1648 : ExprTy **Args, unsigned NumArgs,
1649 : SourceLocation *CommaLocs,
1650 0: SourceLocation RParenLoc) {
1651 0: return true;
1652 : }
1653 :
1654 : /// ActOnMemInitializers - This is invoked when all of the member
1655 : /// initializers of a constructor have been parsed. ConstructorDecl
1656 : /// is the function declaration (which will be a C++ constructor in
1657 : /// a well-formed program), ColonLoc is the location of the ':' that
1658 : /// starts the constructor initializer, and MemInit/NumMemInits
1659 : /// contains the individual member (and base) initializers.
1660 : /// AnyErrors will be true if there were any invalid member initializers
1661 : /// that are not represented in the list.
1662 : virtual void ActOnMemInitializers(DeclPtrTy ConstructorDecl,
1663 : SourceLocation ColonLoc,
1664 : MemInitTy **MemInits, unsigned NumMemInits,
1665 0: bool AnyErrors){
1666 0: }
1667 :
1668 40: virtual void ActOnDefaultCtorInitializers(DeclPtrTy CDtorDecl) {}
1669 :
1670 : /// ActOnFinishCXXMemberSpecification - Invoked after all member declarators
1671 : /// are parsed but *before* parsing of inline method definitions.
1672 : virtual void ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc,
1673 : DeclPtrTy TagDecl,
1674 : SourceLocation LBrac,
1675 0: SourceLocation RBrac) {
1676 0: }
1677 :
1678 : //===---------------------------C++ Templates----------------------------===//
1679 :
1680 : /// ActOnTypeParameter - Called when a C++ template type parameter
1681 : /// (e.g., "typename T") has been parsed. Typename specifies whether
1682 : /// the keyword "typename" was used to declare the type parameter
1683 : /// (otherwise, "class" was used), ellipsis specifies whether this is a
1684 : /// C++0x parameter pack, EllipsisLoc specifies the start of the ellipsis,
1685 : /// and KeyLoc is the location of the "class" or "typename" keyword.
1686 : // ParamName is the name of the parameter (NULL indicates an unnamed template
1687 : // parameter) and ParamNameLoc is the location of the parameter name (if any)
1688 : /// If the type parameter has a default argument, it will be added
1689 : /// later via ActOnTypeParameterDefault. Depth and Position provide
1690 : /// the number of enclosing templates (see
1691 : /// ActOnTemplateParameterList) and the number of previous
1692 : /// parameters within this template parameter list.
1693 : virtual DeclPtrTy ActOnTypeParameter(Scope *S, bool Typename, bool Ellipsis,
1694 : SourceLocation EllipsisLoc,
1695 : SourceLocation KeyLoc,
1696 : IdentifierInfo *ParamName,
1697 : SourceLocation ParamNameLoc,
1698 0: unsigned Depth, unsigned Position) {
1699 0: return DeclPtrTy();
1700 : }
1701 :
1702 : /// ActOnTypeParameterDefault - Adds a default argument (the type
1703 : /// Default) to the given template type parameter (TypeParam).
1704 : virtual void ActOnTypeParameterDefault(DeclPtrTy TypeParam,
1705 : SourceLocation EqualLoc,
1706 : SourceLocation DefaultLoc,
1707 0: TypeTy *Default) {
1708 0: }
1709 :
1710 : /// ActOnNonTypeTemplateParameter - Called when a C++ non-type
1711 : /// template parameter (e.g., "int Size" in "template<int Size>
1712 : /// class Array") has been parsed. S is the current scope and D is
1713 : /// the parsed declarator. Depth and Position provide the number of
1714 : /// enclosing templates (see
1715 : /// ActOnTemplateParameterList) and the number of previous
1716 : /// parameters within this template parameter list.
1717 : virtual DeclPtrTy ActOnNonTypeTemplateParameter(Scope *S, Declarator &D,
1718 : unsigned Depth,
1719 0: unsigned Position) {
1720 0: return DeclPtrTy();
1721 : }
1722 :
1723 : /// \brief Adds a default argument to the given non-type template
1724 : /// parameter.
1725 : virtual void ActOnNonTypeTemplateParameterDefault(DeclPtrTy TemplateParam,
1726 : SourceLocation EqualLoc,
1727 0: ExprArg Default) {
1728 0: }
1729 :
1730 : /// ActOnTemplateTemplateParameter - Called when a C++ template template
1731 : /// parameter (e.g., "int T" in "template<template <typename> class T> class
1732 : /// Array") has been parsed. TmpLoc is the location of the "template" keyword,
1733 : /// TemplateParams is the sequence of parameters required by the template,
1734 : /// ParamName is the name of the parameter (null if unnamed), and ParamNameLoc
1735 : /// is the source location of the identifier (if given).
1736 : virtual DeclPtrTy ActOnTemplateTemplateParameter(Scope *S,
1737 : SourceLocation TmpLoc,
1738 : TemplateParamsTy *Params,
1739 : IdentifierInfo *ParamName,
1740 : SourceLocation ParamNameLoc,
1741 : unsigned Depth,
1742 0: unsigned Position) {
1743 0: return DeclPtrTy();
1744 : }
1745 :
1746 : /// \brief Adds a default argument to the given template template
1747 : /// parameter.
1748 : virtual void ActOnTemplateTemplateParameterDefault(DeclPtrTy TemplateParam,
1749 : SourceLocation EqualLoc,
1750 0: const ParsedTemplateArgument &Default) {
1751 0: }
1752 :
1753 : /// ActOnTemplateParameterList - Called when a complete template
1754 : /// parameter list has been parsed, e.g.,
1755 : ///
1756 : /// @code
1757 : /// export template<typename T, T Size>
1758 : /// @endcode
1759 : ///
1760 : /// Depth is the number of enclosing template parameter lists. This
1761 : /// value does not include templates from outer scopes. For example:
1762 : ///
1763 : /// @code
1764 : /// template<typename T> // depth = 0
1765 : /// class A {
1766 : /// template<typename U> // depth = 0
1767 : /// class B;
1768 : /// };
1769 : ///
1770 : /// template<typename T> // depth = 0
1771 : /// template<typename U> // depth = 1
1772 : /// class A<T>::B { ... };
1773 : /// @endcode
1774 : ///
1775 : /// ExportLoc, if valid, is the position of the "export"
1776 : /// keyword. Otherwise, "export" was not specified.
1777 : /// TemplateLoc is the position of the template keyword, LAngleLoc
1778 : /// is the position of the left angle bracket, and RAngleLoc is the
1779 : /// position of the corresponding right angle bracket.
1780 : /// Params/NumParams provides the template parameters that were
1781 : /// parsed as part of the template-parameter-list.
1782 : virtual TemplateParamsTy *
1783 : ActOnTemplateParameterList(unsigned Depth,
1784 : SourceLocation ExportLoc,
1785 : SourceLocation TemplateLoc,
1786 : SourceLocation LAngleLoc,
1787 : DeclPtrTy *Params, unsigned NumParams,
1788 0: SourceLocation RAngleLoc) {
1789 0: return 0;
1790 : }
1791 :
1792 : /// \brief Form a type from a template and a list of template
1793 : /// arguments.
1794 : ///
1795 : /// This action merely forms the type for the template-id, possibly
1796 : /// checking well-formedness of the template arguments. It does not
1797 : /// imply the declaration of any entity.
1798 : ///
1799 : /// \param Template A template whose specialization results in a
1800 : /// type, e.g., a class template or template template parameter.
1801 : virtual TypeResult ActOnTemplateIdType(TemplateTy Template,
1802 : SourceLocation TemplateLoc,
1803 : SourceLocation LAngleLoc,
1804 : ASTTemplateArgsPtr TemplateArgs,
1805 0: SourceLocation RAngleLoc) {
1806 0: return TypeResult();
1807 : }
1808 :
1809 : /// \brief Note that a template ID was used with a tag.
1810 : ///
1811 : /// \param Type The result of ActOnTemplateIdType.
1812 : ///
1813 : /// \param TUK Either TUK_Reference or TUK_Friend. Declarations and
1814 : /// definitions are interpreted as explicit instantiations or
1815 : /// specializations.
1816 : ///
1817 : /// \param TagSpec The tag keyword that was provided as part of the
1818 : /// elaborated-type-specifier; either class, struct, union, or enum.
1819 : ///
1820 : /// \param TagLoc The location of the tag keyword.
1821 : virtual TypeResult ActOnTagTemplateIdType(TypeResult Type,
1822 : TagUseKind TUK,
1823 : DeclSpec::TST TagSpec,
1824 0: SourceLocation TagLoc) {
1825 0: return TypeResult();
1826 : }
1827 :
1828 : /// \brief Form a dependent template name.
1829 : ///
1830 : /// This action forms a dependent template name given the template
1831 : /// name and its (presumably dependent) scope specifier. For
1832 : /// example, given "MetaFun::template apply", the scope specifier \p
1833 : /// SS will be "MetaFun::", \p TemplateKWLoc contains the location
1834 : /// of the "template" keyword, and "apply" is the \p Name.
1835 : ///
1836 : /// \param TemplateKWLoc the location of the "template" keyword (if any).
1837 : ///
1838 : /// \param SS the nested-name-specifier that precedes the "template" keyword
1839 : /// or the template name. If the dependent template name occurs in
1840 : /// a member access expression, e.g., "x.template f<T>", this
1841 : /// nested-name-specifier will be empty.
1842 : ///
1843 : /// \param Name the name of the template.
1844 : ///
1845 : /// \param ObjectType if this dependent template name occurs in the
1846 : /// context of a member access expression, the type of the object being
1847 : /// accessed.
1848 : ///
1849 : /// \param EnteringContext whether we are entering the context of this
1850 : /// template.
1851 : virtual TemplateTy ActOnDependentTemplateName(SourceLocation TemplateKWLoc,
1852 : const CXXScopeSpec &SS,
1853 : UnqualifiedId &Name,
1854 : TypeTy *ObjectType,
1855 0: bool EnteringContext) {
1856 0: return TemplateTy();
1857 : }
1858 :
1859 : /// \brief Process the declaration or definition of an explicit
1860 : /// class template specialization or a class template partial
1861 : /// specialization.
1862 : ///
1863 : /// This routine is invoked when an explicit class template
1864 : /// specialization or a class template partial specialization is
1865 : /// declared or defined, to introduce the (partial) specialization
1866 : /// and produce a declaration for it. In the following example,
1867 : /// ActOnClassTemplateSpecialization will be invoked for the
1868 : /// declarations at both A and B:
1869 : ///
1870 : /// \code
1871 : /// template<typename T> class X;
1872 : /// template<> class X<int> { }; // A: explicit specialization
1873 : /// template<typename T> class X<T*> { }; // B: partial specialization
1874 : /// \endcode
1875 : ///
1876 : /// Note that it is the job of semantic analysis to determine which
1877 : /// of the two cases actually occurred in the source code, since
1878 : /// they are parsed through the same path. The formulation of the
1879 : /// template parameter lists describes which case we are in.
1880 : ///
1881 : /// \param S the current scope
1882 : ///
1883 : /// \param TagSpec whether this declares a class, struct, or union
1884 : /// (template)
1885 : ///
1886 : /// \param TUK whether this is a declaration or a definition
1887 : ///
1888 : /// \param KWLoc the location of the 'class', 'struct', or 'union'
1889 : /// keyword.
1890 : ///
1891 : /// \param SS the scope specifier preceding the template-id
1892 : ///
1893 : /// \param Template the declaration of the class template that we
1894 : /// are specializing.
1895 : ///
1896 : /// \param Attr attributes on the specialization
1897 : ///
1898 : /// \param TemplateParameterLists the set of template parameter
1899 : /// lists that apply to this declaration. In a well-formed program,
1900 : /// the number of template parameter lists will be one more than the
1901 : /// number of template-ids in the scope specifier. However, it is
1902 : /// common for users to provide the wrong number of template
1903 : /// parameter lists (such as a missing \c template<> prior to a
1904 : /// specialization); the parser does not check this condition.
1905 : virtual DeclResult
1906 : ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK,
1907 : SourceLocation KWLoc,
1908 : const CXXScopeSpec &SS,
1909 : TemplateTy Template,
1910 : SourceLocation TemplateNameLoc,
1911 : SourceLocation LAngleLoc,
1912 : ASTTemplateArgsPtr TemplateArgs,
1913 : SourceLocation RAngleLoc,
1914 : AttributeList *Attr,
1915 0: MultiTemplateParamsArg TemplateParameterLists) {
1916 0: return DeclResult();
1917 : }
1918 :
1919 : /// \brief Invoked when a declarator that has one or more template parameter
1920 : /// lists has been parsed.
1921 : ///
1922 : /// This action is similar to ActOnDeclarator(), except that the declaration
1923 : /// being created somehow involves a template, e.g., it is a template
1924 : /// declaration or specialization.
1925 : virtual DeclPtrTy ActOnTemplateDeclarator(Scope *S,
1926 : MultiTemplateParamsArg TemplateParameterLists,
1927 0: Declarator &D) {
1928 0: return DeclPtrTy();
1929 : }
1930 :
1931 : /// \brief Invoked when the parser is beginning to parse a function template
1932 : /// or function template specialization definition.
1933 : virtual DeclPtrTy ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope,
1934 : MultiTemplateParamsArg TemplateParameterLists,
1935 0: Declarator &D) {
1936 0: return DeclPtrTy();
1937 : }
1938 :
1939 : /// \brief Process the explicit instantiation of a class template
1940 : /// specialization.
1941 : ///
1942 : /// This routine is invoked when an explicit instantiation of a
1943 : /// class template specialization is encountered. In the following
1944 : /// example, ActOnExplicitInstantiation will be invoked to force the
1945 : /// instantiation of X<int>:
1946 : ///
1947 : /// \code
1948 : /// template<typename T> class X { /* ... */ };
1949 : /// template class X<int>; // explicit instantiation
1950 : /// \endcode
1951 : ///
1952 : /// \param S the current scope
1953 : ///
1954 : /// \param ExternLoc the location of the 'extern' keyword that specifies that
1955 : /// this is an extern template (if any).
1956 : ///
1957 : /// \param TemplateLoc the location of the 'template' keyword that
1958 : /// specifies that this is an explicit instantiation.
1959 : ///
1960 : /// \param TagSpec whether this declares a class, struct, or union
1961 : /// (template).
1962 : ///
1963 : /// \param KWLoc the location of the 'class', 'struct', or 'union'
1964 : /// keyword.
1965 : ///
1966 : /// \param SS the scope specifier preceding the template-id.
1967 : ///
1968 : /// \param Template the declaration of the class template that we
1969 : /// are instantiation.
1970 : ///
1971 : /// \param LAngleLoc the location of the '<' token in the template-id.
1972 : ///
1973 : /// \param TemplateArgs the template arguments used to form the
1974 : /// template-id.
1975 : ///
1976 : /// \param TemplateArgLocs the locations of the template arguments.
1977 : ///
1978 : /// \param RAngleLoc the location of the '>' token in the template-id.
1979 : ///
1980 : /// \param Attr attributes that apply to this instantiation.
1981 : virtual DeclResult
1982 : ActOnExplicitInstantiation(Scope *S,
1983 : SourceLocation ExternLoc,
1984 : SourceLocation TemplateLoc,
1985 : unsigned TagSpec,
1986 : SourceLocation KWLoc,
1987 : const CXXScopeSpec &SS,
1988 : TemplateTy Template,
1989 : SourceLocation TemplateNameLoc,
1990 : SourceLocation LAngleLoc,
1991 : ASTTemplateArgsPtr TemplateArgs,
1992 : SourceLocation RAngleLoc,
1993 0: AttributeList *Attr) {
1994 0: return DeclResult();
1995 : }
1996 :
1997 : /// \brief Process the explicit instantiation of a member class of a
1998 : /// class template specialization.
1999 : ///
2000 : /// This routine is invoked when an explicit instantiation of a
2001 : /// member class of a class template specialization is
2002 : /// encountered. In the following example,
2003 : /// ActOnExplicitInstantiation will be invoked to force the
2004 : /// instantiation of X<int>::Inner:
2005 : ///
2006 : /// \code
2007 : /// template<typename T> class X { class Inner { /* ... */}; };
2008 : /// template class X<int>::Inner; // explicit instantiation
2009 : /// \endcode
2010 : ///
2011 : /// \param S the current scope
2012 : ///
2013 : /// \param ExternLoc the location of the 'extern' keyword that specifies that
2014 : /// this is an extern template (if any).
2015 : ///
2016 : /// \param TemplateLoc the location of the 'template' keyword that
2017 : /// specifies that this is an explicit instantiation.
2018 : ///
2019 : /// \param TagSpec whether this declares a class, struct, or union
2020 : /// (template).
2021 : ///
2022 : /// \param KWLoc the location of the 'class', 'struct', or 'union'
2023 : /// keyword.
2024 : ///
2025 : /// \param SS the scope specifier preceding the template-id.
2026 : ///
2027 : /// \param Template the declaration of the class template that we
2028 : /// are instantiation.
2029 : ///
2030 : /// \param LAngleLoc the location of the '<' token in the template-id.
2031 : ///
2032 : /// \param TemplateArgs the template arguments used to form the
2033 : /// template-id.
2034 : ///
2035 : /// \param TemplateArgLocs the locations of the template arguments.
2036 : ///
2037 : /// \param RAngleLoc the location of the '>' token in the template-id.
2038 : ///
2039 : /// \param Attr attributes that apply to this instantiation.
2040 : virtual DeclResult
2041 : ActOnExplicitInstantiation(Scope *S,
2042 : SourceLocation ExternLoc,
2043 : SourceLocation TemplateLoc,
2044 : unsigned TagSpec,
2045 : SourceLocation KWLoc,
2046 : const CXXScopeSpec &SS,
2047 : IdentifierInfo *Name,
2048 : SourceLocation NameLoc,
2049 0: AttributeList *Attr) {
2050 0: return DeclResult();
2051 : }
2052 :
2053 : /// \brief Process the explicit instantiation of a function template or a
2054 : /// member of a class template.
2055 : ///
2056 : /// This routine is invoked when an explicit instantiation of a
2057 : /// function template or member function of a class template specialization
2058 : /// is encountered. In the following example,
2059 : /// ActOnExplicitInstantiation will be invoked to force the
2060 : /// instantiation of X<int>:
2061 : ///
2062 : /// \code
2063 : /// template<typename T> void f(T);
2064 : /// template void f(int); // explicit instantiation
2065 : /// \endcode
2066 : ///
2067 : /// \param S the current scope
2068 : ///
2069 : /// \param ExternLoc the location of the 'extern' keyword that specifies that
2070 : /// this is an extern template (if any).
2071 : ///
2072 : /// \param TemplateLoc the location of the 'template' keyword that
2073 : /// specifies that this is an explicit instantiation.
2074 : ///
2075 : /// \param D the declarator describing the declaration to be implicitly
2076 : /// instantiated.
2077 : virtual DeclResult ActOnExplicitInstantiation(Scope *S,
2078 : SourceLocation ExternLoc,
2079 : SourceLocation TemplateLoc,
2080 0: Declarator &D) {
2081 0: return DeclResult();
2082 : }
2083 :
2084 :
2085 : /// \brief Called when the parser has parsed a C++ typename
2086 : /// specifier that ends in an identifier, e.g., "typename T::type".
2087 : ///
2088 : /// \param TypenameLoc the location of the 'typename' keyword
2089 : /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
2090 : /// \param II the identifier we're retrieving (e.g., 'type' in the example).
2091 : /// \param IdLoc the location of the identifier.
2092 : virtual TypeResult
2093 : ActOnTypenameType(SourceLocation TypenameLoc, const CXXScopeSpec &SS,
2094 0: const IdentifierInfo &II, SourceLocation IdLoc) {
2095 0: return TypeResult();
2096 : }
2097 :
2098 : /// \brief Called when the parser has parsed a C++ typename
2099 : /// specifier that ends in a template-id, e.g.,
2100 : /// "typename MetaFun::template apply<T1, T2>".
2101 : ///
2102 : /// \param TypenameLoc the location of the 'typename' keyword
2103 : /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
2104 : /// \param TemplateLoc the location of the 'template' keyword, if any.
2105 : /// \param Ty the type that the typename specifier refers to.
2106 : virtual TypeResult
2107 : ActOnTypenameType(SourceLocation TypenameLoc, const CXXScopeSpec &SS,
2108 0: SourceLocation TemplateLoc, TypeTy *Ty) {
2109 0: return TypeResult();
2110 : }
2111 :
2112 : //===----------------------- Obj-C Declarations -------------------------===//
2113 :
2114 : // ActOnStartClassInterface - this action is called immediately after parsing
2115 : // the prologue for a class interface (before parsing the instance
2116 : // variables). Instance variables are processed by ActOnFields().
2117 : virtual DeclPtrTy ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
2118 : IdentifierInfo *ClassName,
2119 : SourceLocation ClassLoc,
2120 : IdentifierInfo *SuperName,
2121 : SourceLocation SuperLoc,
2122 : const DeclPtrTy *ProtoRefs,
2123 : unsigned NumProtoRefs,
2124 : const SourceLocation *ProtoLocs,
2125 : SourceLocation EndProtoLoc,
2126 0: AttributeList *AttrList) {
2127 0: return DeclPtrTy();
2128 : }
2129 :
2130 : /// ActOnCompatiblityAlias - this action is called after complete parsing of
2131 : /// @compaatibility_alias declaration. It sets up the alias relationships.
2132 : virtual DeclPtrTy ActOnCompatiblityAlias(
2133 : SourceLocation AtCompatibilityAliasLoc,
2134 : IdentifierInfo *AliasName, SourceLocation AliasLocation,
2135 0: IdentifierInfo *ClassName, SourceLocation ClassLocation) {
2136 0: return DeclPtrTy();
2137 : }
2138 :
2139 : // ActOnStartProtocolInterface - this action is called immdiately after
2140 : // parsing the prologue for a protocol interface.
2141 : virtual DeclPtrTy ActOnStartProtocolInterface(SourceLocation AtProtoLoc,
2142 : IdentifierInfo *ProtocolName,
2143 : SourceLocation ProtocolLoc,
2144 : const DeclPtrTy *ProtoRefs,
2145 : unsigned NumProtoRefs,
2146 : const SourceLocation *ProtoLocs,
2147 : SourceLocation EndProtoLoc,
2148 2: AttributeList *AttrList) {
2149 2: return DeclPtrTy();
2150 : }
2151 : // ActOnStartCategoryInterface - this action is called immdiately after
2152 : // parsing the prologue for a category interface.
2153 : virtual DeclPtrTy ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
2154 : IdentifierInfo *ClassName,
2155 : SourceLocation ClassLoc,
2156 : IdentifierInfo *CategoryName,
2157 : SourceLocation CategoryLoc,
2158 : const DeclPtrTy *ProtoRefs,
2159 : unsigned NumProtoRefs,
2160 : const SourceLocation *ProtoLocs,
2161 2: SourceLocation EndProtoLoc) {
2162 2: return DeclPtrTy();
2163 : }
2164 : // ActOnStartClassImplementation - this action is called immdiately after
2165 : // parsing the prologue for a class implementation. Instance variables are
2166 : // processed by ActOnFields().
2167 : virtual DeclPtrTy ActOnStartClassImplementation(
2168 : SourceLocation AtClassImplLoc,
2169 : IdentifierInfo *ClassName,
2170 : SourceLocation ClassLoc,
2171 : IdentifierInfo *SuperClassname,
2172 4: SourceLocation SuperClassLoc) {
2173 4: return DeclPtrTy();
2174 : }
2175 : // ActOnStartCategoryImplementation - this action is called immdiately after
2176 : // parsing the prologue for a category implementation.
2177 : virtual DeclPtrTy ActOnStartCategoryImplementation(
2178 : SourceLocation AtCatImplLoc,
2179 : IdentifierInfo *ClassName,
2180 : SourceLocation ClassLoc,
2181 : IdentifierInfo *CatName,
2182 2: SourceLocation CatLoc) {
2183 2: return DeclPtrTy();
2184 : }
2185 : // ActOnPropertyImplDecl - called for every property implementation
2186 : virtual DeclPtrTy ActOnPropertyImplDecl(
2187 : SourceLocation AtLoc, // location of the @synthesize/@dynamic
2188 : SourceLocation PropertyNameLoc, // location for the property name
2189 : bool ImplKind, // true for @synthesize, false for
2190 : // @dynamic
2191 : DeclPtrTy ClassImplDecl, // class or category implementation
2192 : IdentifierInfo *propertyId, // name of property
2193 6: IdentifierInfo *propertyIvar) { // name of the ivar
2194 6: return DeclPtrTy();
2195 : }
2196 :
2197 3663: struct ObjCArgInfo {
2198 : IdentifierInfo *Name;
2199 : SourceLocation NameLoc;
2200 : // The Type is null if no type was specified, and the DeclSpec is invalid
2201 : // in this case.
2202 : TypeTy *Type;
2203 : ObjCDeclSpec DeclSpec;
2204 :
2205 : /// ArgAttrs - Attribute list for this argument.
2206 : AttributeList *ArgAttrs;
2207 : };
2208 :
2209 : // ActOnMethodDeclaration - called for all method declarations.
2210 : virtual DeclPtrTy ActOnMethodDeclaration(
2211 : SourceLocation BeginLoc, // location of the + or -.
2212 : SourceLocation EndLoc, // location of the ; or {.
2213 : tok::TokenKind MethodType, // tok::minus for instance, tok::plus for class.
2214 : DeclPtrTy ClassDecl, // class this methods belongs to.
2215 : ObjCDeclSpec &ReturnQT, // for return type's in inout etc.
2216 : TypeTy *ReturnType, // the method return type.
2217 : Selector Sel, // a unique name for the method.
2218 : ObjCArgInfo *ArgInfo, // ArgInfo: Has 'Sel.getNumArgs()' entries.
2219 : llvm::SmallVectorImpl<Declarator> &Cdecls, // c-style args
2220 : AttributeList *MethodAttrList, // optional
2221 : // tok::objc_not_keyword, tok::objc_optional, tok::objc_required
2222 : tok::ObjCKeywordKind impKind,
2223 48: bool isVariadic = false) {
2224 48: return DeclPtrTy();
2225 : }
2226 : // ActOnAtEnd - called to mark the @end. For declarations (interfaces,
2227 : // protocols, categories), the parser passes all methods/properties.
2228 : // For class implementations, these values default to 0. For implementations,
2229 : // methods are processed incrementally (by ActOnMethodDeclaration above).
2230 : virtual void ActOnAtEnd(SourceRange AtEnd,
2231 : DeclPtrTy classDecl,
2232 : DeclPtrTy *allMethods = 0,
2233 : unsigned allNum = 0,
2234 : DeclPtrTy *allProperties = 0,
2235 : unsigned pNum = 0,
2236 : DeclGroupPtrTy *allTUVars = 0,
2237 11: unsigned tuvNum = 0) {
2238 11: }
2239 : // ActOnProperty - called to build one property AST
2240 : virtual DeclPtrTy ActOnProperty(Scope *S, SourceLocation AtLoc,
2241 : FieldDeclarator &FD, ObjCDeclSpec &ODS,
2242 : Selector GetterSel, Selector SetterSel,
2243 : DeclPtrTy ClassCategory,
2244 : bool *OverridingProperty,
2245 12: tok::ObjCKeywordKind MethodImplKind) {
2246 12: return DeclPtrTy();
2247 : }
2248 :
2249 : virtual OwningExprResult ActOnClassPropertyRefExpr(
2250 : IdentifierInfo &receiverName,
2251 : IdentifierInfo &propertyName,
2252 : SourceLocation &receiverNameLoc,
2253 0: SourceLocation &propertyNameLoc) {
2254 0: return ExprEmpty();
2255 : }
2256 :
2257 : // ActOnClassMessage - used for both unary and keyword messages.
2258 : // ArgExprs is optional - if it is present, the number of expressions
2259 : // is obtained from NumArgs.
2260 : virtual ExprResult ActOnClassMessage(
2261 : Scope *S,
2262 : IdentifierInfo *receivingClassName,
2263 : Selector Sel,
2264 : SourceLocation lbrac, SourceLocation receiverLoc,
2265 : SourceLocation selectorLoc,
2266 : SourceLocation rbrac,
2267 4: ExprTy **ArgExprs, unsigned NumArgs) {
2268 4: return ExprResult();
2269 : }
2270 : // ActOnInstanceMessage - used for both unary and keyword messages.
2271 : // ArgExprs is optional - if it is present, the number of expressions
2272 : // is obtained from NumArgs.
2273 : virtual ExprResult ActOnInstanceMessage(
2274 : ExprTy *receiver, Selector Sel,
2275 : SourceLocation lbrac, SourceLocation selectorLoc, SourceLocation rbrac,
2276 9: ExprTy **ArgExprs, unsigned NumArgs) {
2277 9: return ExprResult();
2278 : }
2279 : virtual DeclPtrTy ActOnForwardClassDeclaration(
2280 : SourceLocation AtClassLoc,
2281 : IdentifierInfo **IdentList,
2282 : SourceLocation *IdentLocs,
2283 0: unsigned NumElts) {
2284 0: return DeclPtrTy();
2285 : }
2286 : virtual DeclPtrTy ActOnForwardProtocolDeclaration(
2287 : SourceLocation AtProtocolLoc,
2288 : const IdentifierLocPair*IdentList,
2289 : unsigned NumElts,
2290 2: AttributeList *AttrList) {
2291 2: return DeclPtrTy();
2292 : }
2293 :
2294 : /// FindProtocolDeclaration - This routine looks up protocols and
2295 : /// issues error if they are not declared. It returns list of valid
2296 : /// protocols found.
2297 : virtual void FindProtocolDeclaration(bool WarnOnDeclarations,
2298 : const IdentifierLocPair *ProtocolId,
2299 : unsigned NumProtocols,
2300 4: llvm::SmallVectorImpl<DeclPtrTy> &ResProtos) {
2301 4: }
2302 :
2303 : //===----------------------- Obj-C Expressions --------------------------===//
2304 :
2305 : virtual ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs,
2306 : ExprTy **Strings,
2307 1: unsigned NumStrings) {
2308 1: return ExprResult();
2309 : }
2310 :
2311 : virtual ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc,
2312 : SourceLocation EncLoc,
2313 : SourceLocation LParenLoc,
2314 : TypeTy *Ty,
2315 0: SourceLocation RParenLoc) {
2316 0: return ExprResult();
2317 : }
2318 :
2319 : virtual ExprResult ParseObjCSelectorExpression(Selector Sel,
2320 : SourceLocation AtLoc,
2321 : SourceLocation SelLoc,
2322 : SourceLocation LParenLoc,
2323 9: SourceLocation RParenLoc) {
2324 9: return ExprResult();
2325 : }
2326 :
2327 : virtual ExprResult ParseObjCProtocolExpression(IdentifierInfo *ProtocolId,
2328 : SourceLocation AtLoc,
2329 : SourceLocation ProtoLoc,
2330 : SourceLocation LParenLoc,
2331 0: SourceLocation RParenLoc) {
2332 0: return ExprResult();
2333 : }
2334 :
2335 : //===---------------------------- Pragmas -------------------------------===//
2336 :
2337 : enum PragmaPackKind {
2338 : PPK_Default, // #pragma pack([n])
2339 : PPK_Show, // #pragma pack(show), only supported by MSVC.
2340 : PPK_Push, // #pragma pack(push, [identifier], [n])
2341 : PPK_Pop // #pragma pack(pop, [identifier], [n])
2342 : };
2343 :
2344 : /// ActOnPragmaPack - Called on well formed #pragma pack(...).
2345 : virtual void ActOnPragmaPack(PragmaPackKind Kind,
2346 : IdentifierInfo *Name,
2347 : ExprTy *Alignment,
2348 : SourceLocation PragmaLoc,
2349 : SourceLocation LParenLoc,
2350 0: SourceLocation RParenLoc) {
2351 : return;
2352 : }
2353 :
2354 : /// ActOnPragmaUnused - Called on well formed #pragma unused(...).
2355 : virtual void ActOnPragmaUnused(const Token *Identifiers,
2356 : unsigned NumIdentifiers, Scope *CurScope,
2357 : SourceLocation PragmaLoc,
2358 : SourceLocation LParenLoc,
2359 0: SourceLocation RParenLoc) {
2360 : return;
2361 : }
2362 :
2363 : /// ActOnPragmaWeakID - Called on well formed #pragma weak ident.
2364 : virtual void ActOnPragmaWeakID(IdentifierInfo* WeakName,
2365 : SourceLocation PragmaLoc,
2366 0: SourceLocation WeakNameLoc) {
2367 : return;
2368 : }
2369 :
2370 : /// ActOnPragmaWeakAlias - Called on well formed #pragma weak ident = ident.
2371 : virtual void ActOnPragmaWeakAlias(IdentifierInfo* WeakName,
2372 : IdentifierInfo* AliasName,
2373 : SourceLocation PragmaLoc,
2374 : SourceLocation WeakNameLoc,
2375 0: SourceLocation AliasNameLoc) {
2376 : return;
2377 : }
2378 :
2379 : /// \name Code completion actions
2380 : ///
2381 : /// These actions are used to signal that a code-completion token has been
2382 : /// found at a point in the grammar where the Action implementation is
2383 : /// likely to be able to provide a list of possible completions, e.g.,
2384 : /// after the "." or "->" of a member access expression.
2385 : ///
2386 : /// \todo Code completion for designated field initializers
2387 : /// \todo Code completion for call arguments after a function template-id
2388 : /// \todo Code completion within a call expression, object construction, etc.
2389 : /// \todo Code completion within a template argument list.
2390 : /// \todo Code completion for attributes.
2391 : //@{
2392 :
2393 : /// \brief Describes the context in which code completion occurs.
2394 : enum CodeCompletionContext {
2395 : /// \brief Code completion occurs at top-level or namespace context.
2396 : CCC_Namespace,
2397 : /// \brief Code completion occurs within a class, struct, or union.
2398 : CCC_Class,
2399 : /// \brief Code completion occurs within an Objective-C interface, protocol,
2400 : /// or category.
2401 : CCC_ObjCInterface,
2402 : /// \brief Code completion occurs within an Objective-C implementation or
2403 : /// category implementation
2404 : CCC_ObjCImplementation,
2405 : /// \brief Code completion occurs within the list of instance variables
2406 : /// in an Objective-C interface, protocol, category, or implementation.
2407 : CCC_ObjCInstanceVariableList,
2408 : /// \brief Code completion occurs following one or more template
2409 : /// headers.
2410 : CCC_Template,
2411 : /// \brief Code completion occurs following one or more template
2412 : /// headers within a class.
2413 : CCC_MemberTemplate,
2414 : /// \brief Code completion occurs within an expression.
2415 : CCC_Expression,
2416 : /// \brief Code completion occurs within a statement, which may
2417 : /// also be an expression or a declaration.
2418 : CCC_Statement,
2419 : /// \brief Code completion occurs at the beginning of the
2420 : /// initialization statement (or expression) in a for loop.
2421 : CCC_ForInit,
2422 : /// \brief Code completion ocurs within the condition of an if,
2423 : /// while, switch, or for statement.
2424 : CCC_Condition
2425 : };
2426 :
2427 : /// \brief Code completion for an ordinary name that occurs within the given
2428 : /// scope.
2429 : ///
2430 : /// \param S the scope in which the name occurs.
2431 : ///
2432 : /// \param CompletionContext the context in which code completion
2433 : /// occurs.
2434 : virtual void CodeCompleteOrdinaryName(Scope *S,
2435 0: CodeCompletionContext CompletionContext) { }
2436 :
2437 : /// \brief Code completion for a member access expression.
2438 : ///
2439 : /// This code completion action is invoked when the code-completion token
2440 : /// is found after the "." or "->" of a member access expression.
2441 : ///
2442 : /// \param S the scope in which the member access expression occurs.
2443 : ///
2444 : /// \param Base the base expression (e.g., the x in "x.foo") of the member
2445 : /// access.
2446 : ///
2447 : /// \param OpLoc the location of the "." or "->" operator.
2448 : ///
2449 : /// \param IsArrow true when the operator is "->", false when it is ".".
2450 : virtual void CodeCompleteMemberReferenceExpr(Scope *S, ExprTy *Base,
2451 : SourceLocation OpLoc,
2452 0: bool IsArrow) { }
2453 :
2454 : /// \brief Code completion for a reference to a tag.
2455 : ///
2456 : /// This code completion action is invoked when the code-completion
2457 : /// token is found after a tag keyword (struct, union, enum, or class).
2458 : ///
2459 : /// \param S the scope in which the tag reference occurs.
2460 : ///
2461 : /// \param TagSpec an instance of DeclSpec::TST, indicating what kind of tag
2462 : /// this is (struct/union/enum/class).
2463 0: virtual void CodeCompleteTag(Scope *S, unsigned TagSpec) { }
2464 :
2465 : /// \brief Code completion for a case statement.
2466 : ///
2467 : /// \brief S the scope in which the case statement occurs.
2468 0: virtual void CodeCompleteCase(Scope *S) { }
2469 :
2470 : /// \brief Code completion for a call.
2471 : ///
2472 : /// \brief S the scope in which the call occurs.
2473 : ///
2474 : /// \param Fn the expression describing the function being called.
2475 : ///
2476 : /// \param Args the arguments to the function call (so far).
2477 : ///
2478 : /// \param NumArgs the number of arguments in \p Args.
2479 : virtual void CodeCompleteCall(Scope *S, ExprTy *Fn,
2480 0: ExprTy **Args, unsigned NumArgs) { }
2481 :
2482 : /// \brief Code completion for a C++ nested-name-specifier that precedes a
2483 : /// qualified-id of some form.
2484 : ///
2485 : /// This code completion action is invoked when the code-completion token
2486 : /// is found after the "::" of a nested-name-specifier.
2487 : ///
2488 : /// \param S the scope in which the nested-name-specifier occurs.
2489 : ///
2490 : /// \param SS the scope specifier ending with "::".
2491 : ///
2492 : /// \parame EnteringContext whether we're entering the context of this
2493 : /// scope specifier.
2494 : virtual void CodeCompleteQualifiedId(Scope *S, const CXXScopeSpec &SS,
2495 0: bool EnteringContext) { }
2496 :
2497 : /// \brief Code completion for a C++ "using" declaration or directive.
2498 : ///
2499 : /// This code completion action is invoked when the code-completion token is
2500 : /// found after the "using" keyword.
2501 : ///
2502 : /// \param S the scope in which the "using" occurs.
2503 0: virtual void CodeCompleteUsing(Scope *S) { }
2504 :
2505 : /// \brief Code completion for a C++ using directive.
2506 : ///
2507 : /// This code completion action is invoked when the code-completion token is
2508 : /// found after "using namespace".
2509 : ///
2510 : /// \param S the scope in which the "using namespace" occurs.
2511 0: virtual void CodeCompleteUsingDirective(Scope *S) { }
2512 :
2513 : /// \brief Code completion for a C++ namespace declaration or namespace
2514 : /// alias declaration.
2515 : ///
2516 : /// This code completion action is invoked when the code-completion token is
2517 : /// found after "namespace".
2518 : ///
2519 : /// \param S the scope in which the "namespace" token occurs.
2520 0: virtual void CodeCompleteNamespaceDecl(Scope *S) { }
2521 :
2522 : /// \brief Code completion for a C++ namespace alias declaration.
2523 : ///
2524 : /// This code completion action is invoked when the code-completion token is
2525 : /// found after "namespace identifier = ".
2526 : ///
2527 : /// \param S the scope in which the namespace alias declaration occurs.
2528 0: virtual void CodeCompleteNamespaceAliasDecl(Scope *S) { }
2529 :
2530 : /// \brief Code completion for an operator name.
2531 : ///
2532 : /// This code completion action is invoked when the code-completion token is
2533 : /// found after the keyword "operator".
2534 : ///
2535 : /// \param S the scope in which the operator keyword occurs.
2536 0: virtual void CodeCompleteOperatorName(Scope *S) { }
2537 :
2538 : /// \brief Code completion after the '@' at the top level.
2539 : ///
2540 : /// \param S the scope in which the '@' occurs.
2541 : ///
2542 : /// \param ObjCImpDecl the Objective-C implementation or category
2543 : /// implementation.
2544 : ///
2545 : /// \param InInterface whether we are in an Objective-C interface or
2546 : /// protocol.
2547 : virtual void CodeCompleteObjCAtDirective(Scope *S, DeclPtrTy ObjCImpDecl,
2548 0: bool InInterface) { }
2549 :
2550 : /// \brief Code completion after the '@' in the list of instance variables.
2551 0: virtual void CodeCompleteObjCAtVisibility(Scope *S) { }
2552 :
2553 : /// \brief Code completion after the '@' in a statement.
2554 0: virtual void CodeCompleteObjCAtStatement(Scope *S) { }
2555 :
2556 : /// \brief Code completion after the '@' in an expression.
2557 0: virtual void CodeCompleteObjCAtExpression(Scope *S) { }
2558 :
2559 : /// \brief Code completion for an ObjC property decl.
2560 : ///
2561 : /// This code completion action is invoked when the code-completion token is
2562 : /// found after the left paren.
2563 : ///
2564 : /// \param S the scope in which the operator keyword occurs.
2565 0: virtual void CodeCompleteObjCPropertyFlags(Scope *S, ObjCDeclSpec &ODS) { }
2566 :
2567 : /// \brief Code completion for the getter of an Objective-C property
2568 : /// declaration.
2569 : ///
2570 : /// This code completion action is invoked when the code-completion
2571 : /// token is found after the "getter = " in a property declaration.
2572 : ///
2573 : /// \param S the scope in which the property is being declared.
2574 : ///
2575 : /// \param ClassDecl the Objective-C class or category in which the property
2576 : /// is being defined.
2577 : ///
2578 : /// \param Methods the set of methods declared thus far within \p ClassDecl.
2579 : ///
2580 : /// \param NumMethods the number of methods in \p Methods
2581 : virtual void CodeCompleteObjCPropertyGetter(Scope *S, DeclPtrTy ClassDecl,
2582 : DeclPtrTy *Methods,
2583 0: unsigned NumMethods) {
2584 0: }
2585 :
2586 : /// \brief Code completion for the setter of an Objective-C property
2587 : /// declaration.
2588 : ///
2589 : /// This code completion action is invoked when the code-completion
2590 : /// token is found after the "setter = " in a property declaration.
2591 : ///
2592 : /// \param S the scope in which the property is being declared.
2593 : ///
2594 : /// \param ClassDecl the Objective-C class or category in which the property
2595 : /// is being defined.
2596 : ///
2597 : /// \param Methods the set of methods declared thus far within \p ClassDecl.
2598 : ///
2599 : /// \param NumMethods the number of methods in \p Methods
2600 : virtual void CodeCompleteObjCPropertySetter(Scope *S, DeclPtrTy ClassDecl,
2601 : DeclPtrTy *Methods,
2602 0: unsigned NumMethods) {
2603 0: }
2604 :
2605 : /// \brief Code completion for an ObjC message expression that refers to
2606 : /// a class method.
2607 : ///
2608 : /// This code completion action is invoked when the code-completion token is
2609 : /// found after the class name and after each argument.
2610 : ///
2611 : /// \param S the scope in which the message expression occurs.
2612 : /// \param FName the factory name.
2613 : /// \param FNameLoc the source location of the factory name.
2614 : /// \param SelIdents the identifiers that describe the selector (thus far).
2615 : /// \param NumSelIdents the number of identifiers in \p SelIdents.
2616 : virtual void CodeCompleteObjCClassMessage(Scope *S, IdentifierInfo *FName,
2617 : SourceLocation FNameLoc,
2618 : IdentifierInfo **SelIdents,
2619 0: unsigned NumSelIdents){ }
2620 :
2621 : /// \brief Code completion for an ObjC message expression that refers to
2622 : /// an instance method.
2623 : ///
2624 : /// This code completion action is invoked when the code-completion token is
2625 : /// found after the receiver expression and after each argument.
2626 : ///
2627 : /// \param S the scope in which the operator keyword occurs.
2628 : /// \param Receiver an expression for the receiver of the message.
2629 : /// \param SelIdents the identifiers that describe the selector (thus far).
2630 : /// \param NumSelIdents the number of identifiers in \p SelIdents.
2631 : virtual void CodeCompleteObjCInstanceMessage(Scope *S, ExprTy *Receiver,
2632 : IdentifierInfo **SelIdents,
2633 0: unsigned NumSelIdents) { }
2634 :
2635 : /// \brief Code completion for a list of protocol references in Objective-C,
2636 : /// such as P1 and P2 in \c id<P1,P2>.
2637 : ///
2638 : /// This code completion action is invoked prior to each identifier
2639 : /// in the protocol list.
2640 : ///
2641 : /// \param Protocols the set of protocols that have already been parsed.
2642 : ///
2643 : /// \param NumProtocols the number of protocols that have already been
2644 : /// parsed.
2645 : virtual void CodeCompleteObjCProtocolReferences(IdentifierLocPair *Protocols,
2646 0: unsigned NumProtocols) { }
2647 :
2648 : /// \brief Code completion for a protocol declaration or definition, after
2649 : /// the @protocol but before any identifier.
2650 : ///
2651 : /// \param S the scope in which the protocol declaration occurs.
2652 0: virtual void CodeCompleteObjCProtocolDecl(Scope *S) { }
2653 :
2654 : /// \brief Code completion for an Objective-C interface, after the
2655 : /// @interface but before any identifier.
2656 0: virtual void CodeCompleteObjCInterfaceDecl(Scope *S) { }
2657 :
2658 : /// \brief Code completion for the superclass of an Objective-C
2659 : /// interface, after the ':'.
2660 : ///
2661 : /// \param S the scope in which the interface declaration occurs.
2662 : ///
2663 : /// \param ClassName the name of the class being defined.
2664 : virtual void CodeCompleteObjCSuperclass(Scope *S,
2665 0: IdentifierInfo *ClassName) {
2666 0: }
2667 :
2668 : /// \brief Code completion for an Objective-C implementation, after the
2669 : /// @implementation but before any identifier.
2670 0: virtual void CodeCompleteObjCImplementationDecl(Scope *S) { }
2671 :
2672 : /// \brief Code completion for the category name in an Objective-C interface
2673 : /// declaration.
2674 : ///
2675 : /// This code completion action is invoked after the '(' that indicates
2676 : /// a category name within an Objective-C interface declaration.
2677 : virtual void CodeCompleteObjCInterfaceCategory(Scope *S,
2678 0: IdentifierInfo *ClassName) {
2679 0: }
2680 :
2681 : /// \brief Code completion for the category name in an Objective-C category
2682 : /// implementation.
2683 : ///
2684 : /// This code completion action is invoked after the '(' that indicates
2685 : /// the category name within an Objective-C category implementation.
2686 : virtual void CodeCompleteObjCImplementationCategory(Scope *S,
2687 0: IdentifierInfo *ClassName) {
2688 0: }
2689 :
2690 : /// \brief Code completion for the property names when defining an
2691 : /// Objective-C property.
2692 : ///
2693 : /// This code completion action is invoked after @synthesize or @dynamic and
2694 : /// after each "," within one of those definitions.
2695 : virtual void CodeCompleteObjCPropertyDefinition(Scope *S,
2696 0: DeclPtrTy ObjCImpDecl) {
2697 0: }
2698 :
2699 : /// \brief Code completion for the instance variable name that should
2700 : /// follow an '=' when synthesizing an Objective-C property.
2701 : ///
2702 : /// This code completion action is invoked after each '=' that occurs within
2703 : /// an @synthesized definition.
2704 : virtual void CodeCompleteObjCPropertySynthesizeIvar(Scope *S,
2705 : IdentifierInfo *PropertyName,
2706 0: DeclPtrTy ObjCImpDecl) {
2707 0: }
2708 : //@}
2709 : };
2710 :
2711 : /// MinimalAction - Minimal actions are used by light-weight clients of the
2712 : /// parser that do not need name resolution or significant semantic analysis to
2713 : /// be performed. The actions implemented here are in the form of unresolved
2714 : /// identifiers. By using a simpler interface than the SemanticAction class,
2715 : /// the parser doesn't have to build complex data structures and thus runs more
2716 : /// quickly.
2717 : class MinimalAction : public Action {
2718 : /// Translation Unit Scope - useful to Objective-C actions that need
2719 : /// to lookup file scope declarations in the "ordinary" C decl namespace.
2720 : /// For example, user-defined classes, built-in "id" type, etc.
2721 : Scope *TUScope;
2722 : IdentifierTable &Idents;
2723 : Preprocessor &PP;
2724 : void *TypeNameInfoTablePtr;
2725 : public:
2726 : MinimalAction(Preprocessor &pp);
2727 : ~MinimalAction();
2728 :
2729 : /// getTypeName - This looks at the IdentifierInfo::FETokenInfo field to
2730 : /// determine whether the name is a typedef or not in this scope.
2731 : ///
2732 : /// \param II the identifier for which we are performing name lookup
2733 : ///
2734 : /// \param NameLoc the location of the identifier
2735 : ///
2736 : /// \param S the scope in which this name lookup occurs
2737 : ///
2738 : /// \param SS if non-NULL, the C++ scope specifier that precedes the
2739 : /// identifier
2740 : ///
2741 : /// \param isClassName whether this is a C++ class-name production, in
2742 : /// which we can end up referring to a member of an unknown specialization
2743 : /// that we know (from the grammar) is supposed to be a type. For example,
2744 : /// this occurs when deriving from "std::vector<T>::allocator_type", where T
2745 : /// is a template parameter.
2746 : ///
2747 : /// \returns the type referred to by this identifier, or NULL if the type
2748 : /// does not name an identifier.
2749 : virtual TypeTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
2750 : Scope *S, const CXXScopeSpec *SS,
2751 : bool isClassName = false,
2752 : TypeTy *ObjectType = 0);
2753 :
2754 : /// isCurrentClassName - Always returns false, because MinimalAction
2755 : /// does not support C++ classes with constructors.
2756 : virtual bool isCurrentClassName(const IdentifierInfo& II, Scope *S,
2757 : const CXXScopeSpec *SS);
2758 :
2759 : virtual TemplateNameKind isTemplateName(Scope *S,
2760 : const CXXScopeSpec &SS,
2761 : UnqualifiedId &Name,
2762 : TypeTy *ObjectType,
2763 : bool EnteringContext,
2764 : TemplateTy &Template);
2765 :
2766 : /// ActOnDeclarator - If this is a typedef declarator, we modify the
2767 : /// IdentifierInfo::FETokenInfo field to keep track of this fact, until S is
2768 : /// popped.
2769 : virtual DeclPtrTy ActOnDeclarator(Scope *S, Declarator &D);
2770 :
2771 : /// ActOnPopScope - When a scope is popped, if any typedefs are now
2772 : /// out-of-scope, they are removed from the IdentifierInfo::FETokenInfo field.
2773 : virtual void ActOnPopScope(SourceLocation Loc, Scope *S);
2774 : virtual void ActOnTranslationUnitScope(SourceLocation Loc, Scope *S);
2775 :
2776 : virtual DeclPtrTy ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
2777 : IdentifierInfo **IdentList,
2778 : SourceLocation *SLocs,
2779 : unsigned NumElts);
2780 :
2781 : virtual DeclPtrTy ActOnStartClassInterface(SourceLocation interLoc,
2782 : IdentifierInfo *ClassName,
2783 : SourceLocation ClassLoc,
2784 : IdentifierInfo *SuperName,
2785 : SourceLocation SuperLoc,
2786 : const DeclPtrTy *ProtoRefs,
2787 : unsigned NumProtoRefs,
2788 : const SourceLocation *ProtoLocs,
2789 : SourceLocation EndProtoLoc,
2790 : AttributeList *AttrList);
2791 : };
2792 :
2793 : /// PrettyStackTraceActionsDecl - If a crash occurs in the parser while parsing
2794 : /// something related to a virtualized decl, include that virtualized decl in
2795 : /// the stack trace.
0: branch 1 not taken
15195: branch 2 taken
0: branch 6 not taken
2796 15195: class PrettyStackTraceActionsDecl : public llvm::PrettyStackTraceEntry {
2797 : Action::DeclPtrTy TheDecl;
2798 : SourceLocation Loc;
2799 : Action &Actions;
2800 : SourceManager &SM;
2801 : const char *Message;
2802 : public:
2803 : PrettyStackTraceActionsDecl(Action::DeclPtrTy Decl, SourceLocation L,
2804 : Action &actions, SourceManager &sm,
2805 15195: const char *Msg)
2806 15195: : TheDecl(Decl), Loc(L), Actions(actions), SM(sm), Message(Msg) {}
2807 :
2808 : virtual void print(llvm::raw_ostream &OS) const;
2809 : };
2810 :
2811 : /// \brief RAII object that enters a new expression evaluation context.
2812 : class EnterExpressionEvaluationContext {
2813 : /// \brief The action object.
2814 : Action &Actions;
2815 :
2816 : public:
2817 : EnterExpressionEvaluationContext(Action &Actions,
2818 53904: Action::ExpressionEvaluationContext NewContext)
2819 53904: : Actions(Actions) {
2820 53904: Actions.PushExpressionEvaluationContext(NewContext);
2821 53904: }
2822 :
2823 53904: ~EnterExpressionEvaluationContext() {
2824 53904: Actions.PopExpressionEvaluationContext();
2825 53904: }
2826 : };
2827 :
2828 : } // end namespace clang
2829 :
2830 : #endif
Generated: 2010-02-10 01:31 by zcov