aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Parse/Parser.h23
-rw-r--r--include/clang/Sema/Action.h3303
-rw-r--r--include/clang/Sema/AttributeList.h1
-rw-r--r--include/clang/Sema/Designator.h15
-rw-r--r--include/clang/Sema/Ownership.h21
-rw-r--r--include/clang/Sema/PrettyDeclStackTrace.h46
-rw-r--r--include/clang/Sema/Sema.h539
-rw-r--r--lib/Parse/ParseCXXInlineMethods.cpp2
-rw-r--r--lib/Parse/ParseDecl.cpp32
-rw-r--r--lib/Parse/ParseDeclCXX.cpp52
-rw-r--r--lib/Parse/ParseExpr.cpp22
-rw-r--r--lib/Parse/ParseExprCXX.cpp8
-rw-r--r--lib/Parse/ParseInit.cpp12
-rw-r--r--lib/Parse/ParseObjc.cpp42
-rw-r--r--lib/Parse/ParsePragma.cpp25
-rw-r--r--lib/Parse/ParsePragma.h32
-rw-r--r--lib/Parse/ParseStmt.cpp17
-rw-r--r--lib/Parse/ParseTemplate.cpp4
-rw-r--r--lib/Parse/Parser.cpp14
-rw-r--r--lib/Sema/Action.cpp38
-rw-r--r--lib/Sema/CMakeLists.txt1
-rw-r--r--lib/Sema/Sema.cpp19
-rw-r--r--lib/Sema/SemaAttr.cpp10
-rw-r--r--lib/Sema/SemaCXXCast.cpp7
-rw-r--r--lib/Sema/SemaCodeComplete.cpp124
-rw-r--r--lib/Sema/SemaDecl.cpp10
-rw-r--r--lib/Sema/SemaDeclAttr.cpp2
-rw-r--r--lib/Sema/SemaDeclCXX.cpp29
-rw-r--r--lib/Sema/SemaExprCXX.cpp11
-rw-r--r--lib/Sema/SemaExprObjC.cpp36
-rw-r--r--lib/Sema/SemaInit.cpp60
-rw-r--r--lib/Sema/SemaOverload.cpp23
-rw-r--r--lib/Sema/SemaTemplate.cpp32
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp4
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp26
-rw-r--r--lib/Sema/SemaType.cpp2
-rw-r--r--lib/Sema/TreeTransform.h425
37 files changed, 990 insertions, 4079 deletions
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h
index e4dad1fba5..5a8ff91cb1 100644
--- a/include/clang/Parse/Parser.h
+++ b/include/clang/Parse/Parser.h
@@ -17,8 +17,9 @@
#include "clang/Basic/Specifiers.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/CodeCompletionHandler.h"
-#include "clang/Sema/Action.h"
+#include "clang/Sema/Sema.h"
#include "clang/Sema/DeclSpec.h"
+#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/ADT/OwningPtr.h"
#include <stack>
#include <list>
@@ -93,7 +94,7 @@ class Parser : public CodeCompletionHandler {
/// Actions - These are the callbacks we invoke as we parse various constructs
/// in the file.
- Action &Actions;
+ Sema &Actions;
Diagnostic &Diags;
@@ -134,13 +135,13 @@ class Parser : public CodeCompletionHandler {
unsigned TemplateParameterDepth;
public:
- Parser(Preprocessor &PP, Action &Actions);
+ Parser(Preprocessor &PP, Sema &Actions);
~Parser();
const LangOptions &getLang() const { return PP.getLangOptions(); }
const TargetInfo &getTargetInfo() const { return PP.getTargetInfo(); }
Preprocessor &getPreprocessor() const { return PP; }
- Action &getActions() const { return Actions; }
+ Sema &getActions() const { return Actions; }
const Token &getCurToken() const { return Tok; }
Scope *getCurScope() const { return Actions.getCurScope(); }
@@ -166,7 +167,7 @@ public:
typedef Expr *ExprArg;
typedef ASTMultiPtr<Stmt*> MultiStmtArg;
- typedef Action::FullExprArg FullExprArg;
+ typedef Sema::FullExprArg FullExprArg;
/// Adorns a ExprResult with Actions to make it an ExprResult
ExprResult Owned(ExprResult res) {
@@ -658,8 +659,8 @@ private:
/// variable's initializer, but not when parsing the body of a
/// class or function definition.
class ParsingDeclRAIIObject {
- Action &Actions;
- Action::ParsingDeclStackState State;
+ Sema &Actions;
+ Sema::ParsingDeclStackState State;
bool Popped;
public:
@@ -963,10 +964,10 @@ private:
/// ParseExpressionList - Used for C/C++ (argument-)expression-list.
bool ParseExpressionList(llvm::SmallVectorImpl<Expr*> &Exprs,
llvm::SmallVectorImpl<SourceLocation> &CommaLocs,
- void (Action::*Completer)(Scope *S,
- Expr *Data,
- Expr **Args,
- unsigned NumArgs) = 0,
+ void (Sema::*Completer)(Scope *S,
+ Expr *Data,
+ Expr **Args,
+ unsigned NumArgs) = 0,
Expr *Data = 0);
/// ParenParseOption - Control what ParseParenExpression will parse.
diff --git a/include/clang/Sema/Action.h b/include/clang/Sema/Action.h
deleted file mode 100644
index 1af23ba776..0000000000
--- a/include/clang/Sema/Action.h
+++ /dev/null
@@ -1,3303 +0,0 @@
-//===--- Action.h - Parser Action Interface ---------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the Action and EmptyAction interface.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_SEMA_ACTION_H
-#define LLVM_CLANG_SEMA_ACTION_H
-
-#include "clang/Basic/IdentifierTable.h"
-#include "clang/Basic/SourceLocation.h"
-#include "clang/Basic/Specifiers.h"
-#include "clang/Basic/TemplateKinds.h"
-#include "clang/Basic/TypeTraits.h"
-#include "clang/Sema/DeclSpec.h"
-#include "clang/Sema/Ownership.h"
-#include "llvm/Support/PrettyStackTrace.h"
-#include "llvm/ADT/PointerUnion.h"
-
-namespace clang {
- // Semantic.
- class AttributeList;
- class CXXScopeSpec;
- class Declarator;
- class DeclSpec;
- struct FieldDeclarator;
- class ObjCDeclSpec;
- class TemplateParameterList;
-
- // Parse.
- class Scope;
- class Action;
- class Selector;
- class Designation;
- class InitListDesignations;
- // Lex.
- class Preprocessor;
- class Token;
- class MacroInfo;
-
-/// Action - As the parser reads the input file and recognizes the productions
-/// of the grammar, it invokes methods on this class to turn the parsed input
-/// into something useful: e.g. a parse tree.
-///
-/// The callback methods that this class provides are phrased as actions that
-/// the parser has just done or is about to do when the method is called. They
-/// are not requests that the actions module do the specified action.
-///
-/// All of the methods here are optional except getTypeName() and
-/// isCurrentClassName(), which must be specified in order for the
-/// parse to complete accurately.
-class Action {
- /// \brief The parser's current scope.
- ///
- /// The parser maintains this state here so that is accessible to \c Action
- /// subclasses via \c getCurScope().
- Scope *CurScope;
-
-protected:
- friend class Parser;
-
- /// \brief Retrieve the parser's current scope.
- Scope *getCurScope() const { return CurScope; }
-
-public:
- Action() : CurScope(0) { }
-
- /// Out-of-line virtual destructor to provide home for this class.
- virtual ~Action();
-
- // Types - Though these don't actually enforce strong typing, they document
- // what types are required to be identical for the actions.
- // Types - Though these don't actually enforce strong typing, they document
- // what types are required to be identical for the actions.
- typedef OpaquePtr<DeclGroupRef> DeclGroupPtrTy;
- typedef OpaquePtr<TemplateName> TemplateTy;
- typedef OpaquePtr<QualType> TypeTy;
- typedef Attr AttrTy;
- typedef CXXBaseSpecifier BaseTy;
- typedef CXXBaseOrMemberInitializer MemInitTy;
- typedef Expr ExprTy;
- typedef Stmt StmtTy;
- typedef TemplateParameterList TemplateParamsTy;
- typedef NestedNameSpecifier CXXScopeTy;
-
- /// Expr/Stmt/Type/BaseResult - Provide a unique type to wrap
- /// ExprTy/StmtTy/TypeTy/BaseTy, providing strong typing and
- /// allowing for failure.
- typedef clang::ExprResult ExprResult;
- typedef clang::StmtResult StmtResult;
- typedef clang::TypeResult TypeResult;
- typedef clang::BaseResult BaseResult;
- typedef clang::DeclResult DeclResult;
- typedef clang::MemInitResult MemInitResult;
-
- /// Single expressions or statements as arguments.
- typedef Expr *ExprArg;
- typedef Stmt *StmtArg;
-
- /// Multiple expressions or statements as arguments.
- typedef ASTMultiPtr<Expr*> MultiExprArg;
- typedef ASTMultiPtr<Stmt*> MultiStmtArg;
- typedef ASTMultiPtr<TemplateParameterList*> MultiTemplateParamsArg;
-
- class FullExprArg {
- public:
- FullExprArg(Action &actions) : E(0) { }
-
- // FIXME: The const_cast here is ugly. RValue references would make this
- // much nicer (or we could duplicate a bunch of the move semantics
- // emulation code from Ownership.h).
- FullExprArg(const FullExprArg& Other): E(Other.E) {}
-
- ExprResult release() {
- return move(E);
- }
-
- Expr *get() const { return E; }
-
- Expr *operator->() {
- return E;
- }
-
- private:
- // FIXME: No need to make the entire Action class a friend when it's just
- // Action::FullExpr that needs access to the constructor below.
- friend class Action;
-
- explicit FullExprArg(Expr *expr) : E(expr) {}
-
- Expr *E;
- };
-
- FullExprArg MakeFullExpr(Expr *Arg) {
- return FullExprArg(ActOnFinishFullExpr(Arg).release());
- }
-
- // Utilities for Action implementations to return smart results.
-
- ExprResult ExprError() { return ExprResult(true); }
- StmtResult StmtError() { return StmtResult(true); }
-
- ExprResult ExprError(const DiagnosticBuilder&) { return ExprError(); }
- StmtResult StmtError(const DiagnosticBuilder&) { return StmtError(); }
-
- ExprResult ExprEmpty() { return ExprResult(false); }
- StmtResult StmtEmpty() { return StmtResult(false); }
-
- /// Statistics.
- virtual void PrintStats() const {}
-
- /// getDeclName - Return a pretty name for the specified decl if possible, or
- /// an empty string if not. This is used for pretty crash reporting.
- virtual std::string getDeclName(Decl *D) { return ""; }
-
- //===--------------------------------------------------------------------===//
- // Declaration Tracking Callbacks.
- //===--------------------------------------------------------------------===//
-
- typedef uintptr_t ParsingDeclStackState;
-
- /// PushParsingDeclaration - Notes that the parser has begun
- /// processing a declaration of some sort. Guaranteed to be matched
- /// by a call to PopParsingDeclaration with the value returned by
- /// this method.
- virtual ParsingDeclStackState PushParsingDeclaration() {
- return ParsingDeclStackState();
- }
-
- /// PopParsingDeclaration - Notes that the parser has completed
- /// processing a declaration of some sort. The decl will be empty
- /// if the declaration didn't correspond to a full declaration (or
- /// if the actions module returned an empty decl for it).
- virtual void PopParsingDeclaration(ParsingDeclStackState S, Decl *D) {
- }
-
- /// ConvertDeclToDeclGroup - If the parser has one decl in a context where it
- /// needs a decl group, it calls this to convert between the two
- /// representations.
- virtual DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr) {
- return DeclGroupPtrTy();
- }
-
- virtual void DiagnoseUseOfUnimplementedSelectors() {}
-
- /// getTypeName - Return non-null if the specified identifier is a type name
- /// in the current scope.
- ///
- /// \param II the identifier for which we are performing name lookup
- ///
- /// \param NameLoc the location of the identifier
- ///
- /// \param S the scope in which this name lookup occurs
- ///
- /// \param SS if non-NULL, the C++ scope specifier that precedes the
- /// identifier
- ///
- /// \param isClassName whether this is a C++ class-name production, in
- /// which we can end up referring to a member of an unknown specialization
- /// that we know (from the grammar) is supposed to be a type. For example,
- /// this occurs when deriving from "std::vector<T>::allocator_type", where T
- /// is a template parameter.
- ///
- /// \param ObjectType if we're checking whether an identifier is a type
- /// within a C++ member access expression, this will be the type of the
- ///
- /// \returns the type referred to by this identifier, or NULL if the type
- /// does not name an identifier.
- virtual ParsedType getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
- Scope *S, CXXScopeSpec *SS = 0,
- bool isClassName = false,
- ParsedType ObjectType = ParsedType()) = 0;
-
- /// isTagName() - This method is called *for error recovery purposes only*
- /// to determine if the specified name is a valid tag name ("struct foo"). If
- /// so, this returns the TST for the tag corresponding to it (TST_enum,
- /// TST_union, TST_struct, TST_class). This is used to diagnose cases in C
- /// where the user forgot to specify the tag.
- virtual DeclSpec::TST isTagName(IdentifierInfo &II, Scope *S) {
- return DeclSpec::TST_unspecified;
- }
-
- /// \brief Action called as part of error recovery when the parser has
- /// determined that the given name must refer to a type, but
- /// \c getTypeName() did not return a result.
- ///
- /// This callback permits the action to give a detailed diagnostic when an
- /// unknown type name is encountered and, potentially, to try to recover
- /// by producing a new type in \p SuggestedType.
- ///
- /// \param II the name that should be a type.
- ///
- /// \param IILoc the location of the name in the source.
- ///
- /// \param S the scope in which name lookup was performed.
- ///
- /// \param SS if non-NULL, the C++ scope specifier that preceded the name.
- ///
- /// \param SuggestedType if the action sets this type to a non-NULL type,
- /// the parser will recovery by consuming the type name token and then
- /// pretending that the given type was the type it parsed.
- ///
- /// \returns true if a diagnostic was emitted, false otherwise. When false,
- /// the parser itself will emit a generic "unknown type name" diagnostic.
- virtual bool DiagnoseUnknownTypeName(const IdentifierInfo &II,
- SourceLocation IILoc,
- Scope *S,
- CXXScopeSpec *SS,
- ParsedType &SuggestedType) {
- return false;
- }
-
- /// isCurrentClassName - Return true if the specified name is the
- /// name of the innermost C++ class type currently being defined.
- virtual bool isCurrentClassName(const IdentifierInfo &II, Scope *S,
- const CXXScopeSpec *SS = 0) = 0;
-
- /// \brief Determine whether the given name refers to a template.
- ///
- /// This callback is used by the parser after it has seen a '<' to determine
- /// whether the given name refers to a template and, if so, what kind of
- /// template.
- ///
- /// \param S the scope in which the name occurs.
- ///
- /// \param SS the C++ nested-name-specifier that precedes the template name,
- /// if any.
- ///
- /// \param hasTemplateKeyword true if the template keyword was specified.
- ///
- /// \param Name the name that we are querying to determine whether it is
- /// a template.
- ///
- /// \param ObjectType if we are determining whether the given name is a
- /// template name in the context of a member access expression (e.g.,
- /// \c p->X<int>), this is the type of the object referred to by the
- /// member access (e.g., \c p).
- ///
- /// \param EnteringContext whether we are potentially entering the context
- /// referred to by the nested-name-specifier \p SS, which allows semantic
- /// analysis to look into uninstantiated templates.
- ///
- /// \param Template if the name does refer to a template, the declaration
- /// of the template that the name refers to.
- ///
- /// \param MemberOfUnknownSpecialization Will be set true if the resulting
- /// member would be a member of an unknown specialization, in which case this
- /// lookup cannot possibly pass at this time.
- ///
- /// \returns the kind of template that this name refers to.
- virtual TemplateNameKind isTemplateName(Scope *S,
- CXXScopeSpec &SS,
- bool hasTemplateKeyword,
- UnqualifiedId &Name,
- ParsedType ObjectType,
- bool EnteringContext,
- TemplateTy &Template,
- bool &MemberOfUnknownSpecialization) = 0;
-
- /// \brief Action called as part of error recovery when the parser has
- /// determined that the given name must refer to a template, but
- /// \c isTemplateName() did not return a result.
- ///
- /// This callback permits the action to give a detailed diagnostic when an
- /// unknown template name is encountered and, potentially, to try to recover
- /// by producing a new template in \p SuggestedTemplate.
- ///
- /// \param II the name that should be a template.
- ///
- /// \param IILoc the location of the name in the source.
- ///
- /// \param S the scope in which name lookup was performed.
- ///
- /// \param SS the C++ scope specifier that preceded the name.
- ///
- /// \param SuggestedTemplate if the action sets this template to a non-NULL,
- /// template, the parser will recover by consuming the template name token
- /// and the template argument list that follows.
- ///
- /// \param SuggestedTemplateKind as input, the kind of template that we
- /// expect (e.g., \c TNK_Type_template or \c TNK_Function_template). If the
- /// action provides a suggested template, this should be set to the kind of
- /// template.
- ///
- /// \returns true if a diagnostic was emitted, false otherwise. When false,
- /// the parser itself will emit a generic "unknown template name" diagnostic.
- virtual bool DiagnoseUnknownTemplateName(const IdentifierInfo &II,
- SourceLocation IILoc,
- Scope *S,
- const CXXScopeSpec *SS,
- TemplateTy &SuggestedTemplate,
- TemplateNameKind &SuggestedKind) {
- return false;
- }
-
- /// \brief Determine whether the given name refers to a non-type nested name
- /// specifier, e.g., the name of a namespace or namespace alias.
- ///
- /// This actual is used in the parsing of pseudo-destructor names to
- /// distinguish a nested-name-specifier and a "type-name ::" when we
- /// see the token sequence "X :: ~".
- virtual bool isNonTypeNestedNameSpecifier(Scope *S, CXXScopeSpec &SS,
- SourceLocation IdLoc,
- IdentifierInfo &II,
- ParsedType ObjectType) {
- return false;
- }
-
- /// ActOnCXXGlobalScopeSpecifier - Return the object that represents the
- /// global scope ('::').
- virtual CXXScopeTy *ActOnCXXGlobalScopeSpecifier(Scope *S,
- SourceLocation CCLoc) {
- return 0;
- }
-
- /// \brief Parsed an identifier followed by '::' in a C++
- /// nested-name-specifier.
- ///
- /// \param S the scope in which the nested-name-specifier was parsed.
- ///
- /// \param SS the nested-name-specifier that precedes the identifier. For
- /// example, if we are parsing "foo::bar::", \p SS will describe the "foo::"
- /// that has already been parsed.
- ///
- /// \param IdLoc the location of the identifier we have just parsed (e.g.,
- /// the "bar" in "foo::bar::".
- ///
- /// \param CCLoc the location of the '::' at the end of the
- /// nested-name-specifier.
- ///
- /// \param II the identifier that represents the scope that this
- /// nested-name-specifier refers to, e.g., the "bar" in "foo::bar::".
- ///
- /// \param ObjectType if this nested-name-specifier occurs as part of a
- /// C++ member access expression such as "x->Base::f", the type of the base
- /// object (e.g., *x in the example, if "x" were a pointer).
- ///
- /// \param EnteringContext if true, then we intend to immediately enter the
- /// context of this nested-name-specifier, e.g., for an out-of-line
- /// definition of a class member.
- ///
- /// \returns a CXXScopeTy* object representing the C++ scope.
- virtual CXXScopeTy *ActOnCXXNestedNameSpecifier(Scope *S,
- CXXScopeSpec &SS,
- SourceLocation IdLoc,
- SourceLocation CCLoc,
- IdentifierInfo &II,
- ParsedType ObjectType,
- bool EnteringContext) {
- return 0;
- }
-
- /// IsInvalidUnlessNestedName - This method is used for error recovery
- /// purposes to determine whether the specified identifier is only valid as
- /// a nested name specifier, for example a namespace name. It is
- /// conservatively correct to always return false from this method.
- ///
- /// The arguments are the same as those passed to ActOnCXXNestedNameSpecifier.
- virtual bool IsInvalidUnlessNestedName(Scope *S,
- CXXScopeSpec &SS,
- IdentifierInfo &II,
- ParsedType ObjectType,
- bool EnteringContext) {
- return false;
- }
-
- /// ActOnCXXNestedNameSpecifier - Called during parsing of a
- /// nested-name-specifier that involves a template-id, e.g.,
- /// "foo::bar<int, float>::", and now we need to build a scope
- /// specifier. \p SS is empty or the previously parsed nested-name
- /// part ("foo::"), \p Type is the already-parsed class template
- /// specialization (or other template-id that names a type), \p
- /// TypeRange is the source range where the type is located, and \p
- /// CCLoc is the location of the trailing '::'.
- virtual CXXScopeTy *ActOnCXXNestedNameSpecifier(Scope *S,
- const CXXScopeSpec &SS,
- ParsedType Type,
- SourceRange TypeRange,
- SourceLocation CCLoc) {
- return 0;
- }
-
- /// ShouldEnterDeclaratorScope - Called when a C++ scope specifier
- /// is parsed as part of a declarator-id to determine whether a scope
- /// should be entered.
- ///
- /// \param S the current scope
- /// \param SS the scope being entered
- /// \param isFriendDeclaration whether this is a friend declaration
- virtual bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
- return false;
- }
-
- /// ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global
- /// scope or nested-name-specifier) is parsed as part of a declarator-id.
- /// After this method is called, according to [C++ 3.4.3p3], names should be
- /// looked up in the declarator-id's scope, until the declarator is parsed and
- /// ActOnCXXExitDeclaratorScope is called.
- /// The 'SS' should be a non-empty valid CXXScopeSpec.
- /// \returns true if an error occurred, false otherwise.
- virtual bool ActOnCXXEnterDeclaratorScope(Scope *S, CXXScopeSpec &SS) {
- return false;
- }
-
- /// ActOnCXXExitDeclaratorScope - Called when a declarator that previously
- /// invoked ActOnCXXEnterDeclaratorScope(), is finished. 'SS' is the same
- /// CXXScopeSpec that was passed to ActOnCXXEnterDeclaratorScope as well.
- /// Used to indicate that names should revert to being looked up in the
- /// defining scope.
- virtual void ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
- }
-
- /// ActOnCXXEnterDeclInitializer - Invoked when we are about to parse an
- /// initializer for the declaration 'Dcl'.
- /// After this method is called, according to [C++ 3.4.1p13], if 'Dcl' is a
- /// static data member of class X, names should be looked up in the scope of
- /// class X.
- virtual void ActOnCXXEnterDeclInitializer(Scope *S, Decl *Dcl) {
- }
-
- /// ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an
- /// initializer for the declaration 'Dcl'.
- virtual void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl) {
- }
-
- /// ActOnDeclarator - This callback is invoked when a declarator is parsed and
- /// 'Init' specifies the initializer if any. This is for things like:
- /// "int X = 4" or "typedef int foo".
- ///
- virtual Decl *ActOnDeclarator(Scope *S, Declarator &D) {
- return 0;
- }
-
- /// ActOnParamDeclarator - This callback is invoked when a parameter
- /// declarator is parsed. This callback only occurs for functions
- /// with prototypes. S is the function prototype scope for the
- /// parameters (C++ [basic.scope.proto]).
- virtual Decl *ActOnParamDeclarator(Scope *S, Declarator &D) {
- return 0;
- }
-
- /// \brief Parsed an exception object declaration within an Objective-C
- /// @catch statement.
- virtual Decl *ActOnObjCExceptionDecl(Scope *S, Declarator &D) {
- return 0;
- }
-
- /// AddInitializerToDecl - This action is called immediately after
- /// ActOnDeclarator (when an initializer is present). The code is factored
- /// this way to make sure we are able to handle the following:
- /// void func() { int xx = xx; }
- /// This allows ActOnDeclarator to register "xx" prior to parsing the
- /// initializer. The declaration above should still result in a warning,
- /// since the reference to "xx" is uninitialized.
- virtual void AddInitializerToDecl(Decl *Dcl, ExprArg Init) {
- return;
- }
-
- /// SetDeclDeleted - This action is called immediately after ActOnDeclarator
- /// if =delete is parsed. C++0x [dcl.fct.def]p10
- /// Note that this can be called even for variable declarations. It's the
- /// action's job to reject it.
- virtual void SetDeclDeleted(Decl *Dcl, SourceLocation DelLoc) {
- return;
- }
-
- /// ActOnUninitializedDecl - This action is called immediately after
- /// ActOnDeclarator (when an initializer is *not* present).
- /// If TypeContainsUndeducedAuto is true, then the type of the declarator
- /// has an undeduced 'auto' type somewhere.
- virtual void ActOnUninitializedDecl(Decl *Dcl,
- bool TypeContainsUndeducedAuto) {
- return;
- }
-
- /// \brief Note that the given declaration had an initializer that could not
- /// be parsed.
- virtual void ActOnInitializerError(Decl *Dcl) {
- return;
- }
-
- /// FinalizeDeclaratorGroup - After a sequence of declarators are parsed, this
- /// gives the actions implementation a chance to process the group as a whole.
- virtual DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, const DeclSpec& DS,
- Decl **Group,
- unsigned NumDecls) {
- return DeclGroupPtrTy();
- }
-
-
- /// @brief Indicates that all K&R-style parameter declarations have
- /// been parsed prior to a function definition.
- /// @param S The function prototype scope.
- /// @param D The function declarator.
- virtual void ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D,
- SourceLocation LocAfterDecls) {
- }
-
- /// ActOnStartOfFunctionDef - This is called at the start of a function
- /// definition, instead of calling ActOnDeclarator. The Declarator includes
- /// information about formal arguments that are part of this function.
- virtual Decl *ActOnStartOfFunctionDef(Scope *FnBodyScope,
- Declarator &D) = 0;
-
- /// ActOnStartOfFunctionDef - This is called at the start of a function
- /// definition, after the FunctionDecl has already been created.
- virtual Decl *ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D) = 0;
-
- virtual void ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) {
- return;
- }
-
- /// ActOnFinishFunctionBody - This is called when a function body has
- /// completed parsing. Decl is returned by ParseStartOfFunctionDef.
- virtual Decl *ActOnFinishFunctionBody(Decl *Decl, StmtArg Body) {
- return Decl;
- }
-
- virtual Decl *ActOnFileScopeAsmDecl(SourceLocation Loc,
- ExprArg AsmString) {
- return 0;
- }
-
- /// ActOnPopScope - This callback is called immediately before the specified
- /// scope is popped and deleted.
- virtual void ActOnPopScope(SourceLocation Loc, Scope *S) {}
-
- /// ActOnTranslationUnitScope - This callback is called once, immediately
- /// after creating the translation unit scope (in Parser::Initialize).
- virtual void ActOnTranslationUnitScope(Scope *S) {}
-
- /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
- /// no declarator (e.g. "struct foo;") is parsed.
- virtual Decl *ParsedFreeStandingDeclSpec(Scope *S,
- AccessSpecifier Access,
- DeclSpec &DS) {
- return 0;
- }
-
- /// ActOnStartLinkageSpecification - Parsed the beginning of a C++
- /// linkage specification, including the language and (if present)
- /// the '{'. ExternLoc is the location of the 'extern', LangLoc is
- /// the location of the language string literal, which is provided
- /// by Lang/StrSize. LBraceLoc, if valid, provides the location of
- /// the '{' brace. Otherwise, this linkage specification does not
- /// have any braces.
- virtual Decl *ActOnStartLinkageSpecification(Scope *S,
- SourceLocation ExternLoc,
- SourceLocation LangLoc,
- llvm::StringRef Lang,
- SourceLocation LBraceLoc) {
- return 0;
- }
-
- /// ActOnFinishLinkageSpecification - Completely the definition of
- /// the C++ linkage specification LinkageSpec. If RBraceLoc is
- /// valid, it's the position of the closing '}' brace in a linkage
- /// specification that uses braces.
- virtual Decl *ActOnFinishLinkageSpecification(Scope *S,
- Decl *LinkageSpec,
- SourceLocation RBraceLoc) {
- return LinkageSpec;
- }
-
- /// ActOnEndOfTranslationUnit - This is called at the very end of the
- /// translation unit when EOF is reached and all but the top-level scope is
- /// pop