aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-08-26 23:41:50 +0000
committerJohn McCall <rjmccall@apple.com>2010-08-26 23:41:50 +0000
commitf312b1ea179f1c44371f9ee0cd0bc006f612de11 (patch)
tree41c3e6944395d783ebe193409578392f9e37d4d1
parent468e8fbda71a02eba31b4d8282fc1d509b552fbe (diff)
One who seeks knowledge learns something new every day.
One who seeks the Tao unlearns something new every day. Less and less remains until you arrive at non-action. When you arrive at non-action, nothing will be left undone. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112244 91177308-0d34-0410-b5e6-96231b3b80d8
-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
- /// popped.
- virtual void ActOnEndOfTranslationUnit() {}
-
- //===--------------------------------------------------------------------===//
- // Type Parsing Callbacks.
- //===--------------------------------------------------------------------===//
-
- /// ActOnTypeName - A type-name (type-id in C++) was parsed.
- virtual TypeResult ActOnTypeName(Scope *S, Declarator &D) {
- return TypeResult();
- }
-
- enum TagUseKind {
- TUK_Reference, // Reference to a tag: 'struct foo *X;'
- TUK_Declaration, // Fwd decl of a tag: 'struct foo;'
- TUK_Definition, // Definition of a tag: 'struct foo { int X; } Y;'
- TUK_Friend // Friend declaration: 'friend struct foo;'
- };
-
- /// \brief The parser has encountered a tag (e.g., "class X") that should be
- /// turned into a declaration by the action module.
- ///
- /// \param S the scope in which this tag occurs.
- ///
- /// \param TagSpec an instance of DeclSpec::TST, indicating what kind of tag
- /// this is (struct/union/enum/class).
- ///
- /// \param TUK how the tag we have encountered is being used, which
- /// can be a reference to a (possibly pre-existing) tag, a
- /// declaration of that tag, or the beginning of a definition of
- /// that tag.
- ///
- /// \param KWLoc the location of the "struct", "class", "union", or "enum"
- /// keyword.
- ///
- /// \param SS C++ scope specifier that precedes the name of the tag, e.g.,
- /// the "std::" in "class std::type_info".
- ///
- /// \param Name the name of the tag, e.g., "X" in "struct X". This parameter
- /// may be NULL, to indicate an anonymous class/struct/union/enum type.
- ///
- /// \param NameLoc the location of the name of the tag.
- ///
- /// \param Attr the set of attributes that appertain to the tag.
- ///
- /// \param AS when this tag occurs within a C++ class, provides the
- /// current access specifier (AS_public, AS_private, AS_protected).
- /// Otherwise, it will be AS_none.
- ///
- /// \param TemplateParameterLists the set of C++ template parameter lists
- /// that apply to this tag, if the tag is a declaration or definition (see
- /// the \p TK parameter). The action module is responsible for determining,
- /// based on the template parameter lists and the scope specifier, whether
- /// the declared tag is a class template or not.
- ///
- /// \param OwnedDecl the callee should set this flag true when the returned
- /// declaration is "owned" by this reference. Ownership is handled entirely
- /// by the action module.
- ///
- /// \returns the declaration to which this tag refers.
- virtual Decl *ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
- SourceLocation KWLoc, CXXScopeSpec &SS,
- IdentifierInfo *Name, SourceLocation NameLoc,
- AttributeList *Attr, AccessSpecifier AS,
- MultiTemplateParamsArg TemplateParameterLists,
- bool &OwnedDecl, bool &IsDependent) {
- return 0;
- }
-
- /// Acts on a reference to a dependent tag name. This arises in
- /// cases like:
- ///
- /// template <class T> class A;
- /// template <class T> class B {
- /// friend class A<T>::M; // here
- /// };
- ///
- /// \param TagSpec an instance of DeclSpec::TST corresponding to the
- /// tag specifier.
- ///
- /// \param TUK the tag use kind (either TUK_Friend or TUK_Reference)
- ///
- /// \param SS the scope specifier (always defined)
- virtual TypeResult ActOnDependentTag(Scope *S,
- unsigned TagSpec,
- TagUseKind TUK,
- const CXXScopeSpec &SS,
- IdentifierInfo *Name,
- SourceLocation KWLoc,
- SourceLocation NameLoc) {
- return TypeResult();
- }
-
- /// Act on @defs() element found when parsing a structure. ClassName is the
- /// name of the referenced class.
- virtual void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart,
- IdentifierInfo *ClassName,
- llvm::SmallVectorImpl<Decl *> &Decls) {}
- virtual Decl *ActOnField(Scope *S, Decl *TagD,
- SourceLocation DeclStart,
- Declarator &D, ExprTy *BitfieldWidth) {
- return 0;
- }
-
- virtual Decl *ActOnIvar(Scope *S, SourceLocation DeclStart,
- Decl *IntfDecl,
- Declarator &D, ExprTy *BitfieldWidth,
- tok::ObjCKeywordKind visibility) {
- return 0;
- }
-
- virtual void ActOnLastBitfield(SourceLocation DeclStart, Decl *IntfDecl,
- llvm::SmallVectorImpl<Decl *> &AllIvarDecls) {}
-
- virtual void ActOnFields(Scope* S, SourceLocation RecLoc, Decl *TagDecl,
- Decl **Fields, unsigned NumFields,
- SourceLocation LBrac, SourceLocation RBrac,
- AttributeList *AttrList) {}
-
- /// ActOnTagStartDefinition - Invoked when we have entered the
- /// scope of a tag's definition (e.g., for an enumeration, class,
- /// struct, or union).
- virtual void ActOnTagStartDefinition(Scope *S, Decl *TagDecl) { }
-
- /// ActOnStartCXXMemberDeclarations - Invoked when we have parsed a
- /// C++ record definition's base-specifiers clause and are starting its
- /// member declarations.
- virtual void ActOnStartCXXMemberDeclarations(Scope *S, Decl *TagDecl,
- SourceLocation LBraceLoc) { }
-
- /// ActOnTagFinishDefinition - Invoked once we have finished parsing
- /// the definition of a tag (enumeration, class, struct, or union).
- ///
- /// The scope is the scope of the tag definition.
- virtual void ActOnTagFinishDefinition(Scope *S, Decl *TagDecl,
- SourceLocation RBraceLoc) { }
-
- /// ActOnTagDefinitionError - Invoked if there's an unrecoverable
- /// error parsing the definition of a tag.
- ///
- /// The scope is the scope of the tag definition.
- virtual void ActOnTagDefinitionError(Scope *S, Decl *TagDecl) { }
-
- virtual Decl *ActOnEnumConstant(Scope *S, Decl *EnumDecl,
- Decl *LastEnumConstant,
- SourceLocation IdLoc, IdentifierInfo *Id,
- SourceLocation EqualLoc, ExprTy *Val) {
- return 0;
- }
- virtual void ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
- SourceLocation RBraceLoc, Decl *EnumDecl,
- Decl **Elements, unsigned NumElements,
- Scope *S, AttributeList *AttrList) {}
-
- //===--------------------------------------------------------------------===//
- // Statement Parsing Callbacks.
- //===--------------------------------------------------------------------===//
-
- virtual StmtResult ActOnNullStmt(SourceLocation SemiLoc) {
- return StmtEmpty();
- }
-
- virtual StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R,
- MultiStmtArg Elts,
- bool isStmtExpr) {
- return StmtEmpty();
- }
- virtual StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl,
- SourceLocation StartLoc,
- SourceLocation EndLoc) {
- return StmtEmpty();
- }
-
- virtual void ActOnForEachDeclStmt(DeclGroupPtrTy Decl) {
- }
-
- virtual StmtResult ActOnExprStmt(FullExprArg Expr) = 0;
-
- /// ActOnCaseStmt - Note that this handles the GNU 'case 1 ... 4' extension,
- /// which can specify an RHS value. The sub-statement of the case is
- /// specified in a separate action.
- virtual StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprArg LHSVal,
- SourceLocation DotDotDotLoc,
- ExprArg RHSVal,
- SourceLocation ColonLoc) {
- return StmtEmpty();
- }
-
- /// ActOnCaseStmtBody - This installs a statement as the body of a case.
- virtual void ActOnCaseStmtBody(StmtTy *CaseStmt, StmtArg SubStmt) {}
-
- virtual StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc,
- SourceLocation ColonLoc,
- StmtArg SubStmt, Scope *CurScope){
- return StmtEmpty();
- }
-
- virtual StmtResult ActOnLabelStmt(SourceLocation IdentLoc,
- IdentifierInfo *II,
- SourceLocation ColonLoc,
- StmtArg SubStmt) {
- return StmtEmpty();
- }
-
- /// \brief Parsed an "if" statement.
- ///
- /// \param IfLoc the location of the "if" keyword.
- ///
- /// \param CondVal if the "if" condition was parsed as an expression,
- /// the expression itself.
- ///
- /// \param CondVar if the "if" condition was parsed as a condition variable,
- /// the condition variable itself.
- ///
- /// \param ThenVal the "then" statement.
- ///
- /// \param ElseLoc the location of the "else" keyword.
- ///
- /// \param ElseVal the "else" statement.
- virtual StmtResult ActOnIfStmt(SourceLocation IfLoc,
- FullExprArg CondVal,
- Decl *CondVar,
- StmtArg ThenVal,
- SourceLocation ElseLoc,
- StmtArg ElseVal) {
- return StmtEmpty();
- }
-
- /// \brief Parsed the start of a "switch" statement.
- ///
- /// \param SwitchLoc The location of the "switch" keyword.
- ///
- /// \param Cond if the "switch" condition was parsed as an expression,
- /// the expression itself.
- ///
- /// \param CondVar if the "switch" condition was parsed as a condition
- /// variable, the condition variable itself.
- virtual StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc,
- ExprArg Cond,
- Decl *CondVar) {
- return StmtEmpty();
- }
-
- virtual StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc,
- StmtArg Switch, StmtArg Body) {
- return StmtEmpty();
- }
-
- /// \brief Parsed a "while" statement.
- ///
- /// \param Cond if the "while" condition was parsed as an expression,
- /// the expression itself.
- ///
- /// \param CondVar if the "while" condition was parsed as a condition
- /// variable, the condition variable itself.
- ///
- /// \param Body the body of the "while" loop.
- virtual StmtResult ActOnWhileStmt(SourceLocation WhileLoc,
- FullExprArg Cond, Decl *CondVar,
- StmtArg Body) {
- return StmtEmpty();
- }
- virtual StmtResult ActOnDoStmt(SourceLocation DoLoc, StmtArg Body,
- SourceLocation WhileLoc,
- SourceLocation CondLParen,
- ExprArg Cond,
- SourceLocation CondRParen) {
- return StmtEmpty();
- }
-
- /// \brief Parsed a "for" statement.
- ///
- /// \param ForLoc the location of the "for" keyword.
- ///
- /// \param LParenLoc the location of the left parentheses.
- ///
- /// \param First the statement used to initialize the for loop.
- ///
- /// \param Second the condition to be checked during each iteration, if
- /// that condition was parsed as an expression.
- ///
- /// \param SecondArg the condition variable to be checked during each
- /// iterator, if that condition was parsed as a variable declaration.
- ///
- /// \param Third the expression that will be evaluated to "increment" any
- /// values prior to the next iteration.
- ///
- /// \param RParenLoc the location of the right parentheses.
- ///
- /// \param Body the body of the "body" loop.
- virtual StmtResult ActOnForStmt(SourceLocation ForLoc,
- SourceLocation LParenLoc,
- StmtArg First, FullExprArg Second,
- Decl *SecondVar, FullExprArg Third,
- SourceLocation RParenLoc,
- StmtArg Body) {
- return StmtEmpty();
- }
-
- virtual StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc,
- SourceLocation LParenLoc,
- StmtArg First, ExprArg Second,
- SourceLocation RParenLoc, StmtArg Body) {
- return StmtEmpty();
- }
- virtual StmtResult ActOnGotoStmt(SourceLocation GotoLoc,
- SourceLocation LabelLoc,
- IdentifierInfo *LabelII) {
- return StmtEmpty();
- }
- virtual StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc,
- SourceLocation StarLoc,
- ExprArg DestExp) {
- return StmtEmpty();
- }
- virtual StmtResult ActOnContinueStmt(SourceLocation ContinueLoc,
- Scope *CurScope) {
- return StmtEmpty();
- }
- virtual StmtResult ActOnBreakStmt(SourceLocation GotoLoc,
- Scope *CurScope) {
- return StmtEmpty();
- }
- virtual StmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
- ExprArg RetValExp) {
- return StmtEmpty();
- }
- virtual StmtResult ActOnAsmStmt(SourceLocation AsmLoc,
- bool IsSimple,
- bool IsVolatile,
- unsigned NumOutputs,
- unsigned NumInputs,
- IdentifierInfo **Names,
- MultiExprArg Constraints,
- MultiExprArg Exprs,
- ExprArg AsmString,
- MultiExprArg Clobbers,
- SourceLocation RParenLoc,
- bool MSAsm = false) {
- return StmtEmpty();
- }
-
- // Objective-c statements
-
- /// \brief Parsed an Objective-C @catch statement.
- ///
- /// \param AtLoc The location of the '@' starting the '@catch'.
- ///
- /// \param RParen The location of the right parentheses ')' after the
- /// exception variable.
- ///
- /// \param Parm The variable that will catch the exception. Will be NULL if
- /// this is a @catch(...) block.
- ///
- /// \param Body The body of the @catch block.
- virtual StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
- SourceLocation RParen,
- Decl *Parm, StmtArg Body) {
- return StmtEmpty();
- }
-
- /// \brief Parsed an Objective-C @finally statement.
- ///
- /// \param AtLoc The location of the '@' starting the '@finally'.
- ///
- /// \param Body The body of the @finally block.
- virtual StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
- StmtArg Body) {
- return StmtEmpty();
- }
-
- /// \brief Parsed an Objective-C @try-@catch-@finally statement.
- ///
- /// \param AtLoc The location of the '@' starting '@try'.
- ///
- /// \param Try The body of the '@try' statement.
- ///
- /// \param CatchStmts The @catch statements.
- ///
- /// \param Finally The @finally statement.
- virtual StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc,
- StmtArg Try,
- MultiStmtArg CatchStmts,
- StmtArg Finally) {
- return StmtEmpty();
- }
-
- virtual StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
- ExprArg Throw,
- Scope *CurScope) {
- return StmtEmpty();
- }
-
- virtual StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
- ExprArg SynchExpr,
- StmtArg SynchBody) {
- return StmtEmpty();
- }
-
- // C++ Statements
- virtual Decl *ActOnExceptionDeclarator(Scope *S, Declarator &D) {
- return 0;
- }
-
- virtual StmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc,
- Decl *ExceptionDecl,
- StmtArg HandlerBlock) {
- return StmtEmpty();
- }
-
- virtual StmtResult ActOnCXXTryBlock(SourceLocation TryLoc,
- StmtArg TryBlock,
- MultiStmtArg Handlers) {
- return StmtEmpty();
- }
-
- //===--------------------------------------------------------------------===//
- // Expression Parsing Callbacks.
- //===--------------------------------------------------------------------===//
-
- /// \brief Describes how the expressions currently being parsed are
- /// evaluated at run-time, if at all.
- enum ExpressionEvaluationContext {
- /// \brief The current expression and its subexpressions occur within an
- /// unevaluated operand (C++0x [expr]p8), such as a constant expression
- /// or the subexpression of \c sizeof, where the type or the value of the
- /// expression may be significant but no code will be generated to evaluate
- /// the value of the expression at run time.
- Unevaluated,
-
- /// \brief The current expression is potentially evaluated at run time,
- /// which means that code may be generated to evaluate the value of the
- /// expression at run time.
- PotentiallyEvaluated,
-
- /// \brief The current expression may be potentially evaluated or it may
- /// be unevaluated, but it is impossible to tell from the lexical context.
- /// This evaluation context is used primary for the operand of the C++
- /// \c typeid expression, whose argument is potentially evaluated only when
- /// it is an lvalue of polymorphic class type (C++ [basic.def.odr]p2).
- PotentiallyPotentiallyEvaluated
- };
-
- /// \brief The parser is entering a new expression evaluation context.
- ///
- /// \param NewContext is the new expression evaluation context.
- virtual void
- PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext) { }
-
- /// \brief The parser is exiting an expression evaluation context.
- virtual void
- PopExpressionEvaluationContext() { }
-
- // Primary Expressions.
-
- /// \brief Retrieve the source range that corresponds to the given
- /// expression.
- virtual SourceRange getExprRange(ExprTy *E) const {
- return SourceRange();
- }
-
- /// \brief Parsed an id-expression (C++) or identifier (C) in expression
- /// context, e.g., the expression "x" that refers to a variable named "x".
- ///
- /// \param S the scope in which this id-expression or identifier occurs.
- ///
- /// \param SS the C++ nested-name-specifier that qualifies the name of the
- /// value, e.g., "std::" in "std::sort".
- ///
- /// \param Name the name to which the id-expression refers. In C, this will
- /// always be an identifier. In C++, it may also be an overloaded operator,
- /// destructor name (if there is a nested-name-specifier), or template-id.
- ///
- /// \param HasTrailingLParen whether the next token following the
- /// id-expression or identifier is a left parentheses ('(').
- ///
- /// \param IsAddressOfOperand whether the token that precedes this
- /// id-expression or identifier was an ampersand ('&'), indicating that
- /// we will be taking the address of this expression.
- virtual ExprResult ActOnIdExpression(Scope *S,
- CXXScopeSpec &SS,
- UnqualifiedId &Name,
- bool HasTrailingLParen,
- bool IsAddressOfOperand) {
- return ExprEmpty();
- }
-
- virtual ExprResult ActOnPredefinedExpr(SourceLocation Loc,
- tok::TokenKind Kind) {
- return ExprEmpty();
- }
- virtual ExprResult ActOnCharacterConstant(const Token &) {
- return ExprEmpty();
- }
- virtual ExprResult ActOnNumericConstant(const Token &) {
- return ExprEmpty();
- }
-
- /// ActOnStringLiteral - The specified tokens were lexed as pasted string
- /// fragments (e.g. "foo" "bar" L"baz").
- virtual ExprResult ActOnStringLiteral(const Token *Toks,
- unsigned NumToks) {
- return ExprEmpty();
- }
-
- virtual ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R,
- ExprArg Val) {
- return move(Val); // Default impl returns operand.
- }
-
- virtual ExprResult ActOnParenOrParenListExpr(SourceLocation L,
- SourceLocation R,
- MultiExprArg Val,
- ParsedType TypeOfCast
- = ParsedType()) {
- return ExprEmpty();
- }
-
- // Postfix Expressions.
- virtual ExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc,
- tok::TokenKind Kind,
- ExprArg Input) {
- return ExprEmpty();
- }
- virtual ExprResult ActOnArraySubscriptExpr(Scope *S, ExprArg Base,
- SourceLocation LLoc,
- ExprArg Idx,
- SourceLocation RLoc) {
- return ExprEmpty();
- }
-
- /// \brief Parsed a member access expresion (C99 6.5.2.3, C++ [expr.ref])
- /// of the form \c x.m or \c p->m.
- ///
- /// \param S the scope in which the member access expression occurs.
- ///
- /// \param Base the class or pointer to class into which this member
- /// access expression refers, e.g., \c x in \c x.m.
- ///
- /// \param OpLoc the location of the "." or "->" operator.
- ///
- /// \param OpKind the kind of member access operator, which will be either
- /// tok::arrow ("->") or tok::period (".").
- ///
- /// \param SS in C++, the nested-name-specifier that precedes the member
- /// name, if any.
- ///
- /// \param Member the name of the member that we are referring to. In C,
- /// this will always store an identifier; in C++, we may also have operator
- /// names, conversion function names, destructors, and template names.
- ///
- /// \param ObjCImpDecl the Objective-C implementation declaration.
- /// FIXME: Do we really need this?
- ///
- /// \param HasTrailingLParen whether this member name is immediately followed
- /// by a left parentheses ('(').
- virtual ExprResult ActOnMemberAccessExpr(Scope *S, ExprArg Base,
- SourceLocation OpLoc,
- tok::TokenKind OpKind,
- CXXScopeSpec &SS,
- UnqualifiedId &Member,
- Decl *ObjCImpDecl,
- bool HasTrailingLParen) {
- return ExprEmpty();
- }
-
- /// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
- /// This provides the location of the left/right parens and a list of comma
- /// locations. There are guaranteed to be one fewer commas than arguments,
- /// unless there are zero arguments.
- virtual ExprResult ActOnCallExpr(Scope *S, ExprArg Fn,
- SourceLocation LParenLoc,
- MultiExprArg Args,
- SourceLocation *CommaLocs,
- SourceLocation RParenLoc) {
- return ExprEmpty();
- }
-
- // Unary Operators. 'Tok' is the token for the operator.
- virtual ExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
- tok::TokenKind Op, ExprArg Input) {
- return ExprEmpty();
- }
- virtual ExprResult
- ActOnSizeOfAlignOfExpr(SourceLocation OpLoc, bool isSizeof, bool isType,
- void *TyOrEx, const SourceRange &ArgRange) {
- return ExprEmpty();
- }
-
- virtual ExprResult ActOnCompoundLiteral(SourceLocation LParen,
- ParsedType Ty,
- SourceLocation RParen,
- ExprArg Op) {
- return ExprEmpty();
- }
- virtual ExprResult ActOnInitList(SourceLocation LParenLoc,
- MultiExprArg InitList,
- SourceLocation RParenLoc) {
- return ExprEmpty();
- }
- /// @brief Parsed a C99 designated initializer.
- ///
- /// @param Desig Contains the designation with one or more designators.
- ///
- /// @param Loc The location of the '=' or ':' prior to the
- /// initialization expression.
- ///
- /// @param GNUSyntax If true, then this designated initializer used
- /// the deprecated GNU syntax @c fieldname:foo or @c [expr]foo rather
- /// than the C99 syntax @c .fieldname=foo or @c [expr]=foo.
- ///
- /// @param Init The value that the entity (or entities) described by
- /// the designation will be initialized with.
- virtual ExprResult ActOnDesignatedInitializer(Designation &Desig,
- SourceLocation Loc,
- bool GNUSyntax,
- ExprResult Init) {
- return ExprEmpty();
- }
-
- virtual ExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
- ParsedType Ty, SourceLocation RParenLoc,
- ExprArg Op) {
- return ExprEmpty();
- }
-
- virtual bool TypeIsVectorType(ParsedType Ty) {
- return false;
- }
-
- virtual ExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc,
- tok::TokenKind Kind,
- ExprArg LHS, ExprArg RHS) {
- return ExprEmpty();
- }
-
- /// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
- /// in the case of a the GNU conditional expr extension.
- virtual ExprResult ActOnConditionalOp(SourceLocation QuestionLoc,
- SourceLocation ColonLoc,
- ExprArg Cond, ExprArg LHS,
- ExprArg RHS) {
- return ExprEmpty();
- }
-
- //===---------------------- GNU Extension Expressions -------------------===//
-
- virtual ExprResult ActOnAddrLabel(SourceLocation OpLoc,
- SourceLocation LabLoc,
- IdentifierInfo *LabelII) { // "&&foo"
- return ExprEmpty();
- }
-
- virtual ExprResult ActOnStmtExpr(SourceLocation LPLoc, StmtArg SubStmt,
- SourceLocation RPLoc) { // "({..})"
- return ExprEmpty();
- }
-
- // __builtin_offsetof(type, identifier(.identifier|[expr])*)
- struct OffsetOfComponent {
- SourceLocation LocStart, LocEnd;
- bool isBrackets; // true if [expr], false if .ident
- union {
- IdentifierInfo *IdentInfo;
- ExprTy *E;
- } U;
- };
-
- virtual ExprResult ActOnBuiltinOffsetOf(Scope *S,
- SourceLocation BuiltinLoc,
- SourceLocation TypeLoc,
- ParsedType Arg1,
- OffsetOfComponent *CompPtr,
- unsigned NumComponents,
- SourceLocation RParenLoc) {
- return ExprEmpty();
- }
-
- // __builtin_types_compatible_p(type1, type2)
- virtual ExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
- ParsedType arg1,
- ParsedType arg2,
- SourceLocation RPLoc) {
- return ExprEmpty();
- }
- // __builtin_choose_expr(constExpr, expr1, expr2)
- virtual ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
- ExprArg cond, ExprArg expr1,
- ExprArg expr2, SourceLocation RPLoc){
- return ExprEmpty();
- }
-
- // __builtin_va_arg(expr, type)
- virtual ExprResult ActOnVAArg(SourceLocation BuiltinLoc,
- ExprArg expr, ParsedType type,
- SourceLocation RPLoc) {
- return ExprEmpty();
- }
-
- /// ActOnGNUNullExpr - Parsed the GNU __null expression, the token
- /// for which is at position TokenLoc.
- virtual ExprResult ActOnGNUNullExpr(SourceLocation TokenLoc) {
- return ExprEmpty();
- }
-
- //===------------------------- "Block" Extension ------------------------===//
-
- /// ActOnBlockStart - This callback is invoked when a block literal is
- /// started. The result pointer is passed into the block finalizers.
- virtual void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope) {}
-
- /// ActOnBlockArguments - This callback allows processing of block arguments.
- /// If there are no arguments, this is still invoked.
- virtual void ActOnBlockArguments(Declarator &ParamInfo, Scope *CurScope) {}
-
- /// ActOnBlockError - If there is an error parsing a block, this callback
- /// is invoked to pop the information about the block from the action impl.
- virtual void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope) {}
-
- /// ActOnBlockStmtExpr - This is called when the body of a block statement
- /// literal was successfully completed. ^(int x){...}
- virtual ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc,
- StmtArg Body,
- Scope *CurScope) {
- return ExprEmpty();
- }
-
- //===------------------------- C++ Declarations -------------------------===//
-
- /// ActOnStartNamespaceDef - This is called at the start of a namespace
- /// definition.
- virtual Decl *ActOnStartNamespaceDef(Scope *S, SourceLocation IdentLoc,
- IdentifierInfo *Ident,
- SourceLocation LBrace,
- AttributeList *AttrList) {
- return 0;
- }
-
- /// ActOnFinishNamespaceDef - This callback is called after a namespace is
- /// exited. Decl is returned by ActOnStartNamespaceDef.
- virtual void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace) {
- return;
- }
-
- /// ActOnUsingDirective - This is called when using-directive is parsed.
- virtual Decl *ActOnUsingDirective(Scope *CurScope,
- SourceLocation UsingLoc,
- SourceLocation NamespcLoc,
- CXXScopeSpec &SS,
- SourceLocation IdentLoc,
- IdentifierInfo *NamespcName,
- AttributeList *AttrList) = 0;
-
- /// ActOnNamespaceAliasDef - This is called when a namespace alias definition
- /// is parsed.
- virtual Decl *ActOnNamespaceAliasDef(Scope *CurScope,
- SourceLocation NamespaceLoc,
- SourceLocation AliasLoc,
- IdentifierInfo *Alias,
- CXXScopeSpec &SS,
- SourceLocation IdentLoc,
- IdentifierInfo *Ident) {
- return 0;
- }
-
- /// \brief Parsed a C++ using-declaration.
- ///
- /// This callback will be invoked when the parser has parsed a C++
- /// using-declaration, e.g.,
- ///
- /// \code
- /// namespace std {
- /// template<typename T, typename Alloc> class vector;
- /// }
- ///
- /// using std::vector; // using-declaration here
- /// \endcode
- ///
- /// \param CurScope the scope in which this using declaration was parsed.
- ///
- /// \param AS the currently-active access specifier.
- ///
- /// \param HasUsingKeyword true if this was declared with an
- /// explicit 'using' keyword (i.e. if this is technically a using
- /// declaration, not an access declaration)
- ///
- /// \param UsingLoc the location of the 'using' keyword.
- ///
- /// \param SS the nested-name-specifier that precedes the name.
- ///
- /// \param Name the name to which the using declaration refers.
- ///
- /// \param AttrList attributes applied to this using declaration, if any.
- ///
- /// \param IsTypeName whether this using declaration started with the
- /// 'typename' keyword. FIXME: This will eventually be split into a
- /// separate action.
- ///
- /// \param TypenameLoc the location of the 'typename' keyword, if present
- ///
- /// \returns a representation of the using declaration.
- virtual Decl *ActOnUsingDeclaration(Scope *CurScope,
- AccessSpecifier AS,
- bool HasUsingKeyword,
- SourceLocation UsingLoc,
- CXXScopeSpec &SS,
- UnqualifiedId &Name,
- AttributeList *AttrList,
- bool IsTypeName,
- SourceLocation TypenameLoc) = 0;
-
- /// ActOnParamDefaultArgument - Parse default argument for function parameter
- virtual void ActOnParamDefaultArgument(Decl *param,
- SourceLocation EqualLoc,
- ExprArg defarg) {
- }
-
- /// ActOnParamUnparsedDefaultArgument - We've seen a default
- /// argument for a function parameter, but we can't parse it yet
- /// because we're inside a class definition. Note that this default
- /// argument will be parsed later.
- virtual void ActOnParamUnparsedDefaultArgument(Decl *param,
- SourceLocation EqualLoc,
- SourceLocation ArgLoc) { }
-
- /// ActOnParamDefaultArgumentError - Parsing or semantic analysis of
- /// the default argument for the parameter param failed.
- virtual void ActOnParamDefaultArgumentError(Decl *param) { }
-
- /// AddCXXDirectInitializerToDecl - This action is called immediately after
- /// ActOnDeclarator, when a C++ direct initializer is present.
- /// e.g: "int x(1);"
- virtual void AddCXXDirectInitializerToDecl(Decl *Dcl,
- SourceLocation LParenLoc,
- MultiExprArg Exprs,
- SourceLocation *CommaLocs,
- SourceLocation RParenLoc) {
- return;
- }
-
- /// \brief Called when we re-enter a template parameter scope.
- ///
- /// This action occurs when we are going to parse an member
- /// function's default arguments or inline definition after the
- /// outermost class definition has been completed, and when one or
- /// more of the class definitions enclosing the member function is a
- /// template. The "entity" in the given scope will be set as it was
- /// when we entered the scope of the template initially, and should
- /// be used to, e.g., reintroduce the names of template parameters
- /// into the current scope so that they can be found by name lookup.
- ///
- /// \param S The (new) template parameter scope.
- ///
- /// \param Template the class template declaration whose template
- /// parameters should be reintroduced into the current scope.
- virtual void ActOnReenterTemplateScope(Scope *S, Decl *Template) {
- }
-
- /// ActOnStartDelayedMemberDeclarations - We have completed parsing
- /// a C++ class, and we are about to start parsing any parts of
- /// member declarations that could not be parsed earlier. Enter
- /// the appropriate record scope.
- virtual void ActOnStartDelayedMemberDeclarations(Scope *S,
- Decl *Record) {
- }
-
- /// ActOnStartDelayedCXXMethodDeclaration - We have completed
- /// parsing a top-level (non-nested) C++ class, and we are now
- /// parsing those parts of the given Method declaration that could
- /// not be parsed earlier (C++ [class.mem]p2), such as default
- /// arguments. This action should enter the scope of the given
- /// Method declaration as if we had just parsed the qualified method
- /// name. However, it should not bring the parameters into scope;
- /// that will be performed by ActOnDelayedCXXMethodParameter.
- virtual void ActOnStartDelayedCXXMethodDeclaration(Scope *S,
- Decl *Method) {
- }
-
- /// ActOnDelayedCXXMethodParameter - We've already started a delayed
- /// C++ method declaration. We're (re-)introducing the given
- /// function parameter into scope for use in parsing later parts of
- /// the method declaration. For example, we could see an
- /// ActOnParamDefaultArgument event for this parameter.
- virtual void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param) {
- }
-
- /// ActOnFinishDelayedCXXMethodDeclaration - We have finished
- /// processing the delayed method declaration for Method. The method
- /// declaration is now considered finished. There may be a separate
- /// ActOnStartOfFunctionDef action later (not necessarily
- /// immediately!) for this method, if it was also defined inside the
- /// class body.
- virtual void ActOnFinishDelayedCXXMethodDeclaration(Scope *S,
- Decl *Method) {
- }
-
- /// ActOnFinishDelayedMemberDeclarations - We have finished parsing
- /// a C++ class, and we are about to start parsing any parts of
- /// member declarations that could not be parsed earlier. Enter the
- /// appropriate record scope.
- virtual void ActOnFinishDelayedMemberDeclarations(Scope *S,
- Decl *Record) {
- }
-
- /// ActOnStaticAssertDeclaration - Parse a C++0x static_assert declaration.
- virtual Decl *ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
- ExprArg AssertExpr,
- ExprArg AssertMessageExpr) {
- return 0;
- }
-
- /// ActOnFriendFunctionDecl - Parsed a friend function declarator.
- /// The name is actually a slight misnomer, because the declarator
- /// is not necessarily a function declarator.
- virtual Decl *ActOnFriendFunctionDecl(Scope *S,
- Declarator &D,
- bool IsDefinition,
- MultiTemplateParamsArg TParams) {
- return 0;
- }
-
- /// ActOnFriendTypeDecl - Parsed a friend type declaration.
- virtual Decl *ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
- MultiTemplateParamsArg TParams) {
- return 0;
- }
-
- //===------------------------- C++ Expressions --------------------------===//
-
- /// \brief Parsed a destructor name or pseudo-destructor name.
- ///
- /// \returns the type being destructed.
- virtual ParsedType getDestructorName(SourceLocation TildeLoc,
- IdentifierInfo &II, SourceLocation NameLoc,
- Scope *S, CXXScopeSpec &SS,
- ParsedType ObjectType,
- bool EnteringContext) {
- return getTypeName(II, NameLoc, S, &SS, false, ObjectType);
- }
-
-
- /// ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const}_cast's.
- virtual ExprResult ActOnCXXNamedCast(SourceLocation OpLoc,
- tok::TokenKind Kind,
- SourceLocation LAngleBracketLoc,
- ParsedType Ty,
- SourceLocation RAngleBracketLoc,
- SourceLocation LParenLoc,
- ExprArg Op,
- SourceLocation RParenLoc) {
- return ExprEmpty();
- }
-
- /// ActOnCXXTypeidOfType - Parse typeid( type-id ).
- virtual ExprResult ActOnCXXTypeid(SourceLocation OpLoc,
- SourceLocation LParenLoc, bool isType,
- void *TyOrExpr,
- SourceLocation RParenLoc) {
- return ExprEmpty();
- }
-
- /// ActOnCXXThis - Parse the C++ 'this' pointer.
- virtual ExprResult ActOnCXXThis(SourceLocation ThisLoc) {
- return ExprEmpty();
- }
-
- /// ActOnCXXBoolLiteral - Parse {true,false} literals.
- virtual ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc,
- tok::TokenKind Kind) {
- return ExprEmpty();
- }
-
- /// ActOnCXXNullPtrLiteral - Parse 'nullptr'.
- virtual ExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc) {
- return ExprEmpty();
- }
-
- /// ActOnCXXThrow - Parse throw expressions.
- virtual ExprResult ActOnCXXThrow(SourceLocation OpLoc, ExprArg Op) {
- return ExprEmpty();
- }
-
- /// ActOnCXXTypeConstructExpr - Parse construction of a specified type.
- /// Can be interpreted either as function-style casting ("int(x)")
- /// or class type construction ("ClassType(x,y,z)")
- /// or creation of a value-initialized type ("int()").
- virtual ExprResult ActOnCXXTypeConstructExpr(SourceRange TypeRange,
- ParsedType TypeRep,
- SourceLocation LParenLoc,
- MultiExprArg Exprs,
- SourceLocation *CommaLocs,
- SourceLocation RParenLoc) {
- return ExprEmpty();
- }
-
- /// \brief Parsed a condition declaration in a C++ if, switch, or while
- /// statement.
- ///
- /// This callback will be invoked after parsing the declaration of "x" in
- ///
- /// \code
- /// if (int x = f()) {
- /// // ...
- /// }
- /// \endcode
- ///
- /// \param S the scope of the if, switch, or while statement.
- ///
- /// \param D the declarator that that describes the variable being declared.
- virtual DeclResult ActOnCXXConditionDeclaration(Scope *S, Declarator &D) = 0;
-
- /// \brief Parsed an expression that will be handled as the condition in
- /// an if/while/for statement.
- ///
- /// This routine handles the conversion of the expression to 'bool'.
- ///
- /// \param S The scope in which the expression occurs.
- ///
- /// \param Loc The location of the construct that requires the conversion to
- /// a boolean value.
- ///
- /// \param SubExpr The expression that is being converted to bool.
- virtual ExprResult ActOnBooleanCondition(Scope *S, SourceLocation Loc,
- ExprArg SubExpr) {
- return move(SubExpr);
- }
-
- /// \brief Parsed a C++ 'new' expression.
- ///
- /// \param StartLoc The start of the new expression, which is either the
- /// "new" keyword or the "::" preceding it, depending on \p UseGlobal.
- ///
- /// \param UseGlobal True if the "new" was qualified with "::".
- ///
- /// \param PlacementLParen The location of the opening parenthesis ('(') for
- /// the placement arguments, if any.
- ///
- /// \param PlacementArgs The placement arguments, if any.
- ///
- /// \param PlacementRParen The location of the closing parenthesis (')') for
- /// the placement arguments, if any.
- ///
- /// \param TypeIdParens If the type was expressed as a type-id in parentheses,
- /// the source range covering the parenthesized type-id.
- ///
- /// \param D The parsed declarator, which may include an array size (for
- /// array new) as the first declarator.
- ///
- /// \param ConstructorLParen The location of the opening parenthesis ('(') for
- /// the constructor arguments, if any.
- ///
- /// \param ConstructorArgs The constructor arguments, if any.
- ///
- /// \param ConstructorRParen The location of the closing parenthesis (')') for
- /// the constructor arguments, if any.
- virtual ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
- SourceLocation PlacementLParen,
- MultiExprArg PlacementArgs,
- SourceLocation PlacementRParen,
- SourceRange TypeIdParens, Declarator &D,
- SourceLocation ConstructorLParen,
- MultiExprArg ConstructorArgs,
- SourceLocation ConstructorRParen) {
- return ExprEmpty();
- }
-
- /// ActOnCXXDelete - Parsed a C++ 'delete' expression. UseGlobal is true if
- /// the delete was qualified (::delete). ArrayForm is true if the array form
- /// was used (delete[]).
- virtual ExprResult ActOnCXXDelete(SourceLocation StartLoc,
- bool UseGlobal, bool ArrayForm,
- ExprArg Operand) {
- return ExprEmpty();
- }
-
- virtual ExprResult ActOnUnaryTypeTrait(UnaryTypeTrait OTT,
- SourceLocation KWLoc,
- SourceLocation LParen,
- ParsedType Ty,
- SourceLocation RParen) {
- return ExprEmpty();
- }
-
- /// \brief Invoked when the parser is starting to parse a C++ member access
- /// expression such as x.f or x->f.
- ///
- /// \param S the scope in which the member access expression occurs.
- ///
- /// \param Base the expression in which a member is being accessed, e.g., the
- /// "x" in "x.f".
- ///
- /// \param OpLoc the location of the member access operator ("." or "->")
- ///
- /// \param OpKind the kind of member access operator ("." or "->")
- ///
- /// \param ObjectType originally NULL. The action should fill in this type
- /// with the type into which name lookup should look to find the member in
- /// the member access expression.
- ///
- /// \param MayBePseudoDestructor Originally false. The action should
- /// set this true if the expression may end up being a
- /// pseudo-destructor expression, indicating to the parser that it
- /// shoudl be parsed as a pseudo-destructor rather than as a member
- /// access expression. Note that this should apply both when the
- /// object type is a scalar and when the object type is dependent.
- ///
- /// \returns the (possibly modified) \p Base expression
- virtual ExprResult ActOnStartCXXMemberReference(Scope *S,
- ExprArg Base,
- SourceLocation OpLoc,
- tok::TokenKind OpKind,
- ParsedType &ObjectType,
- bool &MayBePseudoDestructor) {
- return ExprEmpty();
- }
-
- /// \brief Parsed a C++ pseudo-destructor expression or a dependent
- /// member access expression that has the same syntactic form as a
- /// pseudo-destructor expression.
- ///
- /// \param S The scope in which the member access expression occurs.
- ///
- /// \param Base The expression in which a member is being accessed, e.g., the
- /// "x" in "x.f".
- ///
- /// \param OpLoc The location of the member access operator ("." or "->")
- ///
- /// \param OpKind The kind of member access operator ("." or "->")
- ///
- /// \param SS The nested-name-specifier that precedes the type names
- /// in the grammar. Note that this nested-name-specifier will not
- /// cover the last "type-name ::" in the grammar, because it isn't
- /// necessarily a nested-name-specifier.
- ///
- /// \param FirstTypeName The type name that follows the optional
- /// nested-name-specifier but precedes the '::', e.g., the first
- /// type-name in "type-name :: type-name". This type name may be
- /// empty. This will be either an identifier or a template-id.
- ///
- /// \param CCLoc The location of the '::' in "type-name ::
- /// typename". May be invalid, if there is no \p FirstTypeName.
- ///
- /// \param TildeLoc The location of the '~'.
- ///
- /// \param SecondTypeName The type-name following the '~', which is
- /// the name of the type being destroyed. This will be either an
- /// identifier or a template-id.
- ///
- /// \param HasTrailingLParen Whether the next token in the stream is
- /// a left parentheses.
- virtual ExprResult ActOnPseudoDestructorExpr(Scope *S, ExprArg Base,
- SourceLocation OpLoc,
- tok::TokenKind OpKind,
- CXXScopeSpec &SS,
- UnqualifiedId &FirstTypeName,
- SourceLocation CCLoc,
- SourceLocation TildeLoc,
- UnqualifiedId &SecondTypeName,
- bool HasTrailingLParen) {
- return ExprEmpty();
- }
-
- /// ActOnFinishFullExpr - Called whenever a full expression has been parsed.
- /// (C++ [intro.execution]p12).
- virtual ExprResult ActOnFinishFullExpr(ExprArg Expr) {
- return move(Expr);
- }
-
- //===---------------------------- C++ Classes ---------------------------===//
- /// ActOnBaseSpecifier - Parsed a base specifier
- virtual BaseResult ActOnBaseSpecifier(Decl *classdecl,
- SourceRange SpecifierRange,
- bool Virtual, AccessSpecifier Access,
- ParsedType basetype,
- SourceLocation BaseLoc) {
- return BaseResult();
- }
-
- virtual void ActOnBaseSpecifiers(Decl *ClassDecl, BaseTy **Bases,
- unsigned NumBases) {
- }
-
- /// ActOnAccessSpecifier - This is invoked when an access specifier
- /// (and the colon following it) is found during the parsing of a
- /// C++ class member declarator.
- virtual Decl *ActOnAccessSpecifier(AccessSpecifier AS,
- SourceLocation ASLoc,
- SourceLocation ColonLoc) {
- return 0;
- }
-
- /// ActOnCXXMemberDeclarator - This is invoked when a C++ class member
- /// declarator is parsed. 'AS' is the access specifier, 'BitfieldWidth'
- /// specifies the bitfield width if there is one and 'Init' specifies the
- /// initializer if any. 'Deleted' is true if there's a =delete
- /// specifier on the function.
- virtual Decl *ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS,
- Declarator &D,
- MultiTemplateParamsArg TemplateParameterLists,
- ExprTy *BitfieldWidth,
- ExprTy *Init,
- bool IsDefinition,
- bool Deleted = false) {
- return 0;
- }
-
- virtual MemInitResult ActOnMemInitializer(Decl *ConstructorDecl,
- Scope *S,
- CXXScopeSpec &SS,
- IdentifierInfo *MemberOrBase,
- ParsedType TemplateTypeTy,
- SourceLocation IdLoc,
- SourceLocation LParenLoc,
- ExprTy **Args, unsigned NumArgs,
- SourceLocation *CommaLocs,
- SourceLocation RParenLoc) {
- return true;
- }
-
- /// ActOnMemInitializers - This is invoked when all of the member
- /// initializers of a constructor have been parsed. ConstructorDecl
- /// is the function declaration (which will be a C++ constructor in
- /// a well-formed program), ColonLoc is the location of the ':' that
- /// starts the constructor initializer, and MemInit/NumMemInits
- /// contains the individual member (and base) initializers.
- /// AnyErrors will be true if there were any invalid member initializers
- /// that are not represented in the list.
- virtual void ActOnMemInitializers(Decl *ConstructorDecl,
- SourceLocation ColonLoc,
- MemInitTy **MemInits, unsigned NumMemInits,
- bool AnyErrors){
- }
-
- virtual void ActOnDefaultCtorInitializers(Decl *CDtorDecl) {}
-
- /// ActOnFinishCXXMemberSpecification - Invoked after all member declarators
- /// are parsed but *before* parsing of inline method definitions.
- virtual void ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc,
- Decl *TagDecl,
- SourceLocation LBrac,
- SourceLocation RBrac,
- AttributeList *AttrList) {
- }
-
- //===---------------------------C++ Templates----------------------------===//
-
- /// \brief Called when a C++ template type parameter(e.g., "typename T") has
- /// been parsed.
- ///
- /// Given
- ///
- /// \code
- /// template<typename T, typename U = T> struct pair;
- /// \endcode
- ///
- /// this callback will be invoked twice: once for the type parameter \c T
- /// with \p Depth=0 and \p Position=0, and once for the type parameter \c U
- /// with \p Depth=0 and \p Position=1.
- ///
- /// \param Typename Specifies whether the keyword "typename" was used to
- /// declare the type parameter (otherwise, "class" was used).
- ///
- /// \param Ellipsis Specifies whether this is a C++0x parameter pack.
- ///
- /// \param EllipsisLoc Specifies the start of the ellipsis.
- ///
- /// \param KeyLoc The location of the "class" or "typename" keyword.
- ///
- /// \param ParamName The name of the parameter, where NULL indicates an
- /// unnamed template parameter.
- ///
- /// \param ParamNameLoc The location of the parameter name (if any).
- ///
- /// \param Depth The depth of this template parameter, e.g., the number of
- /// template parameter lists that occurred outside the template parameter
- /// list in which this template type parameter occurs.
- ///
- /// \param Position The zero-based position of this template parameter within
- /// its template parameter list, which is also the number of template
- /// parameters that precede this parameter in the template parameter list.
- ///
- /// \param EqualLoc The location of the '=' sign for the default template
- /// argument, if any.
- ///
- /// \param DefaultArg The default argument, if provided.
- virtual Decl *ActOnTypeParameter(Scope *S, bool Typename, bool Ellipsis,
- SourceLocation EllipsisLoc,
- SourceLocation KeyLoc,
- IdentifierInfo *ParamName,
- SourceLocation ParamNameLoc,
- unsigned Depth, unsigned Position,
- SourceLocation EqualLoc,
- ParsedType DefaultArg) {
- return 0;
- }
-
- /// \brief Called when a C++ non-type template parameter has been parsed.
- ///
- /// Given
- ///
- /// \code
- /// template<int Size> class Array;
- /// \endcode
- ///
- /// This callback will be invoked for the 'Size' non-type template parameter.
- ///
- /// \param S The current scope.
- ///
- /// \param D The parsed declarator.
- ///
- /// \param Depth The depth of this template parameter, e.g., the number of
- /// template parameter lists that occurred outside the template parameter
- /// list in which this template type parameter occurs.
- ///
- /// \param Position The zero-based position of this template parameter within
- /// its template parameter list, which is also the number of template
- /// parameters that precede this parameter in the template parameter list.
- ///
- /// \param EqualLoc The location of the '=' sign for the default template
- /// argument, if any.
- ///
- /// \param DefaultArg The default argument, if provided.
- virtual Decl *ActOnNonTypeTemplateParameter(Scope *S, Declarator &D,
- unsigned Depth,
- unsigned Position,
- SourceLocation EqualLoc,
- ExprArg DefaultArg) {
- return 0;
- }
-
- /// \brief Adds a default argument to the given non-type template
- /// parameter.
- virtual void ActOnNonTypeTemplateParameterDefault(Decl *TemplateParam,
- SourceLocation EqualLoc,
- ExprArg Default) {
- }
-
- /// \brief Called when a C++ template template parameter has been parsed.
- ///
- /// Given
- ///
- /// \code
- /// template<template <typename> class T> class X;
- /// \endcode
- ///
- /// this callback will be invoked for the template template parameter \c T.
- ///
- /// \param S The scope in which this template template parameter occurs.
- ///
- /// \param TmpLoc The location of the "template" keyword.
- ///
- /// \param TemplateParams The template parameters required by the template.
- ///
- /// \param ParamName The name of the parameter, or NULL if unnamed.
- ///
- /// \param ParamNameLoc The source location of the parameter name (if given).
- ///
- /// \param Depth The depth of this template parameter, e.g., the number of
- /// template parameter lists that occurred outside the template parameter
- /// list in which this template parameter occurs.
- ///
- /// \param Position The zero-based position of this template parameter within
- /// its template parameter list, which is also the number of template
- /// parameters that precede this parameter in the template parameter list.
- ///
- /// \param EqualLoc The location of the '=' sign for the default template
- /// argument, if any.
- ///
- /// \param DefaultArg The default argument, if provided.
- virtual Decl *ActOnTemplateTemplateParameter(Scope *S,
- SourceLocation TmpLoc,
- TemplateParamsTy *Params,
- IdentifierInfo *ParamName,
- SourceLocation ParamNameLoc,
- unsigned Depth,
- unsigned Position,
- SourceLocation EqualLoc,
- const ParsedTemplateArgument &DefaultArg) {
- return 0;
- }
-
- /// ActOnTemplateParameterList - Called when a complete template
- /// parameter list has been parsed, e.g.,
- ///
- /// @code
- /// export template<typename T, T Size>
- /// @endcode
- ///
- /// Depth is the number of enclosing template parameter lists. This
- /// value does not include templates from outer scopes. For example:
- ///
- /// @code
- /// template<typename T> // depth = 0
- /// class A {
- /// template<typename U> // depth = 0
- /// class B;
- /// };
- ///
- /// template<typename T> // depth = 0
- /// template<typename U> // depth = 1
- /// class A<T>::B { ... };
- /// @endcode
- ///
- /// ExportLoc, if valid, is the position of the "export"
- /// keyword. Otherwise, "export" was not specified.
- /// TemplateLoc is the position of the template keyword, LAngleLoc
- /// is the position of the left angle bracket, and RAngleLoc is the
- /// position of the corresponding right angle bracket.
- /// Params/NumParams provides the template parameters that were
- /// parsed as part of the template-parameter-list.
- virtual TemplateParamsTy *
- ActOnTemplateParameterList(unsigned Depth,
- SourceLocation ExportLoc,
- SourceLocation TemplateLoc,
- SourceLocation LAngleLoc,
- Decl **Params, unsigned NumParams,
- SourceLocation RAngleLoc) {
- return 0;
- }
-
- /// \brief Form a type from a template and a list of template
- /// arguments.
- ///
- /// This action merely forms the type for the template-id, possibly
- /// checking well-formedness of the template arguments. It does not
- /// imply the declaration of any entity.
- ///
- /// \param Template A template whose specialization results in a
- /// type, e.g., a class template or template template parameter.
- virtual TypeResult ActOnTemplateIdType(TemplateTy Template,
- SourceLocation TemplateLoc,
- SourceLocation LAngleLoc,
- ASTTemplateArgsPtr TemplateArgs,
- SourceLocation RAngleLoc) {
- return TypeResult();
- }
-
- /// \brief Note that a template ID was used with a tag.
- ///
- /// \param Type The result of ActOnTemplateIdType.
- ///
- /// \param TUK Either TUK_Reference or TUK_Friend. Declarations and
- /// definitions are interpreted as explicit instantiations or
- /// specializations.
- ///
- /// \param TagSpec The tag keyword that was provided as part of the
- /// elaborated-type-specifier; either class, struct, union, or enum.
- ///
- /// \param TagLoc The location of the tag keyword.
- virtual TypeResult ActOnTagTemplateIdType(TypeResult Type,
- TagUseKind TUK,
- DeclSpec::TST TagSpec,
- SourceLocation TagLoc) {
- return TypeResult();
- }
-
- /// \brief Form a dependent template name.
- ///
- /// This action forms a dependent template name given the template
- /// name and its (presumably dependent) scope specifier. For
- /// example, given "MetaFun::template apply", the scope specifier \p
- /// SS will be "MetaFun::", \p TemplateKWLoc contains the location
- /// of the "template" keyword, and "apply" is the \p Name.
- ///
- /// \param S The scope in which the dependent template name was parsed.
- ///
- /// \param TemplateKWLoc the location of the "template" keyword (if any).
- ///
- /// \param SS the nested-name-specifier that precedes the "template" keyword
- /// or the template name. If the dependent template name occurs in
- /// a member access expression, e.g., "x.template f<T>", this
- /// nested-name-specifier will be empty.
- ///
- /// \param Name the name of the template.
- ///
- /// \param ObjectType if this dependent template name occurs in the
- /// context of a member access expression, the type of the object being
- /// accessed.
- ///
- /// \param EnteringContext whether we are entering the context of this
- /// template.
- ///
- /// \param Template Will be set to the dependent template name, on success.
- ///
- /// \returns The kind of template name that was produced. Generally, this will
- /// be \c TNK_Dependent_template_name. However, if the nested-name-specifier
- /// is not dependent, or refers to the current instantiation, then we may
- /// be able to resolve the template kind more specifically.
- virtual TemplateNameKind ActOnDependentTemplateName(Scope *S,
- SourceLocation TemplateKWLoc,
- CXXScopeSpec &SS,
- UnqualifiedId &Name,
- ParsedType ObjectType,
- bool EnteringContext,
- TemplateTy &Template) {
- return TNK_Non_template;
- }
-
- /// \brief Process the declaration or definition of an explicit
- /// class template specialization or a class template partial
- /// specialization.
- ///
- /// This routine is invoked when an explicit class template
- /// specialization or a class template partial specialization is
- /// declared or defined, to introduce the (partial) specialization
- /// and produce a declaration for it. In the following example,
- /// ActOnClassTemplateSpecialization will be invoked for the
- /// declarations at both A and B:
- ///
- /// \code
- /// template<typename T> class X;
- /// template<> class X<int> { }; // A: explicit specialization
- /// template<typename T> class X<T*> { }; // B: partial specialization
- /// \endcode
- ///
- /// Note that it is the job of semantic analysis to determine which
- /// of the two cases actually occurred in the source code, since
- /// they are parsed through the same path. The formulation of the
- /// template parameter lists describes which case we are in.
- ///
- /// \param S the current scope
- ///
- /// \param TagSpec whether this declares a class, struct, or union
- /// (template)
- ///
- /// \param TUK whether this is a declaration or a definition
- ///
- /// \param KWLoc the location of the 'class', 'struct', or 'union'
- /// keyword.
- ///
- /// \param SS the scope specifier preceding the template-id
- ///
- /// \param Template the declaration of the class template that we
- /// are specializing.
- ///
- /// \param Attr attributes on the specialization
- ///
- /// \param TemplateParameterLists the set of template parameter
- /// lists that apply to this declaration. In a well-formed program,
- /// the number of template parameter lists will be one more than the
- /// number of template-ids in the scope specifier. However, it is
- /// common for users to provide the wrong number of template
- /// parameter lists (such as a missing \c template<> prior to a
- /// specialization); the parser does not check this condition.
- virtual DeclResult
- ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK,
- SourceLocation KWLoc,
- CXXScopeSpec &SS,
- TemplateTy Template,
- SourceLocation TemplateNameLoc,
- SourceLocation LAngleLoc,
- ASTTemplateArgsPtr TemplateArgs,
- SourceLocation RAngleLoc,
- AttributeList *Attr,
- MultiTemplateParamsArg TemplateParameterLists) = 0;
-
- /// \brief Invoked when a declarator that has one or more template parameter
- /// lists has been parsed.
- ///
- /// This action is similar to ActOnDeclarator(), except that the declaration
- /// being created somehow involves a template, e.g., it is a template
- /// declaration or specialization.
- virtual Decl *ActOnTemplateDeclarator(Scope *S,
- MultiTemplateParamsArg TemplateParameterLists,
- Declarator &D) {
- return 0;
- }
-
- /// \brief Invoked when the parser is beginning to parse a function template
- /// or function template specialization definition.
- virtual Decl *ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope,
- MultiTemplateParamsArg TemplateParameterLists,
- Declarator &D) {
- return 0;
- }
-
- /// \brief Process the explicit instantiation of a class template
- /// specialization.
- ///
- /// This routine is invoked when an explicit instantiation of a
- /// class template specialization is encountered. In the following
- /// example, ActOnExplicitInstantiation will be invoked to force the
- /// instantiation of X<int>:
- ///
- /// \code
- /// template<typename T> class X { /* ... */ };
- /// template class X<int>; // explicit instantiation
- /// \endcode
- ///
- /// \param S the current scope
- ///
- /// \param ExternLoc the location of the 'extern' keyword that specifies that
- /// this is an extern template (if any).
- ///
- /// \param TemplateLoc the location of the 'template' keyword that
- /// specifies that this is an explicit instantiation.
- ///
- /// \param TagSpec whether this declares a class, struct, or union
- /// (template).
- ///
- /// \param KWLoc the location of the 'class', 'struct', or 'union'
- /// keyword.
- ///
- /// \param SS the scope specifier preceding the template-id.
- ///
- /// \param Template the declaration of the class template that we
- /// are instantiation.
- ///
- /// \param LAngleLoc the location of the '<' token in the template-id.
- ///
- /// \param TemplateArgs the template arguments used to form the
- /// template-id.
- ///
- /// \param TemplateArgLocs the locations of the template arguments.
- ///
- /// \param RAngleLoc the location of the '>' token in the template-id.
- ///
- /// \param Attr attributes that apply to this instantiation.
- virtual DeclResult
- ActOnExplicitInstantiation(Scope *S,
- SourceLocation ExternLoc,
- SourceLocation TemplateLoc,
- unsigned TagSpec,
- SourceLocation KWLoc,
- const CXXScopeSpec &SS,
- TemplateTy Template,
- SourceLocation TemplateNameLoc,
- SourceLocation LAngleLoc,
- ASTTemplateArgsPtr TemplateArgs,
- SourceLocation RAngleLoc,
- AttributeList *Attr) {
- return DeclResult();
- }
-
- /// \brief Process the explicit instantiation of a member class of a
- /// class template specialization.
- ///
- /// This routine is invoked when an explicit instantiation of a
- /// member class of a class template specialization is
- /// encountered. In the following example,
- /// ActOnExplicitInstantiation will be invoked to force the
- /// instantiation of X<int>::Inner:
- ///
- /// \code
- /// template<typename T> class X { class Inner { /* ... */}; };
- /// template class X<int>::Inner; // explicit instantiation
- /// \endcode
- ///
- /// \param S the current scope
- ///
- /// \param ExternLoc the location of the 'extern' keyword that specifies that
- /// this is an extern template (if any).
- ///
- /// \param TemplateLoc the location of the 'template' keyword that
- /// specifies that this is an explicit instantiation.
- ///
- /// \param TagSpec whether this declares a class, struct, or union
- /// (template).
- ///
- /// \param KWLoc the location of the 'class', 'struct', or 'union'
- /// keyword.
- ///
- /// \param SS the scope specifier preceding the template-id.
- ///
- /// \param Template the declaration of the class template that we
- /// are instantiation.
- ///
- /// \param LAngleLoc the location of the '<' token in the template-id.
- ///
- /// \param TemplateArgs the template arguments used to form the
- /// template-id.
- ///
- /// \param TemplateArgLocs the locations of the template arguments.
- ///
- /// \param RAngleLoc the location of the '>' token in the template-id.
- ///
- /// \param Attr attributes that apply to this instantiation.
- virtual DeclResult
- ActOnExplicitInstantiation(Scope *S,
- SourceLocation ExternLoc,
- SourceLocation TemplateLoc,
- unsigned TagSpec,
- SourceLocation KWLoc,
- CXXScopeSpec &SS,
- IdentifierInfo *Name,
- SourceLocation NameLoc,
- AttributeList *Attr) {
- return DeclResult();
- }
-
- /// \brief Process the explicit instantiation of a function template or a
- /// member of a class template.
- ///
- /// This routine is invoked when an explicit instantiation of a
- /// function template or member function of a class template specialization
- /// is encountered. In the following example,
- /// ActOnExplicitInstantiation will be invoked to force the
- /// instantiation of X<int>:
- ///
- /// \code
- /// template<typename T> void f(T);
- /// template void f(int); // explicit instantiation
- /// \endcode
- ///
- /// \param S the current scope
- ///
- /// \param ExternLoc the location of the 'extern' keyword that specifies that
- /// this is an extern template (if any).
- ///
- /// \param TemplateLoc the location of the 'template' keyword that
- /// specifies that this is an explicit instantiation.
- ///
- /// \param D the declarator describing the declaration to be implicitly
- /// instantiated.
- virtual DeclResult ActOnExplicitInstantiation(Scope *S,
- SourceLocation ExternLoc,
- SourceLocation TemplateLoc,
- Declarator &D) {
- return DeclResult();
- }
-
-
- /// \brief Called when the parser has parsed a C++ typename
- /// specifier that ends in an identifier, e.g., "typename T::type".
- ///
- /// \param TypenameLoc the location of the 'typename' keyword
- /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
- /// \param II the identifier we're retrieving (e.g., 'type' in the example).
- /// \param IdLoc the location of the identifier.
- virtual TypeResult
- ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
- const CXXScopeSpec &SS, const IdentifierInfo &II,
- SourceLocation IdLoc) {
- return TypeResult();
- }
-
- /// \brief Called when the parser has parsed a C++ typename
- /// specifier that ends in a template-id, e.g.,
- /// "typename MetaFun::template apply<T1, T2>".
- ///
- /// \param TypenameLoc the location of the 'typename' keyword
- /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
- /// \param TemplateLoc the location of the 'template' keyword, if any.
- /// \param Ty the type that the typename specifier refers to.
- virtual TypeResult
- ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
- const CXXScopeSpec &SS, SourceLocation TemplateLoc,
- ParsedType Ty) {
- return TypeResult();
- }
-
- /// \brief Called when the parser begins parsing a construct which should not
- /// have access control applied to it.
- virtual void ActOnStartSuppressingAccessChecks() {
- }
-
- /// \brief Called when the parser finishes parsing a construct which should
- /// not have access control applied to it.
- virtual void ActOnStopSuppressingAccessChecks() {
- }
-
- //===----------------------- Obj-C Declarations -------------------------===//
-
- // ActOnStartClassInterface - this action is called immediately after parsing
- // the prologue for a class interface (before parsing the instance
- // variables). Instance variables are processed by ActOnFields().
- virtual Decl *ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
- IdentifierInfo *ClassName,
- SourceLocation ClassLoc,
- IdentifierInfo *SuperName,
- SourceLocation SuperLoc,
- Decl * const *ProtoRefs,
- unsigned NumProtoRefs,
- const SourceLocation *ProtoLocs,
- SourceLocation EndProtoLoc,
- AttributeList *AttrList) {
- return 0;
- }
-
- /// ActOnCompatiblityAlias - this action is called after complete parsing of
- /// @compaatibility_alias declaration. It sets up the alias relationships.
- virtual Decl *ActOnCompatiblityAlias(
- SourceLocation AtCompatibilityAliasLoc,
- IdentifierInfo *AliasName, SourceLocation AliasLocation,
- IdentifierInfo *ClassName, SourceLocation ClassLocation) {
- return 0;
- }
-
- // ActOnStartProtocolInterface - this action is called immdiately after
- // parsing the prologue for a protocol interface.
- virtual Decl *ActOnStartProtocolInterface(SourceLocation AtProtoLoc,
- IdentifierInfo *ProtocolName,
- SourceLocation ProtocolLoc,
- Decl * const *ProtoRefs,
- unsigned NumProtoRefs,
- const SourceLocation *ProtoLocs,
- SourceLocation EndProtoLoc,
- AttributeList *AttrList) {
- return 0;
- }
- // ActOnStartCategoryInterface - this action is called immdiately after
- // parsing the prologue for a category interface.
- virtual Decl *ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
- IdentifierInfo *ClassName,
- SourceLocation ClassLoc,
- IdentifierInfo *CategoryName,
- SourceLocation CategoryLoc,
- Decl * const *ProtoRefs,
- unsigned NumProtoRefs,
- const SourceLocation *ProtoLocs,
- SourceLocation EndProtoLoc) {
- return 0;
- }
- // ActOnStartClassImplementation - this action is called immdiately after
- // parsing the prologue for a class implementation. Instance variables are
- // processed by ActOnFields().
- virtual Decl *ActOnStartClassImplementation(
- SourceLocation AtClassImplLoc,
- IdentifierInfo *ClassName,
- SourceLocation ClassLoc,
- IdentifierInfo *SuperClassname,
- SourceLocation SuperClassLoc) {
- return 0;
- }
- // ActOnStartCategoryImplementation - this action is called immdiately after
- // parsing the prologue for a category implementation.
- virtual Decl *ActOnStartCategoryImplementation(
- SourceLocation AtCatImplLoc,
- IdentifierInfo *ClassName,
- SourceLocation ClassLoc,
- IdentifierInfo *CatName,
- SourceLocation CatLoc) {
- return 0;
- }
- // ActOnPropertyImplDecl - called for every property implementation
- virtual Decl *ActOnPropertyImplDecl(
- Scope *S,
- SourceLocation AtLoc, // location of the @synthesize/@dynamic
- SourceLocation PropertyNameLoc, // location for the property name
- bool ImplKind, // true for @synthesize, false for
- // @dynamic
- Decl *ClassImplDecl, // class or category implementation
- IdentifierInfo *propertyId, // name of property
- IdentifierInfo *propertyIvar) { // name of the ivar
- return 0;
- }
-
- struct ObjCArgInfo {
- IdentifierInfo *Name;
- SourceLocation NameLoc;
- // The Type is null if no type was specified, and the DeclSpec is invalid
- // in this case.
- ParsedType Type;
- ObjCDeclSpec DeclSpec;
-
- /// ArgAttrs - Attribute list for this argument.
- AttributeList *ArgAttrs;
- };
-
- // ActOnMethodDeclaration - called for all method declarations.
- virtual Decl *ActOnMethodDeclaration(
- SourceLocation BeginLoc, // location of the + or -.
- SourceLocation EndLoc, // location of the ; or {.
- tok::TokenKind MethodType, // tok::minus for instance, tok::plus for class.
- Decl *ClassDecl, // class this methods belongs to.
- ObjCDeclSpec &ReturnQT, // for return type's in inout etc.
- ParsedType ReturnType, // the method return type.
- Selector Sel, // a unique name for the method.
- ObjCArgInfo *ArgInfo, // ArgInfo: Has 'Sel.getNumArgs()' entries.
- DeclaratorChunk::ParamInfo *CParamInfo, unsigned CNumArgs, // c-style args
- AttributeList *MethodAttrList, // optional
- // tok::objc_not_keyword, tok::objc_optional, tok::objc_required
- tok::ObjCKeywordKind impKind,
- bool isVariadic = false) {
- return 0;
- }
- // ActOnAtEnd - called to mark the @end. For declarations (interfaces,
- // protocols, categories), the parser passes all methods/properties.
- // For class implementations, these values default to 0. For implementations,
- // methods are processed incrementally (by ActOnMethodDeclaration above).
- virtual void ActOnAtEnd(Scope *S, SourceRange AtEnd,
- Decl *classDecl,
- Decl **allMethods = 0,
- unsigned allNum = 0,
- Decl **allProperties = 0,
- unsigned pNum = 0,
- DeclGroupPtrTy *allTUVars = 0,
- unsigned tuvNum = 0) {
- }
- // ActOnProperty - called to build one property AST
- virtual Decl *ActOnProperty(Scope *S, SourceLocation AtLoc,
- FieldDeclarator &FD, ObjCDeclSpec &ODS,
- Selector GetterSel, Selector SetterSel,
- Decl *ClassCategory,
- bool *OverridingProperty,
- tok::ObjCKeywordKind MethodImplKind) {
- return 0;
- }
-
- virtual ExprResult
- ActOnClassPropertyRefExpr(IdentifierInfo &receiverName,
- IdentifierInfo &propertyName,
- SourceLocation receiverNameLoc,
- SourceLocation propertyNameLoc) {
- return ExprEmpty();
- }
-
- /// \brief Describes the kind of message expression indicated by a message
- /// send that starts with an identifier.
- enum ObjCMessageKind {
- /// \brief The message is sent to 'super'.
- ObjCSuperMessage,
- /// \brief The message is an instance message.
- ObjCInstanceMessage,
- /// \brief The message is a class message, and the identifier is a type
- /// name.
- ObjCClassMessage
- };
-
- /// \brief Determine the kind of Objective-C message send that we will be
- /// performing based on the identifier given.
- ///
- /// This action determines how a message send that starts with [
- /// identifier (followed by another identifier) will be parsed,
- /// e.g., as a class message, instance message, super message. The
- /// result depends on the meaning of the given identifier. If the
- /// identifier is unknown, the action should indicate that the
- /// message is an instance message.
- ///
- /// By default, this routine applies syntactic disambiguation and uses
- /// \c getTypeName() to determine whether the identifier refers to a type.
- /// However, \c Action subclasses may override this routine to improve
- /// error recovery.
- ///
- /// \param S The scope in which the message send occurs.
- ///
- /// \param Name The identifier following the '['.
- ///
- /// \param NameLoc The location of the identifier.
- ///
- /// \param IsSuper Whether the name is the pseudo-keyword "super".
- ///
- /// \param HasTrailingDot Whether the name is followed by a period.
- ///
- /// \param ReceiverType If this routine returns \c ObjCClassMessage,
- /// this argument will be set to the receiver type.
- ///
- /// \returns The kind of message send.
- virtual ObjCMessageKind getObjCMessageKind(Scope *S,
- IdentifierInfo *Name,
- SourceLocation NameLoc,
- bool IsSuper,
- bool HasTrailingDot,
- ParsedType &ReceiverType) = 0;
-
- /// \brief Parsed a message send to 'super'.
- ///
- /// \param S The scope in which the message send occurs.
- /// \param SuperLoc The location of the 'super' keyword.
- /// \param Sel The selector to which the message is being sent.
- /// \param LBracLoc The location of the opening square bracket ']'.
- /// \param SelectorLoc The location of the first identifier in the selector.
- /// \param RBrac The location of the closing square bracket ']'.
- /// \param Args The message arguments.
- virtual ExprResult ActOnSuperMessage(Scope *S, SourceLocation SuperLoc,
- Selector Sel,
- SourceLocation LBracLoc,
- SourceLocation SelectorLoc,
- SourceLocation RBracLoc,
- MultiExprArg Args) = 0;
-
- /// \brief Parsed a message send to a class.
- ///
- /// \param S The scope in which the message send occurs.
- /// \param Receiver The type of the class receiving the message.
- /// \param Sel The selector to which the message is being sent.
- /// \param LBracLoc The location of the opening square bracket ']'.
- /// \param SelectorLoc The location of the first identifier in the selector.
- /// \param RBrac The location of the closing square bracket ']'.
- /// \param Args The message arguments.
- virtual ExprResult ActOnClassMessage(Scope *S,
- ParsedType Receiver,
- Selector Sel,
- SourceLocation LBracLoc,
- SourceLocation SelectorLoc,
- SourceLocation RBracLoc,
- MultiExprArg Args) = 0;
-
- /// \brief Parsed a message send to an object instance.
- ///
- /// \param S The scope in which the message send occurs.
- /// \param Receiver The expression that computes the receiver object.
- /// \param Sel The selector to which the message is being sent.
- /// \param LBracLoc The location of the opening square bracket ']'.
- /// \param SelectorLoc The location of the first identifier in the selector.
- /// \param RBrac The location of the closing square bracket ']'.
- /// \param Args The message arguments.
- virtual ExprResult ActOnInstanceMessage(Scope *S,
- ExprArg Receiver,
- Selector Sel,
- SourceLocation LBracLoc,
- SourceLocation SelectorLoc,
- SourceLocation RBracLoc,
- MultiExprArg Args) = 0;
-
- virtual Decl *ActOnForwardClassDeclaration(
- SourceLocation AtClassLoc,
- IdentifierInfo **IdentList,
- SourceLocation *IdentLocs,
- unsigned NumElts) {
- return 0;
- }
- virtual Decl *ActOnForwardProtocolDeclaration(
- SourceLocation AtProtocolLoc,
- const IdentifierLocPair*IdentList,
- unsigned NumElts,
- AttributeList *AttrList) {
- return 0;
- }
-
- /// FindProtocolDeclaration - This routine looks up protocols and
- /// issues error if they are not declared. It returns list of valid
- /// protocols found.
- virtual void FindProtocolDeclaration(bool WarnOnDeclarations,
- const IdentifierLocPair *ProtocolId,
- unsigned NumProtocols,
- llvm::SmallVectorImpl<Decl *> &ResProtos) {
- }
-
- //===----------------------- Obj-C Expressions --------------------------===//
-
- virtual ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs,
- ExprTy **Strings,
- unsigned NumStrings) {
- return ExprResult();
- }
-
- virtual ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc,
- SourceLocation EncLoc,
- SourceLocation LParenLoc,
- ParsedType Ty,
- SourceLocation RParenLoc) {
- return ExprResult();
- }
-
- virtual ExprResult ParseObjCSelectorExpression(Selector Sel,
- SourceLocation AtLoc,
- SourceLocation SelLoc,
- SourceLocation LParenLoc,
- SourceLocation RParenLoc) {
- return ExprResult();
- }
-
- virtual ExprResult ParseObjCProtocolExpression(IdentifierInfo *ProtocolId,
- SourceLocation AtLoc,
- SourceLocation ProtoLoc,
- SourceLocation LParenLoc,
- SourceLocation RParenLoc) {
- return ExprResult();
- }
-
- //===---------------------------- Pragmas -------------------------------===//
-
- enum PragmaOptionsAlignKind {
- POAK_Native, // #pragma options align=native
- POAK_Natural, // #pragma options align=natural
- POAK_Packed, // #pragma options align=packed
- POAK_Power, // #pragma options align=power
- POAK_Mac68k, // #pragma options align=mac68k
- POAK_Reset // #pragma options align=reset
- };
-
- /// ActOnPragmaOptionsAlign - Called on well formed #pragma options
- /// align={...}.
- virtual void ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind,
- SourceLocation PragmaLoc,
- SourceLocation KindLoc) {
- return;
- }
-
- enum PragmaPackKind {
- PPK_Default, // #pragma pack([n])
- PPK_Show, // #pragma pack(show), only supported by MSVC.
- PPK_Push, // #pragma pack(push, [identifier], [n])
- PPK_Pop // #pragma pack(pop, [identifier], [n])
- };
-
- /// ActOnPragmaPack - Called on well formed #pragma pack(...).
- virtual void ActOnPragmaPack(PragmaPackKind Kind,
- IdentifierInfo *Name,
- ExprTy *Alignment,
- SourceLocation PragmaLoc,
- SourceLocation LParenLoc,
- SourceLocation RParenLoc) {
- return;
- }
-
- /// ActOnPragmaUnused - Called on well formed #pragma unused(...).
- virtual void ActOnPragmaUnused(const Token *Identifiers,
- unsigned NumIdentifiers, Scope *CurScope,
- SourceLocation PragmaLoc,
- SourceLocation LParenLoc,
- SourceLocation RParenLoc) {
- return;
- }
-
-
- /// ActOnPragmaVisibility - Called on well formed #pragma GCC visibility... .
- virtual void ActOnPragmaVisibility(bool IsPush, const IdentifierInfo* VisType,
- SourceLocation PragmaLoc) {
- return;
- }
-
-
- /// ActOnPragmaWeakID - Called on well formed #pragma weak ident.
- virtual void ActOnPragmaWeakID(IdentifierInfo* WeakName,
- SourceLocation PragmaLoc,
- SourceLocation WeakNameLoc) {
- return;
- }
-
- /// ActOnPragmaWeakAlias - Called on well formed #pragma weak ident = ident.
- virtual void ActOnPragmaWeakAlias(IdentifierInfo* WeakName,
- IdentifierInfo* AliasName,
- SourceLocation PragmaLoc,
- SourceLocation WeakNameLoc,
- SourceLocation AliasNameLoc) {
- return;
- }
-
- /// \name Code completion actions
- ///
- /// These actions are used to signal that a code-completion token has been
- /// found at a point in the grammar where the Action implementation is
- /// likely to be able to provide a list of possible completions, e.g.,
- /// after the "." or "->" of a member access expression.
- ///
- /// \todo Code completion for designated field initializers
- /// \todo Code completion for call arguments after a function template-id
- /// \todo Code completion within a call expression, object construction, etc.
- /// \todo Code completion within a template argument list.
- /// \todo Code completion for attributes.
- //@{
-
- /// \brief Describes the context in which code completion occurs.
- enum ParserCompletionContext {
- /// \brief Code completion occurs at top-level or namespace context.
- PCC_Namespace,
- /// \brief Code completion occurs within a class, struct, or union.
- PCC_Class,
- /// \brief Code completion occurs within an Objective-C interface, protocol,
- /// or category.
- PCC_ObjCInterface,
- /// \brief Code completion occurs within an Objective-C implementation or
- /// category implementation
- PCC_ObjCImplementation,
- /// \brief Code completion occurs within the list of instance variables
- /// in an Objective-C interface, protocol, category, or implementation.
- PCC_ObjCInstanceVariableList,
- /// \brief Code completion occurs following one or more template
- /// headers.
- PCC_Template,
- /// \brief Code completion occurs following one or more template
- /// headers within a class.
- PCC_MemberTemplate,
- /// \brief Code completion occurs within an expression.
- PCC_Expression,
- /// \brief Code completion occurs within a statement, which may
- /// also be an expression or a declaration.
- PCC_Statement,
- /// \brief Code completion occurs at the beginning of the
- /// initialization statement (or expression) in a for loop.
- PCC_ForInit,
- /// \brief Code completion occurs within the condition of an if,
- /// while, switch, or for statement.
- PCC_Condition,
- /// \brief Code completion occurs within the body of a function on a
- /// recovery path, where we do not have a specific handle on our position
- /// in the grammar.
- PCC_RecoveryInFunction,
- /// \brief Code completion occurs where only a type is permitted.
- PCC_Type
- };
-
- /// \brief Code completion for an ordinary name that occurs within the given
- /// scope.
- ///
- /// \param S the scope in which the name occurs.
- ///
- /// \param CompletionContext the context in which code completion
- /// occurs.
- virtual void CodeCompleteOrdinaryName(Scope *S,
- ParserCompletionContext CompletionContext) { }
-
- /// \brief Code completion for a declarator name.
- ///
- ///
- ///
- /// \param S The scope in which code completion occurs.
- ///
- /// \param AllowNonIdentifiers Whether non-identifier names are allowed in
- /// this context, e.g., operator+.
- ///
- /// \param AllowNestedNameSpecifiers Whether nested-name-specifiers are
- /// allowed in this context, e.g., because it is a top-level declaration or
- /// a friend declaration.
- virtual void CodeCompleteDeclarator(Scope *S,
- bool AllowNonIdentifiers,
- bool AllowNestedNameSpecifiers) { }
-
- /// \brief Code completion for a member access expression.
- ///
- /// This code completion action is invoked when the code-completion token
- /// is found after the "." or "->" of a member access expression.
- ///
- /// \param S the scope in which the member access expression occurs.
- ///
- /// \param Base the base expression (e.g., the x in "x.foo") of the member
- /// access.
- ///
- /// \param OpLoc the location of the "." or "->" operator.
- ///
- /// \param IsArrow true when the operator is "->", false when it is ".".
- virtual void CodeCompleteMemberReferenceExpr(Scope *S, ExprTy *Base,
- SourceLocation OpLoc,
- bool IsArrow) { }
-
- /// \brief Code completion for a reference to a tag.
- ///
- /// This code completion action is invoked when the code-completion
- /// token is found after a tag keyword (struct, union, enum, or class).
- ///
- /// \param S the scope in which the tag reference occurs.
- ///
- /// \param TagSpec an instance of DeclSpec::TST, indicating what kind of tag
- /// this is (struct/union/enum/class).
- virtual void CodeCompleteTag(Scope *S, unsigned TagSpec) { }
-
- /// \brief Code completion for a case statement.
- ///
- /// \brief S the scope in which the case statement occurs.
- virtual void CodeCompleteCase(Scope *S) { }
-
- /// \brief Code completion for a call.
- ///
- /// \brief S the scope in which the call occurs.
- ///
- /// \param Fn the expression describing the function being called.
- ///
- /// \param Args the arguments to the function call (so far).
- ///
- /// \param NumArgs the number of arguments in \p Args.
- virtual void CodeCompleteCall(Scope *S, Expr *Fn,
- Expr **Args, unsigned NumArgs) { }
-
- /// \brief Code completion for the initializer of a variable declaration.
- ///
- /// \param S The scope in which the initializer occurs.
- ///
- /// \param D The declaration being initialized.
- virtual void CodeCompleteInitializer(Scope *S, Decl *D) { }
-
- /// \brief Code completion after the "return" keyword within a function.
- ///
- /// \param S The scope in which the return statement occurs.
- virtual void CodeCompleteReturn(Scope *S) { }
-
- /// \brief Code completion for the right-hand side of an assignment or
- /// compound assignment operator.
- ///
- /// \param S The scope in which the assignment occurs.
- ///
- /// \param LHS The left-hand side of the assignment expression.
- virtual void CodeCompleteAssignmentRHS(Scope *S, ExprTy *LHS) { }
-
- /// \brief Code completion for a C++ nested-name-specifier that precedes a
- /// qualified-id of some form.
- ///
- /// This code completion action is invoked when the code-completion token
- /// is found after the "::" of a nested-name-specifier.
- ///
- /// \param S the scope in which the nested-name-specifier occurs.
- ///
- /// \param SS the scope specifier ending with "::".
- ///
- /// \parame EnteringContext whether we're entering the context of this
- /// scope specifier.
- virtual void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS,
- bool EnteringContext) { }
-
- /// \brief Code completion for a C++ "using" declaration or directive.
- ///
- /// This code completion action is invoked when the code-completion token is
- /// found after the "using" keyword.
- ///
- /// \param S the scope in which the "using" occurs.
- virtual void CodeCompleteUsing(Scope *S) { }
-
- /// \brief Code completion for a C++ using directive.
- ///
- /// This code completion action is invoked when the code-completion token is
- /// found after "using namespace".
- ///
- /// \param S the scope in which the "using namespace" occurs.
- virtual void CodeCompleteUsingDirective(Scope *S) { }
-
- /// \brief Code completion for a C++ namespace declaration or namespace
- /// alias declaration.
- ///
- /// This code completion action is invoked when the code-completion token is
- /// found after "namespace".
- ///
- /// \param S the scope in which the "namespace" token occurs.
- virtual void CodeCompleteNamespaceDecl(Scope *S) { }
-
- /// \brief Code completion for a C++ namespace alias declaration.
- ///
- /// This code completion action is invoked when the code-completion token is
- /// found after "namespace identifier = ".
- ///
- /// \param S the scope in which the namespace alias declaration occurs.
- virtual void CodeCompleteNamespaceAliasDecl(Scope *S) { }
-
- /// \brief Code completion for an operator name.
- ///
- /// This code completion action is invoked when the code-completion token is
- /// found after the keyword "operator".
- ///
- /// \param S the scope in which the operator keyword occurs.
- virtual void CodeCompleteOperatorName(Scope *S) { }
-
- /// \brief Code completion after the '@' at the top level.
- ///
- /// \param S the scope in which the '@' occurs.
- ///
- /// \param ObjCImpDecl the Objective-C implementation or category
- /// implementation.
- ///
- /// \param InInterface whether we are in an Objective-C interface or
- /// protocol.
- virtual void CodeCompleteObjCAtDirective(Scope *S, Decl *ObjCImpDecl,
- bool InInterface) { }
-
- /// \brief Code completion after the '@' in the list of instance variables.
- virtual void CodeCompleteObjCAtVisibility(Scope *S) { }
-
- /// \brief Code completion after the '@' in a statement.
- virtual void CodeCompleteObjCAtStatement(Scope *S) { }
-
- /// \brief Code completion after the '@' in an expression.
- virtual void CodeCompleteObjCAtExpression(Scope *S) { }
-
- /// \brief Code completion for an ObjC property decl.
- ///
- /// This code completion action is invoked when the code-completion token is
- /// found after the left paren.
- ///
- /// \param S the scope in which the operator keyword occurs.
- virtual void CodeCompleteObjCPropertyFlags(Scope *S, ObjCDeclSpec &ODS) { }
-
- /// \brief Code completion for the getter of an Objective-C property
- /// declaration.
- ///
- /// This code completion action is invoked when the code-completion
- /// token is found after the "getter = " in a property declaration.
- ///
- /// \param S the scope in which the property is being declared.
- ///
- /// \param ClassDecl the Objective-C class or category in which the property
- /// is being defined.
- ///
- /// \param Methods the set of methods declared thus far within \p ClassDecl.
- ///
- /// \param NumMethods the number of methods in \p Methods
- virtual void CodeCompleteObjCPropertyGetter(Scope *S, Decl *ClassDecl,
- Decl **Methods,
- unsigned NumMethods) {
- }
-
- /// \brief Code completion for the setter of an Objective-C property
- /// declaration.
- ///
- /// This code completion action is invoked when the code-completion
- /// token is found after the "setter = " in a property declaration.
- ///
- /// \param S the scope in which the property is being declared.
- ///
- /// \param ClassDecl the Objective-C class or category in which the property
- /// is being defined.
- ///
- /// \param Methods the set of methods declared thus far within \p ClassDecl.
- ///
- /// \param NumMethods the number of methods in \p Methods
- virtual void CodeCompleteObjCPropertySetter(Scope *S, Decl *ClassDecl,
- Decl **Methods,
- unsigned NumMethods) {
- }
-
- /// \brief Code completion for an Objective-C method parameter or return type.
- ///
- /// This code completion action is invoked when we are parsing the type of
- /// an Objective-C method parameter or return type.
- ///
- /// \param S The scope in which the code-completion occurs.
- /// \param DS The Objective-C declaration specifiers so far.
- virtual void CodeCompleteObjCPassingType(Scope *S, ObjCDeclSpec &DS){
- }
-
- /// \brief Code completion for the receiver in an Objective-C message send.
- ///
- /// This code completion action is invoked when we see a '[' that indicates
- /// the start of an Objective-C message send.
- ///
- /// \param S The scope in which the Objective-C message send occurs.
- virtual void CodeCompleteObjCMessageReceiver(Scope *S) { }
-
- /// \brief Code completion for an ObjC message expression that sends
- /// a message to the superclass.
- ///
- /// This code completion action is invoked when the code-completion token is
- /// found after the class name and after each argument.
- ///
- /// \param S The scope in which the message expression occurs.
- /// \param SuperLoc The location of the 'super' keyword.
- /// \param SelIdents The identifiers that describe the selector (thus far).
- /// \param NumSelIdents The number of identifiers in \p SelIdents.
- virtual void CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc,
- IdentifierInfo **SelIdents,
- unsigned NumSelIdents) { }
-
- /// \brief Code completion for an ObjC message expression that refers to
- /// a class method.
- ///
- /// This code completion action is invoked when the code-completion token is
- /// found after the class name and after each argument.
- ///
- /// \param S The scope in which the message expression occurs.
- /// \param Receiver The type of the class that is receiving a message.
- /// \param SelIdents The identifiers that describe the selector (thus far).
- /// \param NumSelIdents The number of identifiers in \p SelIdents.
- virtual void CodeCompleteObjCClassMessage(Scope *S, ParsedType Receiver,
- IdentifierInfo **SelIdents,
- unsigned NumSelIdents) { }
-
- /// \brief Code completion for an ObjC message expression that refers to
- /// an instance method.
- ///
- /// This code completion action is invoked when the code-completion token is
- /// found after the receiver expression and after each argument.
- ///
- /// \param S the scope in which the operator keyword occurs.
- /// \param Receiver an expression for the receiver of the message.
- /// \param SelIdents the identifiers that describe the selector (thus far).
- /// \param NumSelIdents the number of identifiers in \p SelIdents.
- virtual void CodeCompleteObjCInstanceMessage(Scope *S, ExprTy *Receiver,
- IdentifierInfo **SelIdents,
- unsigned NumSelIdents) { }
-
- /// \brief Code completion for the collection argument of an Objective-C
- /// for-each statement.
- ///
- /// \param S The Scope in which the completion occurs.
- ///
- /// \param IterationBar The iteration variable declaration.
- virtual void CodeCompleteObjCForCollection(Scope *S,
- DeclGroupPtrTy IterationVar) { }
-
- /// \brief Code completion for an Objective-C @selector expression, in which
- /// we may have already parsed parts of the selector.
- ///
- /// \param S The scope in which the @selector expression occurs.
- /// \param SelIdents The identifiers that describe the selector (thus far).
- /// \param NumSelIdents The number of identifiers in \p SelIdents.
- virtual void CodeCompleteObjCSelector(Scope *S,
- IdentifierInfo **SelIdents,
- unsigned NumSelIdents) { }
-
- /// \brief Code completion for a list of protocol references in Objective-C,
- /// such as P1 and P2 in \c id<P1,P2>.
- ///
- /// This code completion action is invoked prior to each identifier
- /// in the protocol list.
- ///
- /// \param Protocols the set of protocols that have already been parsed.
- ///
- /// \param NumProtocols the number of protocols that have already been
- /// parsed.
- virtual void CodeCompleteObjCProtocolReferences(IdentifierLocPair *Protocols,
- unsigned NumProtocols) { }
-
- /// \brief Code completion for a protocol declaration or definition, after
- /// the @protocol but before any identifier.
- ///
- /// \param S the scope in which the protocol declaration occurs.
- virtual void CodeCompleteObjCProtocolDecl(Scope *S) { }
-
- /// \brief Code completion for an Objective-C interface, after the
- /// @interface but before any identifier.
- virtual void CodeCompleteObjCInterfaceDecl(Scope *S) { }
-
- /// \brief Code completion for the superclass of an Objective-C
- /// interface, after the ':'.
- ///
- /// \param S the scope in which the interface declaration occurs.
- ///
- /// \param ClassName the name of the class being defined.
- virtual void CodeCompleteObjCSuperclass(Scope *S,
- IdentifierInfo *ClassName,
- SourceLocation ClassNameLoc) {
- }
-
- /// \brief Code completion for an Objective-C implementation, after the
- /// @implementation but before any identifier.
- virtual void CodeCompleteObjCImplementationDecl(Scope *S) { }
-
- /// \brief Code completion for the category name in an Objective-C interface
- /// declaration.
- ///
- /// This code completion action is invoked after the '(' that indicates
- /// a category name within an Objective-C interface declaration.
- virtual void CodeCompleteObjCInterfaceCategory(Scope *S,
- IdentifierInfo *ClassName,
- SourceLocation ClassNameLoc) {
- }
-
- /// \brief Code completion for the category name in an Objective-C category
- /// implementation.
- ///
- /// This code completion action is invoked after the '(' that indicates
- /// the category name within an Objective-C category implementation.
- virtual void CodeCompleteObjCImplementationCategory(Scope *S,
- IdentifierInfo *ClassName,
- SourceLocation ClassNameLoc) {
- }
-
- /// \brief Code completion for the property names when defining an
- /// Objective-C property.
- ///
- /// This code completion action is invoked after @synthesize or @dynamic and
- /// after each "," within one of those definitions.
- virtual void CodeCompleteObjCPropertyDefinition(Scope *S,
- Decl *ObjCImpDecl) {
- }
-
- /// \brief Code completion for the instance variable name that should
- /// follow an '=' when synthesizing an Objective-C property.
- ///
- /// This code completion action is invoked after each '=' that occurs within
- /// an @synthesized definition.
- virtual void CodeCompleteObjCPropertySynthesizeIvar(Scope *S,
- IdentifierInfo *PropertyName,
- Decl *ObjCImpDecl) {
- }
-
- /// \brief Code completion for an Objective-C method declaration or
- /// definition, which may occur within an interface, category,
- /// extension, protocol, or implementation thereof (where applicable).
- ///
- /// This code completion action is invoked after the "-" or "+" that
- /// starts a method declaration or definition, and after the return
- /// type such a declaration (e.g., "- (id)").
- ///
- /// \param S The scope in which the completion occurs.
- ///
- /// \param IsInstanceMethod Whether this is an instance method
- /// (introduced with '-'); otherwise, it's a class method
- /// (introduced with '+').
- ///
- /// \param ReturnType If non-NULL, the specified return type of the method
- /// being declared or defined.
- ///
- /// \param IDecl The interface, category, protocol, or
- /// implementation, or category implementation in which this method
- /// declaration or definition occurs.
- virtual void CodeCompleteObjCMethodDecl(Scope *S,
- bool IsInstanceMethod,
- ParsedType ReturnType,
- Decl *IDecl) {
- }
-
- /// \brief Code completion for a selector identifier or argument name within
- /// an Objective-C method declaration.
- ///
- /// \param S The scope in which this code completion occurs.
- ///
- /// \param IsInstanceMethod Whether we are parsing an instance method (or,
- /// if false, a class method).
- ///
- /// \param AtParameterName Whether the actual code completion point is at the
- /// argument name.
- ///
- /// \param ReturnType If non-NULL, the specified return type of the method
- /// being declared or defined.
- ///
- /// \param SelIdents The identifiers that occurred in the selector for the
- /// method declaration prior to the code completion point.
- ///
- /// \param NumSelIdents The number of identifiers provided by SelIdents.
- virtual void CodeCompleteObjCMethodDeclSelector(Scope *S,
- bool IsInstanceMethod,
- bool AtParameterName,
- ParsedType ReturnType,
- IdentifierInfo **SelIdents,
- unsigned NumSelIdents) { }
-
- /// \brief Code completion for a preprocessor directive.
- ///
- /// \brief InConditional Whether we're inside a preprocessor conditional.
- virtual void CodeCompletePreprocessorDirective(bool InConditional) {
- }
-
- /// \brief Code completion while in an area of the translation unit that was
- /// excluded due to preprocessor conditionals.
- virtual void CodeCompleteInPreprocessorConditionalExclusion(Scope *S) { }
-
- /// \brief Code completion in the preprocessor where an already-defined
- /// macro name is expected, e.g., an #ifdef or #undef.
- ///
- /// \param IsDefinition Whether this code completion for a macro name occurs
- /// in a definition of the macro (#define) or in another use that already
- /// expects that the macro is defined (e.g., #undef or #ifdef).
- virtual void CodeCompletePreprocessorMacroName(bool IsDefinition) {
- }
-
- /// \brief Callback invoked when performing code completion in a preprocessor
- /// expression, such as the condition of an #if or #elif directive.
- virtual void CodeCompletePreprocessorExpression() { }
-
- /// \brief Callback invoked when performing code completion inside a
- /// function-like macro argument.
- ///
- /// \param S The scope in which this macro is being expanded.
- ///
- /// \param Macro The name of the macro that is going to be expanded.
- ///
- /// \param MacroInfo Information about the macro that is going to be
- /// expanded.
- ///
- /// \param Argument The argument in which the code-completion token occurs.
- virtual void CodeCompletePreprocessorMacroArgument(Scope *S,
- IdentifierInfo *Macro,
- MacroInfo *MacroInfo,
- unsigned Argument) { }
-
- /// \brief Callback invoked when performing code completion in a context where
- /// we expect a natural language, e.g., inside a comment or string.
- virtual void CodeCompleteNaturalLanguage() { }
- //@}
-};
-
-/// PrettyStackTraceActionsDecl - If a crash occurs in the parser while parsing
-/// something related to a virtualized decl, include that virtualized decl in
-/// the stack trace.
-class PrettyStackTraceActionsDecl : public llvm::PrettyStackTraceEntry {
- Decl *TheDecl;
- SourceLocation Loc;
- Action &Actions;
- SourceManager &SM;
- const char *Message;
-
-public:
- PrettyStackTraceActionsDecl(Decl *D, SourceLocation L,
- Action &actions, SourceManager &sm,
- const char *Msg)
- : TheDecl(D), Loc(L), Actions(actions), SM(sm), Message(Msg) {}
-
- virtual void print(llvm::raw_ostream &OS) const;
-};
-
-/// \brief RAII object that enters a new expression evaluation context.
-class EnterExpressionEvaluationContext {
- /// \brief The action object.
- Action &Actions;
-
-public:
- EnterExpressionEvaluationContext(Action &Actions,
- Action::ExpressionEvaluationContext NewContext)
- : Actions(Actions) {
- Actions.PushExpressionEvaluationContext(NewContext);
- }
-
- ~EnterExpressionEvaluationContext() {
- Actions.PopExpressionEvaluationContext();
- }
-};
-
-
-} // end namespace clang
-
-#endif
diff --git a/include/clang/Sema/AttributeList.h b/include/clang/Sema/AttributeList.h
index 8cae4143c0..c067b0ccd7 100644
--- a/include/clang/Sema/AttributeList.h
+++ b/include/clang/Sema/AttributeList.h
@@ -21,7 +21,6 @@
namespace clang {
class IdentifierInfo;
- class Action;
class Expr;
/// AttributeList - Represents GCC's __attribute__ declaration. There are
diff --git a/include/clang/Sema/Designator.h b/include/clang/Sema/Designator.h
index 49a8aeda80..6fe7ab24f0 100644
--- a/include/clang/Sema/Designator.h
+++ b/include/clang/Sema/Designator.h
@@ -15,10 +15,15 @@
#ifndef LLVM_CLANG_SEMA_DESIGNATOR_H
#define LLVM_CLANG_SEMA_DESIGNATOR_H
-#include "clang/Sema/Action.h"
+#include "clang/Basic/SourceLocation.h"
+#include "llvm/ADT/SmallVector.h"
namespace clang {
+class Expr;
+class IdentifierInfo;
+class Sema;
+
/// Designator - A designator in a C99 designated initializer.
///
/// This class is a discriminated union which holds the various
@@ -163,11 +168,11 @@ public:
/// ClearExprs - Null out any expression references, which prevents
/// them from being 'delete'd later.
- void ClearExprs(Action &Actions) {}
+ void ClearExprs(Sema &Actions) {}
/// FreeExprs - Release any unclaimed memory for the expressions in
/// this designator.
- void FreeExprs(Action &Actions) {}
+ void FreeExprs(Sema &Actions) {}
};
@@ -201,11 +206,11 @@ public:
/// ClearExprs - Null out any expression references, which prevents them from
/// being 'delete'd later.
- void ClearExprs(Action &Actions) {}
+ void ClearExprs(Sema &Actions) {}
/// FreeExprs - Release any unclaimed memory for the expressions in this
/// designation.
- void FreeExprs(Action &Actions) {}
+ void FreeExprs(Sema &Actions) {}
};
} // end namespace clang
diff --git a/include/clang/Sema/Ownership.h b/include/clang/Sema/Ownership.h
index 9b1ca565d0..7739f3a5d2 100644
--- a/include/clang/Sema/Ownership.h
+++ b/include/clang/Sema/Ownership.h
@@ -22,7 +22,6 @@
//===----------------------------------------------------------------------===//
namespace clang {
- class Action;
class Attr;
class CXXBaseOrMemberInitializer;
class CXXBaseSpecifier;
@@ -31,6 +30,7 @@ namespace clang {
class Expr;
class NestedNameSpecifier;
class QualType;
+ class Sema;
class Stmt;
class TemplateName;
class TemplateParameterList;
@@ -307,8 +307,9 @@ namespace clang {
public:
// Normal copying implicitly defined
- explicit ASTMultiPtr(Action &) : Nodes(0), Count(0) {}
- ASTMultiPtr(Action &, PtrTy *nodes, unsigned count)
+ ASTMultiPtr() : Nodes(0), Count(0) {}
+ explicit ASTMultiPtr(Sema &) : Nodes(0), Count(0) {}
+ ASTMultiPtr(Sema &, PtrTy *nodes, unsigned count)
: Nodes(nodes), Count(count) {}
// Fake mover in Parse/AstGuard.h needs this:
ASTMultiPtr(PtrTy *nodes, unsigned count) : Nodes(nodes), Count(count) {}
@@ -331,7 +332,7 @@ namespace clang {
mutable unsigned Count;
public:
- ASTTemplateArgsPtr(Action &actions, ParsedTemplateArgument *args,
+ ASTTemplateArgsPtr(Sema &actions, ParsedTemplateArgument *args,
unsigned count) :
Args(args), Count(count) { }
@@ -369,7 +370,7 @@ namespace clang {
ASTOwningVector &operator=(ASTOwningVector &); // do not implement
public:
- explicit ASTOwningVector(Action &Actions)
+ explicit ASTOwningVector(Sema &Actions)
{ }
PtrTy *take() {
@@ -435,8 +436,18 @@ namespace clang {
inline Stmt *move(Stmt *S) { return S; }
typedef ASTMultiPtr<Expr*> MultiExprArg;
+ typedef ASTMultiPtr<Stmt*> MultiStmtArg;
typedef ASTMultiPtr<TemplateParameterList*> MultiTemplateParamsArg;
+ inline ExprResult ExprError() { return ExprResult(true); }
+ inline StmtResult StmtError() { return StmtResult(true); }
+
+ inline ExprResult ExprError(const DiagnosticBuilder&) { return ExprError(); }
+ inline StmtResult StmtError(const DiagnosticBuilder&) { return StmtError(); }
+
+ inline ExprResult ExprEmpty() { return ExprResult(false); }
+ inline StmtResult StmtEmpty() { return StmtResult(false); }
+
inline Expr *AssertSuccess(ExprResult R) {
assert(!R.isInvalid() && "operation was asserted to never fail!");
return R.get();
diff --git a/include/clang/Sema/PrettyDeclStackTrace.h b/include/clang/Sema/PrettyDeclStackTrace.h
new file mode 100644
index 0000000000..b78a1c01e5
--- /dev/null
+++ b/include/clang/Sema/PrettyDeclStackTrace.h
@@ -0,0 +1,46 @@
+//===- PrettyDeclStackTrace.h - Stack trace for decl processing -*- 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 an llvm::PrettyStackTraceEntry object for showing
+// that a particular declaration was being processed when a crash
+// occurred.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_SEMA_PRETTY_DECL_STACK_TRACE_H
+#define LLVM_CLANG_SEMA_PRETTY_DECL_STACK_TRACE_H
+
+#include "clang/Basic/SourceLocation.h"
+#include "llvm/Support/PrettyStackTrace.h"
+
+namespace clang {
+
+class Decl;
+class Sema;
+class SourceManager;
+
+/// PrettyDeclStackTraceEntry - If a crash occurs in the parser while
+/// parsing something related to a declaration, include that
+/// declaration in the stack trace.
+class PrettyDeclStackTraceEntry : public llvm::PrettyStackTraceEntry {
+ Sema &S;
+ Decl *TheDecl;
+ SourceLocation Loc;
+ const char *Message;
+
+public:
+ PrettyDeclStackTraceEntry(Sema &S, Decl *D, SourceLocation Loc, const char *Msg)
+ : S(S), TheDecl(D), Loc(Loc), Message(Msg) {}
+
+ virtual void print(llvm::raw_ostream &OS) const;
+};
+
+}
+
+#endif
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index f23c4a1e93..fbc15d4beb 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -15,13 +15,17 @@
#ifndef LLVM_CLANG_SEMA_SEMA_H
#define LLVM_CLANG_SEMA_SEMA_H
-#include "clang/Sema/Action.h"
+#include "clang/Sema/Ownership.h"
#include "clang/Sema/AnalysisBasedWarnings.h"
#include "clang/Sema/IdentifierResolver.h"
#include "clang/Sema/ObjCMethodList.h"
+#include "clang/Sema/DeclSpec.h"
#include "clang/AST/OperationKinds.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/ExternalASTSource.h"
+#include "clang/Basic/Specifiers.h"
+#include "clang/Basic/TemplateKinds.h"
+#include "clang/Basic/TypeTraits.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
@@ -39,6 +43,7 @@ namespace clang {
class ASTConsumer;
class ASTContext;
class ArrayType;
+ class AttributeList;
class BlockDecl;
class CXXBasePath;
class CXXBasePaths;
@@ -49,6 +54,7 @@ namespace clang {
class CXXFieldCollector;
class CXXMemberCallExpr;
class CXXMethodDecl;
+ class CXXScopeSpec;
class CXXTemporary;
class CXXTryStmt;
class CallExpr;
@@ -61,11 +67,11 @@ namespace clang {
class DeclAccessPair;
class DeclContext;
class DeclRefExpr;
- class DeclSpec;
class DeclaratorDecl;
class DeducedTemplateArgument;
class DependentDiagnostic;
class DesignatedInitExpr;
+ class Designation;
class EnumConstantDecl;
class Expr;
class ExtVectorType;
@@ -86,6 +92,7 @@ namespace clang {
class LangOptions;
class LocalInstantiationScope;
class LookupResult;
+ class MacroInfo;
class MultiLevelTemplateArgumentList;
class NamedDecl;
class NonNullAttr;
@@ -122,6 +129,7 @@ namespace clang {
class TemplateTemplateParmDecl;
class Token;
class TypedefDecl;
+ class UnqualifiedId;
class UnresolvedLookupExpr;
class UnresolvedMemberExpr;
class UnresolvedSetImpl;
@@ -139,7 +147,7 @@ namespace sema {
class DelayedDiagnostic;
class FunctionScopeInfo;
class TemplateDeductionInfo;
-}
+}
/// \brief Holds a QualType and a TypeSourceInfo* that came out of a declarator
/// parsing.
@@ -176,11 +184,22 @@ public:
};
/// Sema - This implements semantic analysis and AST building for C.
-class Sema : public Action {
+class Sema {
Sema(const Sema&); // DO NOT IMPLEMENT
void operator=(const Sema&); // DO NOT IMPLEMENT
mutable const TargetAttributesSema* TheTargetAttributesSema;
public:
+ 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;
+
const LangOptions &LangOpts;
Preprocessor &PP;
ASTContext &Context;
@@ -359,6 +378,29 @@ public:
typedef llvm::SmallVector<std::pair<SourceLocation, PartialDiagnostic>, 10>
PotentiallyEmittedDiagnostics;
+ /// \brief Describes how the expressions currently being parsed are
+ /// evaluated at run-time, if at all.
+ enum ExpressionEvaluationContext {
+ /// \brief The current expression and its subexpressions occur within an
+ /// unevaluated operand (C++0x [expr]p8), such as a constant expression
+ /// or the subexpression of \c sizeof, where the type or the value of the
+ /// expression may be significant but no code will be generated to evaluate
+ /// the value of the expression at run time.
+ Unevaluated,
+
+ /// \brief The current expression is potentially evaluated at run time,
+ /// which means that code may be generated to evaluate the value of the
+ /// expression at run time.
+ PotentiallyEvaluated,
+
+ /// \brief The current expression may be potentially evaluated or it may
+ /// be unevaluated, but it is impossible to tell from the lexical context.
+ /// This evaluation context is used primary for the operand of the C++
+ /// \c typeid expression, whose argument is potentially evaluated only when
+ /// it is an lvalue of polymorphic class type (C++ [basic.def.odr]p2).
+ PotentiallyPotentiallyEvaluated
+ };
+
/// \brief Data structure used to record current or nested
/// expression evaluation contexts.
struct ExpressionEvaluationContextRecord {
@@ -494,8 +536,8 @@ public:
/// \brief Build a partial diagnostic.
PartialDiagnostic PDiag(unsigned DiagID = 0); // in SemaInternal.h
- virtual void DeleteExpr(ExprTy *E);
- virtual void DeleteStmt(StmtTy *S);
+ virtual void DeleteExpr(Expr *E);
+ virtual void DeleteStmt(Stmt *S);
ExprResult Owned(Expr* E) { return E; }
ExprResult Owned(ExprResult R) { return R; }
@@ -537,7 +579,7 @@ public:
QualType BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM,
Expr *ArraySize, unsigned Quals,
SourceRange Brackets, DeclarationName Entity);
- QualType BuildExtVectorType(QualType T, ExprArg ArraySize,
+ QualType BuildExtVectorType(QualType T, Expr *ArraySize,
SourceLocation AttrLoc);
QualType BuildFunctionType(QualType T,
QualType *ParamTypes, unsigned NumParamTypes,
@@ -598,10 +640,6 @@ public:
// Symbol table / Decl tracking callbacks: SemaDecl.cpp.
//
- /// 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);
-
DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr);
void DiagnoseUseOfUnimplementedSelectors();
@@ -610,7 +648,7 @@ public:
Scope *S, CXXScopeSpec *SS = 0,
bool isClassName = false,
ParsedType ObjectType = ParsedType());
- virtual DeclSpec::TST isTagName(IdentifierInfo &II, Scope *S);
+ virtual TypeSpecifierType isTagName(IdentifierInfo &II, Scope *S);
virtual bool DiagnoseUnknownTypeName(const IdentifierInfo &II,
SourceLocation IILoc,
Scope *S,
@@ -664,12 +702,12 @@ public:
StorageClass SCAsWritten);
virtual void ActOnParamDefaultArgument(Decl *param,
SourceLocation EqualLoc,
- ExprArg defarg);
+ Expr *defarg);
virtual void ActOnParamUnparsedDefaultArgument(Decl *param,
SourceLocation EqualLoc,
SourceLocation ArgLoc);
virtual void ActOnParamDefaultArgumentError(Decl *param);
- bool SetParamDefaultArgument(ParmVarDecl *Param, ExprArg DefaultArg,
+ bool SetParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg,
SourceLocation EqualLoc);
@@ -677,8 +715,8 @@ public:
// argument locations.
llvm::DenseMap<ParmVarDecl *,SourceLocation> UnparsedDefaultArgLocs;
- virtual void AddInitializerToDecl(Decl *dcl, ExprArg init);
- void AddInitializerToDecl(Decl *dcl, ExprArg init, bool DirectInit);
+ virtual void AddInitializerToDecl(Decl *dcl, Expr *init);
+ void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit);
void ActOnUninitializedDecl(Decl *dcl, bool TypeContainsUndeducedAuto);
virtual void ActOnInitializerError(Decl *Dcl);
virtual void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc);
@@ -691,8 +729,8 @@ public:
virtual Decl *ActOnStartOfFunctionDef(Scope *S, Decl *D);
virtual void ActOnStartOfObjCMethodDef(Scope *S, Decl *D);
- virtual Decl *ActOnFinishFunctionBody(Decl *Decl, StmtArg Body);
- Decl *ActOnFinishFunctionBody(Decl *Decl, StmtArg Body,
+ virtual Decl *ActOnFinishFunctionBody(Decl *Decl, Stmt *Body);
+ Decl *ActOnFinishFunctionBody(Decl *Decl, Stmt *Body,
bool IsInstantiation);
/// \brief Diagnose any unused parameters in the given sequence of
@@ -701,7 +739,7 @@ public:
ParmVarDecl * const *End);
void DiagnoseInvalidJumps(Stmt *Body);
- virtual Decl *ActOnFileScopeAsmDecl(SourceLocation Loc, ExprArg expr);
+ virtual Decl *ActOnFileScopeAsmDecl(SourceLocation Loc, Expr *expr);
/// Scope actions.
virtual void ActOnPopScope(SourceLocation Loc, Scope *S);
@@ -721,6 +759,13 @@ public:
SourceLocation NewTagLoc,
const IdentifierInfo &Name);
+ enum TagUseKind {
+ TUK_Reference, // Reference to a tag: 'struct foo *X;'
+ TUK_Declaration, // Fwd decl of a tag: 'struct foo;'
+ TUK_Definition, // Definition of a tag: 'struct foo { int X; } Y;'
+ TUK_Friend // Friend declaration: 'friend struct foo;'
+ };
+
virtual Decl *ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
SourceLocation KWLoc, CXXScopeSpec &SS,
IdentifierInfo *Name, SourceLocation NameLoc,
@@ -741,7 +786,7 @@ public:
llvm::SmallVectorImpl<Decl *> &Decls);
virtual Decl *ActOnField(Scope *S, Decl *TagD,
SourceLocation DeclStart,
- Declarator &D, ExprTy *BitfieldWidth);
+ Declarator &D, Expr *BitfieldWidth);
FieldDecl *HandleField(Scope *S, RecordDecl *TagD, SourceLocation DeclStart,
Declarator &D, Expr *BitfieldWidth,
@@ -769,7 +814,7 @@ public:
llvm::SmallVectorImpl<Decl *> &AllIvarDecls);
virtual Decl *ActOnIvar(Scope *S, SourceLocation DeclStart,
Decl *IntfDecl,
- Declarator &D, ExprTy *BitfieldWidth,
+ Declarator &D, Expr *BitfieldWidth,
tok::ObjCKeywordKind visibility);
// This is used for both record definitions and ObjC interface declarations.
@@ -803,12 +848,12 @@ public:
EnumConstantDecl *LastEnumConst,
SourceLocation IdLoc,
IdentifierInfo *Id,
- ExprArg val);
+ Expr *val);
virtual Decl *ActOnEnumConstant(Scope *S, Decl *EnumDecl,
Decl *LastEnumConstant,
SourceLocation IdLoc, IdentifierInfo *Id,
- SourceLocation EqualLoc, ExprTy *Val);
+ SourceLocation EqualLoc, Expr *Val);
virtual void ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
SourceLocation RBraceLoc, Decl *EnumDecl,
Decl **Elements, unsigned NumElements,
@@ -941,7 +986,7 @@ public:
bool PerformContextuallyConvertToObjCId(Expr *&From);
ExprResult
- ConvertToIntegralOrEnumerationType(SourceLocation Loc, ExprArg FromE,
+ ConvertToIntegralOrEnumerationType(SourceLocation Loc, Expr *FromE,
const PartialDiagnostic &NotIntDiag,
const PartialDiagnostic &IncompleteDiag,
const PartialDiagnostic &ExplicitConvDiag,
@@ -1066,7 +1111,7 @@ public:
ExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc,
unsigned Opc,
const UnresolvedSetImpl &Fns,
- ExprArg input);
+ Expr *input);
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc,
unsigned Opc,
@@ -1075,7 +1120,7 @@ public:
ExprResult CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
SourceLocation RLoc,
- ExprArg Base,ExprArg Idx);
+ Expr *Base,Expr *Idx);
ExprResult
BuildCallToMemberFunction(Scope *S, Expr *MemExpr,
@@ -1088,7 +1133,7 @@ public:
SourceLocation *CommaLocs,
SourceLocation RParenLoc);
- ExprResult BuildOverloadedArrowExpr(Scope *S, ExprArg Base,
+ ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base,
SourceLocation OpLoc);
/// CheckCallReturnType - Checks that a call expression's return type is
@@ -1440,85 +1485,118 @@ public:
//===--------------------------------------------------------------------===//
// Statement Parsing Callbacks: SemaStmt.cpp.
public:
+ class FullExprArg {
+ public:
+ FullExprArg(Sema &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 Sema class a friend when it's just
+ // Sema::FullExpr that needs access to the constructor below.
+ friend class Sema;
+
+ explicit FullExprArg(Expr *expr) : E(expr) {}
+
+ Expr *E;
+ };
+
+ FullExprArg MakeFullExpr(Expr *Arg) {
+ return FullExprArg(ActOnFinishFullExpr(Arg).release());
+ }
+
virtual StmtResult ActOnExprStmt(FullExprArg Expr);
virtual StmtResult ActOnNullStmt(SourceLocation SemiLoc);
virtual StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R,
- MultiStmtArg Elts,
- bool isStmtExpr);
+ MultiStmtArg Elts,
+ bool isStmtExpr);
virtual StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl,
- SourceLocation StartLoc,
- SourceLocation EndLoc);
+ SourceLocation StartLoc,
+ SourceLocation EndLoc);
virtual void ActOnForEachDeclStmt(DeclGroupPtrTy Decl);
- virtual StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprArg LHSVal,
- SourceLocation DotDotDotLoc, ExprArg RHSVal,
- SourceLocation ColonLoc);
- virtual void ActOnCaseStmtBody(StmtTy *CaseStmt, StmtArg SubStmt);
+ virtual StmtResult ActOnCaseStmt(SourceLocation CaseLoc, Expr *LHSVal,
+ SourceLocation DotDotDotLoc, Expr *RHSVal,
+ SourceLocation ColonLoc);
+ virtual void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt);
virtual StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc,
- SourceLocation ColonLoc,
- StmtArg SubStmt, Scope *CurScope);
+ SourceLocation ColonLoc,
+ Stmt *SubStmt, Scope *CurScope);
virtual StmtResult ActOnLabelStmt(SourceLocation IdentLoc,
- IdentifierInfo *II,
- SourceLocation ColonLoc,
- StmtArg SubStmt);
+ IdentifierInfo *II,
+ SourceLocation ColonLoc,
+ Stmt *SubStmt);
virtual StmtResult ActOnIfStmt(SourceLocation IfLoc,
- FullExprArg CondVal, Decl *CondVar,
- StmtArg ThenVal,
- SourceLocation ElseLoc, StmtArg ElseVal);
+ FullExprArg CondVal, Decl *CondVar,
+ Stmt *ThenVal,
+ SourceLocation ElseLoc, Stmt *ElseVal);
virtual StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc,
- ExprArg Cond,
- Decl *CondVar);
+ Expr *Cond,
+ Decl *CondVar);
virtual StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc,
- StmtArg Switch, StmtArg Body);
+ Stmt *Switch, Stmt *Body);
virtual StmtResult ActOnWhileStmt(SourceLocation WhileLoc,
- FullExprArg Cond,
- Decl *CondVar, StmtArg Body);
- virtual StmtResult ActOnDoStmt(SourceLocation DoLoc, StmtArg Body,
- SourceLocation WhileLoc,
- SourceLocation CondLParen, ExprArg Cond,
- SourceLocation CondRParen);
+ FullExprArg Cond,
+ Decl *CondVar, Stmt *Body);
+ virtual StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body,
+ SourceLocation WhileLoc,
+ SourceLocation CondLParen, Expr *Cond,
+ SourceLocation CondRParen);
virtual StmtResult ActOnForStmt(SourceLocation ForLoc,
- SourceLocation LParenLoc,
- StmtArg First, FullExprArg Second,
- Decl *SecondVar,
- FullExprArg Third,
- SourceLocation RParenLoc,
- StmtArg Body);
+ SourceLocation LParenLoc,
+ Stmt *First, FullExprArg Second,
+ Decl *SecondVar,
+ FullExprArg Third,
+ SourceLocation RParenLoc,
+ Stmt *Body);
virtual StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc,
SourceLocation LParenLoc,
- StmtArg First, ExprArg Second,
- SourceLocation RParenLoc, StmtArg Body);
+ Stmt *First, Expr *Second,
+ SourceLocation RParenLoc, Stmt *Body);
virtual StmtResult ActOnGotoStmt(SourceLocation GotoLoc,
- SourceLocation LabelLoc,
- IdentifierInfo *LabelII);
+ SourceLocation LabelLoc,
+ IdentifierInfo *LabelII);
virtual StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc,
- SourceLocation StarLoc,
- ExprArg DestExp);
+ SourceLocation StarLoc,
+ Expr *DestExp);
virtual StmtResult ActOnContinueStmt(SourceLocation ContinueLoc,
- Scope *CurScope);
+ Scope *CurScope);
virtual StmtResult ActOnBreakStmt(SourceLocation GotoLoc,
- Scope *CurScope);
+ Scope *CurScope);
virtual StmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
- ExprArg RetValExp);
+ Expr *RetValExp);
StmtResult ActOnBlockReturnStmt(SourceLocation ReturnLoc,
- Expr *RetValExp);
+ Expr *RetValExp);
virtual StmtResult ActOnAsmStmt(SourceLocation AsmLoc,
- bool IsSimple,
- bool IsVolatile,
- unsigned NumOutputs,
- unsigned NumInputs,
- IdentifierInfo **Names,
- MultiExprArg Constraints,
- MultiExprArg Exprs,
- ExprArg AsmString,
- MultiExprArg Clobbers,
- SourceLocation RParenLoc,
- bool MSAsm = false);
+ bool IsSimple,
+ bool IsVolatile,
+ unsigned NumOutputs,
+ unsigned NumInputs,
+ IdentifierInfo **Names,
+ MultiExprArg Constraints,
+ MultiExprArg Exprs,
+ Expr *AsmString,
+ MultiExprArg Clobbers,
+ SourceLocation RParenLoc,
+ bool MSAsm = false);
VarDecl *BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType,
@@ -1528,25 +1606,25 @@ public:
virtual Decl *ActOnObjCExceptionDecl(Scope *S, Declarator &D);
virtual StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
- SourceLocation RParen,
- Decl *Parm, StmtArg Body);
+ SourceLocation RParen,
+ Decl *Parm, Stmt *Body);
virtual StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
- StmtArg Body);
+ Stmt *Body);
virtual StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc,
- StmtArg Try,
- MultiStmtArg Catch,
- StmtArg Finally);
+ Stmt *Try,
+ MultiStmtArg Catch,
+ Stmt *Finally);
virtual StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc,
- ExprArg Throw);
+ Expr *Throw);
virtual StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
- ExprArg Throw,
- Scope *CurScope);
+ Expr *Throw,
+ Scope *CurScope);
virtual StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
- ExprArg SynchExpr,
- StmtArg SynchBody);
+ Expr *SynchExpr,
+ Stmt *SynchBody);
VarDecl *BuildExceptionDeclaration(Scope *S, QualType ExDeclType,
TypeSourceInfo *TInfo,
@@ -1556,11 +1634,11 @@ public:
virtual Decl *ActOnExceptionDeclarator(Scope *S, Declarator &D);
virtual StmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc,
- Decl *ExDecl,
- StmtArg HandlerBlock);
+ Decl *ExDecl,
+ Stmt *HandlerBlock);
virtual StmtResult ActOnCXXTryBlock(SourceLocation TryLoc,
- StmtArg TryBlock,
- MultiStmtArg Handlers);
+ Stmt *TryBlock,
+ MultiStmtArg Handlers);
void DiagnoseReturnInConstructorExceptionHandler(CXXTryStmt *TryBlock);
bool ShouldWarnIfUnusedFileScopedDecl(const DeclaratorDecl *D) const;
@@ -1574,6 +1652,8 @@ public:
void DiagnoseUnusedExprResult(const Stmt *S);
void DiagnoseUnusedDecl(const NamedDecl *ND);
+ typedef uintptr_t ParsingDeclStackState;
+
ParsingDeclStackState PushParsingDeclaration();
void PopParsingDeclaration(ParsingDeclStackState S, Decl *D);
void EmitDeprecationWarning(NamedDecl *D, SourceLocation Loc);
@@ -1600,7 +1680,7 @@ public:
bool DiagRuntimeBehavior(SourceLocation Loc, const PartialDiagnostic &PD);
// Primary Expressions.
- virtual SourceRange getExprRange(ExprTy *E) const;
+ virtual SourceRange getExprRange(Expr *E) const;
virtual ExprResult ActOnIdExpression(Scope *S,
CXXScopeSpec &SS,
@@ -1663,7 +1743,7 @@ public:
virtual ExprResult ActOnNumericConstant(const Token &);
virtual ExprResult ActOnCharacterConstant(const Token &);
virtual ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R,
- ExprArg Val);
+ Expr *Val);
virtual ExprResult ActOnParenOrParenListExpr(SourceLocation L,
SourceLocation R,
MultiExprArg Val,
@@ -1680,9 +1760,9 @@ public:
unsigned OpcIn,
Expr *InputArg);
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc,
- UnaryOperatorKind Opc, ExprArg input);
+ UnaryOperatorKind Opc, Expr *input);
virtual ExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
- tok::TokenKind Op, ExprArg Input);
+ tok::TokenKind Op, Expr *Input);
ExprResult CreateSizeOfAlignOfExpr(TypeSourceInfo *T,
SourceLocation OpLoc,
@@ -1699,18 +1779,18 @@ public:
virtual ExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc,
tok::TokenKind Kind,
- ExprArg Input);
+ Expr *Input);
- virtual ExprResult ActOnArraySubscriptExpr(Scope *S, ExprArg Base,
+ virtual ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base,
SourceLocation LLoc,
- ExprArg Idx,
+ Expr *Idx,
SourceLocation RLoc);
- ExprResult CreateBuiltinArraySubscriptExpr(ExprArg Base,
+ ExprResult CreateBuiltinArraySubscriptExpr(Expr *Base,
SourceLocation LLoc,
- ExprArg Idx,
+ Expr *Idx,
SourceLocation RLoc);
- ExprResult BuildMemberReferenceExpr(ExprArg Base,
+ ExprResult BuildMemberReferenceExpr(Expr *Base,
QualType BaseType,
SourceLocation OpLoc,
bool IsArrow,
@@ -1719,7 +1799,7 @@ public:
const DeclarationNameInfo &NameInfo,
const TemplateArgumentListInfo *TemplateArgs);
- ExprResult BuildMemberReferenceExpr(ExprArg Base,
+ ExprResult BuildMemberReferenceExpr(Expr *Base,
QualType BaseType,
SourceLocation OpLoc, bool IsArrow,
const CXXScopeSpec &SS,
@@ -1738,7 +1818,7 @@ public:
const CXXScopeSpec &SS,
const LookupResult &R);
- ExprResult ActOnDependentMemberExpr(ExprArg Base,
+ ExprResult ActOnDependentMemberExpr(Expr *Base,
QualType BaseType,
bool IsArrow,
SourceLocation OpLoc,
@@ -1747,7 +1827,7 @@ public:
const DeclarationNameInfo &NameInfo,
const TemplateArgumentListInfo *TemplateArgs);
- virtual ExprResult ActOnMemberAccessExpr(Scope *S, ExprArg Base,
+ virtual ExprResult ActOnMemberAccessExpr(Scope *S, Expr *Base,
SourceLocation OpLoc,
tok::TokenKind OpKind,
CXXScopeSpec &SS,
@@ -1765,7 +1845,7 @@ public:
/// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
/// This provides the location of the left/right parens and a list of comma
/// locations.
- virtual ExprResult ActOnCallExpr(Scope *S, ExprArg Fn,
+ virtual ExprResult ActOnCallExpr(Scope *S, Expr *Fn,
SourceLocation LParenLoc,
MultiExprArg Args,
SourceLocation *CommaLocs,
@@ -1778,11 +1858,11 @@ public:
virtual ExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
ParsedType Ty, SourceLocation RParenLoc,
- ExprArg Op);
+ Expr *Op);
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc,
TypeSourceInfo *Ty,
SourceLocation RParenLoc,
- ExprArg Op);
+ Expr *Op);
virtual bool TypeIsVectorType(ParsedType Ty) {
return GetTypeFromParser(Ty)->isVectorType();
@@ -1790,31 +1870,31 @@ public:
ExprResult MaybeConvertParenListExprToParenExpr(Scope *S, Expr *ME);
ExprResult ActOnCastOfParenListExpr(Scope *S, SourceLocation LParenLoc,
- SourceLocation RParenLoc, ExprArg E,
+ SourceLocation RParenLoc, Expr *E,
TypeSourceInfo *TInfo);
virtual ExprResult ActOnCompoundLiteral(SourceLocation LParenLoc,
ParsedType Ty,
SourceLocation RParenLoc,
- ExprArg Op);
+ Expr *Op);
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc,
TypeSourceInfo *TInfo,
SourceLocation RParenLoc,
- ExprArg InitExpr);
+ Expr *InitExpr);
virtual ExprResult ActOnInitList(SourceLocation LParenLoc,
MultiExprArg InitList,
SourceLocation RParenLoc);
virtual ExprResult ActOnDesignatedInitializer(Designation &Desig,
- SourceLocation Loc,
- bool GNUSyntax,
- ExprResult Init);
+ SourceLocation Loc,
+ bool GNUSyntax,
+ ExprResult Init);
virtual ExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc,
tok::TokenKind Kind,
- ExprArg LHS, ExprArg RHS);
+ Expr *LHS, Expr *RHS);
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc,
BinaryOperatorKind Opc,
Expr *lhs, Expr *rhs);
@@ -1825,17 +1905,27 @@ public:
/// in the case of a the GNU conditional expr extension.
virtual ExprResult ActOnConditionalOp(SourceLocation QuestionLoc,
SourceLocation ColonLoc,
- ExprArg Cond, ExprArg LHS,
- ExprArg RHS);
+ Expr *Cond, Expr *LHS,
+ Expr *RHS);
/// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
virtual ExprResult ActOnAddrLabel(SourceLocation OpLoc,
SourceLocation LabLoc,
IdentifierInfo *LabelII);
- virtual ExprResult ActOnStmtExpr(SourceLocation LPLoc, StmtArg SubStmt,
+ virtual ExprResult ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt,
SourceLocation RPLoc); // "({..})"
+ // __builtin_offsetof(type, identifier(.identifier|[expr])*)
+ struct OffsetOfComponent {
+ SourceLocation LocStart, LocEnd;
+ bool isBrackets; // true if [expr], false if .ident
+ union {
+ IdentifierInfo *IdentInfo;
+ ExprTy *E;
+ } U;
+ };
+
/// __builtin_offsetof(type, a.b[123][456].c)
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc,
TypeSourceInfo *TInfo,
@@ -1867,10 +1957,10 @@ public:
// __builtin_va_arg(expr, type)
virtual ExprResult ActOnVAArg(SourceLocation BuiltinLoc,
- ExprArg expr, ParsedType type,
+ Expr *expr, ParsedType type,
SourceLocation RPLoc);
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc,
- ExprArg expr, TypeSourceInfo *TInfo,
+ Expr *expr, TypeSourceInfo *TInfo,
SourceLocation RPLoc);
// __null
@@ -1893,7 +1983,7 @@ public:
/// ActOnBlockStmtExpr - This is called when the body of a block statement
/// literal was successfully completed. ^(int x){...}
virtual ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc,
- StmtArg Body, Scope *CurScope);
+ Stmt *Body, Scope *CurScope);
//===---------------------------- C++ Features --------------------------===//
@@ -2089,13 +2179,13 @@ public:
ParsedType Ty,
SourceLocation RAngleBracketLoc,
SourceLocation LParenLoc,
- ExprArg E,
+ Expr *E,
SourceLocation RParenLoc);
ExprResult BuildCXXNamedCast(SourceLocation OpLoc,
tok::TokenKind Kind,
TypeSourceInfo *Ty,
- ExprArg E,
+ Expr *E,
SourceRange AngleBrackets,
SourceRange Parens);
@@ -2105,7 +2195,7 @@ public:
SourceLocation RParenLoc);
ExprResult BuildCXXTypeId(QualType TypeInfoType,
SourceLocation TypeidLoc,
- ExprArg Operand,
+ Expr *Operand,
SourceLocation RParenLoc);
/// ActOnCXXTypeid - Parse typeid( something ).
@@ -2126,7 +2216,7 @@ public:
//// ActOnCXXThrow - Parse throw expressions.
virtual ExprResult ActOnCXXThrow(SourceLocation OpLoc,
- ExprArg expr);
+ Expr *expr);
bool CheckCXXThrowOperand(SourceLocation ThrowLoc, Expr *&E);
/// ActOnCXXTypeConstructExpr - Parse construction of a specified type.
@@ -2157,7 +2247,7 @@ public:
QualType AllocType,
SourceLocation TypeLoc,
SourceRange TypeRange,
- ExprArg ArraySize,
+ Expr *ArraySize,
SourceLocation ConstructorLParen,
MultiExprArg ConstructorArgs,
SourceLocation ConstructorRParen);
@@ -2184,7 +2274,7 @@ public:
/// ActOnCXXDelete - Parsed a C++ 'delete' expression
virtual ExprResult ActOnCXXDelete(SourceLocation StartLoc,
bool UseGlobal, bool ArrayForm,
- ExprArg Operand);
+ Expr *Operand);
virtual DeclResult ActOnCXXConditionDeclaration(Scope *S,
Declarator &D);
@@ -2201,16 +2291,16 @@ public:
SourceLocation RParen);
virtual ExprResult ActOnStartCXXMemberReference(Scope *S,
- ExprArg Base,
+ Expr *Base,
SourceLocation OpLoc,
tok::TokenKind OpKind,
ParsedType &ObjectType,
bool &MayBePseudoDestructor);
ExprResult DiagnoseDtorReference(SourceLocation NameLoc,
- ExprArg MemExpr);
+ Expr *MemExpr);
- ExprResult BuildPseudoDestructorExpr(ExprArg Base,
+ ExprResult BuildPseudoDestructorExpr(Expr *Base,
SourceLocation OpLoc,
tok::TokenKind OpKind,
const CXXScopeSpec &SS,
@@ -2220,7 +2310,7 @@ public:
PseudoDestructorTypeStorage DestroyedType,
bool HasTrailingLParen);
- virtual ExprResult ActOnPseudoDestructorExpr(Scope *S, ExprArg Base,
+ virtual ExprResult ActOnPseudoDestructorExpr(Scope *S, Expr *Base,
SourceLocation OpLoc,
tok::TokenKind OpKind,
CXXScopeSpec &SS,
@@ -2237,7 +2327,7 @@ public:
ExprResult MaybeCreateCXXExprWithTemporaries(ExprResult SubExpr);
FullExpr CreateFullExpr(Expr *SubExpr);
- virtual ExprResult ActOnFinishFullExpr(ExprArg Expr);
+ virtual ExprResult ActOnFinishFullExpr(Expr *Expr);
// Marks SS invalid if it represents an incomplete type.
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC);
@@ -2251,8 +2341,8 @@ public:
/// ActOnCXXGlobalScopeSpecifier - Return the object that represents the
/// global scope ('::').
- virtual CXXScopeTy *ActOnCXXGlobalScopeSpecifier(Scope *S,
- SourceLocation CCLoc);
+ virtual NestedNameSpecifier *
+ ActOnCXXGlobalScopeSpecifier(Scope *S, SourceLocation CCLoc);
bool isAcceptableNestedNameSpecifier(NamedDecl *SD);
NamedDecl *FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS);
@@ -2262,23 +2352,23 @@ public:
IdentifierInfo &II,
ParsedType ObjectType);
- CXXScopeTy *BuildCXXNestedNameSpecifier(Scope *S,
- CXXScopeSpec &SS,
- SourceLocation IdLoc,
- SourceLocation CCLoc,
- IdentifierInfo &II,
- QualType ObjectType,
- NamedDecl *ScopeLookupResult,
- bool EnteringContext,
- bool ErrorRecoveryLookup);
-
- virtual CXXScopeTy *ActOnCXXNestedNameSpecifier(Scope *S,
- CXXScopeSpec &SS,
- SourceLocation IdLoc,
- SourceLocation CCLoc,
- IdentifierInfo &II,
- ParsedType ObjectType,
- bool EnteringContext);
+ NestedNameSpecifier *BuildCXXNestedNameSpecifier(Scope *S,
+ CXXScopeSpec &SS,
+ SourceLocation IdLoc,
+ SourceLocation CCLoc,
+ IdentifierInfo &II,
+ QualType ObjectType,
+ NamedDecl *ScopeLookupResult,
+ bool EnteringContext,
+ bool ErrorRecoveryLookup);
+
+ virtual NestedNameSpecifier *ActOnCXXNestedNameSpecifier(Scope *S,
+ CXXScopeSpec &SS,
+ SourceLocation IdLoc,
+ SourceLocation CCLoc,
+ IdentifierInfo &II,
+ ParsedType ObjectType,
+ bool EnteringContext);
virtual bool IsInvalidUnlessNestedName(Scope *S,
CXXScopeSpec &SS,
@@ -2330,7 +2420,7 @@ public:
// ParseObjCStringLiteral - Parse Objective-C string literals.
virtual ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs,
- ExprTy **Strings,
+ Expr **Strings,
unsigned NumStrings);
Expr *BuildObjCEncodeExpression(SourceLocation AtLoc,
@@ -2386,8 +2476,8 @@ public:
virtual Decl *ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS,
Declarator &D,
MultiTemplateParamsArg TemplateParameterLists,
- ExprTy *BitfieldWidth,
- ExprTy *Init, bool IsDefinition,
+ Expr *BitfieldWidth,
+ Expr *Init, bool IsDefinition,
bool Deleted = false);
virtual MemInitResult ActOnMemInitializer(Decl *ConstructorD,
@@ -2397,7 +2487,7 @@ public:
ParsedType TemplateTypeTy,
SourceLocation IdLoc,
SourceLocation LParenLoc,
- ExprTy **Args, unsigned NumArgs,
+ Expr **Args, unsigned NumArgs,
SourceLocation *CommaLocs,
SourceLocation RParenLoc);
@@ -2485,8 +2575,8 @@ public:
Decl *Record);
virtual Decl *ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
- ExprArg AssertExpr,
- ExprArg AssertMessageExpr);
+ Expr *AssertExpr,
+ Expr *AssertMessageExpr);
FriendDecl *CheckFriendTypeDecl(SourceLocation FriendLoc,
TypeSourceInfo *TSInfo);
@@ -2696,7 +2786,7 @@ public:
unsigned Depth,
unsigned Position,
SourceLocation EqualLoc,
- ExprArg DefaultArg);
+ Expr *DefaultArg);
virtual Decl *ActOnTemplateTemplateParameter(Scope *S,
SourceLocation TmpLoc,
TemplateParamsTy *Params,
@@ -2758,7 +2848,7 @@ public:
virtual TypeResult ActOnTagTemplateIdType(TypeResult Type,
TagUseKind TUK,
- DeclSpec::TST TagSpec,
+ TypeSpecifierType TagSpec,
SourceLocation TagLoc);
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS,
@@ -3643,6 +3733,18 @@ public:
IdentifierInfo *PropertyId,
IdentifierInfo *PropertyIvar);
+ struct ObjCArgInfo {
+ IdentifierInfo *Name;
+ SourceLocation NameLoc;
+ // The Type is null if no type was specified, and the DeclSpec is invalid
+ // in this case.
+ ParsedType Type;
+ ObjCDeclSpec DeclSpec;
+
+ /// ArgAttrs - Attribute list for this argument.
+ AttributeList *ArgAttrs;
+ };
+
virtual Decl *ActOnMethodDeclaration(
SourceLocation BeginLoc, // location of the + or -.
SourceLocation EndLoc, // location of the ; or {.
@@ -3677,6 +3779,18 @@ public:
SourceLocation receiverNameLoc,
SourceLocation propertyNameLoc);
+ /// \brief Describes the kind of message expression indicated by a message
+ /// send that starts with an identifier.
+ enum ObjCMessageKind {
+ /// \brief The message is sent to 'super'.
+ ObjCSuperMessage,
+ /// \brief The message is an instance message.
+ ObjCInstanceMessage,
+ /// \brief The message is a class message, and the identifier is a type
+ /// name.
+ ObjCClassMessage
+ };
+
virtual ObjCMessageKind getObjCMessageKind(Scope *S,
IdentifierInfo *Name,
SourceLocation NameLoc,
@@ -3708,7 +3822,7 @@ public:
SourceLocation RBracLoc,
MultiExprArg Args);
- ExprResult BuildInstanceMessage(ExprArg Receiver,
+ ExprResult BuildInstanceMessage(Expr *Receiver,
QualType ReceiverType,
SourceLocation SuperLoc,
Selector Sel,
@@ -3718,7 +3832,7 @@ public:
MultiExprArg Args);
virtual ExprResult ActOnInstanceMessage(Scope *S,
- ExprArg Receiver,
+ Expr *Receiver,
Selector Sel,
SourceLocation LBracLoc,
SourceLocation SelectorLoc,
@@ -3726,15 +3840,31 @@ public:
MultiExprArg Args);
+ enum PragmaOptionsAlignKind {
+ POAK_Native, // #pragma options align=native
+ POAK_Natural, // #pragma options align=natural
+ POAK_Packed, // #pragma options align=packed
+ POAK_Power, // #pragma options align=power
+ POAK_Mac68k, // #pragma options align=mac68k
+ POAK_Reset // #pragma options align=reset
+ };
+
/// ActOnPragmaOptionsAlign - Called on well formed #pragma options align.
virtual void ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind,
SourceLocation PragmaLoc,
SourceLocation KindLoc);
+ enum PragmaPackKind {
+ PPK_Default, // #pragma pack([n])
+ PPK_Show, // #pragma pack(show), only supported by MSVC.
+ PPK_Push, // #pragma pack(push, [identifier], [n])
+ PPK_Pop // #pragma pack(pop, [identifier], [n])
+ };
+
/// ActOnPragmaPack - Called on well formed #pragma pack(...).
virtual void ActOnPragmaPack(PragmaPackKind Kind,
IdentifierInfo *Name,
- ExprTy *Alignment,
+ Expr *Alignment,
SourceLocation PragmaLoc,
SourceLocation LParenLoc,
SourceLocation RParenLoc);
@@ -4111,7 +4241,7 @@ public:
bool CheckBooleanCondition(Expr *&CondExpr, SourceLocation Loc);
virtual ExprResult ActOnBooleanCondition(Scope *S, SourceLocation Loc,
- ExprArg SubExpr);
+ Expr *SubExpr);
/// DiagnoseAssignmentAsCondition - Given that an expression is
/// being used as a boolean condition, warn if it's an assignment.
@@ -4149,6 +4279,46 @@ public:
/// \name Code completion
//@{
+ /// \brief Describes the context in which code completion occurs.
+ enum ParserCompletionContext {
+ /// \brief Code completion occurs at top-level or namespace context.
+ PCC_Namespace,
+ /// \brief Code completion occurs within a class, struct, or union.
+ PCC_Class,
+ /// \brief Code completion occurs within an Objective-C interface, protocol,
+ /// or category.
+ PCC_ObjCInterface,
+ /// \brief Code completion occurs within an Objective-C implementation or
+ /// category implementation
+ PCC_ObjCImplementation,
+ /// \brief Code completion occurs within the list of instance variables
+ /// in an Objective-C interface, protocol, category, or implementation.
+ PCC_ObjCInstanceVariableList,
+ /// \brief Code completion occurs following one or more template
+ /// headers.
+ PCC_Template,
+ /// \brief Code completion occurs following one or more template
+ /// headers within a class.
+ PCC_MemberTemplate,
+ /// \brief Code completion occurs within an expression.
+ PCC_Expression,
+ /// \brief Code completion occurs within a statement, which may
+ /// also be an expression or a declaration.
+ PCC_Statement,
+ /// \brief Code completion occurs at the beginning of the
+ /// initialization statement (or expression) in a for loop.
+ PCC_ForInit,
+ /// \brief Code completion occurs within the condition of an if,
+ /// while, switch, or for statement.
+ PCC_Condition,
+ /// \brief Code completion occurs within the body of a function on a
+ /// recovery path, where we do not have a specific handle on our position
+ /// in the grammar.
+ PCC_RecoveryInFunction,
+ /// \brief Code completion occurs where only a type is permitted.
+ PCC_Type
+ };
+
virtual void CodeCompleteOrdinaryName(Scope *S,
ParserCompletionContext CompletionContext);
virtual void CodeCompleteDeclarator(Scope *S,
@@ -4158,16 +4328,16 @@ public:
struct CodeCompleteExpressionData;
virtual void CodeCompleteExpression(Scope *S,
const CodeCompleteExpressionData &Data);
- virtual void CodeCompleteMemberReferenceExpr(Scope *S, ExprTy *Base,
+ virtual void CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base,
SourceLocation OpLoc,
bool IsArrow);
virtual void CodeCompleteTag(Scope *S, unsigned TagSpec);
virtual void CodeCompleteCase(Scope *S);
- virtual void CodeCompleteCall(Scope *S, ExprTy *Fn,
- ExprTy **Args, unsigned NumArgs);
+ virtual void CodeCompleteCall(Scope *S, Expr *Fn,
+ Expr **Args, unsigned NumArgs);
virtual void CodeCompleteInitializer(Scope *S, Decl *D);
virtual void CodeCompleteReturn(Scope *S);
- virtual void CodeCompleteAssignmentRHS(Scope *S, ExprTy *LHS);
+ virtual void CodeCompleteAssignmentRHS(Scope *S, Expr *LHS);
virtual void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS,
bool EnteringContext);
@@ -4197,7 +4367,7 @@ public:
virtual void CodeCompleteObjCClassMessage(Scope *S, ParsedType Receiver,
IdentifierInfo **SelIdents,
unsigned NumSelIdents);
- virtual void CodeCompleteObjCInstanceMessage(Scope *S, ExprTy *Receiver,
+ virtual void CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver,
IdentifierInfo **SelIdents,
unsigned NumSelIdents);
virtual void CodeCompleteObjCForCollection(Scope *S,
@@ -4247,6 +4417,8 @@ public:
llvm::SmallVectorImpl<CodeCompletionResult> &Results);
//@}
+ void PrintStats() const {}
+
//===--------------------------------------------------------------------===//
// Extra semantic analysis beyond the C type system
@@ -4302,6 +4474,33 @@ private:
SourceLocation ReturnLoc);
void CheckFloatComparison(SourceLocation loc, Expr* lex, Expr* rex);
void CheckImplicitConversions(Expr *E);
+
+ /// \brief The parser's current scope.
+ ///
+ /// The parser maintains this state here.
+ Scope *CurScope;
+
+protected:
+ friend class Parser;
+
+ /// \brief Retrieve the parser's current scope.
+ Scope *getCurScope() const { return CurScope; }
+};
+
+/// \brief RAII object that enters a new expression evaluation context.
+class EnterExpressionEvaluationContext {
+ Sema &Actions;
+
+public:
+ EnterExpressionEvaluationContext(Sema &Actions,
+ Sema::ExpressionEvaluationContext NewContext)
+ : Actions(Actions) {
+ Actions.PushExpressionEvaluationContext(NewContext);
+ }
+
+ ~EnterExpressionEvaluationContext() {
+ Actions.PopExpressionEvaluationContext();
+ }
};
} // end namespace clang
diff --git a/lib/Parse/ParseCXXInlineMethods.cpp b/lib/Parse/ParseCXXInlineMethods.cpp
index 61c4d3ebba..d327db485c 100644
--- a/lib/Parse/ParseCXXInlineMethods.cpp
+++ b/lib/Parse/ParseCXXInlineMethods.cpp
@@ -27,7 +27,7 @@ Decl *Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, Declarator &D,
assert((Tok.is(tok::l_brace) || Tok.is(tok::colon) || Tok.is(tok::kw_try)) &&
"Current token not a '{', ':' or 'try'!");
- Action::MultiTemplateParamsArg TemplateParams(Actions,
+ MultiTemplateParamsArg TemplateParams(Actions,
TemplateInfo.TemplateParams ? TemplateInfo.TemplateParams->data() : 0,
TemplateInfo.TemplateParams ? TemplateInfo.TemplateParams->size() : 0);
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 8db4964e3d..0cc9103c05 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -15,6 +15,7 @@
#include "clang/Parse/ParseDiagnostic.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ParsedTemplate.h"
+#include "clang/Sema/PrettyDeclStackTrace.h"
#include "RAIIObjectsForParser.h"
#include "llvm/ADT/SmallSet.h"
using namespace clang;
@@ -28,7 +29,7 @@ using namespace clang;
/// specifier-qualifier-list abstract-declarator[opt]
///
/// Called type-id in C++.
-Action::TypeResult Parser::ParseTypeName(SourceRange *Range) {
+TypeResult Parser::ParseTypeName(SourceRange *Range) {
// Parse the common declaration-specifiers piece.
DeclSpec DS;
ParseSpecifierQualifierList(DS);
@@ -541,7 +542,7 @@ Decl *Parser::ParseDeclarationAfterDeclarator(Declarator &D,
case ParsedTemplateInfo::Template:
case ParsedTemplateInfo::ExplicitSpecialization:
ThisDecl = Actions.ActOnTemplateDeclarator(getCurScope(),
- Action::MultiTemplateParamsArg(Actions,
+ MultiTemplateParamsArg(Actions,
TemplateInfo.TemplateParams->data(),
TemplateInfo.TemplateParams->size()),
D);
@@ -870,7 +871,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
return;
case tok::code_completion: {
- Action::ParserCompletionContext CCC = Action::PCC_Namespace;
+ Sema::ParserCompletionContext CCC = Sema::PCC_Namespace;
if (DS.hasTypeSpecifier()) {
bool AllowNonIdentifiers
= (getCurScope()->getFlags() & (Scope::ControlScope |
@@ -889,12 +890,12 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
}
if (TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate)
- CCC = DSContext == DSC_class? Action::PCC_MemberTemplate
- : Action::PCC_Template;
+ CCC = DSContext == DSC_class? Sema::PCC_MemberTemplate
+ : Sema::PCC_Template;
else if (DSContext == DSC_class)
- CCC = Action::PCC_Class;
+ CCC = Sema::PCC_Class;
else if (ObjCImpDecl)
- CCC = Action::PCC_ObjCImplementation;
+ CCC = Sema::PCC_ObjCImplementation;
Actions.CodeCompleteOrdinaryName(getCurScope(), CCC);
ConsumeCodeCompletionToken();
@@ -1798,9 +1799,8 @@ ParseStructDeclaration(DeclSpec &DS, FieldCallback &Fields) {
///
void Parser::ParseStructUnionBody(SourceLocation RecordLoc,
unsigned TagType, Decl *TagDecl) {
- PrettyStackTraceActionsDecl CrashInfo(TagDecl, RecordLoc, Actions,
- PP.getSourceManager(),
- "parsing struct/union body");
+ PrettyDeclStackTraceEntry CrashInfo(Actions, TagDecl, RecordLoc,
+ "parsing struct/union body");
SourceLocation LBraceLoc = ConsumeBrace();
@@ -1972,18 +1972,18 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
// enum foo {..}; void bar() { enum foo; } <- new foo in bar.
// enum foo {..}; void bar() { enum foo x; } <- use of old foo.
//
- Action::TagUseKind TUK;
+ Sema::TagUseKind TUK;
if (Tok.is(tok::l_brace))
- TUK = Action::TUK_Definition;
+ TUK = Sema::TUK_Definition;
else if (Tok.is(tok::semi))
- TUK = Action::TUK_Declaration;
+ TUK = Sema::TUK_Declaration;
else
- TUK = Action::TUK_Reference;
+ TUK = Sema::TUK_Reference;
// enums cannot be templates, although they can be referenced from a
// template.
if (TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate &&
- TUK != Action::TUK_Reference) {
+ TUK != Sema::TUK_Reference) {
Diag(Tok, diag::err_enum_template);
// Skip the rest of this declarator, up until the comma or semicolon.
@@ -1999,7 +1999,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
Decl *TagDecl = Actions.ActOnTag(getCurScope(), DeclSpec::TST_enum, TUK,
StartLoc, SS, Name, NameLoc, Attr.get(),
AS,
- Action::MultiTemplateParamsArg(Actions),
+ MultiTemplateParamsArg(Actions),
Owned, IsDependent);
if (IsDependent) {
// This enum has a dependent nested-name-specifier. Handle it as a
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index d80410c9ee..df707b22e1 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -17,6 +17,7 @@
#include "clang/Sema/DeclSpec.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ParsedTemplate.h"
+#include "clang/Sema/PrettyDeclStackTrace.h"
#include "RAIIObjectsForParser.h"
using namespace clang;
@@ -102,9 +103,8 @@ Decl *Parser::ParseNamespace(unsigned Context,
Actions.ActOnStartNamespaceDef(getCurScope(), IdentLoc, Ident, LBrace,
AttrList.get());
- PrettyStackTraceActionsDecl CrashInfo(NamespcDecl, NamespaceLoc, Actions,
- PP.getSourceManager(),
- "parsing namespace");
+ PrettyDeclStackTraceEntry CrashInfo(Actions, NamespcDecl, NamespaceLoc,
+ "parsing namespace");
while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) {
CXX0XAttributeList Attr;
@@ -439,7 +439,7 @@ void Parser::ParseDecltypeSpecifier(DeclSpec &DS) {
// C++0x [dcl.type.simple]p4:
// The operand of the decltype specifier is an unevaluated operand.
EnterExpressionEvaluationContext Unevaluated(Actions,
- Action::Unevaluated);
+ Sema::Unevaluated);
ExprResult Result = ParseExpression();
if (Result.isInvalid()) {
SkipUntil(tok::r_paren);
@@ -784,9 +784,9 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
// or
// &T::operator struct s;
// For these, SuppressDeclarations is true.
- Action::TagUseKind TUK;
+ Sema::TagUseKind TUK;
if (SuppressDeclarations)
- TUK = Action::TUK_Reference;
+ TUK = Sema::TUK_Reference;
else if (Tok.is(tok::l_brace) || (getLang().CPlusPlus && Tok.is(tok::colon))){
if (DS.isFriendSpecified()) {
// C++ [class.friend]p2:
@@ -797,18 +797,18 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
// Skip everything up to the semicolon, so that this looks like a proper
// friend class (or template thereof) declaration.
SkipUntil(tok::semi, true, true);
- TUK = Action::TUK_Friend;
+ TUK = Sema::TUK_Friend;
} else {
// Okay, this is a class definition.
- TUK = Action::TUK_Definition;
+ TUK = Sema::TUK_Definition;
}
} else if (Tok.is(tok::semi))
- TUK = DS.isFriendSpecified() ? Action::TUK_Friend : Action::TUK_Declaration;
+ TUK = DS.isFriendSpecified() ? Sema::TUK_Friend : Sema::TUK_Declaration;
else
- TUK = Action::TUK_Reference;
+ TUK = Sema::TUK_Reference;
if (!Name && !TemplateId && (DS.getTypeSpecType() == DeclSpec::TST_error ||
- TUK != Action::TUK_Definition)) {
+ TUK != Sema::TUK_Definition)) {
if (DS.getTypeSpecType() != DeclSpec::TST_error) {
// We have a declaration or reference to an anonymous class.
Diag(StartLoc, diag::err_anon_type_definition)
@@ -834,7 +834,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
TemplateId->getTemplateArgs(),
TemplateId->NumArgs);
if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation &&
- TUK == Action::TUK_Declaration) {
+ TUK == Sema::TUK_Declaration) {
// This is an explicit instantiation of a class template.
TagOrTempResult
= Actions.ActOnExplicitInstantiation(getCurScope(),
@@ -854,8 +854,8 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
// they have template headers, in which case they're ill-formed
// (FIXME: "template <class T> friend class A<T>::B<int>;").
// We diagnose this error in ActOnClassTemplateSpecialization.
- } else if (TUK == Action::TUK_Reference ||
- (TUK == Action::TUK_Friend &&
+ } else if (TUK == Sema::TUK_Reference ||
+ (TUK == Sema::TUK_Friend &&
TemplateInfo.Kind == ParsedTemplateInfo::NonTemplate)) {
TypeResult
= Actions.ActOnTemplateIdType(TemplateId->Template,
@@ -880,7 +880,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
// but it actually has a definition. Most likely, this was
// meant to be an explicit specialization, but the user forgot
// the '<>' after 'template'.
- assert(TUK == Action::TUK_Definition && "Expected a definition here");
+ assert(TUK == Sema::TUK_Definition && "Expected a definition here");
SourceLocation LAngleLoc
= PP.getLocForEndOfToken(TemplateInfo.TemplateLoc);
@@ -911,13 +911,13 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
TemplateArgsPtr,
TemplateId->RAngleLoc,
AttrList,
- Action::MultiTemplateParamsArg(Actions,
+ MultiTemplateParamsArg(Actions,
TemplateParams? &(*TemplateParams)[0] : 0,
TemplateParams? TemplateParams->size() : 0));
}
TemplateId->Destroy();
} else if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation &&
- TUK == Action::TUK_Declaration) {
+ TUK == Sema::TUK_Declaration) {
// Explicit instantiation of a member of a class template
// specialization, e.g.,
//
@@ -931,7 +931,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
NameLoc, AttrList);
} else {
if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation &&
- TUK == Action::TUK_Definition) {
+ TUK == Sema::TUK_Definition) {
// FIXME: Diagnose this particular error.
}
@@ -940,7 +940,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
// Declaration or definition of a class type
TagOrTempResult = Actions.ActOnTag(getCurScope(), TagType, TUK, StartLoc, SS,
Name, NameLoc, AttrList, AS,
- Action::MultiTemplateParamsArg(Actions,
+ MultiTemplateParamsArg(Actions,
TemplateParams? &(*TemplateParams)[0] : 0,
TemplateParams? TemplateParams->size() : 0),
Owned, IsDependent);
@@ -953,7 +953,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
}
// If there is a body, parse it and inform the actions module.
- if (TUK == Action::TUK_Definition) {
+ if (TUK == Sema::TUK_Definition) {
assert(Tok.is(tok::l_brace) ||
(getLang().CPlusPlus && Tok.is(tok::colon)));
if (getLang().CPlusPlus)
@@ -990,7 +990,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
// the end of the declaration and recover that way.
//
// This switch enumerates the valid "follow" set for definition.
- if (TUK == Action::TUK_Definition) {
+ if (TUK == Sema::TUK_Definition) {
bool ExpectedSemi = true;
switch (Tok.getKind()) {
default: break;
@@ -1337,7 +1337,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
DS.AddAttributes(AttrList.AttrList);
ParseDeclarationSpecifiers(DS, TemplateInfo, AS, DSC_class);
- Action::MultiTemplateParamsArg TemplateParams(Actions,
+ MultiTemplateParamsArg TemplateParams(Actions,
TemplateInfo.TemplateParams? TemplateInfo.TemplateParams->data() : 0,
TemplateInfo.TemplateParams? TemplateInfo.TemplateParams->size() : 0);
@@ -1538,9 +1538,8 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
TagType == DeclSpec::TST_union ||
TagType == DeclSpec::TST_class) && "Invalid TagType!");
- PrettyStackTraceActionsDecl CrashInfo(TagDecl, RecordLoc, Actions,
- PP.getSourceManager(),
- "parsing struct/union/class body");
+ PrettyDeclStackTraceEntry CrashInfo(Actions, TagDecl, RecordLoc,
+ "parsing struct/union/class body");
// Determine whether this is a non-nested class. Note that local
// classes are *not* considered to be nested classes.
@@ -2062,8 +2061,7 @@ CXX0XAttributeList Parser::ParseCXX0XAttributes(SourceLocation *EndLoc) {
/// [C++0x] 'align' '(' assignment-expression ')'
ExprResult Parser::ParseCXX0XAlignArgument(SourceLocation Start) {
if (isTypeIdInParens()) {
- EnterExpressionEvaluationContext Unevaluated(Actions,
- Action::Unevaluated);
+ EnterExpressionEvaluationContext Unevaluated(Actions, Sema::Unevaluated);
SourceLocation TypeLoc = Tok.getLocation();
ParsedType Ty = ParseTypeName().get();
SourceRange TypeRange(Start, Tok.getLocation());
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 7020fa412e..d70eb63a78 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -220,7 +220,7 @@ Parser::ParseExpressionWithLeadingExtension(SourceLocation ExtLoc) {
///
ExprResult Parser::ParseAssignmentExpression() {
if (Tok.is(tok::code_completion)) {
- Actions.CodeCompleteOrdinaryName(getCurScope(), Action::PCC_Expression);
+ Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_Expression);
ConsumeCodeCompletionToken();
}
@@ -261,7 +261,7 @@ ExprResult Parser::ParseConstantExpression() {
// An expression is potentially evaluated unless it appears where an
// integral constant expression is required (see 5.19) [...].
EnterExpressionEvaluationContext Unevaluated(Actions,
- Action::Unevaluated);
+ Sema::Unevaluated);
ExprResult LHS(ParseCastExpression(false));
if (LHS.isInvalid()) return move(LHS);
@@ -905,7 +905,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression,
case tok::caret:
return ParsePostfixExpressionSuffix(ParseBlockLiteralExpression());
case tok::code_completion:
- Actions.CodeCompleteOrdinaryName(getCurScope(), Action::PCC_Expression);
+ Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_Expression);
ConsumeCodeCompletionToken();
return ParseCastExpression(isUnaryExpression, isAddressOfOperand,
NotCastExpr, TypeOfCast);
@@ -995,7 +995,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
}
if (Tok.isNot(tok::r_paren)) {
- if (ParseExpressionList(ArgExprs, CommaLocs, &Action::CodeCompleteCall,
+ if (ParseExpressionList(ArgExprs, CommaLocs, &Sema::CodeCompleteCall,
LHS.get())) {
SkipUntil(tok::r_paren);
return ExprError();
@@ -1132,7 +1132,7 @@ Parser::ParseExprAfterTypeofSizeofAlignof(const Token &OpTok,
// The GNU typeof and alignof extensions also behave as unevaluated
// operands.
EnterExpressionEvaluationContext Unevaluated(Actions,
- Action::Unevaluated);
+ Sema::Unevaluated);
Operand = ParseCastExpression(true/*isUnaryExpression*/);
} else {
// If it starts with a '(', we know that it is either a parenthesized
@@ -1149,7 +1149,7 @@ Parser::ParseExprAfterTypeofSizeofAlignof(const Token &OpTok,
// The GNU typeof and alignof extensions also behave as unevaluated
// operands.
EnterExpressionEvaluationContext Unevaluated(Actions,
- Action::Unevaluated);
+ Sema::Unevaluated);
Operand = ParseParenExpression(ExprType, true/*stopIfCastExpr*/,
ParsedType(), CastTy, RParenLoc);
CastRange = SourceRange(LParenLoc, RParenLoc);
@@ -1287,9 +1287,9 @@ ExprResult Parser::ParseBuiltinPrimaryExpression() {
}
// Keep track of the various subcomponents we see.
- llvm::SmallVector<Action::OffsetOfComponent, 4> Comps;
+ llvm::SmallVector<Sema::OffsetOfComponent, 4> Comps;
- Comps.push_back(Action::OffsetOfComponent());
+ Comps.push_back(Sema::OffsetOfComponent());
Comps.back().isBrackets = false;
Comps.back().U.IdentInfo = Tok.getIdentifierInfo();
Comps.back().LocStart = Comps.back().LocEnd = ConsumeToken();
@@ -1298,7 +1298,7 @@ ExprResult Parser::ParseBuiltinPrimaryExpression() {
while (1) {
if (Tok.is(tok::period)) {
// offsetof-member-designator: offsetof-member-designator '.' identifier
- Comps.push_back(Action::OffsetOfComponent());
+ Comps.push_back(Sema::OffsetOfComponent());
Comps.back().isBrackets = false;
Comps.back().LocStart = ConsumeToken();
@@ -1312,7 +1312,7 @@ ExprResult Parser::ParseBuiltinPrimaryExpression() {
} else if (Tok.is(tok::l_square)) {
// offsetof-member-designator: offsetof-member-design '[' expression ']'
- Comps.push_back(Action::OffsetOfComponent());
+ Comps.push_back(Sema::OffsetOfComponent());
Comps.back().isBrackets = true;
Comps.back().LocStart = ConsumeBracket();
Res = ParseExpression();
@@ -1579,7 +1579,7 @@ ExprResult Parser::ParseStringLiteralExpression() {
///
bool Parser::ParseExpressionList(llvm::SmallVectorImpl<Expr*> &Exprs,
llvm::SmallVectorImpl<SourceLocation> &CommaLocs,
- void (Action::*Completer)(Scope *S,
+ void (Sema::*Completer)(Scope *S,
Expr *Data,
Expr **Args,
unsigned NumArgs),
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index de9498eff5..7270f6a909 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -530,7 +530,7 @@ ExprResult Parser::ParseCXXTypeid() {
// polymorphic class type until after we've parsed the expression, so
// we the expression is potentially potentially evaluated.
EnterExpressionEvaluationContext Unevaluated(Actions,
- Action::PotentiallyPotentiallyEvaluated);
+ Sema::PotentiallyPotentiallyEvaluated);
Result = ParseExpression();
// Match the ')'.
@@ -735,7 +735,7 @@ bool Parser::ParseCXXCondition(ExprResult &ExprOut,
SourceLocation Loc,
bool ConvertToBoolean) {
if (Tok.is(tok::code_completion)) {
- Actions.CodeCompleteOrdinaryName(getCurScope(), Action::PCC_Condition);
+ Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_Condition);
ConsumeCodeCompletionToken();
}
@@ -1147,7 +1147,7 @@ bool Parser::ParseUnqualifiedIdTemplateId(CXXScopeSpec &SS,
TemplateArgs.size());
// Constructor and destructor names.
- Action::TypeResult Type
+ TypeResult Type
= Actions.ActOnTemplateIdType(Template, NameLoc,
LAngleLoc, TemplateArgsPtr,
RAngleLoc);
@@ -1339,7 +1339,7 @@ bool Parser::ParseUnqualifiedIdOperator(CXXScopeSpec &SS, bool EnteringContext,
ParseDeclaratorInternal(D, /*DirectDeclParser=*/0);
// Finish up the type.
- Action::TypeResult Ty = Actions.ActOnTypeName(getCurScope(), D);
+ TypeResult Ty = Actions.ActOnTypeName(getCurScope(), D);
if (Ty.isInvalid())
return true;
diff --git a/lib/Parse/ParseInit.cpp b/lib/Parse/ParseInit.cpp
index 2589867b03..4347294141 100644
--- a/lib/Parse/ParseInit.cpp
+++ b/lib/Parse/ParseInit.cpp
@@ -184,15 +184,15 @@ ExprResult Parser::ParseInitializerWithPotentialDesignator() {
// Three cases. This is a message send to a type: [type foo]
// This is a message send to super: [super foo]
// This is a message sent to an expr: [super.bar foo]
- switch (Action::ObjCMessageKind Kind
+ switch (Sema::ObjCMessageKind Kind
= Actions.getObjCMessageKind(getCurScope(), II, IILoc,
II == Ident_super,
NextToken().is(tok::period),
ReceiverType)) {
- case Action::ObjCSuperMessage:
- case Action::ObjCClassMessage:
+ case Sema::ObjCSuperMessage:
+ case Sema::ObjCClassMessage:
CheckArrayDesignatorSyntax(*this, StartLoc, Desig);
- if (Kind == Action::ObjCSuperMessage)
+ if (Kind == Sema::ObjCSuperMessage)
return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
ConsumeToken(),
ParsedType(),
@@ -208,7 +208,7 @@ ExprResult Parser::ParseInitializerWithPotentialDesignator() {
ReceiverType,
0);
- case Action::ObjCInstanceMessage:
+ case Sema::ObjCInstanceMessage:
// Fall through; we'll just parse the expression and
// (possibly) treat this like an Objective-C message send
// later.
@@ -321,7 +321,7 @@ ExprResult Parser::ParseBraceInitializer() {
if (!getLang().CPlusPlus)
Diag(LBraceLoc, diag::ext_gnu_empty_initializer);
// Match the '}'.
- return Actions.ActOnInitList(LBraceLoc, Action::MultiExprArg(Actions),
+ return Actions.ActOnInitList(LBraceLoc, MultiExprArg(Actions),
ConsumeBrace());
}
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index 4b65652011..914d52ea38 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -14,6 +14,7 @@
#include "clang/Parse/ParseDiagnostic.h"
#include "clang/Parse/Parser.h"
#include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/PrettyDeclStackTrace.h"
#include "clang/Sema/Scope.h"
#include "llvm/ADT/SmallVector.h"
using namespace clang;
@@ -348,8 +349,8 @@ void Parser::ParseObjCInterfaceDeclList(Decl *interfaceDecl,
// Code completion within an Objective-C interface.
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteOrdinaryName(getCurScope(),
- ObjCImpDecl? Action::PCC_ObjCImplementation
- : Action::PCC_ObjCInterface);
+ ObjCImpDecl? Sema::PCC_ObjCImplementation
+ : Sema::PCC_ObjCInterface);
ConsumeCodeCompletionToken();
}
@@ -840,10 +841,10 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc,
}
llvm::SmallVector<IdentifierInfo *, 12> KeyIdents;
- llvm::SmallVector<Action::ObjCArgInfo, 12> ArgInfos;
+ llvm::SmallVector<Sema::ObjCArgInfo, 12> ArgInfos;
while (1) {
- Action::ObjCArgInfo ArgInfo;
+ Sema::ObjCArgInfo ArgInfo;
// Each iteration parses a single keyword argument.
if (Tok.isNot(tok::colon)) {
@@ -951,7 +952,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc,
PD.complete(Result);
// Delete referenced AttributeList objects.
- for (llvm::SmallVectorImpl<Action::ObjCArgInfo>::iterator
+ for (llvm::SmallVectorImpl<Sema::ObjCArgInfo>::iterator
I = ArgInfos.begin(), E = ArgInfos.end(); I != E; ++I)
delete I->ArgAttrs;
@@ -1076,7 +1077,7 @@ void Parser::ParseObjCClassInstanceVariables(Decl *interfaceDecl,
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteOrdinaryName(getCurScope(),
- Action::PCC_ObjCInstanceVariableList);
+ Sema::PCC_ObjCInstanceVariableList);
ConsumeCodeCompletionToken();
}
@@ -1634,9 +1635,8 @@ StmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
Decl *Parser::ParseObjCMethodDefinition() {
Decl *MDecl = ParseObjCMethodPrototype(ObjCImpDecl);
- PrettyStackTraceActionsDecl CrashInfo(MDecl, Tok.getLocation(), Actions,
- PP.getSourceManager(),
- "parsing Objective-C method");
+ PrettyDeclStackTraceEntry CrashInfo(Actions, MDecl, Tok.getLocation(),
+ "parsing Objective-C method");
// parse optional ';'
if (Tok.is(tok::semi)) {
@@ -1896,11 +1896,11 @@ ExprResult Parser::ParseObjCMessageExpression() {
Name == Ident_super,
NextToken().is(tok::period),
ReceiverType)) {
- case Action::ObjCSuperMessage:
+ case Sema::ObjCSuperMessage:
return ParseObjCMessageExpressionBody(LBracLoc, ConsumeToken(),
ParsedType(), 0);
- case Action::ObjCClassMessage:
+ case Sema::ObjCClassMessage:
if (!ReceiverType) {
SkipUntil(tok::r_square);
return ExprError();
@@ -1911,7 +1911,7 @@ ExprResult Parser::ParseObjCMessageExpression() {
return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(),
ReceiverType, 0);
- case Action::ObjCInstanceMessage:
+ case Sema::ObjCInstanceMessage:
// Fall through to parse an expression.
break;
}
@@ -2090,20 +2090,20 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
if (SuperLoc.isValid())
return Actions.ActOnSuperMessage(getCurScope(), SuperLoc, Sel,
LBracLoc, SelectorLoc, RBracLoc,
- Action::MultiExprArg(Actions,
- KeyExprs.take(),
- KeyExprs.size()));
+ MultiExprArg(Actions,
+ KeyExprs.take(),
+ KeyExprs.size()));
else if (ReceiverType)
return Actions.ActOnClassMessage(getCurScope(), ReceiverType, Sel,
LBracLoc, SelectorLoc, RBracLoc,
- Action::MultiExprArg(Actions,
- KeyExprs.take(),
- KeyExprs.size()));
+ MultiExprArg(Actions,
+ KeyExprs.take(),
+ KeyExprs.size()));
return Actions.ActOnInstanceMessage(getCurScope(), ReceiverExpr, Sel,
LBracLoc, SelectorLoc, RBracLoc,
- Action::MultiExprArg(Actions,
- KeyExprs.take(),
- KeyExprs.size()));
+ MultiExprArg(Actions,
+ KeyExprs.take(),
+ KeyExprs.size()));
}
ExprResult Parser::ParseObjCStringLiteral(SourceLocation AtLoc) {
diff --git a/lib/Parse/ParsePragma.cpp b/lib/Parse/ParsePragma.cpp
index e4693ad131..ddba09ae0f 100644
--- a/lib/Parse/ParsePragma.cpp
+++ b/lib/Parse/ParsePragma.cpp
@@ -15,7 +15,6 @@
#include "clang/Parse/ParseDiagnostic.h"
#include "clang/Parse/Parser.h"
#include "clang/Lex/Preprocessor.h"
-#include "clang/Sema/Action.h"
using namespace clang;
@@ -85,7 +84,7 @@ void PragmaPackHandler::HandlePragma(Preprocessor &PP, Token &PackTok) {
return;
}
- Action::PragmaPackKind Kind = Action::PPK_Default;
+ Sema::PragmaPackKind Kind = Sema::PPK_Default;
IdentifierInfo *Name = 0;
ExprResult Alignment;
SourceLocation LParenLoc = Tok.getLocation();
@@ -99,13 +98,13 @@ void PragmaPackHandler::HandlePragma(Preprocessor &PP, Token &PackTok) {
} else if (Tok.is(tok::identifier)) {
const IdentifierInfo *II = Tok.getIdentifierInfo();
if (II->isStr("show")) {
- Kind = Action::PPK_Show;
+ Kind = Sema::PPK_Show;
PP.Lex(Tok);
} else {
if (II->isStr("push")) {
- Kind = Action::PPK_Push;
+ Kind = Sema::PPK_Push;
} else if (II->isStr("pop")) {
- Kind = Action::PPK_Pop;
+ Kind = Sema::PPK_Pop;
} else {
PP.Diag(Tok.getLocation(), diag::warn_pragma_pack_invalid_action);
return;
@@ -165,7 +164,7 @@ void PragmaPackHandler::HandlePragma(Preprocessor &PP, Token &PackTok) {
// #pragma 'align' '=' {'native','natural','mac68k','power','reset'}
// #pragma 'options 'align' '=' {'native','natural','mac68k','power','reset'}
-static void ParseAlignPragma(Action &Actions, Preprocessor &PP, Token &FirstTok,
+static void ParseAlignPragma(Sema &Actions, Preprocessor &PP, Token &FirstTok,
bool IsOptions) {
Token Tok;
@@ -192,20 +191,20 @@ static void ParseAlignPragma(Action &Actions, Preprocessor &PP, Token &FirstTok,
return;
}
- Action::PragmaOptionsAlignKind Kind = Action::POAK_Natural;
+ Sema::PragmaOptionsAlignKind Kind = Sema::POAK_Natural;
const IdentifierInfo *II = Tok.getIdentifierInfo();
if (II->isStr("native"))
- Kind = Action::POAK_Native;
+ Kind = Sema::POAK_Native;
else if (II->isStr("natural"))
- Kind = Action::POAK_Natural;
+ Kind = Sema::POAK_Natural;
else if (II->isStr("packed"))
- Kind = Action::POAK_Packed;
+ Kind = Sema::POAK_Packed;
else if (II->isStr("power"))
- Kind = Action::POAK_Power;
+ Kind = Sema::POAK_Power;
else if (II->isStr("mac68k"))
- Kind = Action::POAK_Mac68k;
+ Kind = Sema::POAK_Mac68k;
else if (II->isStr("reset"))
- Kind = Action::POAK_Reset;
+ Kind = Sema::POAK_Reset;
else {
PP.Diag(Tok.getLocation(), diag::warn_pragma_align_invalid_option)
<< IsOptions;
diff --git a/lib/Parse/ParsePragma.h b/lib/Parse/ParsePragma.h
index 8aef400968..0feaa9919e 100644
--- a/lib/Parse/ParsePragma.h
+++ b/lib/Parse/ParsePragma.h
@@ -17,58 +17,58 @@
#include "clang/Lex/Pragma.h"
namespace clang {
- class Action;
+ class Sema;
class Parser;
class PragmaAlignHandler : public PragmaHandler {
- Action &Actions;
+ Sema &Actions;
public:
- explicit PragmaAlignHandler(Action &A) : PragmaHandler("align"), Actions(A) {}
+ explicit PragmaAlignHandler(Sema &A) : PragmaHandler("align"), Actions(A) {}
virtual void HandlePragma(Preprocessor &PP, Token &FirstToken);
};
class PragmaGCCVisibilityHandler : public PragmaHandler {
- Action &Actions;
+ Sema &Actions;
public:
- explicit PragmaGCCVisibilityHandler(Action &A) : PragmaHandler("visibility"),
- Actions(A) {}
+ explicit PragmaGCCVisibilityHandler(Sema &A) : PragmaHandler("visibility"),
+ Actions(A) {}
virtual void HandlePragma(Preprocessor &PP, Token &FirstToken);
};
class PragmaOptionsHandler : public PragmaHandler {
- Action &Actions;
+ Sema &Actions;
public:
- explicit PragmaOptionsHandler(Action &A) : PragmaHandler("options"),
- Actions(A) {}
+ explicit PragmaOptionsHandler(Sema &A) : PragmaHandler("options"),
+ Actions(A) {}
virtual void HandlePragma(Preprocessor &PP, Token &FirstToken);
};
class PragmaPackHandler : public PragmaHandler {
- Action &Actions;
+ Sema &Actions;
public:
- explicit PragmaPackHandler(Action &A) : PragmaHandler("pack"),
- Actions(A) {}
+ explicit PragmaPackHandler(Sema &A) : PragmaHandler("pack"),
+ Actions(A) {}
virtual void HandlePragma(Preprocessor &PP, Token &FirstToken);
};
class PragmaUnusedHandler : public PragmaHandler {
- Action &Actions;
+ Sema &Actions;
Parser &parser;
public:
- PragmaUnusedHandler(Action &A, Parser& p)
+ PragmaUnusedHandler(Sema &A, Parser& p)
: PragmaHandler("unused"), Actions(A), parser(p) {}
virtual void HandlePragma(Preprocessor &PP, Token &FirstToken);
};
class PragmaWeakHandler : public PragmaHandler {
- Action &Actions;
+ Sema &Actions;
public:
- explicit PragmaWeakHandler(Action &A)
+ explicit PragmaWeakHandler(Sema &A)
: PragmaHandler("weak"), Actions(A) {}
virtual void HandlePragma(Preprocessor &PP, Token &FirstToken);
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp
index 6e0a482f9e..af927285a4 100644
--- a/lib/Parse/ParseStmt.cpp
+++ b/lib/Parse/ParseStmt.cpp
@@ -15,6 +15,7 @@
#include "clang/Parse/Parser.h"
#include "RAIIObjectsForParser.h"
#include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/PrettyDeclStackTrace.h"
#include "clang/Sema/Scope.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/PrettyStackTrace.h"
@@ -98,7 +99,7 @@ Parser::ParseStatementOrDeclaration(bool OnlyStatement) {
}
case tok::code_completion:
- Actions.CodeCompleteOrdinaryName(getCurScope(), Action::PCC_Statement);
+ Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_Statement);
ConsumeCodeCompletionToken();
return ParseStatementOrDeclaration(OnlyStatement);
@@ -994,8 +995,8 @@ StmtResult Parser::ParseForStatement(AttributeList *Attr) {
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteOrdinaryName(getCurScope(),
- C99orCXXorObjC? Action::PCC_ForInit
- : Action::PCC_Expression);
+ C99orCXXorObjC? Sema::PCC_ForInit
+ : Sema::PCC_Expression);
ConsumeCodeCompletionToken();
}
@@ -1468,9 +1469,8 @@ Decl *Parser::ParseFunctionStatementBody(Decl *Decl) {
assert(Tok.is(tok::l_brace));
SourceLocation LBraceLoc = Tok.getLocation();
- PrettyStackTraceActionsDecl CrashInfo(Decl, LBraceLoc, Actions,
- PP.getSourceManager(),
- "parsing function body");
+ PrettyDeclStackTraceEntry CrashInfo(Actions, Decl, LBraceLoc,
+ "parsing function body");
// Do not enter a scope for the brace, as the arguments are in the same scope
// (the function body) as the body itself. Instead, just read the statement
@@ -1494,9 +1494,8 @@ Decl *Parser::ParseFunctionTryBlock(Decl *Decl) {
assert(Tok.is(tok::kw_try) && "Expected 'try'");
SourceLocation TryLoc = ConsumeToken();
- PrettyStackTraceActionsDecl CrashInfo(Decl, TryLoc, Actions,
- PP.getSourceManager(),
- "parsing function try block");
+ PrettyDeclStackTraceEntry CrashInfo(Actions, Decl, TryLoc,
+ "parsing function try block");
// Constructor initializer list?
if (Tok.is(tok::colon))
diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp
index d9a468ed95..dfb4785489 100644
--- a/lib/Parse/ParseTemplate.cpp
+++ b/lib/Parse/ParseTemplate.cpp
@@ -772,7 +772,7 @@ bool Parser::AnnotateTemplateIdToken(TemplateTy Template, TemplateNameKind TNK,
// Build the annotation token.
if (TNK == TNK_Type_template && AllowTypeAnnotation) {
- Action::TypeResult Type
+ TypeResult Type
= Actions.ActOnTemplateIdType(Template, TemplateNameLoc,
LAngleLoc, TemplateArgsPtr,
RAngleLoc);
@@ -850,7 +850,7 @@ void Parser::AnnotateTemplateIdTokenAsType(const CXXScopeSpec *SS) {
TemplateId->getTemplateArgs(),
TemplateId->NumArgs);
- Action::TypeResult Type
+ TypeResult Type
= Actions.ActOnTemplateIdType(TemplateId->Template,
TemplateId->TemplateNameLoc,
TemplateId->LAngleLoc,
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index 23c13ebf9d..a5002b0119 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -21,7 +21,7 @@
#include "ParsePragma.h"
using namespace clang;
-Parser::Parser(Preprocessor &pp, Action &actions)
+Parser::Parser(Preprocessor &pp, Sema &actions)
: CrashInfo(*this), PP(pp), Actions(actions), Diags(PP.getDiagnostics()),
GreaterThanIsOperator(true), ColonIsSacred(false),
TemplateParameterDepth(0) {
@@ -467,8 +467,8 @@ Parser::DeclGroupPtrTy Parser::ParseExternalDeclaration(CXX0XAttributeList Attr,
break;
case tok::code_completion:
Actions.CodeCompleteOrdinaryName(getCurScope(),
- ObjCImpDecl? Action::PCC_ObjCImplementation
- : Action::PCC_Namespace);
+ ObjCImpDecl? Sema::PCC_ObjCImplementation
+ : Sema::PCC_Namespace);
ConsumeCodeCompletionToken();
return ParseExternalDeclaration(Attr);
case tok::kw_using:
@@ -680,7 +680,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D,
// specified Declarator for the function.
Decl *Res = TemplateInfo.TemplateParams?
Actions.ActOnStartOfFunctionTemplateDef(getCurScope(),
- Action::MultiTemplateParamsArg(Actions,
+ MultiTemplateParamsArg(Actions,
TemplateInfo.TemplateParams->data(),
TemplateInfo.TemplateParams->size()),
D)
@@ -1110,17 +1110,17 @@ bool Parser::TryAnnotateCXXScopeToken(bool EnteringContext) {
void Parser::CodeCompletionRecovery() {
for (Scope *S = getCurScope(); S; S = S->getParent()) {
if (S->getFlags() & Scope::FnScope) {
- Actions.CodeCompleteOrdinaryName(getCurScope(), Action::PCC_RecoveryInFunction);
+ Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_RecoveryInFunction);
return;
}
if (S->getFlags() & Scope::ClassScope) {
- Actions.CodeCompleteOrdinaryName(getCurScope(), Action::PCC_Class);
+ Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_Class);
return;
}
}
- Actions.CodeCompleteOrdinaryName(getCurScope(), Action::PCC_Namespace);
+ Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_Namespace);
}
// Anchor the Parser::FieldCallback vtable to this translation unit.
diff --git a/lib/Sema/Action.cpp b/lib/Sema/Action.cpp
deleted file mode 100644
index 1df0e01a74..0000000000
--- a/lib/Sema/Action.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-//===--- Action.cpp - Implement the Action class --------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the Action interface.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Sema/Action.h"
-#include "clang/Sema/DeclSpec.h"
-#include "clang/Sema/Scope.h"
-#include "clang/Basic/TargetInfo.h"
-#include "llvm/Support/Allocator.h"
-#include "llvm/Support/RecyclingAllocator.h"
-#include "llvm/Support/raw_ostream.h"
-using namespace clang;
-
-void PrettyStackTraceActionsDecl::print(llvm::raw_ostream &OS) const {
- if (Loc.isValid()) {
- Loc.print(OS, SM);
- OS << ": ";
- }
- OS << Message;
-
- std::string Name = Actions.getDeclName(TheDecl);
- if (!Name.empty())
- OS << " '" << Name << '\'';
-
- OS << '\n';
-}
-
-/// Out-of-line virtual destructor to provide home for Action class.
-Action::~Action() {}
diff --git a/lib/Sema/CMakeLists.txt b/lib/Sema/CMakeLists.txt
index 2144bfefb1..e65bb227f1 100644
--- a/lib/Sema/CMakeLists.txt
+++ b/lib/Sema/CMakeLists.txt
@@ -1,7 +1,6 @@
set(LLVM_NO_RTTI 1)
add_clang_library(clangSema
- Action.cpp
AnalysisBasedWarnings.cpp
AttributeList.cpp
CodeCompleteConsumer.cpp
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 2de4d28cab..60e308a982 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -20,6 +20,7 @@
#include "llvm/ADT/APFloat.h"
#include "clang/Sema/CXXFieldCollector.h"
#include "clang/Sema/ExternalSemaSource.h"
+#include "clang/Sema/PrettyDeclStackTrace.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/SemaConsumer.h"
@@ -555,3 +556,21 @@ BlockScopeInfo *Sema::getCurBlock() {
// Pin this vtable to this file.
ExternalSemaSource::~ExternalSemaSource() {}
+
+void PrettyDeclStackTraceEntry::print(llvm::raw_ostream &OS) const {
+ SourceLocation Loc = this->Loc;
+ if (!Loc.isValid() && TheDecl) Loc = TheDecl->getLocation();
+ if (Loc.isValid()) {
+ Loc.print(OS, S.getSourceManager());
+ OS << ": ";
+ }
+ OS << Message;
+
+ if (TheDecl && isa<NamedDecl>(TheDecl)) {
+ std::string Name = cast<NamedDecl>(TheDecl)->getNameAsString();
+ if (!Name.empty())
+ OS << " '" << Name << '\'';
+ }
+
+ OS << '\n';
+}
diff --git a/lib/Sema/SemaAttr.cpp b/lib/Sema/SemaAttr.cpp
index 917bf2bc3b..0921156b93 100644
--- a/lib/Sema/SemaAttr.cpp
+++ b/lib/Sema/SemaAttr.cpp
@@ -139,7 +139,7 @@ void Sema::ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind,
// Reset just pops the top of the stack, or resets the current alignment to
// default.
- if (Kind == Action::POAK_Reset) {
+ if (Kind == Sema::POAK_Reset) {
if (!Context->pop(0, /*IsReset=*/true)) {
Diag(PragmaLoc, diag::warn_pragma_options_align_reset_failed)
<< "stack empty";
@@ -212,11 +212,11 @@ void Sema::ActOnPragmaPack(PragmaPackKind Kind, IdentifierInfo *Name,
PragmaPackStack *Context = static_cast<PragmaPackStack*>(PackContext);
switch (Kind) {
- case Action::PPK_Default: // pack([n])
+ case Sema::PPK_Default: // pack([n])
Context->setAlignment(AlignmentVal);
break;
- case Action::PPK_Show: // pack(show)
+ case Sema::PPK_Show: // pack(show)
// Show the current alignment, making sure to show the right value
// for the default.
AlignmentVal = Context->getAlignment();
@@ -229,14 +229,14 @@ void Sema::ActOnPragmaPack(PragmaPackKind Kind, IdentifierInfo *Name,
Diag(PragmaLoc, diag::warn_pragma_pack_show) << AlignmentVal;
break;
- case Action::PPK_Push: // pack(push [, id] [, [n])
+ case Sema::PPK_Push: // pack(push [, id] [, [n])
Context->push(Name);
// Set the new alignment if specified.
if (Alignment)
Context->setAlignment(AlignmentVal);
break;
- case Action::PPK_Pop: // pack(pop [, id] [, n])
+ case Sema::PPK_Pop: // pack(pop [, id] [, n])
// MSDN, C/C++ Preprocessor Reference > Pragma Directives > pack:
// "#pragma pack(pop, identifier, n) is undefined"
if (Alignment && Name)
diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp
index c58c92cfce..21b1a73aa3 100644
--- a/lib/Sema/SemaCXXCast.cpp
+++ b/lib/Sema/SemaCXXCast.cpp
@@ -120,7 +120,7 @@ ExprResult
Sema::ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
SourceLocation LAngleBracketLoc, ParsedType Ty,
SourceLocation RAngleBracketLoc,
- SourceLocation LParenLoc, ExprArg E,
+ SourceLocation LParenLoc, Expr *E,
SourceLocation RParenLoc) {
TypeSourceInfo *DestTInfo;
@@ -135,7 +135,7 @@ Sema::ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
ExprResult
Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
- TypeSourceInfo *DestTInfo, ExprArg Ex,
+ TypeSourceInfo *DestTInfo, Expr *Ex,
SourceRange AngleBrackets, SourceRange Parens) {
QualType DestType = DestTInfo->getType();
@@ -965,8 +965,7 @@ TryStaticImplicitCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
return TC_NotApplicable;
ExprResult Result
- = InitSeq.Perform(Self, Entity, InitKind,
- Action::MultiExprArg(Self, &SrcExpr, 1));
+ = InitSeq.Perform(Self, Entity, InitKind, MultiExprArg(Self, &SrcExpr, 1));
if (Result.isInvalid()) {
msg = 0;
return TC_Failed;
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp
index 4c06fac012..aade62710c 100644
--- a/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp
@@ -1113,7 +1113,7 @@ static void AddTypeSpecifierResults(const LangOptions &LangOpts,
}
}
-static void AddStorageSpecifiers(Action::ParserCompletionContext CCC,
+static void AddStorageSpecifiers(Sema::ParserCompletionContext CCC,
const LangOptions &LangOpts,
ResultBuilder &Results) {
typedef CodeCompletionResult Result;
@@ -1124,13 +1124,13 @@ static void AddStorageSpecifiers(Action::ParserCompletionContext CCC,
Results.AddResult(Result("static"));
}
-static void AddFunctionSpecifiers(Action::ParserCompletionContext CCC,
+static void AddFunctionSpecifiers(Sema::ParserCompletionContext CCC,
const LangOptions &LangOpts,
ResultBuilder &Results) {
typedef CodeCompletionResult Result;
switch (CCC) {
- case Action::PCC_Class:
- case Action::PCC_MemberTemplate:
+ case Sema::PCC_Class:
+ case Sema::PCC_MemberTemplate:
if (LangOpts.CPlusPlus) {
Results.AddResult(Result("explicit"));
Results.AddResult(Result("friend"));
@@ -1139,21 +1139,21 @@ static void AddFunctionSpecifiers(Action::ParserCompletionContext CCC,
}
// Fall through
- case Action::PCC_ObjCInterface:
- case Action::PCC_ObjCImplementation:
- case Action::PCC_Namespace:
- case Action::PCC_Template:
+ case Sema::PCC_ObjCInterface:
+ case Sema::PCC_ObjCImplementation:
+ case Sema::PCC_Namespace:
+ case Sema::PCC_Template:
if (LangOpts.CPlusPlus || LangOpts.C99)
Results.AddResult(Result("inline"));
break;
- case Action::PCC_ObjCInstanceVariableList:
- case Action::PCC_Expression:
- case Action::PCC_Statement:
- case Action::PCC_ForInit:
- case Action::PCC_Condition:
- case Action::PCC_RecoveryInFunction:
- case Action::PCC_Type:
+ case Sema::PCC_ObjCInstanceVariableList:
+ case Sema::PCC_Expression:
+ case Sema::PCC_Statement:
+ case Sema::PCC_ForInit:
+ case Sema::PCC_Condition:
+ case Sema::PCC_RecoveryInFunction:
+ case Sema::PCC_Type:
break;
}
}
@@ -1181,29 +1181,29 @@ static void AddTypedefResult(ResultBuilder &Results) {
Results.AddResult(CodeCompletionResult(Pattern));
}
-static bool WantTypesInContext(Action::ParserCompletionContext CCC,
+static bool WantTypesInContext(Sema::ParserCompletionContext CCC,
const LangOptions &LangOpts) {
if (LangOpts.CPlusPlus)
return true;
switch (CCC) {
- case Action::PCC_Namespace:
- case Action::PCC_Class:
- case Action::PCC_ObjCInstanceVariableList:
- case Action::PCC_Template:
- case Action::PCC_MemberTemplate:
- case Action::PCC_Statement:
- case Action::PCC_RecoveryInFunction:
- case Action::PCC_Type:
+ case Sema::PCC_Namespace:
+ case Sema::PCC_Class:
+ case Sema::PCC_ObjCInstanceVariableList:
+ case Sema::PCC_Template:
+ case Sema::PCC_MemberTemplate:
+ case Sema::PCC_Statement:
+ case Sema::PCC_RecoveryInFunction:
+ case Sema::PCC_Type:
return true;
- case Action::PCC_ObjCInterface:
- case Action::PCC_ObjCImplementation:
- case Action::PCC_Expression:
- case Action::PCC_Condition:
+ case Sema::PCC_ObjCInterface:
+ case Sema::PCC_ObjCImplementation:
+ case Sema::PCC_Expression:
+ case Sema::PCC_Condition:
return false;
- case Action::PCC_ForInit:
+ case Sema::PCC_ForInit:
return LangOpts.ObjC1 || LangOpts.C99;
}
@@ -1211,13 +1211,13 @@ static bool WantTypesInContext(Action::ParserCompletionContext CCC,
}
/// \brief Add language constructs that show up for "ordinary" names.
-static void AddOrdinaryNameResults(Action::ParserCompletionContext CCC,
+static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC,
Scope *S,
Sema &SemaRef,
ResultBuilder &Results) {
typedef CodeCompletionResult Result;
switch (CCC) {
- case Action::PCC_Namespace:
+ case Sema::PCC_Namespace:
if (SemaRef.getLangOptions().CPlusPlus) {
CodeCompletionString *Pattern = 0;
@@ -1276,7 +1276,7 @@ static void AddOrdinaryNameResults(Action::ParserCompletionContext CCC,
AddTypedefResult(Results);
// Fall through
- case Action::PCC_Class:
+ case Sema::PCC_Class:
if (SemaRef.getLangOptions().CPlusPlus) {
// Using declaration
CodeCompletionString *Pattern = new CodeCompletionString;
@@ -1300,7 +1300,7 @@ static void AddOrdinaryNameResults(Action::ParserCompletionContext CCC,
Results.AddResult(Result(Pattern));
}
- if (CCC == Action::PCC_Class) {
+ if (CCC == Sema::PCC_Class) {
AddTypedefResult(Results);
// public:
@@ -1324,8 +1324,8 @@ static void AddOrdinaryNameResults(Action::ParserCompletionContext CCC,
}
// Fall through
- case Action::PCC_Template:
- case Action::PCC_MemberTemplate:
+ case Sema::PCC_Template:
+ case Sema::PCC_MemberTemplate:
if (SemaRef.getLangOptions().CPlusPlus && Results.includeCodePatterns()) {
// template < parameters >
CodeCompletionString *Pattern = new CodeCompletionString;
@@ -1340,24 +1340,24 @@ static void AddOrdinaryNameResults(Action::ParserCompletionContext CCC,
AddFunctionSpecifiers(CCC, SemaRef.getLangOptions(), Results);
break;
- case Action::PCC_ObjCInterface:
+ case Sema::PCC_ObjCInterface:
AddObjCInterfaceResults(SemaRef.getLangOptions(), Results, true);
AddStorageSpecifiers(CCC, SemaRef.getLangOptions(), Results);
AddFunctionSpecifiers(CCC, SemaRef.getLangOptions(), Results);
break;
- case Action::PCC_ObjCImplementation:
+ case Sema::PCC_ObjCImplementation:
AddObjCImplementationResults(SemaRef.getLangOptions(), Results, true);
AddStorageSpecifiers(CCC, SemaRef.getLangOptions(), Results);
AddFunctionSpecifiers(CCC, SemaRef.getLangOptions(), Results);
break;
- case Action::PCC_ObjCInstanceVariableList:
+ case Sema::PCC_ObjCInstanceVariableList:
AddObjCVisibilityResults(SemaRef.getLangOptions(), Results, true);
break;
- case Action::PCC_RecoveryInFunction:
- case Action::PCC_Statement: {
+ case Sema::PCC_RecoveryInFunction:
+ case Sema::PCC_Statement: {
AddTypedefResult(Results);
CodeCompletionString *Pattern = 0;
@@ -1529,12 +1529,12 @@ static void AddOrdinaryNameResults(Action::ParserCompletionContext CCC,
}
// Fall through (for statement expressions).
- case Action::PCC_ForInit:
- case Action::PCC_Condition:
+ case Sema::PCC_ForInit:
+ case Sema::PCC_Condition:
AddStorageSpecifiers(CCC, SemaRef.getLangOptions(), Results);
// Fall through: conditions and statements can have expressions.
- case Action::PCC_Expression: {
+ case Sema::PCC_Expression: {
CodeCompletionString *Pattern = 0;
if (SemaRef.getLangOptions().CPlusPlus) {
// 'this', if we're in a non-static member function.
@@ -1670,14 +1670,14 @@ static void AddOrdinaryNameResults(Action::ParserCompletionContext CCC,
break;
}
- case Action::PCC_Type:
+ case Sema::PCC_Type:
break;
}
if (WantTypesInContext(CCC, SemaRef.getLangOptions()))
AddTypeSpecifierResults(SemaRef.getLangOptions(), Results);
- if (SemaRef.getLangOptions().CPlusPlus && CCC != Action::PCC_Type)
+ if (SemaRef.getLangOptions().CPlusPlus && CCC != Sema::PCC_Type)
Results.AddResult(Result("operator"));
}
@@ -2322,35 +2322,35 @@ static void HandleCodeCompleteResults(Sema *S,
static enum CodeCompletionContext::Kind mapCodeCompletionContext(Sema &S,
Sema::ParserCompletionContext PCC) {
switch (PCC) {
- case Action::PCC_Namespace:
+ case Sema::PCC_Namespace:
return CodeCompletionContext::CCC_TopLevel;
- case Action::PCC_Class:
+ case Sema::PCC_Class:
return CodeCompletionContext::CCC_ClassStructUnion;
- case Action::PCC_ObjCInterface:
+ case Sema::PCC_ObjCInterface:
return CodeCompletionContext::CCC_ObjCInterface;
- case Action::PCC_ObjCImplementation:
+ case Sema::PCC_ObjCImplementation:
return CodeCompletionContext::CCC_ObjCImplementation;
- case Action::PCC_ObjCInstanceVariableList:
+ case Sema::PCC_ObjCInstanceVariableList:
return CodeCompletionContext::CCC_ObjCIvarList;
- case Action::PCC_Template:
- case Action::PCC_MemberTemplate:
- case Action::PCC_RecoveryInFunction:
+ case Sema::PCC_Template:
+ case Sema::PCC_MemberTemplate:
+ case Sema::PCC_RecoveryInFunction:
return CodeCompletionContext::CCC_Other;
- case Action::PCC_Expression:
- case Action::PCC_ForInit:
- case Action::PCC_Condition:
+ case Sema::PCC_Expression:
+ case Sema::PCC_ForInit:
+ case Sema::PCC_Condition:
return CodeCompletionContext::CCC_Expression;
- case Action::PCC_Statement:
+ case Sema::PCC_Statement:
return CodeCompletionContext::CCC_Statement;
- case Action::PCC_Type:
+ case Sema::PCC_Type:
return CodeCompletionContext::CCC_Type;
}
@@ -4855,8 +4855,8 @@ void Sema::CodeCompletePreprocessorDirective(bool InConditional) {
void Sema::CodeCompleteInPreprocessorConditionalExclusion(Scope *S) {
CodeCompleteOrdinaryName(S,
- S->getFnParent()? Action::PCC_RecoveryInFunction
- : Action::PCC_Namespace);
+ S->getFnParent()? Sema::PCC_RecoveryInFunction
+ : Sema::PCC_Namespace);
}
void Sema::CodeCompletePreprocessorMacroName(bool IsDefinition) {
@@ -4912,8 +4912,8 @@ void Sema::CodeCompletePreprocessorMacroArgument(Scope *S,
// do for function calls.
CodeCompleteOrdinaryName(S,
- S->getFnParent()? Action::PCC_RecoveryInFunction
- : Action::PCC_Namespace);
+ S->getFnParent()? Sema::PCC_RecoveryInFunction
+ : Sema::PCC_Namespace);
}
void Sema::CodeCompleteNaturalLanguage() {
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 3473bffce8..122a956cb3 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -42,14 +42,6 @@
using namespace clang;
using namespace sema;
-/// getDeclName - Return a pretty name for the specified decl if possible, or
-/// an empty string if not. This is used for pretty crash reporting.
-std::string Sema::getDeclName(Decl *D) {
- if (NamedDecl *DN = dyn_cast_or_null<NamedDecl>(D))
- return DN->getQualifiedNameAsString();
- return "";
-}
-
Sema::DeclGroupPtrTy Sema::ConvertDeclToDeclGroup(Decl *Ptr) {
return DeclGroupPtrTy::make(DeclGroupRef(Ptr));
}
@@ -4921,7 +4913,7 @@ static void ComputeNRVO(Stmt *Body, FunctionScopeInfo *Scope) {
const_cast<VarDecl*>(NRVOCandidate)->setNRVOVariable(true);
}
-Decl *Sema::ActOnFinishFunctionBody(Decl *D, StmtArg BodyArg) {
+Decl *Sema::ActOnFinishFunctionBody(Decl *D, Stmt *BodyArg) {
return ActOnFinishFunctionBody(D, move(BodyArg), false);
}
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 177013e6d5..9b36b31e7e 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -2412,7 +2412,7 @@ void Sema::ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD) {
///
/// The state token we use is the start index of this scope
/// on the warning stack.
-Action::ParsingDeclStackState Sema::PushParsingDeclaration() {
+Sema::ParsingDeclStackState Sema::PushParsingDeclaration() {
ParsingDeclDepth++;
return (ParsingDeclStackState) DelayedDiagnostics.size();
}
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 223569d9d4..513836a002 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -584,7 +584,7 @@ void Sema::SetClassDeclAttributesFromBase(CXXRecordDecl *Class,
/// example:
/// class foo : public bar, virtual private baz {
/// 'public bar' and 'virtual private baz' are each base-specifiers.
-Sema::BaseResult
+BaseResult
Sema::ActOnBaseSpecifier(Decl *classdecl, SourceRange SpecifierRange,
bool Virtual, AccessSpecifier Access,
ParsedType basetype, SourceLocation BaseLoc) {
@@ -1056,7 +1056,7 @@ static bool FindBaseInitializer(Sema &SemaRef,
}
/// ActOnMemInitializer - Handle a C++ member initializer.
-Sema::MemInitResult
+MemInitResult
Sema::ActOnMemInitializer(Decl *ConstructorD,
Scope *S,
CXXScopeSpec &SS,
@@ -1262,7 +1262,7 @@ static bool InitExprContainsUninitializedFields(const Stmt *S,
return false;
}
-Sema::MemInitResult
+MemInitResult
Sema::BuildMemberInitializer(FieldDecl *Member, Expr **Args,
unsigned NumArgs, SourceLocation IdLoc,
SourceLocation LParenLoc,
@@ -1359,7 +1359,7 @@ Sema::BuildMemberInitializer(FieldDecl *Member, Expr **Args,
RParenLoc);
}
-Sema::MemInitResult
+MemInitResult
Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo,
Expr **Args, unsigned NumArgs,
SourceLocation LParenLoc, SourceLocation RParenLoc,
@@ -1519,7 +1519,7 @@ BuildImplicitBaseInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
= InitializationKind::CreateDefault(Constructor->getLocation());
InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, 0, 0);
BaseInit = InitSeq.Perform(SemaRef, InitEntity, InitKind,
- Sema::MultiExprArg(SemaRef, 0, 0));
+ MultiExprArg(SemaRef, 0, 0));
break;
}
@@ -1548,8 +1548,7 @@ BuildImplicitBaseInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
InitializationSequence InitSeq(SemaRef, InitEntity, InitKind,
&CopyCtorArg, 1);
BaseInit = InitSeq.Perform(SemaRef, InitEntity, InitKind,
- Sema::MultiExprArg(SemaRef,
- &CopyCtorArg, 1));
+ MultiExprArg(&CopyCtorArg, 1));
break;
}
@@ -1673,7 +1672,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
ExprResult MemberInit
= InitSeq.Perform(SemaRef, Entities.back(), InitKind,
- Sema::MultiExprArg(SemaRef, &CopyCtorArgE, 1));
+ MultiExprArg(&CopyCtorArgE, 1));
MemberInit = SemaRef.MaybeCreateCXXExprWithTemporaries(MemberInit.get());
if (MemberInit.isInvalid())
return true;
@@ -1698,8 +1697,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, 0, 0);
ExprResult MemberInit =
- InitSeq.Perform(SemaRef, InitEntity, InitKind,
- Sema::MultiExprArg(SemaRef, 0, 0));
+ InitSeq.Perform(SemaRef, InitEntity, InitKind, MultiExprArg());
if (MemberInit.isInvalid())
return true;
@@ -4621,7 +4619,7 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T,
/*TemplateArgs=*/0,
/*SuppressQualifierCheck=*/true);
if (OpEqualRef.isInvalid())
- return S.StmtError();
+ return StmtError();
// Build the call to the assignment operator.
@@ -4629,7 +4627,7 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T,
OpEqualRef.takeAs<Expr>(),
Loc, &From, 1, 0, Loc);
if (Call.isInvalid())
- return S.StmtError();
+ return StmtError();
return S.Owned(Call.takeAs<Stmt>());
}
@@ -4640,7 +4638,7 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T,
if (!ArrayTy) {
ExprResult Assignment = S.CreateBuiltinBinOp(Loc, BO_Assign, To, From);
if (Assignment.isInvalid())
- return S.StmtError();
+ return StmtError();
return S.Owned(Assignment.takeAs<Stmt>());
}
@@ -4707,7 +4705,7 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T,
To, From,
CopyingBaseSubobject, Depth+1);
if (Copy.isInvalid())
- return S.StmtError();
+ return StmtError();
// Construct the loop that copies all elements of this array.
return S.ActOnForStmt(Loc, Loc, InitStmt,
@@ -6947,8 +6945,7 @@ void Sema::SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation) {
InitializationSequence InitSeq(*this, InitEntity, InitKind, 0, 0);
ExprResult MemberInit =
- InitSeq.Perform(*this, InitEntity, InitKind,
- Sema::MultiExprArg(*this, 0, 0));
+ InitSeq.Perform(*this, InitEntity, InitKind, MultiExprArg());
MemberInit = MaybeCreateCXXExprWithTemporaries(MemberInit.get());
// Note, MemberInit could actually come back empty if no initialization
// is required (e.g., because it would call a trivial default constructor)
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 8f61933626..2f8cfe2d2f 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -1587,16 +1587,16 @@ static ExprResult BuildCXXCastArgument(Sema &S,
ASTOwningVector<Expr*> ConstructorArgs(S);
if (S.CompleteConstructorCall(cast<CXXConstructorDecl>(Method),
- Sema::MultiExprArg(S, &From, 1),
+ MultiExprArg(&From, 1),
CastLoc, ConstructorArgs))
- return S.ExprError();
+ return ExprError();
ExprResult Result =
S.BuildCXXConstructExpr(CastLoc, Ty, cast<CXXConstructorDecl>(Method),
move_arg(ConstructorArgs),
/*ZeroInit*/ false, CXXConstructExpr::CK_Complete);
if (Result.isInvalid())
- return S.ExprError();
+ return ExprError();
return S.MaybeBindToTemporary(Result.takeAs<Expr>());
}
@@ -2182,8 +2182,7 @@ static bool ConvertForConditional(Sema &Self, Expr *&E, QualType T) {
InitializationKind Kind = InitializationKind::CreateCopy(E->getLocStart(),
SourceLocation());
InitializationSequence InitSeq(Self, Entity, Kind, &E, 1);
- ExprResult Result = InitSeq.Perform(Self, Entity, Kind,
- Sema::MultiExprArg(Self, &E, 1));
+ ExprResult Result = InitSeq.Perform(Self, Entity, Kind, MultiExprArg(&E, 1));
if (Result.isInvalid())
return true;
@@ -2784,7 +2783,7 @@ ExprResult Sema::DiagnoseDtorReference(SourceLocation NameLoc,
return ActOnCallExpr(/*Scope*/ 0,
MemExpr,
/*LPLoc*/ ExpectedLParenLoc,
- Sema::MultiExprArg(*this, 0, 0),
+ MultiExprArg(),
/*CommaLocs*/ 0,
/*RPLoc*/ ExpectedLParenLoc);
}
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index 56d80a0288..b56159c453 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -24,9 +24,9 @@
using namespace clang;
-Sema::ExprResult Sema::ParseObjCStringLiteral(SourceLocation *AtLocs,
- ExprTy **strings,
- unsigned NumStrings) {
+ExprResult Sema::ParseObjCStringLiteral(SourceLocation *AtLocs,
+ Expr **strings,
+ unsigned NumStrings) {
StringLiteral **Strings = reinterpret_cast<StringLiteral**>(strings);
// Most ObjC strings are formed out of a single piece. However, we *can*
@@ -133,11 +133,11 @@ Expr *Sema::BuildObjCEncodeExpression(SourceLocation AtLoc,
return new (Context) ObjCEncodeExpr(StrTy, EncodedTypeInfo, AtLoc, RParenLoc);
}
-Sema::ExprResult Sema::ParseObjCEncodeExpression(SourceLocation AtLoc,
- SourceLocation EncodeLoc,
- SourceLocation LParenLoc,
- ParsedType ty,
- SourceLocation RParenLoc) {
+ExprResult Sema::ParseObjCEncodeExpression(SourceLocation AtLoc,
+ SourceLocation EncodeLoc,
+ SourceLocation LParenLoc,
+ ParsedType ty,
+ SourceLocation RParenLoc) {
// FIXME: Preserve type source info ?
TypeSourceInfo *TInfo;
QualType EncodedType = GetTypeFromParser(ty, &TInfo);
@@ -148,11 +148,11 @@ Sema::ExprResult Sema::ParseObjCEncodeExpression(SourceLocation AtLoc,
return BuildObjCEncodeExpression(AtLoc, TInfo, RParenLoc);
}
-Sema::ExprResult Sema::ParseObjCSelectorExpression(Selector Sel,
- SourceLocation AtLoc,
- SourceLocation SelLoc,
- SourceLocation LParenLoc,
- SourceLocation RParenLoc) {
+ExprResult Sema::ParseObjCSelectorExpression(Selector Sel,
+ SourceLocation AtLoc,
+ SourceLocation SelLoc,
+ SourceLocation LParenLoc,
+ SourceLocation RParenLoc) {
ObjCMethodDecl *Method = LookupInstanceMethodInGlobalPool(Sel,
SourceRange(LParenLoc, RParenLoc), false, false);
if (!Method)
@@ -170,11 +170,11 @@ Sema::ExprResult Sema::ParseObjCSelectorExpression(Selector Sel,
return new (Context) ObjCSelectorExpr(Ty, Sel, AtLoc, RParenLoc);
}
-Sema::ExprResult Sema::ParseObjCProtocolExpression(IdentifierInfo *ProtocolId,
- SourceLocation AtLoc,
- SourceLocation ProtoLoc,
- SourceLocation LParenLoc,
- SourceLocation RParenLoc) {
+ExprResult Sema::ParseObjCProtocolExpression(IdentifierInfo *ProtocolId,
+ SourceLocation AtLoc,
+ SourceLocation ProtoLoc,
+ SourceLocation LParenLoc,
+ SourceLocation RParenLoc) {
ObjCProtocolDecl* PDecl = LookupProtocol(ProtocolId, ProtoLoc);
if (!PDecl) {
Diag(ProtoLoc, diag::err_undeclared_protocol) << ProtocolId;
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index fdac476272..a719590d6a 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -265,8 +265,7 @@ void InitListChecker::FillInValueInitForField(unsigned Init, FieldDecl *Field,
}
ExprResult MemberInit
- = InitSeq.Perform(SemaRef, MemberEntity, Kind,
- Sema::MultiExprArg(SemaRef, 0, 0));
+ = InitSeq.Perform(SemaRef, MemberEntity, Kind, MultiExprArg());
if (MemberInit.isInvalid()) {
hadError = true;
return;
@@ -375,8 +374,7 @@ InitListChecker::FillInValueInitializations(const InitializedEntity &Entity,
}
ExprResult ElementInit
- = InitSeq.Perform(SemaRef, ElementEntity, Kind,
- Sema::MultiExprArg(SemaRef, 0, 0));
+ = InitSeq.Perform(SemaRef, ElementEntity, Kind, MultiExprArg());
if (ElementInit.isInvalid()) {
hadError = true;
return;
@@ -680,8 +678,7 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity,
if (Seq) {
ExprResult Result =
- Seq.Perform(SemaRef, Entity, Kind,
- Sema::MultiExprArg(SemaRef, &expr, 1));
+ Seq.Perform(SemaRef, Entity, Kind, MultiExprArg(&expr, 1));
if (Result.isInvalid())
hadError = true;
@@ -3369,7 +3366,7 @@ static ExprResult CopyObject(Sema &S,
<< CurInitExpr->getSourceRange();
CandidateSet.NoteCandidates(S, OCD_AllCandidates, &CurInitExpr, 1);
if (!IsExtraneousCopy || S.isSFINAEContext())
- return S.ExprError();
+ return ExprError();
return move(CurInit);
case OR_Ambiguous:
@@ -3377,7 +3374,7 @@ static ExprResult CopyObject(Sema &S,
<< (int)Entity.getKind() << CurInitExpr->getType()
<< CurInitExpr->getSourceRange();
CandidateSet.NoteCandidates(S, OCD_ViableCandidates, &CurInitExpr, 1);
- return S.ExprError();
+ return ExprError();
case OR_Deleted:
S.Diag(Loc, diag::err_temp_copy_deleted)
@@ -3385,7 +3382,7 @@ static ExprResult CopyObject(Sema &S,
<< CurInitExpr->getSourceRange();
S.Diag(Best->Function->getLocation(), diag::note_unavailable_here)
<< Best->Function->isDeleted();
- return S.ExprError();
+ return ExprError();
}
CXXConstructorDecl *Constructor = cast<CXXConstructorDecl>(Best->Function);
@@ -3424,10 +3421,9 @@ static ExprResult CopyObject(Sema &S,
// Determine the arguments required to actually perform the
// constructor call (we might have derived-to-base conversions, or
// the copy constructor may have default arguments).
- if (S.CompleteConstructorCall(Constructor,
- Sema::MultiExprArg(S, &CurInitExpr, 1),
+ if (S.CompleteConstructorCall(Constructor, MultiExprArg(&CurInitExpr, 1),
Loc, ConstructorArgs))
- return S.ExprError();
+ return ExprError();
// Actually perform the constructor call.
CurInit = S.BuildCXXConstructExpr(Loc, T, Constructor, Elidable,
@@ -3459,12 +3455,12 @@ ExprResult
InitializationSequence::Perform(Sema &S,
const InitializedEntity &Entity,
const InitializationKind &Kind,
- Action::MultiExprArg Args,
+ MultiExprArg Args,
QualType *ResultType) {
if (SequenceKind == FailedSequence) {
unsigned NumArgs = Args.size();
Diagnose(S, Entity, Kind, (Expr **)Args.release(), NumArgs);
- return S.ExprError();
+ return ExprError();
}
if (SequenceKind == DependentSequence) {
@@ -3559,7 +3555,7 @@ InitializationSequence::Perform(Sema &S,
assert(Args.size() == 1);
CurInit = ExprResult(((Expr **)(Args.get()))[0]->Retain());
if (CurInit.isInvalid())
- return S.ExprError();
+ return ExprError();
break;
case SK_ConstructorInitialization:
@@ -3573,7 +3569,7 @@ InitializationSequence::Perform(Sema &S,
for (step_iterator Step = step_begin(), StepEnd = step_end();
Step != StepEnd; ++Step) {
if (CurInit.isInvalid())
- return S.ExprError();
+ return ExprError();
Expr *CurInitExpr = (Expr *)CurInit.get();
QualType SourceType = CurInitExpr? CurInitExpr->getType() : QualType();
@@ -3603,7 +3599,7 @@ InitializationSequence::Perform(Sema &S,
CurInitExpr->getLocStart(),
CurInitExpr->getSourceRange(),
&BasePath, IgnoreBaseAccess))
- return S.ExprError();
+ return ExprError();
if (S.BasePathInvolvesVirtualBase(BasePath)) {
QualType T = SourceType;
@@ -3636,7 +3632,7 @@ InitializationSequence::Perform(Sema &S,
<< BitField->getDeclName()
<< CurInitExpr->getSourceRange();
S.Diag(BitField->getLocation(), diag::note_bitfield_decl);
- return S.ExprError();
+ return ExprError();
}
if (CurInitExpr->refersToVectorElement()) {
@@ -3645,14 +3641,14 @@ InitializationSequence::Perform(Sema &S,
<< Entity.getType().isVolatileQualified()
<< CurInitExpr->getSourceRange();
PrintInitLocationNote(S, Entity);
- return S.ExprError();
+ return ExprError();
}
// Reference binding does not have any corresponding ASTs.
// Check exception specifications
if (S.CheckExceptionSpecCompatibility(CurInitExpr, DestType))
- return S.ExprError();
+ return ExprError();
break;
@@ -3661,7 +3657,7 @@ InitializationSequence::Perform(Sema &S,
// Check exception specifications
if (S.CheckExceptionSpecCompatibility(CurInitExpr, DestType))
- return S.ExprError();
+ return ExprError();
break;
@@ -3688,9 +3684,9 @@ InitializationSequence::Perform(Sema &S,
// Determine the arguments required to actually perform the constructor
// call.
if (S.CompleteConstructorCall(Constructor,
- Sema::MultiExprArg(S, &CurInitExpr, 1),
+ MultiExprArg(&CurInitExpr, 1),
Loc, ConstructorArgs))
- return S.ExprError();
+ return ExprError();
// Build the an expression that constructs a temporary.
CurInit = S.BuildCXXConstructExpr(Loc, Step->Type, Constructor,
@@ -3698,7 +3694,7 @@ InitializationSequence::Perform(Sema &S,
/*ZeroInit*/ false,
CXXConstructExpr::CK_Complete);
if (CurInit.isInvalid())
- return S.ExprError();
+ return ExprError();
S.CheckConstructorAccess(Kind.getLocation(), Constructor, Entity,
FoundFn.getAccess());
@@ -3724,7 +3720,7 @@ InitializationSequence::Perform(Sema &S,
// we don't want to turn off access control here for c-style casts.
if (S.PerformObjectArgumentInitialization(CurInitExpr, /*Qualifier=*/0,
FoundFn, Conversion))
- return S.ExprError();
+ return ExprError();
// Do a little dance to make sure that CurInit has the proper
// pointer.
@@ -3734,7 +3730,7 @@ InitializationSequence::Perform(Sema &S,
CurInit = S.Owned(S.BuildCXXMemberCallExpr(CurInitExpr, FoundFn,
Conversion));
if (CurInit.isInvalid() || !CurInit.get())
- return S.ExprError();
+ return ExprError();
CastKind = CK_UserDefinedConversion;
@@ -3792,7 +3788,7 @@ InitializationSequence::Perform(Sema &S,
if (S.PerformImplicitConversion(CurInitExpr, Step->Type, *Step->ICS,
Sema::AA_Converting, IgnoreBaseAccess))
- return S.ExprError();
+ return ExprError();
CurInit.release();
CurInit = S.Owned(CurInitExpr);
@@ -3803,7 +3799,7 @@ InitializationSequence::Perform(Sema &S,
InitListExpr *InitList = cast<InitListExpr>(CurInitExpr);
QualType Ty = Step->Type;
if (S.CheckInitList(Entity, InitList, ResultType? *ResultType : Ty))
- return S.ExprError();
+ return ExprError();
CurInit.release();
CurInit = S.Owned(InitList);
@@ -3836,7 +3832,7 @@ InitializationSequence::Perform(Sema &S,
// call.
if (S.CompleteConstructorCall(Constructor, move(Args),
Loc, ConstructorArgs))
- return S.ExprError();
+ return ExprError();
if (Entity.getKind() == InitializedEntity::EK_Temporary &&
@@ -3881,7 +3877,7 @@ InitializationSequence::Perform(Sema &S,
ConstructKind);
}
if (CurInit.isInvalid())
- return S.ExprError();
+ return ExprError();
// Only check access if all of that succeeded.
S.CheckConstructorAccess(Loc, Constructor, Entity,
@@ -3933,7 +3929,7 @@ InitializationSequence::Perform(Sema &S,
getAssignmentAction(Entity),
&Complained)) {
PrintInitLocationNote(S, Entity);
- return S.ExprError();
+ return ExprError();
} else if (Complained)
PrintInitLocationNote(S, Entity);
@@ -4448,5 +4444,5 @@ Sema::PerformCopyInitialization(const InitializedEntity &Entity,
EqualLoc);
InitializationSequence Seq(*this, Entity, Kind, &InitE, 1);
Init.release();
- return Seq.Perform(*this, Entity, Kind, MultiExprArg(*this, &InitE, 1));
+ return Seq.Perform(*this, Entity, Kind, MultiExprArg(&InitE, 1));
}
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 0d5968f1ef..95c03eb768 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -3423,7 +3423,7 @@ Sema::AddOverloadCandidate(FunctionDecl *Function,
return;
// Overload resolution is always an unevaluated context.
- EnterExpressionEvaluationContext Unevaluated(*this, Action::Unevaluated);
+ EnterExpressionEvaluationContext Unevaluated(*this, Sema::Unevaluated);
if (CXXConstructorDecl *Constructor = dyn_cast<CXXConstructorDecl>(Function)){
// C++ [class.copy]p3:
@@ -3586,7 +3586,7 @@ Sema::AddMethodCandidate(CXXMethodDecl *Method, DeclAccessPair FoundDecl,
return;
// Overload resolution is always an unevaluated context.
- EnterExpressionEvaluationContext Unevaluated(*this, Action::Unevaluated);
+ EnterExpressionEvaluationContext Unevaluated(*this, Sema::Unevaluated);
// Add this candidate
CandidateSet.push_back(OverloadCandidate());
@@ -3784,7 +3784,7 @@ Sema::AddConversionCandidate(CXXConversionDecl *Conversion,
return;
// Overload resolution is always an unevaluated context.
- EnterExpressionEvaluationContext Unevaluated(*this, Action::Unevaluated);
+ EnterExpressionEvaluationContext Unevaluated(*this, Sema::Unevaluated);
// Add this candidate
CandidateSet.push_back(OverloadCandidate());
@@ -3945,7 +3945,7 @@ void Sema::AddSurrogateCandidate(CXXConversionDecl *Conversion,
return;
// Overload resolution is always an unevaluated context.
- EnterExpressionEvaluationContext Unevaluated(*this, Action::Unevaluated);
+ EnterExpressionEvaluationContext Unevaluated(*this, Sema::Unevaluated);
CandidateSet.push_back(OverloadCandidate());
OverloadCandidate& Candidate = CandidateSet.back();
@@ -4090,7 +4090,7 @@ void Sema::AddBuiltinCandidate(QualType ResultTy, QualType *ParamTys,
bool IsAssignmentOperator,
unsigned NumContextualBoolArguments) {
// Overload resolution is always an unevaluated context.
- EnterExpressionEvaluationContext Unevaluated(*this, Action::Unevaluated);
+ EnterExpressionEvaluationContext Unevaluated(*this, Sema::Unevaluated);
// Add this candidate
CandidateSet.push_back(OverloadCandidate());
@@ -6618,13 +6618,13 @@ BuildRecoveryCallExpr(Sema &SemaRef, Scope *S, Expr *Fn,
LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
Sema::LookupOrdinaryName);
if (SemaRef.DiagnoseEmptyLookup(S, SS, R, Sema::CTC_Expression))
- return SemaRef.ExprError();
+ return ExprError();
assert(!R.empty() && "lookup results empty despite recovery");
// Build an implicit member call if appropriate. Just drop the
// casts and such from the call, we don't really care.
- ExprResult NewFn = SemaRef.ExprError();
+ ExprResult NewFn = ExprError();
if ((*R.begin())->isCXXClassMember())
NewFn = SemaRef.BuildPossibleImplicitMemberExpr(SS, R, ExplicitTemplateArgs);
else if (ExplicitTemplateArgs)
@@ -6633,13 +6633,13 @@ BuildRecoveryCallExpr(Sema &SemaRef, Scope *S, Expr *Fn,
NewFn = SemaRef.BuildDeclarationNameExpr(SS, R, false);
if (NewFn.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
// This shouldn't cause an infinite loop because we're giving it
// an expression with non-empty lookup results, which should never
// end up here.
return SemaRef.ActOnCallExpr(/*Scope*/ 0, NewFn.take(), LParenLoc,
- Sema::MultiExprArg(SemaRef, Args, NumArgs),
+ MultiExprArg(Args, NumArgs),
CommaLocs, RParenLoc);
}
@@ -7421,7 +7421,7 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
/// type (C++ [over.call.object]), which can end up invoking an
/// overloaded function call operator (@c operator()) or performing a
/// user-defined conversion on the object argument.
-Sema::ExprResult
+ExprResult
Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object,
SourceLocation LParenLoc,
Expr **Args, unsigned NumArgs,
@@ -7560,8 +7560,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object,
CXXMemberCallExpr *CE = BuildCXXMemberCallExpr(Object, Best->FoundDecl,
Conv);
- return ActOnCallExpr(S, CE, LParenLoc,
- MultiExprArg(*this, (ExprTy**)Args, NumArgs),
+ return ActOnCallExpr(S, CE, LParenLoc, MultiExprArg(Args, NumArgs),
CommaLocs, RParenLoc);
}
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index 22a0933c72..e293e9b39c 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -712,7 +712,7 @@ static void SetNestedNameSpecifier(TagDecl *T, const CXXScopeSpec &SS) {
SS.getRange());
}
-Sema::DeclResult
+DeclResult
Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
SourceLocation KWLoc, CXXScopeSpec &SS,
IdentifierInfo *Name, SourceLocation NameLoc,
@@ -1518,7 +1518,7 @@ QualType Sema::CheckTemplateIdType(TemplateName Name,
return Context.getTemplateSpecializationType(Name, TemplateArgs, CanonType);
}
-Action::TypeResult
+TypeResult
Sema::ActOnTemplateIdType(TemplateTy TemplateD, SourceLocation TemplateLoc,
SourceLocation LAngleLoc,
ASTTemplateArgsPtr TemplateArgsIn,
@@ -1547,12 +1547,12 @@ Sema::ActOnTemplateIdType(TemplateTy TemplateD, SourceLocation TemplateLoc,
return CreateParsedType(Result, DI);
}
-Sema::TypeResult Sema::ActOnTagTemplateIdType(TypeResult TypeResult,
- TagUseKind TUK,
- DeclSpec::TST TagSpec,
- SourceLocation TagLoc) {
+TypeResult Sema::ActOnTagTemplateIdType(TypeResult TypeResult,
+ TagUseKind TUK,
+ TypeSpecifierType TagSpec,
+ SourceLocation TagLoc) {
if (TypeResult.isInvalid())
- return Sema::TypeResult();
+ return ::TypeResult();
// FIXME: preserve source info, ideally without copying the DI.
TypeSourceInfo *DI;
@@ -4634,7 +4634,7 @@ static bool ScopeSpecifierHasTemplateId(const CXXScopeSpec &SS) {
}
// Explicit instantiation of a class template specialization
-Sema::DeclResult
+DeclResult
Sema::ActOnExplicitInstantiation(Scope *S,
SourceLocation ExternLoc,
SourceLocation TemplateLoc,
@@ -4839,7 +4839,7 @@ Sema::ActOnExplicitInstantiation(Scope *S,
bool Owned = false;
bool IsDependent = false;
- Decl *TagD = ActOnTag(S, TagSpec, Action::TUK_Reference,
+ Decl *TagD = ActOnTag(S, TagSpec, Sema::TUK_Reference,
KWLoc, SS, Name, NameLoc, Attr, AS_none,
MultiTemplateParamsArg(*this, 0, 0),
Owned, IsDependent);
@@ -4951,10 +4951,10 @@ Sema::ActOnExplicitInstantiation(Scope *S,
return TagD;
}
-Sema::DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
- SourceLocation ExternLoc,
- SourceLocation TemplateLoc,
- Declarator &D) {
+DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
+ SourceLocation ExternLoc,
+ SourceLocation TemplateLoc,
+ Declarator &D) {
// Explicit instantiations always require a name.
// TODO: check if/when DNInfo should replace Name.
DeclarationNameInfo NameInfo = GetNameForDeclarator(D);
@@ -5204,7 +5204,7 @@ Sema::DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
return (Decl*) 0;
}
-Sema::TypeResult
+TypeResult
Sema::ActOnDependentTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
const CXXScopeSpec &SS, IdentifierInfo *Name,
SourceLocation TagLoc, SourceLocation NameLoc) {
@@ -5228,7 +5228,7 @@ Sema::ActOnDependentTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
return ParsedType::make(Context.getDependentNameType(Kwd, NNS, Name));
}
-Sema::TypeResult
+TypeResult
Sema::ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
const CXXScopeSpec &SS, const IdentifierInfo &II,
SourceLocation IdLoc) {
@@ -5263,7 +5263,7 @@ Sema::ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
return CreateParsedType(T, TSI);
}
-Sema::TypeResult
+TypeResult
Sema::ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
const CXXScopeSpec &SS, SourceLocation TemplateLoc,
ParsedType Ty) {
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index 024060fb99..4d4c18130b 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -821,7 +821,7 @@ TemplateInstantiator::TransformTemplateParmRefExpr(DeclRefExpr *E,
getSema().FindInstantiatedDecl(E->getLocation(),
VD, TemplateArgs));
if (!VD)
- return SemaRef.ExprError();
+ return ExprError();
// Derive the type we want the substituted decl to have. This had
// better be non-dependent, or these checks will have serious problems.
@@ -1201,7 +1201,7 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation,
// PushDeclContext because we don't have a scope.
ContextRAII SavedContext(*this, Instantiation);
EnterExpressionEvaluationContext EvalContext(*this,
- Action::PotentiallyEvaluated);
+ Sema::PotentiallyEvaluated);
// If this is an instantiation of a local class, merge this local
// instantiation scope with the enclosing scope. Otherwise, every
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 1e95b911f1..e40075a45f 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===/
#include "clang/Sema/SemaInternal.h"
#include "clang/Sema/Lookup.h"
+#include "clang/Sema/PrettyDeclStackTrace.h"
#include "clang/Sema/Template.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
@@ -20,7 +21,6 @@
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/TypeLoc.h"
-#include "clang/Basic/PrettyStackTrace.h"
#include "clang/Lex/Preprocessor.h"
using namespace clang;
@@ -147,7 +147,7 @@ void Sema::InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs,
if (Aligned->isAlignmentDependent()) {
// The alignment expression is not potentially evaluated.
EnterExpressionEvaluationContext Unevaluated(*this,
- Action::Unevaluated);
+ Sema::Unevaluated);
if (Aligned->isAlignmentExpr()) {
ExprResult Result = SubstExpr(Aligned->getAlignmentExpr(),
@@ -493,7 +493,7 @@ Decl *TemplateDeclInstantiator::VisitFieldDecl(FieldDecl *D) {
BitWidth = 0;
else if (BitWidth) {
// The bit-width expression is not potentially evaluated.
- EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
+ EnterExpressionEvaluationContext Unevaluated(SemaRef, Sema::Unevaluated);
ExprResult InstantiatedBitWidth
= SemaRef.SubstExpr(BitWidth, TemplateArgs);
@@ -581,7 +581,7 @@ Decl *TemplateDeclInstantiator::VisitStaticAssertDecl(StaticAssertDecl *D) {
Expr *AssertExpr = D->getAssertExpr();
// The expression in a static assertion is not potentially evaluated.
- EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
+ EnterExpressionEvaluationContext Unevaluated(SemaRef, Sema::Unevaluated);
ExprResult InstantiatedAssertExpr
= SemaRef.SubstExpr(AssertExpr, TemplateArgs);
@@ -620,7 +620,7 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) {
if (Expr *UninstValue = EC->getInitExpr()) {
// The enumerator's value expression is not potentially evaluated.
EnterExpressionEvaluationContext Unevaluated(SemaRef,
- Action::Unevaluated);
+ Sema::Unevaluated);
Value = SemaRef.SubstExpr(UninstValue, TemplateArgs);
}
@@ -2070,7 +2070,7 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
PendingInstantiations.swap(SavedPendingInstantiations);
EnterExpressionEvaluationContext EvalContext(*this,
- Action::PotentiallyEvaluated);
+ Sema::PotentiallyEvaluated);
ActOnStartOfFunctionDef(0, Function);
// Introduce a new scope where local variable instantiations will be
@@ -2718,10 +2718,8 @@ void Sema::PerformPendingInstantiations(bool LocalOnly) {
// Instantiate function definitions
if (FunctionDecl *Function = dyn_cast<FunctionDecl>(Inst.first)) {
- PrettyStackTraceActionsDecl CrashInfo(Function,
- Function->getLocation(), *this,
- Context.getSourceManager(),
- "instantiating function definition");
+ PrettyDeclStackTraceEntry CrashInfo(*this, Function, SourceLocation(),
+ "instantiating function definition");
bool DefinitionRequired = Function->getTemplateSpecializationKind() ==
TSK_ExplicitInstantiationDefinition;
InstantiateFunctionDefinition(/*FIXME:*/Inst.second, Function, true,
@@ -2754,10 +2752,9 @@ void Sema::PerformPendingInstantiations(bool LocalOnly) {
break;
}
- PrettyStackTraceActionsDecl CrashInfo(Var, Var->getLocation(), *this,
- Context.getSourceManager(),
- "instantiating static data member "
- "definition");
+ PrettyDeclStackTraceEntry CrashInfo(*this, Var, Var->getLocation(),
+ "instantiating static data member "
+ "definition");
bool DefinitionRequired = Var->getTemplateSpecializationKind() ==
TSK_ExplicitInstantiationDefinition;
@@ -2779,3 +2776,4 @@ void Sema::PerformDependentDiagnostics(const DeclContext *Pattern,
}
}
}
+
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 2bff6838c4..8988de8355 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -1700,7 +1700,7 @@ void LocInfoType::getAsStringInternal(std::string &Str,
" GetTypeFromParser");
}
-Sema::TypeResult Sema::ActOnTypeName(Scope *S, Declarator &D) {
+TypeResult Sema::ActOnTypeName(Scope *S, Declarator &D) {
// C99 6.7.6: Type names have no identifier. This is already validated by
// the parser.
assert(D.getIdentifier() == 0 && "Type name should have no identifier!");
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index ed531c7466..a796f2eaff 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -92,9 +92,6 @@ protected:
Sema &SemaRef;
public:
- typedef Sema::MultiExprArg MultiExprArg;
- typedef Sema::MultiStmtArg MultiStmtArg;
-
/// \brief Initializes a new tree transformer.
TreeTransform(Sema &SemaRef) : SemaRef(SemaRef) { }
@@ -964,11 +961,11 @@ public:
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
StmtResult RebuildObjCForCollectionStmt(SourceLocation ForLoc,
- SourceLocation LParenLoc,
- Stmt *Element,
- Expr *Collection,
- SourceLocation RParenLoc,
- Stmt *Body) {
+ SourceLocation LParenLoc,
+ Stmt *Element,
+ Expr *Collection,
+ SourceLocation RParenLoc,
+ Stmt *Body) {
return getSema().ActOnObjCForCollectionStmt(ForLoc, LParenLoc,
Element,
Collection,
@@ -994,8 +991,8 @@ public:
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
StmtResult RebuildCXXCatchStmt(SourceLocation CatchLoc,
- VarDecl *ExceptionDecl,
- Stmt *Handler) {
+ VarDecl *ExceptionDecl,
+ Stmt *Handler) {
return Owned(new (getSema().Context) CXXCatchStmt(CatchLoc, ExceptionDecl,
Handler));
}
@@ -1005,8 +1002,8 @@ public:
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
StmtResult RebuildCXXTryStmt(SourceLocation TryLoc,
- Stmt *TryBlock,
- MultiStmtArg Handlers) {
+ Stmt *TryBlock,
+ MultiStmtArg Handlers) {
return getSema().ActOnCXXTryBlock(TryLoc, TryBlock, move(Handlers));
}
@@ -1015,8 +1012,8 @@ public:
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
ExprResult RebuildDeclarationNameExpr(const CXXScopeSpec &SS,
- LookupResult &R,
- bool RequiresADL) {
+ LookupResult &R,
+ bool RequiresADL) {
return getSema().BuildDeclarationNameExpr(SS, R, RequiresADL);
}
@@ -1026,10 +1023,10 @@ public:
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
ExprResult RebuildDeclRefExpr(NestedNameSpecifier *Qualifier,
- SourceRange QualifierRange,
- ValueDecl *VD,
- const DeclarationNameInfo &NameInfo,
- TemplateArgumentListInfo *TemplateArgs) {
+ SourceRange QualifierRange,
+ ValueDecl *VD,
+ const DeclarationNameInfo &NameInfo,
+ TemplateArgumentListInfo *TemplateArgs) {
CXXScopeSpec SS;
SS.setScopeRep(Qualifier);
SS.setRange(QualifierRange);
@@ -1078,7 +1075,7 @@ public:
/// Subclasses may override this routine to provide different behavior.
ExprResult RebuildOffsetOfExpr(SourceLocation OperatorLoc,
TypeSourceInfo *Type,
- Action::OffsetOfComponent *Components,
+ Sema::OffsetOfComponent *Components,
unsigned NumComponents,
SourceLocation RParenLoc) {
return getSema().BuildBuiltinOffsetOf(OperatorLoc, Type, Components,
@@ -1105,7 +1102,7 @@ public:
ExprResult Result
= getSema().CreateSizeOfAlignOfExpr(SubExpr, OpLoc, isSizeOf, R);
if (Result.isInvalid())
- return getSema().ExprError();
+ return ExprError();
return move(Result);
}
@@ -1154,7 +1151,7 @@ public:
if (getSema().PerformObjectMemberConversion(Base, Qualifier,
FoundDecl, Member))
- return getSema().ExprError();
+ return ExprError();
MemberExpr *ME =
new (getSema().Context) MemberExpr(Base, isArrow,
@@ -1281,7 +1278,7 @@ public:
= SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
Init);
if (Result.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
ArrayExprs.release();
return move(Result);
@@ -1420,7 +1417,7 @@ public:
break;
}
- return getSema().ExprError();
+ return ExprError();
}
/// \brief Build a new C++ static_cast expression.
@@ -1503,7 +1500,7 @@ public:
return getSema().ActOnCXXTypeConstructExpr(TypeRange,
ParsedType::make(TInfo->getType()),
LParenLoc,
- Sema::MultiExprArg(getSema(), &Sub, 1),
+ MultiExprArg(&Sub, 1),
/*CommaLocs=*/0,
RParenLoc);
}
@@ -1679,7 +1676,7 @@ public:
ASTOwningVector<Expr*> ConvertedArgs(SemaRef);
if (getSema().CompleteConstructorCall(Constructor, move(Args), Loc,
ConvertedArgs))
- return getSema().ExprError();
+ return ExprError();
return getSema().BuildCXXConstructExpr(Loc, T, Constructor, IsElidable,
move_arg(ConvertedArgs),
@@ -1826,7 +1823,7 @@ public:
SS, 0,
false);
if (Result.isInvalid())
- return getSema().ExprError();
+ return ExprError();
if (Result.get())
return move(Result);
@@ -1854,7 +1851,7 @@ public:
/*FIME:*/PropertyLoc,
SS, 0, false);
if (Result.isInvalid())
- return getSema().ExprError();
+ return ExprError();
if (Result.get())
return move(Result);
@@ -1901,7 +1898,7 @@ public:
/*FIME:*/IsaLoc,
SS, 0, false);
if (Result.isInvalid())
- return getSema().ExprError();
+ return ExprError();
if (Result.get())
return move(Result);
@@ -1946,7 +1943,7 @@ public:
// Type-check the __builtin_shufflevector expression.
ExprResult Result = SemaRef.SemaBuiltinShuffleVector(TheCall);
if (Result.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
OwnedCall.release();
return move(Result);
@@ -1975,7 +1972,7 @@ StmtResult TreeTransform<Derived>::TransformStmt(Stmt *S) {
{
ExprResult E = getDerived().TransformExpr(cast<Expr>(S));
if (E.isInvalid())
- return getSema().StmtError();
+ return StmtError();
return getSema().ActOnExprStmt(getSema().MakeFullExpr(E.take()));
}
@@ -2273,7 +2270,7 @@ bool TreeTransform<Derived>::TransformTemplateArgument(
Expr *SourceExpr = Input.getSourceDeclExpression();
if (SourceExpr) {
EnterExpressionEvaluationContext Unevaluated(getSema(),
- Action::Unevaluated);
+ Sema::Unevaluated);
ExprResult E = getDerived().TransformExpr(SourceExpr);
SourceExpr = (E.isInvalid() ? 0 : E.take());
}
@@ -2298,7 +2295,7 @@ bool TreeTransform<Derived>::TransformTemplateArgument(
case TemplateArgument::Expression: {
// Template argument expressions are not potentially evaluated.
EnterExpressionEvaluationContext Unevaluated(getSema(),
- Action::Unevaluated);
+ Sema::Unevaluated);
Expr *InputExpr = Input.getSourceExpression();
if (!InputExpr) InputExpr = Input.getArgument().getAsExpr();
@@ -2628,7 +2625,7 @@ TreeTransform<Derived>::TransformConstantArrayType(TypeLocBuilder &TLB,
Expr *Size = TL.getSizeExpr();
if (Size) {
- EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
+ EnterExpressionEvaluationContext Unevaluated(SemaRef, Sema::Unevaluated);
Size = getDerived().TransformExpr(Size).template takeAs<Expr>();
}
NewTL.setSizeExpr(Size);
@@ -2676,7 +2673,7 @@ TreeTransform<Derived>::TransformVariableArrayType(TypeLocBuilder &TLB,
return QualType();
// Array bounds are not potentially evaluated contexts
- EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
+ EnterExpressionEvaluationContext Unevaluated(SemaRef, Sema::Unevaluated);
ExprResult SizeResult
= getDerived().TransformExpr(T->getSizeExpr());
@@ -2717,7 +2714,7 @@ TreeTransform<Derived>::TransformDependentSizedArrayType(TypeLocBuilder &TLB,
return QualType();
// Array bounds are not potentially evaluated contexts
- EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
+ EnterExpressionEvaluationContext Unevaluated(SemaRef, Sema::Unevaluated);
ExprResult SizeResult
= getDerived().TransformExpr(T->getSizeExpr());
@@ -2763,7 +2760,7 @@ QualType TreeTransform<Derived>::TransformDependentSizedExtVectorType(
return QualType();
// Vector sizes are not potentially evaluated contexts
- EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
+ EnterExpressionEvaluationContext Unevaluated(SemaRef, Sema::Unevaluated);
ExprResult Size = getDerived().TransformExpr(T->getSizeExpr());
if (Size.isInvalid())
@@ -3018,7 +3015,7 @@ QualType TreeTransform<Derived>::TransformTypeOfExprType(TypeLocBuilder &TLB,
TypeOfExprTypeLoc TL,
QualType ObjectType) {
// typeof expressions are not potentially evaluated contexts
- EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
+ EnterExpressionEvaluationContext Unevaluated(SemaRef, Sema::Unevaluated);
ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
if (E.isInvalid())
@@ -3073,7 +3070,7 @@ QualType TreeTransform<Derived>::TransformDecltypeType(TypeLocBuilder &TLB,
DecltypeType *T = TL.getTypePtr();
// decltype expressions are not potentially evaluated contexts
- EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
+ EnterExpressionEvaluationContext Unevaluated(SemaRef, Sema::Unevaluated);
ExprResult E = getDerived().TransformExpr(T->getUnderlyingExpr());
if (E.isInvalid())
@@ -3449,7 +3446,7 @@ TreeTransform<Derived>::TransformCompoundStmt(CompoundStmt *S,
B != BEnd; ++B) {
StmtResult Result = getDerived().TransformStmt(*B);
if (Result.isInvalid())
- return getSema().StmtError();
+ return StmtError();
SubStmtChanged = SubStmtChanged || Result.get() != *B;
Statements.push_back(Result.takeAs<Stmt>());
@@ -3471,17 +3468,17 @@ TreeTransform<Derived>::TransformCaseStmt(CaseStmt *S) {
ExprResult LHS, RHS;
{
// The case value expressions are not potentially evaluated.
- EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
+ EnterExpressionEvaluationContext Unevaluated(SemaRef, Sema::Unevaluated);
// Transform the left-hand case value.
LHS = getDerived().TransformExpr(S->getLHS());
if (LHS.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
// Transform the right-hand case value (for the GNU case-range extension).
RHS = getDerived().TransformExpr(S->getRHS());
if (RHS.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
}
// Build the case statement.
@@ -3493,12 +3490,12 @@ TreeTransform<Derived>::TransformCaseStmt(CaseStmt *S) {
RHS.get(),
S->getColonLoc());
if (Case.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
// Transform the statement following the case
StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt());
if (SubStmt.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
// Attach the body to the case statement
return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
@@ -3510,7 +3507,7 @@ TreeTransform<Derived>::TransformDefaultStmt(DefaultStmt *S) {
// Transform the statement following the default case
StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt());
if (SubStmt.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
// Default statements are always rebuilt
return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
@@ -3522,7 +3519,7 @@ StmtResult
TreeTransform<Derived>::TransformLabelStmt(LabelStmt *S) {
StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt());
if (SubStmt.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
// FIXME: Pass the real colon location in.
SourceLocation ColonLoc = SemaRef.PP.getLocForEndOfToken(S->getIdentLoc());
@@ -3543,12 +3540,12 @@ TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
S->getConditionVariable()->getLocation(),
S->getConditionVariable()));
if (!ConditionVar)
- return SemaRef.StmtError();
+ return StmtError();
} else {
Cond = getDerived().TransformExpr(S->getCond());
if (Cond.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
// Convert the condition to a boolean value.
if (S->getCond()) {
@@ -3556,7 +3553,7 @@ TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
S->getIfLoc(),
Cond.get());
if (CondE.isInvalid())
- return getSema().StmtError();
+ return StmtError();
Cond = CondE.get();
}
@@ -3564,17 +3561,17 @@ TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
Sema::FullExprArg FullCond(getSema().MakeFullExpr(Cond.take()));
if (!S->getConditionVariable() && S->getCond() && !FullCond.get())
- return SemaRef.StmtError();
+ return StmtError();
// Transform the "then" branch.
StmtResult Then = getDerived().TransformStmt(S->getThen());
if (Then.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
// Transform the "else" branch.
StmtResult Else = getDerived().TransformStmt(S->getElse());
if (Else.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
if (!getDerived().AlwaysRebuild() &&
FullCond.get() == S->getCond() &&
@@ -3601,12 +3598,12 @@ TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) {
S->getConditionVariable()->getLocation(),
S->getConditionVariable()));
if (!ConditionVar)
- return SemaRef.StmtError();
+ return StmtError();
} else {
Cond = getDerived().TransformExpr(S->getCond());
if (Cond.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
}
// Rebuild the switch statement.
@@ -3614,12 +3611,12 @@ TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) {
= getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), Cond.get(),
ConditionVar);
if (Switch.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
// Transform the body of the switch statement.
StmtResult Body = getDerived().TransformStmt(S->getBody());
if (Body.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
// Complete the switch statement.
return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(), Switch.get(),
@@ -3639,12 +3636,12 @@ TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) {
S->getConditionVariable()->getLocation(),
S->getConditionVariable()));
if (!ConditionVar)
- return SemaRef.StmtError();
+ return StmtError();
} else {
Cond = getDerived().TransformExpr(S->getCond());
if (Cond.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
if (S->getCond()) {
// Convert the condition to a boolean value.
@@ -3652,19 +3649,19 @@ TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) {
S->getWhileLoc(),
Cond.get());
if (CondE.isInvalid())
- return getSema().StmtError();
+ return StmtError();
Cond = CondE;
}
}
Sema::FullExprArg FullCond(getSema().MakeFullExpr(Cond.take()));
if (!S->getConditionVariable() && S->getCond() && !FullCond.get())
- return SemaRef.StmtError();
+ return StmtError();
// Transform the body
StmtResult Body = getDerived().TransformStmt(S->getBody());
if (Body.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
if (!getDerived().AlwaysRebuild() &&
FullCond.get() == S->getCond() &&
@@ -3682,12 +3679,12 @@ TreeTransform<Derived>::TransformDoStmt(DoStmt *S) {
// Transform the body
StmtResult Body = getDerived().TransformStmt(S->getBody());
if (Body.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
// Transform the condition
ExprResult Cond = getDerived().TransformExpr(S->getCond());
if (Cond.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
if (!getDerived().AlwaysRebuild() &&
Cond.get() == S->getCond() &&
@@ -3705,7 +3702,7 @@ TreeTransform<Derived>::TransformForStmt(ForStmt *S) {
// Transform the initialization statement
StmtResult Init = getDerived().TransformStmt(S->getInit());
if (Init.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
// Transform the condition
ExprResult Cond;
@@ -3717,12 +3714,12 @@ TreeTransform<Derived>::TransformForStmt(ForStmt *S) {
S->getConditionVariable()->getLocation(),
S->getConditionVariable()));
if (!ConditionVar)
- return SemaRef.StmtError();
+ return StmtError();
} else {
Cond = getDerived().TransformExpr(S->getCond());
if (Cond.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
if (S->getCond()) {
// Convert the condition to a boolean value.
@@ -3730,7 +3727,7 @@ TreeTransform<Derived>::TransformForStmt(ForStmt *S) {
S->getForLoc(),
Cond.get());
if (CondE.isInvalid())
- return getSema().StmtError();
+ return StmtError();
Cond = CondE.get();
}
@@ -3738,21 +3735,21 @@ TreeTransform<Derived>::TransformForStmt(ForStmt *S) {
Sema::FullExprArg FullCond(getSema().MakeFullExpr(Cond.take()));
if (!S->getConditionVariable() && S->getCond() && !FullCond.get())
- return SemaRef.StmtError();
+ return StmtError();
// Transform the increment
ExprResult Inc = getDerived().TransformExpr(S->getInc());
if (Inc.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
Sema::FullExprArg FullInc(getSema().MakeFullExpr(Inc.get()));
if (S->getInc() && !FullInc.get())
- return SemaRef.StmtError();
+ return StmtError();
// Transform the body
StmtResult Body = getDerived().TransformStmt(S->getBody());
if (Body.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
if (!getDerived().AlwaysRebuild() &&
Init.get() == S->getInit() &&
@@ -3779,7 +3776,7 @@ StmtResult
TreeTransform<Derived>::TransformIndirectGotoStmt(IndirectGotoStmt *S) {
ExprResult Target = getDerived().TransformExpr(S->getTarget());
if (Target.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
if (!getDerived().AlwaysRebuild() &&
Target.get() == S->getTarget())
@@ -3806,7 +3803,7 @@ StmtResult
TreeTransform<Derived>::TransformReturnStmt(ReturnStmt *S) {
ExprResult Result = getDerived().TransformExpr(S->getRetValue());
if (Result.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
// FIXME: We always rebuild the return statement because there is no way
// to tell whether the return type of the function has changed.
@@ -3823,7 +3820,7 @@ TreeTransform<Derived>::TransformDeclStmt(DeclStmt *S) {
Decl *Transformed = getDerived().TransformDefinition((*D)->getLocation(),
*D);
if (!Transformed)
- return SemaRef.StmtError();
+ return StmtError();
if (Transformed != *D)
DeclChanged = true;
@@ -3869,7 +3866,7 @@ TreeTransform<Derived>::TransformAsmStmt(AsmStmt *S) {
Expr *OutputExpr = S->getOutputExpr(I);
ExprResult Result = getDerived().TransformExpr(OutputExpr);
if (Result.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
ExprsChanged |= Result.get() != OutputExpr;
@@ -3887,7 +3884,7 @@ TreeTransform<Derived>::TransformAsmStmt(AsmStmt *S) {
Expr *InputExpr = S->getInputExpr(I);
ExprResult Result = getDerived().TransformExpr(InputExpr);
if (Result.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
ExprsChanged |= Result.get() != InputExpr;
@@ -3925,7 +3922,7 @@ TreeTransform<Derived>::TransformObjCAtTryStmt(ObjCAtTryStmt *S) {
// Transform the body of the @try.
StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
if (TryBody.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
// Transform the @catch statements (if present).
bool AnyCatchChanged = false;
@@ -3933,7 +3930,7 @@ TreeTransform<Derived>::TransformObjCAtTryStmt(ObjCAtTryStmt *S) {
for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
if (Catch.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
if (Catch.get() != S->getCatchStmt(I))
AnyCatchChanged = true;
CatchStmts.push_back(Catch.release());
@@ -3944,7 +3941,7 @@ TreeTransform<Derived>::TransformObjCAtTryStmt(ObjCAtTryStmt *S) {
if (S->getFinallyStmt()) {
Finally = getDerived().TransformStmt(S->getFinallyStmt());
if (Finally.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
}
// If nothing changed, just retain this statement.
@@ -3969,7 +3966,7 @@ TreeTransform<Derived>::TransformObjCAtCatchStmt(ObjCAtCatchStmt *S) {
if (FromVar->getTypeSourceInfo()) {
TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
if (!TSInfo)
- return SemaRef.StmtError();
+ return StmtError();
}
QualType T;
@@ -3978,17 +3975,17 @@ TreeTransform<Derived>::TransformObjCAtCatchStmt(ObjCAtCatchStmt *S) {
else {
T = getDerived().TransformType(FromVar->getType());
if (T.isNull())
- return SemaRef.StmtError();
+ return StmtError();
}
Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo, T);
if (!Var)
- return SemaRef.StmtError();
+ return StmtError();
}
StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
if (Body.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
S->getRParenLoc(),
@@ -4001,7 +3998,7 @@ TreeTransform<Derived>::TransformObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
// Transform the body.
StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
if (Body.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
// If nothing changed, just retain this statement.
if (!getDerived().AlwaysRebuild() &&
@@ -4020,7 +4017,7 @@ TreeTransform<Derived>::TransformObjCAtThrowStmt(ObjCAtThrowStmt *S) {
if (S->getThrowExpr()) {
Operand = getDerived().TransformExpr(S->getThrowExpr());
if (Operand.isInvalid())
- return getSema().StmtError();
+ return StmtError();
}
if (!getDerived().AlwaysRebuild() &&
@@ -4037,12 +4034,12 @@ TreeTransform<Derived>::TransformObjCAtSynchronizedStmt(
// Transform the object we are locking.
ExprResult Object = getDerived().TransformExpr(S->getSynchExpr());
if (Object.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
// Transform the body.
StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
if (Body.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
// If nothing change, just retain the current statement.
if (!getDerived().AlwaysRebuild() &&
@@ -4062,17 +4059,17 @@ TreeTransform<Derived>::TransformObjCForCollectionStmt(
// Transform the element statement.
StmtResult Element = getDerived().TransformStmt(S->getElement());
if (Element.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
// Transform the collection expression.
ExprResult Collection = getDerived().TransformExpr(S->getCollection());
if (Collection.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
// Transform the body.
StmtResult Body = getDerived().TransformStmt(S->getBody());
if (Body.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
// If nothing changed, just retain this statement.
if (!getDerived().AlwaysRebuild() &&
@@ -4103,7 +4100,7 @@ TreeTransform<Derived>::TransformCXXCatchStmt(CXXCatchStmt *S) {
QualType T = getDerived().TransformType(ExceptionDecl->getType());
if (T.isNull())
- return SemaRef.StmtError();
+ return StmtError();
Var = getDerived().RebuildExceptionDecl(ExceptionDecl,
T,
@@ -4113,13 +4110,13 @@ TreeTransform<Derived>::TransformCXXCatchStmt(CXXCatchStmt *S) {
/*FIXME: Inaccurate*/
SourceRange(ExceptionDecl->getLocation()));
if (!Var || Var->isInvalidDecl())
- return SemaRef.StmtError();
+ return StmtError();
}
// Transform the actual exception handler.
StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
if (Handler.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
if (!getDerived().AlwaysRebuild() &&
!Var &&
@@ -4138,7 +4135,7 @@ TreeTransform<Derived>::TransformCXXTryStmt(CXXTryStmt *S) {
StmtResult TryBlock
= getDerived().TransformCompoundStmt(S->getTryBlock());
if (TryBlock.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
// Transform the handlers.
bool HandlerChanged = false;
@@ -4147,7 +4144,7 @@ TreeTransform<Derived>::TransformCXXTryStmt(CXXTryStmt *S) {
StmtResult Handler
= getDerived().TransformCXXCatchStmt(S->getHandler(I));
if (Handler.isInvalid())
- return SemaRef.StmtError();
+ return StmtError();
HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
Handlers.push_back(Handler.takeAs<Stmt>());
@@ -4179,20 +4176,20 @@ TreeTransform<Derived>::TransformDeclRefExpr(DeclRefExpr *E) {
Qualifier = getDerived().TransformNestedNameSpecifier(E->getQualifier(),
E->getQualifierRange());
if (!Qualifier)
- return SemaRef.ExprError();
+ return ExprError();
}
ValueDecl *ND
= cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
E->getDecl()));
if (!ND)
- return SemaRef.ExprError();
+ return ExprError();
DeclarationNameInfo NameInfo = E->getNameInfo();
if (NameInfo.getName()) {
NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
if (!NameInfo.getName())
- return SemaRef.ExprError();
+ return ExprError();
}
if (!getDerived().AlwaysRebuild() &&
@@ -4216,7 +4213,7 @@ TreeTransform<Derived>::TransformDeclRefExpr(DeclRefExpr *E) {
for (unsigned I = 0, N = E->getNumTemplateArgs(); I != N; ++I) {
TemplateArgumentLoc Loc;
if (getDerived().TransformTemplateArgument(E->getTemplateArgs()[I], Loc))
- return SemaRef.ExprError();
+ return ExprError();
TransArgs.addArgument(Loc);
}
}
@@ -4260,7 +4257,7 @@ ExprResult
TreeTransform<Derived>::TransformParenExpr(ParenExpr *E) {
ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
if (SubExpr.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
return SemaRef.Owned(E->Retain());
@@ -4274,7 +4271,7 @@ ExprResult
TreeTransform<Derived>::TransformUnaryOperator(UnaryOperator *E) {
ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
if (SubExpr.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
return SemaRef.Owned(E->Retain());
@@ -4290,7 +4287,7 @@ TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
// Transform the type.
TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
if (!Type)
- return getSema().ExprError();
+ return ExprError();
// Transform all of the components into components similar to what the
// parser uses.
@@ -4299,7 +4296,7 @@ TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
// the fields again. However, __builtin_offsetof is rare enough in
// template code that we don't care.
bool ExprChanged = false;
- typedef Action::OffsetOfComponent Component;
+ typedef Sema::OffsetOfComponent Component;
typedef OffsetOfExpr::OffsetOfNode Node;
llvm::SmallVector<Component, 4> Components;
for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
@@ -4313,7 +4310,7 @@ TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
ExprResult Index = getDerived().TransformExpr(FromIndex);
if (Index.isInvalid())
- return getSema().ExprError();
+ return ExprError();
ExprChanged = ExprChanged || Index.get() != FromIndex;
Comp.isBrackets = true;
@@ -4358,7 +4355,7 @@ TreeTransform<Derived>::TransformSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) {
TypeSourceInfo *NewT = getDerived().TransformType(OldT);
if (!NewT)
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() && OldT == NewT)
return SemaRef.Owned(E->Retain());
@@ -4373,11 +4370,11 @@ TreeTransform<Derived>::TransformSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) {
// C++0x [expr.sizeof]p1:
// The operand is either an expression, which is an unevaluated operand
// [...]
- EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
+ EnterExpressionEvaluationContext Unevaluated(SemaRef, Sema::Unevaluated);
SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
if (SubExpr.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
return SemaRef.Owned(E->Retain());
@@ -4393,11 +4390,11 @@ ExprResult
TreeTransform<Derived>::TransformArraySubscriptExpr(ArraySubscriptExpr *E) {
ExprResult LHS = getDerived().TransformExpr(E->getLHS());
if (LHS.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
ExprResult RHS = getDerived().TransformExpr(E->getRHS());
if (RHS.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
@@ -4417,7 +4414,7 @@ TreeTransform<Derived>::TransformCallExpr(CallExpr *E) {
// Transform the callee.
ExprResult Callee = getDerived().TransformExpr(E->getCallee());
if (Callee.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
// Transform arguments.
bool ArgChanged = false;
@@ -4426,7 +4423,7 @@ TreeTransform<Derived>::TransformCallExpr(CallExpr *E) {
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
ExprResult Arg = getDerived().TransformExpr(E->getArg(I));
if (Arg.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
// FIXME: Wrong source location information for the ','.
FakeCommaLocs.push_back(
@@ -4455,7 +4452,7 @@ ExprResult
TreeTransform<Derived>::TransformMemberExpr(MemberExpr *E) {
ExprResult Base = getDerived().TransformExpr(E->getBase());
if (Base.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
NestedNameSpecifier *Qualifier = 0;
if (E->hasQualifier()) {
@@ -4463,14 +4460,14 @@ TreeTransform<Derived>::TransformMemberExpr(MemberExpr *E) {
= getDerived().TransformNestedNameSpecifier(E->getQualifier(),
E->getQualifierRange());
if (Qualifier == 0)
- return SemaRef.ExprError();
+ return ExprError();
}
ValueDecl *Member
= cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
E->getMemberDecl()));
if (!Member)
- return SemaRef.ExprError();
+ return ExprError();
NamedDecl *FoundDecl = E->getFoundDecl();
if (FoundDecl == E->getMemberDecl()) {
@@ -4479,7 +4476,7 @@ TreeTransform<Derived>::TransformMemberExpr(MemberExpr *E) {
FoundDecl = cast_or_null<NamedDecl>(
getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
if (!FoundDecl)
- return SemaRef.ExprError();
+ return ExprError();
}
if (!getDerived().AlwaysRebuild() &&
@@ -4502,7 +4499,7 @@ TreeTransform<Derived>::TransformMemberExpr(MemberExpr *E) {
for (unsigned I = 0, N = E->getNumTemplateArgs(); I != N; ++I) {
TemplateArgumentLoc Loc;
if (getDerived().TransformTemplateArgument(E->getTemplateArgs()[I], Loc))
- return SemaRef.ExprError();
+ return ExprError();
TransArgs.addArgument(Loc);
}
}
@@ -4534,11 +4531,11 @@ ExprResult
TreeTransform<Derived>::TransformBinaryOperator(BinaryOperator *E) {
ExprResult LHS = getDerived().TransformExpr(E->getLHS());
if (LHS.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
ExprResult RHS = getDerived().TransformExpr(E->getRHS());
if (RHS.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
LHS.get() == E->getLHS() &&
@@ -4561,15 +4558,15 @@ ExprResult
TreeTransform<Derived>::TransformConditionalOperator(ConditionalOperator *E) {
ExprResult Cond = getDerived().TransformExpr(E->getCond());
if (Cond.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
ExprResult LHS = getDerived().TransformExpr(E->getLHS());
if (LHS.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
ExprResult RHS = getDerived().TransformExpr(E->getRHS());
if (RHS.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
Cond.get() == E->getCond() &&
@@ -4606,13 +4603,13 @@ TreeTransform<Derived>::TransformCStyleCastExpr(CStyleCastExpr *E) {
OldT = E->getTypeInfoAsWritten();
NewT = getDerived().TransformType(OldT);
if (!NewT)
- return SemaRef.ExprError();
+ return ExprError();
}
ExprResult SubExpr
= getDerived().TransformExpr(E->getSubExprAsWritten());
if (SubExpr.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
OldT == NewT &&
@@ -4631,11 +4628,11 @@ TreeTransform<Derived>::TransformCompoundLiteralExpr(CompoundLiteralExpr *E) {
TypeSourceInfo *OldT = E->getTypeSourceInfo();
TypeSourceInfo *NewT = getDerived().TransformType(OldT);
if (!NewT)
- return SemaRef.ExprError();
+ return ExprError();
ExprResult Init = getDerived().TransformExpr(E->getInitializer());
if (Init.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
OldT == NewT &&
@@ -4656,7 +4653,7 @@ ExprResult
TreeTransform<Derived>::TransformExtVectorElementExpr(ExtVectorElementExpr *E) {
ExprResult Base = getDerived().TransformExpr(E->getBase());
if (Base.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase())
@@ -4679,7 +4676,7 @@ TreeTransform<Derived>::TransformInitListExpr(InitListExpr *E) {
for (unsigned I = 0, N = E->getNumInits(); I != N; ++I) {
ExprResult Init = getDerived().TransformExpr(E->getInit(I));
if (Init.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
InitChanged = InitChanged || Init.get() != E->getInit(I);
Inits.push_back(Init.get());
@@ -4700,7 +4697,7 @@ TreeTransform<Derived>::TransformDesignatedInitExpr(DesignatedInitExpr *E) {
// transform the initializer value
ExprResult Init = getDerived().TransformExpr(E->getInit());
if (Init.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
// transform the designators.
ASTOwningVector<Expr*, 4> ArrayExprs(SemaRef);
@@ -4718,7 +4715,7 @@ TreeTransform<Derived>::TransformDesignatedInitExpr(DesignatedInitExpr *E) {
if (D->isArrayDesignator()) {
ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(*D));
if (Index.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
Desig.AddDesignator(Designator::getArray(Index.get(),
D->getLBracketLoc()));
@@ -4732,11 +4729,11 @@ TreeTransform<Derived>::TransformDesignatedInitExpr(DesignatedInitExpr *E) {
ExprResult Start
= getDerived().TransformExpr(E->getArrayRangeStart(*D));
if (Start.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(*D));
if (End.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
Desig.AddDesignator(Designator::getArrayRange(Start.get(),
End.get(),
@@ -4770,7 +4767,7 @@ TreeTransform<Derived>::TransformImplicitValueInitExpr(
// need to transform the type?
QualType T = getDerived().TransformType(E->getType());
if (T.isNull())
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
T == E->getType())
@@ -4784,11 +4781,11 @@ ExprResult
TreeTransform<Derived>::TransformVAArgExpr(VAArgExpr *E) {
TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
if (!TInfo)
- return SemaRef.ExprError();
+ return ExprError();
ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
if (SubExpr.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
TInfo == E->getWrittenTypeInfo() &&
@@ -4807,7 +4804,7 @@ TreeTransform<Derived>::TransformParenListExpr(ParenListExpr *E) {
for (unsigned I = 0, N = E->getNumExprs(); I != N; ++I) {
ExprResult Init = getDerived().TransformExpr(E->getExpr(I));
if (Init.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
ArgumentChanged = ArgumentChanged || Init.get() != E->getExpr(I);
Inits.push_back(Init.get());
@@ -4836,7 +4833,7 @@ TreeTransform<Derived>::TransformStmtExpr(StmtExpr *E) {
StmtResult SubStmt
= getDerived().TransformCompoundStmt(E->getSubStmt(), true);
if (SubStmt.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
SubStmt.get() == E->getSubStmt())
@@ -4855,11 +4852,11 @@ TreeTransform<Derived>::TransformTypesCompatibleExpr(TypesCompatibleExpr *E) {
TInfo1 = getDerived().TransformType(E->getArgTInfo1());
if (!TInfo1)
- return SemaRef.ExprError();
+ return ExprError();
TInfo2 = getDerived().TransformType(E->getArgTInfo2());
if (!TInfo2)
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
TInfo1 == E->getArgTInfo1() &&
@@ -4876,15 +4873,15 @@ ExprResult
TreeTransform<Derived>::TransformChooseExpr(ChooseExpr *E) {
ExprResult Cond = getDerived().TransformExpr(E->getCond());
if (Cond.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
ExprResult LHS = getDerived().TransformExpr(E->getLHS());
if (LHS.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
ExprResult RHS = getDerived().TransformExpr(E->getRHS());
if (RHS.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
Cond.get() == E->getCond() &&
@@ -4912,7 +4909,7 @@ TreeTransform<Derived>::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
case OO_Array_New:
case OO_Array_Delete:
llvm_unreachable("new and delete operators cannot use CXXOperatorCallExpr");
- return SemaRef.ExprError();
+ return ExprError();
case OO_Call: {
// This is a call to an object's operator().
@@ -4921,7 +4918,7 @@ TreeTransform<Derived>::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
// Transform the object itself.
ExprResult Object = getDerived().TransformExpr(E->getArg(0));
if (Object.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
// FIXME: Poor location information
SourceLocation FakeLParenLoc
@@ -4937,7 +4934,7 @@ TreeTransform<Derived>::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
ExprResult Arg = getDerived().TransformExpr(E->getArg(I));
if (Arg.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
// FIXME: Poor source location information.
SourceLocation FakeCommaLoc
@@ -4963,27 +4960,27 @@ TreeTransform<Derived>::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
case OO_Conditional:
llvm_unreachable("conditional operator is not actually overloadable");
- return SemaRef.ExprError();
+ return ExprError();
case OO_None:
case NUM_OVERLOADED_OPERATORS:
llvm_unreachable("not an overloaded operator?");
- return SemaRef.ExprError();
+ return ExprError();
}
ExprResult Callee = getDerived().TransformExpr(E->getCallee());
if (Callee.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
ExprResult First = getDerived().TransformExpr(E->getArg(0));
if (First.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
ExprResult Second;
if (E->getNumArgs() == 2) {
Second = getDerived().TransformExpr(E->getArg(1));
if (Second.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
}
if (!getDerived().AlwaysRebuild() &&
@@ -5019,13 +5016,13 @@ TreeTransform<Derived>::TransformCXXNamedCastExpr(CXXNamedCastExpr *E) {
OldT = E->getTypeInfoAsWritten();
NewT = getDerived().TransformType(OldT);
if (!NewT)
- return SemaRef.ExprError();
+ return ExprError();
}
ExprResult SubExpr
= getDerived().TransformExpr(E->getSubExprAsWritten());
if (SubExpr.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
OldT == NewT &&
@@ -5086,13 +5083,13 @@ TreeTransform<Derived>::TransformCXXFunctionalCastExpr(
OldT = E->getTypeInfoAsWritten();
NewT = getDerived().TransformType(OldT);
if (!NewT)
- return SemaRef.ExprError();
+ return ExprError();
}
ExprResult SubExpr
= getDerived().TransformExpr(E->getSubExprAsWritten());
if (SubExpr.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
OldT == NewT &&
@@ -5115,7 +5112,7 @@ TreeTransform<Derived>::TransformCXXTypeidExpr(CXXTypeidExpr *E) {
TypeSourceInfo *TInfo
= getDerived().TransformType(E->getTypeOperandSourceInfo());
if (!TInfo)
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
TInfo == E->getTypeOperandSourceInfo())
@@ -5131,11 +5128,11 @@ TreeTransform<Derived>::TransformCXXTypeidExpr(CXXTypeidExpr *E) {
// after we perform semantic analysis, so the expression is potentially
// potentially evaluated.
EnterExpressionEvaluationContext Unevaluated(SemaRef,
- Action::PotentiallyPotentiallyEvaluated);
+ Sema::PotentiallyPotentiallyEvaluated);
ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
if (SubExpr.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
SubExpr.get() == E->getExprOperand())
@@ -5167,7 +5164,7 @@ TreeTransform<Derived>::TransformCXXThisExpr(CXXThisExpr *E) {
QualType T = getDerived().TransformType(E->getType());
if (T.isNull())
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
T == E->getType())
@@ -5181,7 +5178,7 @@ ExprResult
TreeTransform<Derived>::TransformCXXThrowExpr(CXXThrowExpr *E) {
ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
if (SubExpr.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
SubExpr.get() == E->getSubExpr())
@@ -5197,7 +5194,7 @@ TreeTransform<Derived>::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
= cast_or_null<ParmVarDecl>(getDerived().TransformDecl(E->getLocStart(),
E->getParam()));
if (!Param)
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
Param == E->getParam())
@@ -5213,7 +5210,7 @@ TreeTransform<Derived>::TransformCXXScalarValueInitExpr(CXXScalarValueInitExpr *
QualType T = getDerived().TransformType(E->getType());
if (T.isNull())
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
T == E->getType())
@@ -5232,12 +5229,12 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
TemporaryBase Rebase(*this, E->getLocStart(), DeclarationName());
QualType AllocType = getDerived().TransformType(E->getAllocatedType());
if (AllocType.isNull())
- return SemaRef.ExprError();
+ return ExprError();
// Transform the size of the array we're allocating (if any).
ExprResult ArraySize = getDerived().TransformExpr(E->getArraySize());
if (ArraySize.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
// Transform the placement arguments (if any).
bool ArgumentChanged = false;
@@ -5245,7 +5242,7 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
for (unsigned I = 0, N = E->getNumPlacementArgs(); I != N; ++I) {
ExprResult Arg = getDerived().TransformExpr(E->getPlacementArg(I));
if (Arg.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
ArgumentChanged = ArgumentChanged || Arg.get() != E->getPlacementArg(I);
PlacementArgs.push_back(Arg.take());
@@ -5259,7 +5256,7 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
ExprResult Arg = getDerived().TransformExpr(E->getConstructorArg(I));
if (Arg.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
ArgumentChanged = ArgumentChanged || Arg.get() != E->getConstructorArg(I);
ConstructorArgs.push_back(Arg.take());
@@ -5272,7 +5269,7 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
getDerived().TransformDecl(E->getLocStart(),
E->getConstructor()));
if (!Constructor)
- return SemaRef.ExprError();
+ return ExprError();
}
FunctionDecl *OperatorNew = 0;
@@ -5281,7 +5278,7 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
getDerived().TransformDecl(E->getLocStart(),
E->getOperatorNew()));
if (!OperatorNew)
- return SemaRef.ExprError();
+ return ExprError();
}
FunctionDecl *OperatorDelete = 0;
@@ -5290,7 +5287,7 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
getDerived().TransformDecl(E->getLocStart(),
E->getOperatorDelete()));
if (!OperatorDelete)
- return SemaRef.ExprError();
+ return ExprError();
}
if (!getDerived().AlwaysRebuild() &&
@@ -5356,7 +5353,7 @@ ExprResult
TreeTransform<Derived>::TransformCXXDeleteExpr(CXXDeleteExpr *E) {
ExprResult Operand = getDerived().TransformExpr(E->getArgument());
if (Operand.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
// Transform the delete operator, if known.
FunctionDecl *OperatorDelete = 0;
@@ -5365,7 +5362,7 @@ TreeTransform<Derived>::TransformCXXDeleteExpr(CXXDeleteExpr *E) {
getDerived().TransformDecl(E->getLocStart(),
E->getOperatorDelete()));
if (!OperatorDelete)
- return SemaRef.ExprError();
+ return ExprError();
}
if (!getDerived().AlwaysRebuild() &&
@@ -5390,7 +5387,7 @@ TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
CXXPseudoDestructorExpr *E) {
ExprResult Base = getDerived().TransformExpr(E->getBase());
if (Base.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
ParsedType ObjectTypePtr;
bool MayBePseudoDestructor = false;
@@ -5400,7 +5397,7 @@ TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
ObjectTypePtr,
MayBePseudoDestructor);
if (Base.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
QualType ObjectType = ObjectTypePtr.get();
NestedNameSpecifier *Qualifier
@@ -5408,14 +5405,14 @@ TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
E->getQualifierRange(),
ObjectType);
if (E->getQualifier() && !Qualifier)
- return SemaRef.ExprError();
+ return ExprError();
PseudoDestructorTypeStorage Destroyed;
if (E->getDestroyedTypeInfo()) {
TypeSourceInfo *DestroyedTypeInfo
= getDerived().TransformType(E->getDestroyedTypeInfo(), ObjectType);
if (!DestroyedTypeInfo)
- return SemaRef.ExprError();
+ return ExprError();
Destroyed = DestroyedTypeInfo;
} else if (ObjectType->isDependentType()) {
// We aren't likely to be able to resolve the identifier down to a type
@@ -5437,7 +5434,7 @@ TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
SS, ObjectTypePtr,
false);
if (!T)
- return SemaRef.ExprError();
+ return ExprError();
Destroyed
= SemaRef.Context.getTrivialTypeSourceInfo(SemaRef.GetTypeFromParser(T),
@@ -5449,7 +5446,7 @@ TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
ScopeTypeInfo = getDerived().TransformType(E->getScopeTypeInfo(),
ObjectType);
if (!ScopeTypeInfo)
- return SemaRef.ExprError();
+ return ExprError();
}
return getDerived().RebuildCXXPseudoDestructorExpr(Base.get(),
@@ -5484,7 +5481,7 @@ TreeTransform<Derived>::TransformUnresolvedLookupExpr(
if (isa<UsingShadowDecl>(*I))
continue;
else
- return SemaRef.ExprError();
+ return ExprError();
}
// Expand using declarations.
@@ -5510,7 +5507,7 @@ TreeTransform<Derived>::TransformUnresolvedLookupExpr(
Qualifier = getDerived().TransformNestedNameSpecifier(Old->getQualifier(),
Old->getQualifierRange());
if (!Qualifier)
- return SemaRef.ExprError();
+ return ExprError();
SS.setScopeRep(Qualifier);
SS.setRange(Old->getQualifierRange());
@@ -5522,7 +5519,7 @@ TreeTransform<Derived>::TransformUnresolvedLookupExpr(
Old->getNameLoc(),
Old->getNamingClass()));
if (!NamingClass)
- return SemaRef.ExprError();
+ return ExprError();
R.setNamingClass(NamingClass);
}
@@ -5537,7 +5534,7 @@ TreeTransform<Derived>::TransformUnresolvedLookupExpr(
for (unsigned I = 0, N = Old->getNumTemplateArgs(); I != N; ++I) {
TemplateArgumentLoc Loc;
if (getDerived().TransformTemplateArgument(Old->getTemplateArgs()[I], Loc))
- return SemaRef.ExprError();
+ return ExprError();
TransArgs.addArgument(Loc);
}
@@ -5552,7 +5549,7 @@ TreeTransform<Derived>::TransformUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) {
QualType T = getDerived().TransformType(E->getQueriedType());
if (T.isNull())
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
T == E->getQueriedType())
@@ -5577,12 +5574,12 @@ TreeTransform<Derived>::TransformDependentScopeDeclRefExpr(
= getDerived().TransformNestedNameSpecifier(E->getQualifier(),
E->getQualifierRange());
if (!NNS)
- return SemaRef.ExprError();
+ return ExprError();
DeclarationNameInfo NameInfo
= getDerived().TransformDeclarationNameInfo(E->getNameInfo());
if (!NameInfo.getName())
- return SemaRef.ExprError();
+ return ExprError();
if (!E->hasExplicitTemplateArgs()) {
if (!getDerived().AlwaysRebuild() &&
@@ -5602,7 +5599,7 @@ TreeTransform<Derived>::TransformDependentScopeDeclRefExpr(
for (unsigned I = 0, N = E->getNumTemplateArgs(); I != N; ++I) {
TemplateArgumentLoc Loc;
if (getDerived().TransformTemplateArgument(E->getTemplateArgs()[I], Loc))
- return SemaRef.ExprError();
+ return ExprError();
TransArgs.addArgument(Loc);
}
@@ -5625,14 +5622,14 @@ TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *E) {
QualType T = getDerived().TransformType(E->getType());
if (T.isNull())
- return SemaRef.ExprError();
+ return ExprError();
CXXConstructorDecl *Constructor
= cast_or_null<CXXConstructorDecl>(
getDerived().TransformDecl(E->getLocStart(),
E->getConstructor()));
if (!Constructor)
- return SemaRef.ExprError();
+ return ExprError();
bool ArgumentChanged = false;
ASTOwningVector<Expr*> Args(SemaRef);
@@ -5646,7 +5643,7 @@ TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *E) {
ExprResult TransArg = getDerived().TransformExpr(*Arg);
if (TransArg.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
ArgumentChanged = ArgumentChanged || TransArg.get() != *Arg;
Args.push_back(TransArg.get());
@@ -5708,14 +5705,14 @@ TreeTransform<Derived>::TransformCXXTemporaryObjectExpr(
TemporaryBase Rebase(*this, E->getTypeBeginLoc(), DeclarationName());
QualType T = getDerived().TransformType(E->getType());
if (T.isNull())
- return SemaRef.ExprError();
+ return ExprError();
CXXConstructorDecl *Constructor
= cast_or_null<CXXConstructorDecl>(
getDerived().TransformDecl(E->getLocStart(),
E->getConstructor()));
if (!Constructor)
- return SemaRef.ExprError();
+ return ExprError();
bool ArgumentChanged = false;
ASTOwningVector<Expr*> Args(SemaRef);
@@ -5730,7 +5727,7 @@ TreeTransform<Derived>::TransformCXXTemporaryObjectExpr(
ExprResult TransArg = getDerived().TransformExpr(*Arg);
if (TransArg.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
ArgumentChanged = ArgumentChanged || TransArg.get() != *Arg;
Args.push_back((Expr *)TransArg.release());
@@ -5767,7 +5764,7 @@ TreeTransform<Derived>::TransformCXXUnresolvedConstructExpr(
TemporaryBase Rebase(*this, E->getTypeBeginLoc(), DeclarationName());
QualType T = getDerived().TransformType(E->getTypeAsWritten());
if (T.isNull())
- return SemaRef.ExprError();
+ return ExprError();
bool ArgumentChanged = false;
ASTOwningVector<Expr*> Args(SemaRef);
@@ -5777,7 +5774,7 @@ TreeTransform<Derived>::TransformCXXUnresolvedConstructExpr(
Arg != ArgEnd; ++Arg) {
ExprResult TransArg = getDerived().TransformExpr(*Arg);
if (TransArg.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
ArgumentChanged = ArgumentChanged || TransArg.get() != *Arg;
FakeCommaLocs.push_back(
@@ -5812,7 +5809,7 @@ TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr(
OldBase = E->getBase();
Base = getDerived().TransformExpr(OldBase);
if (Base.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
// Start the member reference and compute the object's type.
ParsedType ObjectTy;
@@ -5823,7 +5820,7 @@ TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr(
ObjectTy,
MayBePseudoDestructor);
if (Base.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
ObjectType = ObjectTy.get();
BaseType = ((Expr*) Base.get())->getType();
@@ -5847,14 +5844,14 @@ TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr(
ObjectType,
FirstQualifierInScope);
if (!Qualifier)
- return SemaRef.ExprError();
+ return ExprError();
}
DeclarationNameInfo NameInfo
= getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo(),
ObjectType);
if (!NameInfo.getName())
- return SemaRef.ExprError();
+ return ExprError();
if (!E->hasExplicitTemplateArgs()) {
// This is a reference to a member without an explicitly-specified
@@ -5882,7 +5879,7 @@ TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr(
for (unsigned I = 0, N = E->getNumTemplateArgs(); I != N; ++I) {
TemplateArgumentLoc Loc;
if (getDerived().TransformTemplateArgument(E->getTemplateArgs()[I], Loc))
- return SemaRef.ExprError();
+ return ExprError();
TransArgs.addArgument(Loc);
}
@@ -5906,7 +5903,7 @@ TreeTransform<Derived>::TransformUnresolvedMemberExpr(UnresolvedMemberExpr *Old)
if (!Old->isImplicitAccess()) {
Base = getDerived().TransformExpr(Old->getBase());
if (Base.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
BaseType = ((Expr*) Base.get())->getType();
} else {
BaseType = getDerived().TransformType(Old->getBaseType());
@@ -5918,7 +5915,7 @@ TreeTransform<Derived>::TransformUnresolvedMemberExpr(UnresolvedMemberExpr *Old)
= getDerived().TransformNestedNameSpecifier(Old->getQualifier(),
Old->getQualifierRange());
if (Qualifier == 0)
- return SemaRef.ExprError();
+ return ExprError();
}
LookupResult R(SemaRef, Old->getMemberNameInfo(),
@@ -5936,7 +5933,7 @@ TreeTransform<Derived>::TransformUnresolvedMemberExpr(UnresolvedMemberExpr *Old)
if (isa<UsingShadowDecl>(*I))
continue;
else
- return SemaRef.ExprError();
+ return ExprError();
}
// Expand using declarations.
@@ -5960,7 +5957,7 @@ TreeTransform<Derived>::TransformUnresolvedMemberExpr(UnresolvedMemberExpr *Old)
Old->getMemberLoc(),
Old->getNamingClass()));
if (!NamingClass)
- return SemaRef.ExprError();
+ return ExprError();
R.setNamingClass(NamingClass);
}
@@ -5973,7 +5970,7 @@ TreeTransform<Derived>::TransformUnresolvedMemberExpr(UnresolvedMemberExpr *Old)
TemplateArgumentLoc Loc;
if (getDerived().TransformTemplateArgument(Old->getTemplateArgs()[I],
Loc))
- return SemaRef.ExprError();
+ return ExprError();
TransArgs.addArgument(Loc);
}
}
@@ -6008,7 +6005,7 @@ TreeTransform<Derived>::TransformObjCEncodeExpr(ObjCEncodeExpr *E) {
TypeSourceInfo *EncodedTypeInfo
= getDerived().TransformType(E->getEncodedTypeSourceInfo());
if (!EncodedTypeInfo)
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
EncodedTypeInfo == E->getEncodedTypeSourceInfo())
@@ -6028,7 +6025,7 @@ TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *E) {
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
ExprResult Arg = getDerived().TransformExpr(E->getArg(I));
if (Arg.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
ArgChanged = ArgChanged || Arg.get() != E->getArg(I);
Args.push_back(Arg.get());
@@ -6039,7 +6036,7 @@ TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *E) {
TypeSourceInfo *ReceiverTypeInfo
= getDerived().TransformType(E->getClassReceiverTypeInfo());
if (!ReceiverTypeInfo)
- return SemaRef.ExprError();
+ return ExprError();
// If nothing changed, just retain the existing message send.
if (!getDerived().AlwaysRebuild() &&
@@ -6061,7 +6058,7 @@ TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *E) {
ExprResult Receiver
= getDerived().TransformExpr(E->getInstanceReceiver());
if (Receiver.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
// If nothing changed, just retain the existing message send.
if (!getDerived().AlwaysRebuild() &&
@@ -6095,7 +6092,7 @@ TreeTransform<Derived>::TransformObjCIvarRefExpr(ObjCIvarRefExpr *E) {
// Transform the base expression.
ExprResult Base = getDerived().TransformExpr(E->getBase());
if (Base.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
// We don't need to transform the ivar; it will never change.
@@ -6115,7 +6112,7 @@ TreeTransform<Derived>::TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
// Transform the base expression.
ExprResult Base = getDerived().TransformExpr(E->getBase());
if (Base.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
// We don't need to transform the property; it will never change.
@@ -6140,7 +6137,7 @@ TreeTransform<Derived>::TransformObjCImplicitSetterGetterRefExpr(
// Transform the base expression.
ExprResult Base = getDerived().TransformExpr(E->getBase());
if (Base.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
// We don't need to transform the getters/setters; they will never change.
@@ -6171,7 +6168,7 @@ TreeTransform<Derived>::TransformObjCIsaExpr(ObjCIsaExpr *E) {
// Transform the base expression.
ExprResult Base = getDerived().TransformExpr(E->getBase());
if (Base.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
// If nothing changed, just retain the existing expression.
if (!getDerived().AlwaysRebuild() &&
@@ -6190,7 +6187,7 @@ TreeTransform<Derived>::TransformShuffleVectorExpr(ShuffleVectorExpr *E) {
for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I) {
ExprResult SubExpr = getDerived().TransformExpr(E->getExpr(I));
if (SubExpr.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
ArgumentChanged = ArgumentChanged || SubExpr.get() != E->getExpr(I);
SubExprs.push_back(SubExpr.get());
@@ -6239,7 +6236,7 @@ TreeTransform<Derived>::TransformBlockExpr(BlockExpr *E) {
// Transform the body
StmtResult Body = getDerived().TransformStmt(E->getBody());
if (Body.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
// Set the parameters on the block decl.
if (!Params.empty())
CurBlock->TheDecl->setParams(Params.data(), Params.size());
@@ -6265,7 +6262,7 @@ TreeTransform<Derived>::TransformBlockDeclRefExpr(BlockDeclRefExpr *E) {
= cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
E->getDecl()));
if (!ND)
- return SemaRef.ExprError();
+ return ExprError();
if (!getDerived().AlwaysRebuild() &&
ND == E->getDecl()) {
@@ -6624,7 +6621,7 @@ TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
ExprResult Result
= SemaRef.CreateBuiltinBinOp(OpLoc, Opc, First, Second);
if (Result.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
return move(Result);
}
@@ -6666,7 +6663,7 @@ TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
ExprResult Result
= SemaRef.CreateOverloadedBinOp(OpLoc, Opc, Functions, Args[0], Args[1]);
if (Result.isInvalid())
- return SemaRef.ExprError();
+ return ExprError();
return move(Result);
}