[cfe-commits] r111667 - in /cfe/trunk: include/clang/Parse/ include/clang/Sema/ lib/Frontend/ lib/Parse/ lib/Sema/ tools/c-index-test/ tools/driver/ tools/libclang/
John McCall
rjmccall at apple.com
Fri Aug 20 11:27:03 PDT 2010
Author: rjmccall
Date: Fri Aug 20 13:27:03 2010
New Revision: 111667
URL: http://llvm.org/viewvc/llvm-project?rev=111667&view=rev
Log:
Another step in the process of making the parser depend on Sema:
- move DeclSpec &c into the Sema library
- move ParseAST into the Parse library
Reflect this change in a thousand different includes.
Reflect this change in the link orders.
Added:
cfe/trunk/include/clang/Parse/ParseAST.h
- copied, changed from r111642, cfe/trunk/include/clang/Sema/ParseAST.h
cfe/trunk/include/clang/Sema/Action.h
- copied, changed from r111642, cfe/trunk/include/clang/Parse/Action.h
cfe/trunk/include/clang/Sema/AttributeList.h
- copied, changed from r111642, cfe/trunk/include/clang/Parse/AttributeList.h
cfe/trunk/include/clang/Sema/DeclSpec.h
- copied, changed from r111642, cfe/trunk/include/clang/Parse/DeclSpec.h
cfe/trunk/include/clang/Sema/Designator.h
- copied, changed from r111642, cfe/trunk/include/clang/Parse/Designator.h
cfe/trunk/include/clang/Sema/Ownership.h
- copied, changed from r111642, cfe/trunk/include/clang/Parse/Ownership.h
cfe/trunk/include/clang/Sema/ParsedTemplate.h
- copied, changed from r111642, cfe/trunk/include/clang/Parse/Template.h
cfe/trunk/include/clang/Sema/Scope.h
- copied, changed from r111642, cfe/trunk/include/clang/Parse/Scope.h
cfe/trunk/lib/Parse/ParseAST.cpp
- copied, changed from r111642, cfe/trunk/lib/Sema/ParseAST.cpp
cfe/trunk/lib/Sema/Action.cpp
- copied, changed from r111642, cfe/trunk/lib/Parse/Action.cpp
cfe/trunk/lib/Sema/AttributeList.cpp
- copied, changed from r111642, cfe/trunk/lib/Parse/AttributeList.cpp
cfe/trunk/lib/Sema/DeclSpec.cpp
- copied, changed from r111642, cfe/trunk/lib/Parse/DeclSpec.cpp
Removed:
cfe/trunk/include/clang/Parse/Action.h
cfe/trunk/include/clang/Parse/AttributeList.h
cfe/trunk/include/clang/Parse/DeclSpec.h
cfe/trunk/include/clang/Parse/Designator.h
cfe/trunk/include/clang/Parse/Ownership.h
cfe/trunk/include/clang/Parse/Scope.h
cfe/trunk/include/clang/Parse/Template.h
cfe/trunk/include/clang/Sema/ParseAST.h
cfe/trunk/lib/Parse/Action.cpp
cfe/trunk/lib/Parse/AttributeList.cpp
cfe/trunk/lib/Parse/DeclSpec.cpp
cfe/trunk/lib/Sema/ParseAST.cpp
Modified:
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/include/clang/Sema/IdentifierResolver.h
cfe/trunk/include/clang/Sema/Initialization.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Frontend/DiagChecker.cpp
cfe/trunk/lib/Frontend/FrontendAction.cpp
cfe/trunk/lib/Parse/CMakeLists.txt
cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/lib/Parse/ParseInit.cpp
cfe/trunk/lib/Parse/ParseObjc.cpp
cfe/trunk/lib/Parse/ParsePragma.cpp
cfe/trunk/lib/Parse/ParseStmt.cpp
cfe/trunk/lib/Parse/ParseTemplate.cpp
cfe/trunk/lib/Parse/ParseTentative.cpp
cfe/trunk/lib/Parse/Parser.cpp
cfe/trunk/lib/Sema/CMakeLists.txt
cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp
cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/tools/c-index-test/CMakeLists.txt
cfe/trunk/tools/c-index-test/Makefile
cfe/trunk/tools/driver/CMakeLists.txt
cfe/trunk/tools/driver/Makefile
cfe/trunk/tools/libclang/CMakeLists.txt
cfe/trunk/tools/libclang/Makefile
Removed: cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Action.h?rev=111666&view=auto
==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h (removed)
@@ -1,3234 +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_PARSE_ACTION_H
-#define LLVM_CLANG_PARSE_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/Parse/DeclSpec.h"
-#include "clang/Parse/Ownership.h"
-#include "llvm/Support/PrettyStackTrace.h"
-#include "llvm/ADT/PointerUnion.h"
-
-namespace clang {
- // Semantic.
- class DeclSpec;
- class ObjCDeclSpec;
- class CXXScopeSpec;
- class Declarator;
- class AttributeList;
- struct FieldDeclarator;
- // Parse.
- class Scope;
- class Action;
- class Selector;
- class Designation;
- class InitListDesignations;
- // Lex.
- class Preprocessor;
- class Token;
-
- // We can re-use the low bit of expression, statement, base, and
- // member-initializer pointers for the "invalid" flag of
- // ActionResult.
- template<> struct IsResultPtrLowBitFree<0> { static const bool value = true;};
- template<> struct IsResultPtrLowBitFree<1> { static const bool value = true;};
- template<> struct IsResultPtrLowBitFree<3> { static const bool value = true;};
- template<> struct IsResultPtrLowBitFree<4> { static const bool value = true;};
- template<> struct IsResultPtrLowBitFree<5> { static const bool value = true;};
-
-/// 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 : public ActionBase {
- /// \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.
- typedef ActionBase::ExprTy ExprTy;
- typedef ActionBase::StmtTy StmtTy;
-
- /// Expr/Stmt/Type/BaseResult - Provide a unique type to wrap
- /// ExprTy/StmtTy/TypeTy/BaseTy, providing strong typing and
- /// allowing for failure.
- typedef ActionResult<0> ExprResult;
- typedef ActionResult<1> StmtResult;
- typedef ActionResult<2> TypeResult;
- typedef ActionResult<3> BaseResult;
- typedef ActionResult<4> MemInitResult;
- typedef ActionResult<5, DeclPtrTy> DeclResult;
-
- /// Same, but with ownership.
- typedef ASTOwningResult<&ActionBase::DeleteExpr> OwningExprResult;
- typedef ASTOwningResult<&ActionBase::DeleteStmt> OwningStmtResult;
- // Note that these will replace ExprResult and StmtResult when the transition
- // is complete.
-
- /// Single expressions or statements as arguments.
- typedef ASTOwningPtr<&ActionBase::DeleteExpr> ExprArg;
- typedef ASTOwningPtr<&ActionBase::DeleteStmt> StmtArg;
-
- /// Multiple expressions or statements as arguments.
- typedef ASTMultiPtr<&ActionBase::DeleteExpr> MultiExprArg;
- typedef ASTMultiPtr<&ActionBase::DeleteStmt> MultiStmtArg;
- typedef ASTMultiPtr<&ActionBase::DeleteTemplateParams> MultiTemplateParamsArg;
-
- class FullExprArg {
- public:
- FullExprArg(ActionBase &actions) : Expr(actions) { }
-
- // 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)
- : Expr(move(const_cast<FullExprArg&>(Other).Expr)) {}
-
- FullExprArg &operator=(const FullExprArg& Other) {
- Expr.operator=(move(const_cast<FullExprArg&>(Other).Expr));
- return *this;
- }
-
- OwningExprResult release() {
- return move(Expr);
- }
-
- ExprArg* operator->() {
- return &Expr;
- }
-
- 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(ExprArg expr)
- : Expr(move(expr)) {}
-
- ExprArg Expr;
- };
-
- template<typename T>
- FullExprArg MakeFullExpr(T &Arg) {
- return FullExprArg(ActOnFinishFullExpr(move(Arg)));
- }
-
- // Utilities for Action implementations to return smart results.
-
- OwningExprResult ExprError() { return OwningExprResult(*this, true); }
- OwningStmtResult StmtError() { return OwningStmtResult(*this, true); }
-
- OwningExprResult ExprError(const DiagnosticBuilder&) { return ExprError(); }
- OwningStmtResult StmtError(const DiagnosticBuilder&) { return StmtError(); }
-
- OwningExprResult ExprEmpty() { return OwningExprResult(*this, false); }
- OwningStmtResult StmtEmpty() { return OwningStmtResult(*this, 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(DeclPtrTy 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, DeclPtrTy 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(DeclPtrTy 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 TypeTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
- Scope *S, CXXScopeSpec *SS = 0,
- bool isClassName = false,
- TypeTy *ObjectType = 0) = 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,
- TypeTy *&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,
- TypeTy *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,
- TypeTy *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,
- TypeTy *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,
- TypeTy *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,
- TypeTy *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, DeclPtrTy Dcl) {
- }
-
- /// ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an
- /// initializer for the declaration 'Dcl'.
- virtual void ActOnCXXExitDeclInitializer(Scope *S, DeclPtrTy 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 DeclPtrTy ActOnDeclarator(Scope *S, Declarator &D) {
- return DeclPtrTy();
- }
-
- /// 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 DeclPtrTy ActOnParamDeclarator(Scope *S, Declarator &D) {
- return DeclPtrTy();
- }
-
- /// \brief Parsed an exception object declaration within an Objective-C
- /// @catch statement.
- virtual DeclPtrTy ActOnObjCExceptionDecl(Scope *S, Declarator &D) {
- return DeclPtrTy();
- }
-
- /// 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(DeclPtrTy 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(DeclPtrTy 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(DeclPtrTy Dcl,
- bool TypeContainsUndeducedAuto) {
- return;
- }
-
- /// \brief Note that the given declaration had an initializer that could not
- /// be parsed.
- virtual void ActOnInitializerError(DeclPtrTy 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,
- DeclPtrTy *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 DeclPtrTy ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) {
- // Default to ActOnDeclarator.
- return ActOnStartOfFunctionDef(FnBodyScope,
- ActOnDeclarator(FnBodyScope, D));
- }
-
- /// ActOnStartOfFunctionDef - This is called at the start of a function
- /// definition, after the FunctionDecl has already been created.
- virtual DeclPtrTy ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclPtrTy D) {
- return D;
- }
-
- virtual void ActOnStartOfObjCMethodDef(Scope *FnBodyScope, DeclPtrTy D) {
- return;
- }
-
- /// ActOnFinishFunctionBody - This is called when a function body has
- /// completed parsing. Decl is returned by ParseStartOfFunctionDef.
- virtual DeclPtrTy ActOnFinishFunctionBody(DeclPtrTy Decl, StmtArg Body) {
- return Decl;
- }
-
- virtual DeclPtrTy ActOnFileScopeAsmDecl(SourceLocation Loc,
- ExprArg AsmString) {
- return DeclPtrTy();
- }
-
- /// 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(SourceLocation Loc, Scope *S) {}
-
- /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
- /// no declarator (e.g. "struct foo;") is parsed.
- virtual DeclPtrTy ParsedFreeStandingDeclSpec(Scope *S,
- AccessSpecifier Access,
- DeclSpec &DS) {
- return DeclPtrTy();
- }
-
- /// 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 DeclPtrTy ActOnStartLinkageSpecification(Scope *S,
- SourceLocation ExternLoc,
- SourceLocation LangLoc,
- llvm::StringRef Lang,
- SourceLocation LBraceLoc) {
- return DeclPtrTy();
- }
-
- /// 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 DeclPtrTy ActOnFinishLinkageSpecification(Scope *S,
- DeclPtrTy 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 DeclPtrTy 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 DeclPtrTy();
- }
-
- /// 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, DeclPtrTy TagD, SourceLocation DeclStart,
- IdentifierInfo *ClassName,
- llvm::SmallVectorImpl<DeclPtrTy> &Decls) {}
- virtual DeclPtrTy ActOnField(Scope *S, DeclPtrTy TagD,
- SourceLocation DeclStart,
- Declarator &D, ExprTy *BitfieldWidth) {
- return DeclPtrTy();
- }
-
- virtual DeclPtrTy ActOnIvar(Scope *S, SourceLocation DeclStart,
- DeclPtrTy IntfDecl,
- Declarator &D, ExprTy *BitfieldWidth,
- tok::ObjCKeywordKind visibility) {
- return DeclPtrTy();
- }
-
- virtual void ActOnFields(Scope* S, SourceLocation RecLoc, DeclPtrTy TagDecl,
- DeclPtrTy *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, DeclPtrTy 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, DeclPtrTy 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, DeclPtrTy 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, DeclPtrTy TagDecl) { }
-
- virtual DeclPtrTy ActOnEnumConstant(Scope *S, DeclPtrTy EnumDecl,
- DeclPtrTy LastEnumConstant,
- SourceLocation IdLoc, IdentifierInfo *Id,
- SourceLocation EqualLoc, ExprTy *Val) {
- return DeclPtrTy();
- }
- virtual void ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
- SourceLocation RBraceLoc, DeclPtrTy EnumDecl,
- DeclPtrTy *Elements, unsigned NumElements,
- Scope *S, AttributeList *AttrList) {}
-
- //===--------------------------------------------------------------------===//
- // Statement Parsing Callbacks.
- //===--------------------------------------------------------------------===//
-
- virtual OwningStmtResult ActOnNullStmt(SourceLocation SemiLoc) {
- return StmtEmpty();
- }
-
- virtual OwningStmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R,
- MultiStmtArg Elts,
- bool isStmtExpr) {
- return StmtEmpty();
- }
- virtual OwningStmtResult ActOnDeclStmt(DeclGroupPtrTy Decl,
- SourceLocation StartLoc,
- SourceLocation EndLoc) {
- return StmtEmpty();
- }
-
- virtual void ActOnForEachDeclStmt(DeclGroupPtrTy Decl) {
- }
-
- virtual OwningStmtResult ActOnExprStmt(FullExprArg Expr) {
- return OwningStmtResult(*this, Expr->release());
- }
-
- /// 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 OwningStmtResult 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 OwningStmtResult ActOnDefaultStmt(SourceLocation DefaultLoc,
- SourceLocation ColonLoc,
- StmtArg SubStmt, Scope *CurScope){
- return StmtEmpty();
- }
-
- virtual OwningStmtResult 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 OwningStmtResult ActOnIfStmt(SourceLocation IfLoc,
- FullExprArg CondVal,
- DeclPtrTy 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 OwningStmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc,
- ExprArg Cond,
- DeclPtrTy CondVar) {
- return StmtEmpty();
- }
-
- virtual OwningStmtResult 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 OwningStmtResult ActOnWhileStmt(SourceLocation WhileLoc,
- FullExprArg Cond, DeclPtrTy CondVar,
- StmtArg Body) {
- return StmtEmpty();
- }
- virtual OwningStmtResult 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 OwningStmtResult ActOnForStmt(SourceLocation ForLoc,
- SourceLocation LParenLoc,
- StmtArg First, FullExprArg Second,
- DeclPtrTy SecondVar, FullExprArg Third,
- SourceLocation RParenLoc,
- StmtArg Body) {
- return StmtEmpty();
- }
-
- virtual OwningStmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc,
- SourceLocation LParenLoc,
- StmtArg First, ExprArg Second,
- SourceLocation RParenLoc, StmtArg Body) {
- return StmtEmpty();
- }
- virtual OwningStmtResult ActOnGotoStmt(SourceLocation GotoLoc,
- SourceLocation LabelLoc,
- IdentifierInfo *LabelII) {
- return StmtEmpty();
- }
- virtual OwningStmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc,
- SourceLocation StarLoc,
- ExprArg DestExp) {
- return StmtEmpty();
- }
- virtual OwningStmtResult ActOnContinueStmt(SourceLocation ContinueLoc,
- Scope *CurScope) {
- return StmtEmpty();
- }
- virtual OwningStmtResult ActOnBreakStmt(SourceLocation GotoLoc,
- Scope *CurScope) {
- return StmtEmpty();
- }
- virtual OwningStmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
- ExprArg RetValExp) {
- return StmtEmpty();
- }
- virtual OwningStmtResult 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 OwningStmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
- SourceLocation RParen,
- DeclPtrTy 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 OwningStmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
- StmtArg Body) {
- return StmtEmpty();
- }
-
- /// \brief Parsed an Objective-C @try- at 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 OwningStmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc,
- StmtArg Try,
- MultiStmtArg CatchStmts,
- StmtArg Finally) {
- return StmtEmpty();
- }
-
- virtual OwningStmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
- ExprArg Throw,
- Scope *CurScope) {
- return StmtEmpty();
- }
-
- virtual OwningStmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
- ExprArg SynchExpr,
- StmtArg SynchBody) {
- return StmtEmpty();
- }
-
- // C++ Statements
- virtual DeclPtrTy ActOnExceptionDeclarator(Scope *S, Declarator &D) {
- return DeclPtrTy();
- }
-
- virtual OwningStmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc,
- DeclPtrTy ExceptionDecl,
- StmtArg HandlerBlock) {
- return StmtEmpty();
- }
-
- virtual OwningStmtResult 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 OwningExprResult ActOnIdExpression(Scope *S,
- CXXScopeSpec &SS,
- UnqualifiedId &Name,
- bool HasTrailingLParen,
- bool IsAddressOfOperand) {
- return ExprEmpty();
- }
-
- virtual OwningExprResult ActOnPredefinedExpr(SourceLocation Loc,
- tok::TokenKind Kind) {
- return ExprEmpty();
- }
- virtual OwningExprResult ActOnCharacterConstant(const Token &) {
- return ExprEmpty();
- }
- virtual OwningExprResult ActOnNumericConstant(const Token &) {
- return ExprEmpty();
- }
-
- /// ActOnStringLiteral - The specified tokens were lexed as pasted string
- /// fragments (e.g. "foo" "bar" L"baz").
- virtual OwningExprResult ActOnStringLiteral(const Token *Toks,
- unsigned NumToks) {
- return ExprEmpty();
- }
-
- virtual OwningExprResult ActOnParenExpr(SourceLocation L, SourceLocation R,
- ExprArg Val) {
- return move(Val); // Default impl returns operand.
- }
-
- virtual OwningExprResult ActOnParenOrParenListExpr(SourceLocation L,
- SourceLocation R,
- MultiExprArg Val,
- TypeTy *TypeOfCast=0) {
- return ExprEmpty();
- }
-
- // Postfix Expressions.
- virtual OwningExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc,
- tok::TokenKind Kind,
- ExprArg Input) {
- return ExprEmpty();
- }
- virtual OwningExprResult 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 OwningExprResult ActOnMemberAccessExpr(Scope *S, ExprArg Base,
- SourceLocation OpLoc,
- tok::TokenKind OpKind,
- CXXScopeSpec &SS,
- UnqualifiedId &Member,
- DeclPtrTy 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 OwningExprResult 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 OwningExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
- tok::TokenKind Op, ExprArg Input) {
- return ExprEmpty();
- }
- virtual OwningExprResult
- ActOnSizeOfAlignOfExpr(SourceLocation OpLoc, bool isSizeof, bool isType,
- void *TyOrEx, const SourceRange &ArgRange) {
- return ExprEmpty();
- }
-
- virtual OwningExprResult ActOnCompoundLiteral(SourceLocation LParen,
- TypeTy *Ty,
- SourceLocation RParen,
- ExprArg Op) {
- return ExprEmpty();
- }
- virtual OwningExprResult 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 OwningExprResult ActOnDesignatedInitializer(Designation &Desig,
- SourceLocation Loc,
- bool GNUSyntax,
- OwningExprResult Init) {
- return ExprEmpty();
- }
-
- virtual OwningExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
- TypeTy *Ty, SourceLocation RParenLoc,
- ExprArg Op) {
- return ExprEmpty();
- }
-
- virtual bool TypeIsVectorType(TypeTy *Ty) {
- return false;
- }
-
- virtual OwningExprResult 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 OwningExprResult ActOnConditionalOp(SourceLocation QuestionLoc,
- SourceLocation ColonLoc,
- ExprArg Cond, ExprArg LHS,
- ExprArg RHS) {
- return ExprEmpty();
- }
-
- //===---------------------- GNU Extension Expressions -------------------===//
-
- virtual OwningExprResult ActOnAddrLabel(SourceLocation OpLoc,
- SourceLocation LabLoc,
- IdentifierInfo *LabelII) { // "&&foo"
- return ExprEmpty();
- }
-
- virtual OwningExprResult 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 OwningExprResult ActOnBuiltinOffsetOf(Scope *S,
- SourceLocation BuiltinLoc,
- SourceLocation TypeLoc,
- TypeTy *Arg1,
- OffsetOfComponent *CompPtr,
- unsigned NumComponents,
- SourceLocation RParenLoc) {
- return ExprEmpty();
- }
-
- // __builtin_types_compatible_p(type1, type2)
- virtual OwningExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
- TypeTy *arg1, TypeTy *arg2,
- SourceLocation RPLoc) {
- return ExprEmpty();
- }
- // __builtin_choose_expr(constExpr, expr1, expr2)
- virtual OwningExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
- ExprArg cond, ExprArg expr1,
- ExprArg expr2, SourceLocation RPLoc){
- return ExprEmpty();
- }
-
- // __builtin_va_arg(expr, type)
- virtual OwningExprResult ActOnVAArg(SourceLocation BuiltinLoc,
- ExprArg expr, TypeTy *type,
- SourceLocation RPLoc) {
- return ExprEmpty();
- }
-
- /// ActOnGNUNullExpr - Parsed the GNU __null expression, the token
- /// for which is at position TokenLoc.
- virtual OwningExprResult 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 OwningExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc,
- StmtArg Body,
- Scope *CurScope) {
- return ExprEmpty();
- }
-
- //===------------------------- C++ Declarations -------------------------===//
-
- /// ActOnStartNamespaceDef - This is called at the start of a namespace
- /// definition.
- virtual DeclPtrTy ActOnStartNamespaceDef(Scope *S, SourceLocation IdentLoc,
- IdentifierInfo *Ident,
- SourceLocation LBrace,
- AttributeList *AttrList) {
- return DeclPtrTy();
- }
-
- /// ActOnFinishNamespaceDef - This callback is called after a namespace is
- /// exited. Decl is returned by ActOnStartNamespaceDef.
- virtual void ActOnFinishNamespaceDef(DeclPtrTy Dcl, SourceLocation RBrace) {
- return;
- }
-
- /// ActOnUsingDirective - This is called when using-directive is parsed.
- virtual DeclPtrTy ActOnUsingDirective(Scope *CurScope,
- SourceLocation UsingLoc,
- SourceLocation NamespcLoc,
- CXXScopeSpec &SS,
- SourceLocation IdentLoc,
- IdentifierInfo *NamespcName,
- AttributeList *AttrList);
-
- /// ActOnNamespaceAliasDef - This is called when a namespace alias definition
- /// is parsed.
- virtual DeclPtrTy ActOnNamespaceAliasDef(Scope *CurScope,
- SourceLocation NamespaceLoc,
- SourceLocation AliasLoc,
- IdentifierInfo *Alias,
- CXXScopeSpec &SS,
- SourceLocation IdentLoc,
- IdentifierInfo *Ident) {
- return DeclPtrTy();
- }
-
- /// \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 DeclPtrTy ActOnUsingDeclaration(Scope *CurScope,
- AccessSpecifier AS,
- bool HasUsingKeyword,
- SourceLocation UsingLoc,
- CXXScopeSpec &SS,
- UnqualifiedId &Name,
- AttributeList *AttrList,
- bool IsTypeName,
- SourceLocation TypenameLoc);
-
- /// ActOnParamDefaultArgument - Parse default argument for function parameter
- virtual void ActOnParamDefaultArgument(DeclPtrTy 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(DeclPtrTy param,
- SourceLocation EqualLoc,
- SourceLocation ArgLoc) { }
-
- /// ActOnParamDefaultArgumentError - Parsing or semantic analysis of
- /// the default argument for the parameter param failed.
- virtual void ActOnParamDefaultArgumentError(DeclPtrTy param) { }
-
- /// AddCXXDirectInitializerToDecl - This action is called immediately after
- /// ActOnDeclarator, when a C++ direct initializer is present.
- /// e.g: "int x(1);"
- virtual void AddCXXDirectInitializerToDecl(DeclPtrTy 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, DeclPtrTy 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,
- DeclPtrTy 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,
- DeclPtrTy 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, DeclPtrTy 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,
- DeclPtrTy 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,
- DeclPtrTy Record) {
- }
-
- /// ActOnStaticAssertDeclaration - Parse a C++0x static_assert declaration.
- virtual DeclPtrTy ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
- ExprArg AssertExpr,
- ExprArg AssertMessageExpr) {
- return DeclPtrTy();
- }
-
- /// ActOnFriendFunctionDecl - Parsed a friend function declarator.
- /// The name is actually a slight misnomer, because the declarator
- /// is not necessarily a function declarator.
- virtual DeclPtrTy ActOnFriendFunctionDecl(Scope *S,
- Declarator &D,
- bool IsDefinition,
- MultiTemplateParamsArg TParams) {
- return DeclPtrTy();
- }
-
- /// ActOnFriendTypeDecl - Parsed a friend type declaration.
- virtual DeclPtrTy ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
- MultiTemplateParamsArg TParams) {
- return DeclPtrTy();
- }
-
- //===------------------------- C++ Expressions --------------------------===//
-
- /// \brief Parsed a destructor name or pseudo-destructor name.
- ///
- /// \returns the type being destructed.
- virtual TypeTy *getDestructorName(SourceLocation TildeLoc,
- IdentifierInfo &II, SourceLocation NameLoc,
- Scope *S, CXXScopeSpec &SS,
- TypeTy *ObjectType,
- bool EnteringContext) {
- return getTypeName(II, NameLoc, S, &SS, false, ObjectType);
- }
-
-
- /// ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const}_cast's.
- virtual OwningExprResult ActOnCXXNamedCast(SourceLocation OpLoc,
- tok::TokenKind Kind,
- SourceLocation LAngleBracketLoc,
- TypeTy *Ty,
- SourceLocation RAngleBracketLoc,
- SourceLocation LParenLoc,
- ExprArg Op,
- SourceLocation RParenLoc) {
- return ExprEmpty();
- }
-
- /// ActOnCXXTypeidOfType - Parse typeid( type-id ).
- virtual OwningExprResult ActOnCXXTypeid(SourceLocation OpLoc,
- SourceLocation LParenLoc, bool isType,
- void *TyOrExpr,
- SourceLocation RParenLoc) {
- return ExprEmpty();
- }
-
- /// ActOnCXXThis - Parse the C++ 'this' pointer.
- virtual OwningExprResult ActOnCXXThis(SourceLocation ThisLoc) {
- return ExprEmpty();
- }
-
- /// ActOnCXXBoolLiteral - Parse {true,false} literals.
- virtual OwningExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc,
- tok::TokenKind Kind) {
- return ExprEmpty();
- }
-
- /// ActOnCXXNullPtrLiteral - Parse 'nullptr'.
- virtual OwningExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc) {
- return ExprEmpty();
- }
-
- /// ActOnCXXThrow - Parse throw expressions.
- virtual OwningExprResult 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 OwningExprResult ActOnCXXTypeConstructExpr(SourceRange TypeRange,
- TypeTy *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) {
- return DeclResult();
- }
-
- /// \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 OwningExprResult 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 OwningExprResult 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 OwningExprResult ActOnCXXDelete(SourceLocation StartLoc,
- bool UseGlobal, bool ArrayForm,
- ExprArg Operand) {
- return ExprEmpty();
- }
-
- virtual OwningExprResult ActOnUnaryTypeTrait(UnaryTypeTrait OTT,
- SourceLocation KWLoc,
- SourceLocation LParen,
- TypeTy *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 OwningExprResult ActOnStartCXXMemberReference(Scope *S,
- ExprArg Base,
- SourceLocation OpLoc,
- tok::TokenKind OpKind,
- TypeTy *&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 OwningExprResult 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 OwningExprResult ActOnFinishFullExpr(ExprArg Expr) {
- return move(Expr);
- }
-
- //===---------------------------- C++ Classes ---------------------------===//
- /// ActOnBaseSpecifier - Parsed a base specifier
- virtual BaseResult ActOnBaseSpecifier(DeclPtrTy classdecl,
- SourceRange SpecifierRange,
- bool Virtual, AccessSpecifier Access,
- TypeTy *basetype,
- SourceLocation BaseLoc) {
- return BaseResult();
- }
-
- virtual void ActOnBaseSpecifiers(DeclPtrTy 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 DeclPtrTy ActOnAccessSpecifier(AccessSpecifier AS,
- SourceLocation ASLoc,
- SourceLocation ColonLoc) {
- return DeclPtrTy();
- }
-
- /// 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 DeclPtrTy ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS,
- Declarator &D,
- MultiTemplateParamsArg TemplateParameterLists,
- ExprTy *BitfieldWidth,
- ExprTy *Init,
- bool IsDefinition,
- bool Deleted = false) {
- return DeclPtrTy();
- }
-
- virtual MemInitResult ActOnMemInitializer(DeclPtrTy ConstructorDecl,
- Scope *S,
- CXXScopeSpec &SS,
- IdentifierInfo *MemberOrBase,
- TypeTy *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(DeclPtrTy ConstructorDecl,
- SourceLocation ColonLoc,
- MemInitTy **MemInits, unsigned NumMemInits,
- bool AnyErrors){
- }
-
- virtual void ActOnDefaultCtorInitializers(DeclPtrTy CDtorDecl) {}
-
- /// ActOnFinishCXXMemberSpecification - Invoked after all member declarators
- /// are parsed but *before* parsing of inline method definitions.
- virtual void ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc,
- DeclPtrTy 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 DeclPtrTy ActOnTypeParameter(Scope *S, bool Typename, bool Ellipsis,
- SourceLocation EllipsisLoc,
- SourceLocation KeyLoc,
- IdentifierInfo *ParamName,
- SourceLocation ParamNameLoc,
- unsigned Depth, unsigned Position,
- SourceLocation EqualLoc,
- TypeTy *DefaultArg) {
- return DeclPtrTy();
- }
-
- /// \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 DeclPtrTy ActOnNonTypeTemplateParameter(Scope *S, Declarator &D,
- unsigned Depth,
- unsigned Position,
- SourceLocation EqualLoc,
- ExprArg DefaultArg) {
- return DeclPtrTy();
- }
-
- /// \brief Adds a default argument to the given non-type template
- /// parameter.
- virtual void ActOnNonTypeTemplateParameterDefault(DeclPtrTy 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 DeclPtrTy ActOnTemplateTemplateParameter(Scope *S,
- SourceLocation TmpLoc,
- TemplateParamsTy *Params,
- IdentifierInfo *ParamName,
- SourceLocation ParamNameLoc,
- unsigned Depth,
- unsigned Position,
- SourceLocation EqualLoc,
- const ParsedTemplateArgument &DefaultArg) {
- return DeclPtrTy();
- }
-
- /// 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,
- DeclPtrTy *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,
- TypeTy *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) {
- return DeclResult();
- }
-
- /// \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 DeclPtrTy ActOnTemplateDeclarator(Scope *S,
- MultiTemplateParamsArg TemplateParameterLists,
- Declarator &D) {
- return DeclPtrTy();
- }
-
- /// \brief Invoked when the parser is beginning to parse a function template
- /// or function template specialization definition.
- virtual DeclPtrTy ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope,
- MultiTemplateParamsArg TemplateParameterLists,
- Declarator &D) {
- return DeclPtrTy();
- }
-
- /// \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,
- TypeTy *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 DeclPtrTy ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
- IdentifierInfo *ClassName,
- SourceLocation ClassLoc,
- IdentifierInfo *SuperName,
- SourceLocation SuperLoc,
- const DeclPtrTy *ProtoRefs,
- unsigned NumProtoRefs,
- const SourceLocation *ProtoLocs,
- SourceLocation EndProtoLoc,
- AttributeList *AttrList) {
- return DeclPtrTy();
- }
-
- /// ActOnCompatiblityAlias - this action is called after complete parsing of
- /// @compaatibility_alias declaration. It sets up the alias relationships.
- virtual DeclPtrTy ActOnCompatiblityAlias(
- SourceLocation AtCompatibilityAliasLoc,
- IdentifierInfo *AliasName, SourceLocation AliasLocation,
- IdentifierInfo *ClassName, SourceLocation ClassLocation) {
- return DeclPtrTy();
- }
-
- // ActOnStartProtocolInterface - this action is called immdiately after
- // parsing the prologue for a protocol interface.
- virtual DeclPtrTy ActOnStartProtocolInterface(SourceLocation AtProtoLoc,
- IdentifierInfo *ProtocolName,
- SourceLocation ProtocolLoc,
- const DeclPtrTy *ProtoRefs,
- unsigned NumProtoRefs,
- const SourceLocation *ProtoLocs,
- SourceLocation EndProtoLoc,
- AttributeList *AttrList) {
- return DeclPtrTy();
- }
- // ActOnStartCategoryInterface - this action is called immdiately after
- // parsing the prologue for a category interface.
- virtual DeclPtrTy ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
- IdentifierInfo *ClassName,
- SourceLocation ClassLoc,
- IdentifierInfo *CategoryName,
- SourceLocation CategoryLoc,
- const DeclPtrTy *ProtoRefs,
- unsigned NumProtoRefs,
- const SourceLocation *ProtoLocs,
- SourceLocation EndProtoLoc) {
- return DeclPtrTy();
- }
- // ActOnStartClassImplementation - this action is called immdiately after
- // parsing the prologue for a class implementation. Instance variables are
- // processed by ActOnFields().
- virtual DeclPtrTy ActOnStartClassImplementation(
- SourceLocation AtClassImplLoc,
- IdentifierInfo *ClassName,
- SourceLocation ClassLoc,
- IdentifierInfo *SuperClassname,
- SourceLocation SuperClassLoc) {
- return DeclPtrTy();
- }
- // ActOnStartCategoryImplementation - this action is called immdiately after
- // parsing the prologue for a category implementation.
- virtual DeclPtrTy ActOnStartCategoryImplementation(
- SourceLocation AtCatImplLoc,
- IdentifierInfo *ClassName,
- SourceLocation ClassLoc,
- IdentifierInfo *CatName,
- SourceLocation CatLoc) {
- return DeclPtrTy();
- }
- // ActOnPropertyImplDecl - called for every property implementation
- virtual DeclPtrTy 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
- DeclPtrTy ClassImplDecl, // class or category implementation
- IdentifierInfo *propertyId, // name of property
- IdentifierInfo *propertyIvar) { // name of the ivar
- return DeclPtrTy();
- }
-
- struct ObjCArgInfo {
- IdentifierInfo *Name;
- SourceLocation NameLoc;
- // The Type is null if no type was specified, and the DeclSpec is invalid
- // in this case.
- TypeTy *Type;
- ObjCDeclSpec DeclSpec;
-
- /// ArgAttrs - Attribute list for this argument.
- AttributeList *ArgAttrs;
- };
-
- // ActOnMethodDeclaration - called for all method declarations.
- virtual DeclPtrTy ActOnMethodDeclaration(
- SourceLocation BeginLoc, // location of the + or -.
- SourceLocation EndLoc, // location of the ; or {.
- tok::TokenKind MethodType, // tok::minus for instance, tok::plus for class.
- DeclPtrTy ClassDecl, // class this methods belongs to.
- ObjCDeclSpec &ReturnQT, // for return type's in inout etc.
- TypeTy *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 DeclPtrTy();
- }
- // 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,
- DeclPtrTy classDecl,
- DeclPtrTy *allMethods = 0,
- unsigned allNum = 0,
- DeclPtrTy *allProperties = 0,
- unsigned pNum = 0,
- DeclGroupPtrTy *allTUVars = 0,
- unsigned tuvNum = 0) {
- }
- // ActOnProperty - called to build one property AST
- virtual DeclPtrTy ActOnProperty(Scope *S, SourceLocation AtLoc,
- FieldDeclarator &FD, ObjCDeclSpec &ODS,
- Selector GetterSel, Selector SetterSel,
- DeclPtrTy ClassCategory,
- bool *OverridingProperty,
- tok::ObjCKeywordKind MethodImplKind) {
- return DeclPtrTy();
- }
-
- virtual OwningExprResult
- 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,
- TypeTy *&ReceiverType);
-
- /// \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 OwningExprResult ActOnSuperMessage(Scope *S, SourceLocation SuperLoc,
- Selector Sel,
- SourceLocation LBracLoc,
- SourceLocation SelectorLoc,
- SourceLocation RBracLoc,
- MultiExprArg Args) {
- return OwningExprResult(*this);
- }
-
- /// \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 OwningExprResult ActOnClassMessage(Scope *S,
- TypeTy *Receiver,
- Selector Sel,
- SourceLocation LBracLoc,
- SourceLocation SelectorLoc,
- SourceLocation RBracLoc,
- MultiExprArg Args) {
- return OwningExprResult(*this);
- }
-
- /// \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 OwningExprResult ActOnInstanceMessage(Scope *S,
- ExprArg Receiver,
- Selector Sel,
- SourceLocation LBracLoc,
- SourceLocation SelectorLoc,
- SourceLocation RBracLoc,
- MultiExprArg Args) {
- return OwningExprResult(*this);
- }
-
- virtual DeclPtrTy ActOnForwardClassDeclaration(
- SourceLocation AtClassLoc,
- IdentifierInfo **IdentList,
- SourceLocation *IdentLocs,
- unsigned NumElts) {
- return DeclPtrTy();
- }
- virtual DeclPtrTy ActOnForwardProtocolDeclaration(
- SourceLocation AtProtocolLoc,
- const IdentifierLocPair*IdentList,
- unsigned NumElts,
- AttributeList *AttrList) {
- return DeclPtrTy();
- }
-
- /// 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<DeclPtrTy> &ResProtos) {
- }
-
- //===----------------------- Obj-C Expressions --------------------------===//
-
- virtual ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs,
- ExprTy **Strings,
- unsigned NumStrings) {
- return ExprResult();
- }
-
- virtual ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc,
- SourceLocation EncLoc,
- SourceLocation LParenLoc,
- TypeTy *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 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 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, ExprTy *Fn,
- ExprTy **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, DeclPtrTy 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, DeclPtrTy 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, DeclPtrTy ClassDecl,
- DeclPtrTy *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, DeclPtrTy ClassDecl,
- DeclPtrTy *Methods,
- unsigned NumMethods) {
- }
-
- /// \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, TypeTy *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 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,
- DeclPtrTy 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,
- DeclPtrTy 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,
- TypeTy *ReturnType,
- DeclPtrTy 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,
- TypeTy *ReturnType,
- IdentifierInfo **SelIdents,
- unsigned NumSelIdents) { }
-
- //@}
-};
-
-/// 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 {
- Action::DeclPtrTy TheDecl;
- SourceLocation Loc;
- Action &Actions;
- SourceManager &SM;
- const char *Message;
-
-public:
- PrettyStackTraceActionsDecl(Action::DeclPtrTy Decl, SourceLocation L,
- Action &actions, SourceManager &sm,
- const char *Msg)
- : TheDecl(Decl), 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
Removed: cfe/trunk/include/clang/Parse/AttributeList.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/AttributeList.h?rev=111666&view=auto
==============================================================================
--- cfe/trunk/include/clang/Parse/AttributeList.h (original)
+++ cfe/trunk/include/clang/Parse/AttributeList.h (removed)
@@ -1,232 +0,0 @@
-//===--- AttributeList.h ----------------------------------------*- 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 AttributeList class interface.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_ATTRLIST_H
-#define LLVM_CLANG_ATTRLIST_H
-
-#include "clang/Parse/Ownership.h"
-#include "clang/Basic/SourceLocation.h"
-#include <cassert>
-
-namespace clang {
- class IdentifierInfo;
- class Action;
-
-/// AttributeList - Represents GCC's __attribute__ declaration. There are
-/// 4 forms of this construct...they are:
-///
-/// 1: __attribute__(( const )). ParmName/Args/NumArgs will all be unused.
-/// 2: __attribute__(( mode(byte) )). ParmName used, Args/NumArgs unused.
-/// 3: __attribute__(( format(printf, 1, 2) )). ParmName/Args/NumArgs all used.
-/// 4: __attribute__(( aligned(16) )). ParmName is unused, Args/Num used.
-///
-class AttributeList {
- IdentifierInfo *AttrName;
- SourceLocation AttrLoc;
- IdentifierInfo *ScopeName;
- SourceLocation ScopeLoc;
- IdentifierInfo *ParmName;
- SourceLocation ParmLoc;
- ActionBase::ExprTy **Args;
- unsigned NumArgs;
- AttributeList *Next;
- bool DeclspecAttribute, CXX0XAttribute;
- mutable bool Invalid; /// True if already diagnosed as invalid.
- AttributeList(const AttributeList &); // DO NOT IMPLEMENT
- void operator=(const AttributeList &); // DO NOT IMPLEMENT
-public:
- AttributeList(IdentifierInfo *AttrName, SourceLocation AttrLoc,
- IdentifierInfo *ScopeName, SourceLocation ScopeLoc,
- IdentifierInfo *ParmName, SourceLocation ParmLoc,
- ActionBase::ExprTy **args, unsigned numargs,
- AttributeList *Next, bool declspec = false, bool cxx0x = false);
- ~AttributeList();
-
- enum Kind { // Please keep this list alphabetized.
- AT_IBAction, // Clang-specific.
- AT_IBOutlet, // Clang-specific.
- AT_IBOutletCollection, // Clang-specific.
- AT_address_space,
- AT_alias,
- AT_aligned,
- AT_always_inline,
- AT_analyzer_noreturn,
- AT_annotate,
- AT_base_check,
- AT_blocks,
- AT_carries_dependency,
- AT_cdecl,
- AT_cleanup,
- AT_const,
- AT_constructor,
- AT_deprecated,
- AT_destructor,
- AT_dllexport,
- AT_dllimport,
- AT_ext_vector_type,
- AT_fastcall,
- AT_final,
- AT_format,
- AT_format_arg,
- AT_gnu_inline,
- AT_hiding,
- AT_malloc,
- AT_mode,
- AT_nodebug,
- AT_noinline,
- AT_no_instrument_function,
- AT_nonnull,
- AT_noreturn,
- AT_nothrow,
- AT_nsobject,
- AT_objc_exception,
- AT_override,
- AT_cf_returns_not_retained, // Clang-specific.
- AT_cf_returns_retained, // Clang-specific.
- AT_ns_returns_not_retained, // Clang-specific.
- AT_ns_returns_retained, // Clang-specific.
- AT_objc_gc,
- AT_overloadable, // Clang-specific.
- AT_ownership_holds, // Clang-specific.
- AT_ownership_returns, // Clang-specific.
- AT_ownership_takes, // Clang-specific.
- AT_packed,
- AT_pure,
- AT_regparm,
- AT_section,
- AT_sentinel,
- AT_stdcall,
- AT_thiscall,
- AT_transparent_union,
- AT_unavailable,
- AT_unused,
- AT_used,
- AT_vecreturn, // PS3 PPU-specific.
- AT_vector_size,
- AT_visibility,
- AT_warn_unused_result,
- AT_weak,
- AT_weakref,
- AT_weak_import,
- AT_reqd_wg_size,
- AT_init_priority,
- IgnoredAttribute,
- UnknownAttribute
- };
-
- IdentifierInfo *getName() const { return AttrName; }
- SourceLocation getLoc() const { return AttrLoc; }
-
- bool hasScope() const { return ScopeName; }
- IdentifierInfo *getScopeName() const { return ScopeName; }
- SourceLocation getScopeLoc() const { return ScopeLoc; }
-
- IdentifierInfo *getParameterName() const { return ParmName; }
-
- bool isDeclspecAttribute() const { return DeclspecAttribute; }
- bool isCXX0XAttribute() const { return CXX0XAttribute; }
-
- bool isInvalid() const { return Invalid; }
- void setInvalid(bool b = true) const { Invalid = b; }
-
- Kind getKind() const { return getKind(getName()); }
- static Kind getKind(const IdentifierInfo *Name);
-
- AttributeList *getNext() const { return Next; }
- void setNext(AttributeList *N) { Next = N; }
-
- /// getNumArgs - Return the number of actual arguments to this attribute.
- unsigned getNumArgs() const { return NumArgs; }
-
- /// getArg - Return the specified argument.
- ActionBase::ExprTy *getArg(unsigned Arg) const {
- assert(Arg < NumArgs && "Arg access out of range!");
- return Args[Arg];
- }
-
- class arg_iterator {
- ActionBase::ExprTy** X;
- unsigned Idx;
- public:
- arg_iterator(ActionBase::ExprTy** x, unsigned idx) : X(x), Idx(idx) {}
-
- arg_iterator& operator++() {
- ++Idx;
- return *this;
- }
-
- bool operator==(const arg_iterator& I) const {
- assert (X == I.X &&
- "compared arg_iterators are for different argument lists");
- return Idx == I.Idx;
- }
-
- bool operator!=(const arg_iterator& I) const {
- return !operator==(I);
- }
-
- ActionBase::ExprTy* operator*() const {
- return X[Idx];
- }
-
- unsigned getArgNum() const {
- return Idx+1;
- }
- };
-
- arg_iterator arg_begin() const {
- return arg_iterator(Args, 0);
- }
-
- arg_iterator arg_end() const {
- return arg_iterator(Args, NumArgs);
- }
-};
-
-/// addAttributeLists - Add two AttributeLists together
-/// The right-hand list is appended to the left-hand list, if any
-/// A pointer to the joined list is returned.
-/// Note: the lists are not left unmodified.
-inline AttributeList* addAttributeLists (AttributeList *Left,
- AttributeList *Right) {
- if (!Left)
- return Right;
-
- AttributeList *next = Left, *prev;
- do {
- prev = next;
- next = next->getNext();
- } while (next);
- prev->setNext(Right);
- return Left;
-}
-
-/// CXX0XAttributeList - A wrapper around a C++0x attribute list.
-/// Stores, in addition to the list proper, whether or not an actual list was
-/// (as opposed to an empty list, which may be ill-formed in some places) and
-/// the source range of the list.
-struct CXX0XAttributeList {
- AttributeList *AttrList;
- SourceRange Range;
- bool HasAttr;
- CXX0XAttributeList (AttributeList *attrList, SourceRange range, bool hasAttr)
- : AttrList(attrList), Range(range), HasAttr (hasAttr) {
- }
- CXX0XAttributeList ()
- : AttrList(0), Range(), HasAttr(false) {
- }
-};
-
-} // end namespace clang
-
-#endif
Removed: cfe/trunk/include/clang/Parse/DeclSpec.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/DeclSpec.h?rev=111666&view=auto
==============================================================================
--- cfe/trunk/include/clang/Parse/DeclSpec.h (original)
+++ cfe/trunk/include/clang/Parse/DeclSpec.h (removed)
@@ -1,1338 +0,0 @@
-//===--- SemaDeclSpec.h - Declaration Specifier Semantic Analys -*- 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 interfaces used for Declaration Specifiers and Declarators.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_PARSE_DECLSPEC_H
-#define LLVM_CLANG_PARSE_DECLSPEC_H
-
-#include "clang/Parse/AttributeList.h"
-#include "clang/Lex/Token.h"
-#include "clang/Basic/OperatorKinds.h"
-#include "clang/Basic/Specifiers.h"
-#include "llvm/ADT/SmallVector.h"
-
-namespace clang {
- class LangOptions;
- class Diagnostic;
- class IdentifierInfo;
- class Preprocessor;
- class Declarator;
- struct TemplateIdAnnotation;
-
-/// CXXScopeSpec - Represents a C++ nested-name-specifier or a global scope
-/// specifier. These can be in 3 states:
-/// 1) Not present, identified by isEmpty()
-/// 2) Present, identified by isNotEmpty()
-/// 2.a) Valid, idenified by isValid()
-/// 2.b) Invalid, identified by isInvalid().
-///
-/// isSet() is deprecated because it mostly corresponded to "valid" but was
-/// often used as if it meant "present".
-///
-/// The actual scope is described by getScopeRep().
-class CXXScopeSpec {
- SourceRange Range;
- void *ScopeRep;
-
-public:
- CXXScopeSpec() : Range(), ScopeRep() { }
-
- const SourceRange &getRange() const { return Range; }
- void setRange(const SourceRange &R) { Range = R; }
- void setBeginLoc(SourceLocation Loc) { Range.setBegin(Loc); }
- void setEndLoc(SourceLocation Loc) { Range.setEnd(Loc); }
- SourceLocation getBeginLoc() const { return Range.getBegin(); }
- SourceLocation getEndLoc() const { return Range.getEnd(); }
-
- ActionBase::CXXScopeTy *getScopeRep() const { return ScopeRep; }
- void setScopeRep(ActionBase::CXXScopeTy *S) { ScopeRep = S; }
-
- /// No scope specifier.
- bool isEmpty() const { return !Range.isValid(); }
- /// A scope specifier is present, but may be valid or invalid.
- bool isNotEmpty() const { return !isEmpty(); }
-
- /// An error occured during parsing of the scope specifier.
- bool isInvalid() const { return isNotEmpty() && ScopeRep == 0; }
- /// A scope specifier is present, and it refers to a real scope.
- bool isValid() const { return isNotEmpty() && ScopeRep != 0; }
-
- /// Deprecated. Some call sites intend isNotEmpty() while others intend
- /// isValid().
- bool isSet() const { return ScopeRep != 0; }
-
- void clear() {
- Range = SourceRange();
- ScopeRep = 0;
- }
-};
-
-/// DeclSpec - This class captures information about "declaration specifiers",
-/// which encompasses storage-class-specifiers, type-specifiers,
-/// type-qualifiers, and function-specifiers.
-class DeclSpec {
-public:
- // storage-class-specifier
- // Note: The order of these enumerators is important for diagnostics.
- enum SCS {
- SCS_unspecified = 0,
- SCS_typedef,
- SCS_extern,
- SCS_static,
- SCS_auto,
- SCS_register,
- SCS_private_extern,
- SCS_mutable
- };
-
- // Import type specifier width enumeration and constants.
- typedef TypeSpecifierWidth TSW;
- static const TSW TSW_unspecified = clang::TSW_unspecified;
- static const TSW TSW_short = clang::TSW_short;
- static const TSW TSW_long = clang::TSW_long;
- static const TSW TSW_longlong = clang::TSW_longlong;
-
- enum TSC {
- TSC_unspecified,
- TSC_imaginary,
- TSC_complex
- };
-
- // Import type specifier sign enumeration and constants.
- typedef TypeSpecifierSign TSS;
- static const TSS TSS_unspecified = clang::TSS_unspecified;
- static const TSS TSS_signed = clang::TSS_signed;
- static const TSS TSS_unsigned = clang::TSS_unsigned;
-
- // Import type specifier type enumeration and constants.
- typedef TypeSpecifierType TST;
- static const TST TST_unspecified = clang::TST_unspecified;
- static const TST TST_void = clang::TST_void;
- static const TST TST_char = clang::TST_char;
- static const TST TST_wchar = clang::TST_wchar;
- static const TST TST_char16 = clang::TST_char16;
- static const TST TST_char32 = clang::TST_char32;
- static const TST TST_int = clang::TST_int;
- static const TST TST_float = clang::TST_float;
- static const TST TST_double = clang::TST_double;
- static const TST TST_bool = clang::TST_bool;
- static const TST TST_decimal32 = clang::TST_decimal32;
- static const TST TST_decimal64 = clang::TST_decimal64;
- static const TST TST_decimal128 = clang::TST_decimal128;
- static const TST TST_enum = clang::TST_enum;
- static const TST TST_union = clang::TST_union;
- static const TST TST_struct = clang::TST_struct;
- static const TST TST_class = clang::TST_class;
- static const TST TST_typename = clang::TST_typename;
- static const TST TST_typeofType = clang::TST_typeofType;
- static const TST TST_typeofExpr = clang::TST_typeofExpr;
- static const TST TST_decltype = clang::TST_decltype;
- static const TST TST_auto = clang::TST_auto;
- static const TST TST_error = clang::TST_error;
-
- // type-qualifiers
- enum TQ { // NOTE: These flags must be kept in sync with Qualifiers::TQ.
- TQ_unspecified = 0,
- TQ_const = 1,
- TQ_restrict = 2,
- TQ_volatile = 4
- };
-
- /// ParsedSpecifiers - Flags to query which specifiers were applied. This is
- /// returned by getParsedSpecifiers.
- enum ParsedSpecifiers {
- PQ_None = 0,
- PQ_StorageClassSpecifier = 1,
- PQ_TypeSpecifier = 2,
- PQ_TypeQualifier = 4,
- PQ_FunctionSpecifier = 8
- };
-
-private:
-
- // storage-class-specifier
- /*SCS*/unsigned StorageClassSpec : 3;
- bool SCS_thread_specified : 1;
- bool SCS_extern_in_linkage_spec : 1;
-
- // type-specifier
- /*TSW*/unsigned TypeSpecWidth : 2;
- /*TSC*/unsigned TypeSpecComplex : 2;
- /*TSS*/unsigned TypeSpecSign : 2;
- /*TST*/unsigned TypeSpecType : 5;
- bool TypeAltiVecVector : 1;
- bool TypeAltiVecPixel : 1;
- bool TypeAltiVecBool : 1;
- bool TypeSpecOwned : 1;
-
- // type-qualifiers
- unsigned TypeQualifiers : 3; // Bitwise OR of TQ.
-
- // function-specifier
- bool FS_inline_specified : 1;
- bool FS_virtual_specified : 1;
- bool FS_explicit_specified : 1;
-
- // friend-specifier
- bool Friend_specified : 1;
-
- // constexpr-specifier
- bool Constexpr_specified : 1;
-
- /*SCS*/unsigned StorageClassSpecAsWritten : 3;
-
- /// TypeRep - This contains action-specific information about a specific TST.
- /// For example, for a typedef or struct, it might contain the declaration for
- /// these.
- void *TypeRep;
-
- // attributes.
- AttributeList *AttrList;
-
- // Scope specifier for the type spec, if applicable.
- CXXScopeSpec TypeScope;
-
- // List of protocol qualifiers for objective-c classes. Used for
- // protocol-qualified interfaces "NString<foo>" and protocol-qualified id
- // "id<foo>".
- const ActionBase::DeclPtrTy *ProtocolQualifiers;
- unsigned NumProtocolQualifiers;
- SourceLocation ProtocolLAngleLoc;
- SourceLocation *ProtocolLocs;
-
- // SourceLocation info. These are null if the item wasn't specified or if
- // the setting was synthesized.
- SourceRange Range;
-
- SourceLocation StorageClassSpecLoc, SCS_threadLoc;
- SourceLocation TSWLoc, TSCLoc, TSSLoc, TSTLoc, AltiVecLoc;
- SourceRange TypeofParensRange;
- SourceLocation TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc;
- SourceLocation FS_inlineLoc, FS_virtualLoc, FS_explicitLoc;
- SourceLocation FriendLoc, ConstexprLoc;
-
- WrittenBuiltinSpecs writtenBS;
- void SaveWrittenBuiltinSpecs();
- void SaveStorageSpecifierAsWritten();
-
- DeclSpec(const DeclSpec&); // DO NOT IMPLEMENT
- void operator=(const DeclSpec&); // DO NOT IMPLEMENT
-public:
-
- DeclSpec()
- : StorageClassSpec(SCS_unspecified),
- SCS_thread_specified(false),
- SCS_extern_in_linkage_spec(false),
- TypeSpecWidth(TSW_unspecified),
- TypeSpecComplex(TSC_unspecified),
- TypeSpecSign(TSS_unspecified),
- TypeSpecType(TST_unspecified),
- TypeAltiVecVector(false),
- TypeAltiVecPixel(false),
- TypeAltiVecBool(false),
- TypeSpecOwned(false),
- TypeQualifiers(TSS_unspecified),
- FS_inline_specified(false),
- FS_virtual_specified(false),
- FS_explicit_specified(false),
- Friend_specified(false),
- Constexpr_specified(false),
- StorageClassSpecAsWritten(SCS_unspecified),
- TypeRep(0),
- AttrList(0),
- ProtocolQualifiers(0),
- NumProtocolQualifiers(0),
- ProtocolLocs(0),
- writtenBS() {
- }
- ~DeclSpec() {
- delete AttrList;
- delete [] ProtocolQualifiers;
- delete [] ProtocolLocs;
- }
- // storage-class-specifier
- SCS getStorageClassSpec() const { return (SCS)StorageClassSpec; }
- bool isThreadSpecified() const { return SCS_thread_specified; }
- bool isExternInLinkageSpec() const { return SCS_extern_in_linkage_spec; }
- void setExternInLinkageSpec(bool Value) {
- SCS_extern_in_linkage_spec = Value;
- }
-
- SourceLocation getStorageClassSpecLoc() const { return StorageClassSpecLoc; }
- SourceLocation getThreadSpecLoc() const { return SCS_threadLoc; }
-
- void ClearStorageClassSpecs() {
- StorageClassSpec = DeclSpec::SCS_unspecified;
- SCS_thread_specified = false;
- SCS_extern_in_linkage_spec = false;
- StorageClassSpecLoc = SourceLocation();
- SCS_threadLoc = SourceLocation();
- }
-
- // type-specifier
- TSW getTypeSpecWidth() const { return (TSW)TypeSpecWidth; }
- TSC getTypeSpecComplex() const { return (TSC)TypeSpecComplex; }
- TSS getTypeSpecSign() const { return (TSS)TypeSpecSign; }
- TST getTypeSpecType() const { return (TST)TypeSpecType; }
- bool isTypeAltiVecVector() const { return TypeAltiVecVector; }
- bool isTypeAltiVecPixel() const { return TypeAltiVecPixel; }
- bool isTypeAltiVecBool() const { return TypeAltiVecBool; }
- bool isTypeSpecOwned() const { return TypeSpecOwned; }
- void *getTypeRep() const { return TypeRep; }
- CXXScopeSpec &getTypeSpecScope() { return TypeScope; }
- const CXXScopeSpec &getTypeSpecScope() const { return TypeScope; }
-
- const SourceRange &getSourceRange() const { return Range; }
- SourceLocation getTypeSpecWidthLoc() const { return TSWLoc; }
- SourceLocation getTypeSpecComplexLoc() const { return TSCLoc; }
- SourceLocation getTypeSpecSignLoc() const { return TSSLoc; }
- SourceLocation getTypeSpecTypeLoc() const { return TSTLoc; }
- SourceLocation getAltiVecLoc() const { return AltiVecLoc; }
-
- SourceRange getTypeofParensRange() const { return TypeofParensRange; }
- void setTypeofParensRange(SourceRange range) { TypeofParensRange = range; }
-
- /// getSpecifierName - Turn a type-specifier-type into a string like "_Bool"
- /// or "union".
- static const char *getSpecifierName(DeclSpec::TST T);
- static const char *getSpecifierName(DeclSpec::TQ Q);
- static const char *getSpecifierName(DeclSpec::TSS S);
- static const char *getSpecifierName(DeclSpec::TSC C);
- static const char *getSpecifierName(DeclSpec::TSW W);
- static const char *getSpecifierName(DeclSpec::SCS S);
-
- // type-qualifiers
-
- /// getTypeQualifiers - Return a set of TQs.
- unsigned getTypeQualifiers() const { return TypeQualifiers; }
- SourceLocation getConstSpecLoc() const { return TQ_constLoc; }
- SourceLocation getRestrictSpecLoc() const { return TQ_restrictLoc; }
- SourceLocation getVolatileSpecLoc() const { return TQ_volatileLoc; }
-
- // function-specifier
- bool isInlineSpecified() const { return FS_inline_specified; }
- SourceLocation getInlineSpecLoc() const { return FS_inlineLoc; }
-
- bool isVirtualSpecified() const { return FS_virtual_specified; }
- SourceLocation getVirtualSpecLoc() const { return FS_virtualLoc; }
-
- bool isExplicitSpecified() const { return FS_explicit_specified; }
- SourceLocation getExplicitSpecLoc() const { return FS_explicitLoc; }
-
- void ClearFunctionSpecs() {
- FS_inline_specified = false;
- FS_inlineLoc = SourceLocation();
- FS_virtual_specified = false;
- FS_virtualLoc = SourceLocation();
- FS_explicit_specified = false;
- FS_explicitLoc = SourceLocation();
- }
-
- /// hasTypeSpecifier - Return true if any type-specifier has been found.
- bool hasTypeSpecifier() const {
- return getTypeSpecType() != DeclSpec::TST_unspecified ||
- getTypeSpecWidth() != DeclSpec::TSW_unspecified ||
- getTypeSpecComplex() != DeclSpec::TSC_unspecified ||
- getTypeSpecSign() != DeclSpec::TSS_unspecified;
- }
-
- /// getParsedSpecifiers - Return a bitmask of which flavors of specifiers this
- /// DeclSpec includes.
- ///
- unsigned getParsedSpecifiers() const;
-
- SCS getStorageClassSpecAsWritten() const {
- return (SCS)StorageClassSpecAsWritten;
- }
-
- /// isEmpty - Return true if this declaration specifier is completely empty:
- /// no tokens were parsed in the production of it.
- bool isEmpty() const {
- return getParsedSpecifiers() == DeclSpec::PQ_None;
- }
-
- void SetRangeStart(SourceLocation Loc) { Range.setBegin(Loc); }
- void SetRangeEnd(SourceLocation Loc) { Range.setEnd(Loc); }
-
- /// These methods set the specified attribute of the DeclSpec and
- /// return false if there was no error. If an error occurs (for
- /// example, if we tried to set "auto" on a spec with "extern"
- /// already set), they return true and set PrevSpec and DiagID
- /// such that
- /// Diag(Loc, DiagID) << PrevSpec;
- /// will yield a useful result.
- ///
- /// TODO: use a more general approach that still allows these
- /// diagnostics to be ignored when desired.
- bool SetStorageClassSpec(SCS S, SourceLocation Loc, const char *&PrevSpec,
- unsigned &DiagID);
- bool SetStorageClassSpecThread(SourceLocation Loc, const char *&PrevSpec,
- unsigned &DiagID);
- bool SetTypeSpecWidth(TSW W, SourceLocation Loc, const char *&PrevSpec,
- unsigned &DiagID);
- bool SetTypeSpecComplex(TSC C, SourceLocation Loc, const char *&PrevSpec,
- unsigned &DiagID);
- bool SetTypeSpecSign(TSS S, SourceLocation Loc, const char *&PrevSpec,
- unsigned &DiagID);
- bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec,
- unsigned &DiagID, void *Rep = 0, bool Owned = false);
- bool SetTypeAltiVecVector(bool isAltiVecVector, SourceLocation Loc,
- const char *&PrevSpec, unsigned &DiagID);
- bool SetTypeAltiVecPixel(bool isAltiVecPixel, SourceLocation Loc,
- const char *&PrevSpec, unsigned &DiagID);
- bool SetTypeSpecError();
- void UpdateTypeRep(void *Rep) { TypeRep = Rep; }
-
- bool SetTypeQual(TQ T, SourceLocation Loc, const char *&PrevSpec,
- unsigned &DiagID, const LangOptions &Lang);
-
- bool SetFunctionSpecInline(SourceLocation Loc, const char *&PrevSpec,
- unsigned &DiagID);
- bool SetFunctionSpecVirtual(SourceLocation Loc, const char *&PrevSpec,
- unsigned &DiagID);
- bool SetFunctionSpecExplicit(SourceLocation Loc, const char *&PrevSpec,
- unsigned &DiagID);
-
- bool SetFriendSpec(SourceLocation Loc, const char *&PrevSpec,
- unsigned &DiagID);
-
- bool SetConstexprSpec(SourceLocation Loc, const char *&PrevSpec,
- unsigned &DiagID);
-
- bool isFriendSpecified() const { return Friend_specified; }
- SourceLocation getFriendSpecLoc() const { return FriendLoc; }
-
- bool isConstexprSpecified() const { return Constexpr_specified; }
- SourceLocation getConstexprSpecLoc() const { return ConstexprLoc; }
-
- /// AddAttributes - contatenates two attribute lists.
- /// The GCC attribute syntax allows for the following:
- ///
- /// short __attribute__(( unused, deprecated ))
- /// int __attribute__(( may_alias, aligned(16) )) var;
- ///
- /// This declares 4 attributes using 2 lists. The following syntax is
- /// also allowed and equivalent to the previous declaration.
- ///
- /// short __attribute__((unused)) __attribute__((deprecated))
- /// int __attribute__((may_alias)) __attribute__((aligned(16))) var;
- ///
- void AddAttributes(AttributeList *alist) {
- AttrList = addAttributeLists(AttrList, alist);
- }
- void SetAttributes(AttributeList *AL) { AttrList = AL; }
- const AttributeList *getAttributes() const { return AttrList; }
- AttributeList *getAttributes() { return AttrList; }
-
- /// TakeAttributes - Return the current attribute list and remove them from
- /// the DeclSpec so that it doesn't own them.
- AttributeList *TakeAttributes() {
- AttributeList *AL = AttrList;
- AttrList = 0;
- return AL;
- }
-
- typedef const ActionBase::DeclPtrTy *ProtocolQualifierListTy;
- ProtocolQualifierListTy getProtocolQualifiers() const {
- return ProtocolQualifiers;
- }
- SourceLocation *getProtocolLocs() const { return ProtocolLocs; }
- unsigned getNumProtocolQualifiers() const {
- return NumProtocolQualifiers;
- }
- SourceLocation getProtocolLAngleLoc() const { return ProtocolLAngleLoc; }
- void setProtocolQualifiers(const ActionBase::DeclPtrTy *Protos, unsigned NP,
- SourceLocation *ProtoLocs,
- SourceLocation LAngleLoc);
-
- /// Finish - This does final analysis of the declspec, issuing diagnostics for
- /// things like "_Imaginary" (lacking an FP type). After calling this method,
- /// DeclSpec is guaranteed self-consistent, even if an error occurred.
- void Finish(Diagnostic &D, Preprocessor &PP);
-
- const WrittenBuiltinSpecs& getWrittenBuiltinSpecs() const {
- return writtenBS;
- }
-
- /// isMissingDeclaratorOk - This checks if this DeclSpec can stand alone,
- /// without a Declarator. Only tag declspecs can stand alone.
- bool isMissingDeclaratorOk();
-};
-
-/// ObjCDeclSpec - This class captures information about
-/// "declaration specifiers" specific to objective-c
-class ObjCDeclSpec {
-public:
- /// ObjCDeclQualifier - Qualifier used on types in method declarations
- enum ObjCDeclQualifier {
- DQ_None = 0x0,
- DQ_In = 0x1,
- DQ_Inout = 0x2,
- DQ_Out = 0x4,
- DQ_Bycopy = 0x8,
- DQ_Byref = 0x10,
- DQ_Oneway = 0x20
- };
-
- /// PropertyAttributeKind - list of property attributes.
- enum ObjCPropertyAttributeKind { DQ_PR_noattr = 0x0,
- DQ_PR_readonly = 0x01,
- DQ_PR_getter = 0x02,
- DQ_PR_assign = 0x04,
- DQ_PR_readwrite = 0x08,
- DQ_PR_retain = 0x10,
- DQ_PR_copy = 0x20,
- DQ_PR_nonatomic = 0x40,
- DQ_PR_setter = 0x80
- };
-
-
- ObjCDeclSpec()
- : objcDeclQualifier(DQ_None), PropertyAttributes(DQ_PR_noattr),
- GetterName(0), SetterName(0) { }
- ObjCDeclQualifier getObjCDeclQualifier() const { return objcDeclQualifier; }
- void setObjCDeclQualifier(ObjCDeclQualifier DQVal) {
- objcDeclQualifier = (ObjCDeclQualifier) (objcDeclQualifier | DQVal);
- }
-
- ObjCPropertyAttributeKind getPropertyAttributes() const {
- return ObjCPropertyAttributeKind(PropertyAttributes);
- }
- void setPropertyAttributes(ObjCPropertyAttributeKind PRVal) {
- PropertyAttributes =
- (ObjCPropertyAttributeKind)(PropertyAttributes | PRVal);
- }
-
- const IdentifierInfo *getGetterName() const { return GetterName; }
- IdentifierInfo *getGetterName() { return GetterName; }
- void setGetterName(IdentifierInfo *name) { GetterName = name; }
-
- const IdentifierInfo *getSetterName() const { return SetterName; }
- IdentifierInfo *getSetterName() { return SetterName; }
- void setSetterName(IdentifierInfo *name) { SetterName = name; }
-private:
- // FIXME: These two are unrelated and mutially exclusive. So perhaps
- // we can put them in a union to reflect their mutual exclusiveness
- // (space saving is negligible).
- ObjCDeclQualifier objcDeclQualifier : 6;
-
- // NOTE: VC++ treats enums as signed, avoid using ObjCPropertyAttributeKind
- unsigned PropertyAttributes : 8;
- IdentifierInfo *GetterName; // getter name of NULL if no getter
- IdentifierInfo *SetterName; // setter name of NULL if no setter
-};
-
-/// \brief Represents a C++ unqualified-id that has been parsed.
-class UnqualifiedId {
-private:
- const UnqualifiedId &operator=(const UnqualifiedId &); // DO NOT IMPLEMENT
-
-public:
- /// \brief Describes the kind of unqualified-id parsed.
- enum IdKind {
- /// \brief An identifier.
- IK_Identifier,
- /// \brief An overloaded operator name, e.g., operator+.
- IK_OperatorFunctionId,
- /// \brief A conversion function name, e.g., operator int.
- IK_ConversionFunctionId,
- /// \brief A user-defined literal name, e.g., operator "" _i.
- IK_LiteralOperatorId,
- /// \brief A constructor name.
- IK_ConstructorName,
- /// \brief A constructor named via a template-id.
- IK_ConstructorTemplateId,
- /// \brief A destructor name.
- IK_DestructorName,
- /// \brief A template-id, e.g., f<int>.
- IK_TemplateId
- } Kind;
-
- /// \brief Anonymous union that holds extra data associated with the
- /// parsed unqualified-id.
- union {
- /// \brief When Kind == IK_Identifier, the parsed identifier, or when Kind
- /// == IK_UserLiteralId, the identifier suffix.
- IdentifierInfo *Identifier;
-
- /// \brief When Kind == IK_OperatorFunctionId, the overloaded operator
- /// that we parsed.
- struct {
- /// \brief The kind of overloaded operator.
- OverloadedOperatorKind Operator;
-
- /// \brief The source locations of the individual tokens that name
- /// the operator, e.g., the "new", "[", and "]" tokens in
- /// operator new [].
- ///
- /// Different operators have different numbers of tokens in their name,
- /// up to three. Any remaining source locations in this array will be
- /// set to an invalid value for operators with fewer than three tokens.
- unsigned SymbolLocations[3];
- } OperatorFunctionId;
-
- /// \brief When Kind == IK_ConversionFunctionId, the type that the
- /// conversion function names.
- ActionBase::TypeTy *ConversionFunctionId;
-
- /// \brief When Kind == IK_ConstructorName, the class-name of the type
- /// whose constructor is being referenced.
- ActionBase::TypeTy *ConstructorName;
-
- /// \brief When Kind == IK_DestructorName, the type referred to by the
- /// class-name.
- ActionBase::TypeTy *DestructorName;
-
- /// \brief When Kind == IK_TemplateId or IK_ConstructorTemplateId,
- /// the template-id annotation that contains the template name and
- /// template arguments.
- TemplateIdAnnotation *TemplateId;
- };
-
- /// \brief The location of the first token that describes this unqualified-id,
- /// which will be the location of the identifier, "operator" keyword,
- /// tilde (for a destructor), or the template name of a template-id.
- SourceLocation StartLocation;
-
- /// \brief The location of the last token that describes this unqualified-id.
- SourceLocation EndLocation;
-
- UnqualifiedId() : Kind(IK_Identifier), Identifier(0) { }
-
- /// \brief Do not use this copy constructor. It is temporary, and only
- /// exists because we are holding FieldDeclarators in a SmallVector when we
- /// don't actually need them.
- ///
- /// FIXME: Kill this copy constructor.
- UnqualifiedId(const UnqualifiedId &Other)
- : Kind(IK_Identifier), Identifier(Other.Identifier),
- StartLocation(Other.StartLocation), EndLocation(Other.EndLocation) {
- assert(Other.Kind == IK_Identifier && "Cannot copy non-identifiers");
- }
-
- /// \brief Destroy this unqualified-id.
- ~UnqualifiedId() { clear(); }
-
- /// \brief Clear out this unqualified-id, setting it to default (invalid)
- /// state.
- void clear();
-
- /// \brief Determine whether this unqualified-id refers to a valid name.
- bool isValid() const { return StartLocation.isValid(); }
-
- /// \brief Determine whether this unqualified-id refers to an invalid name.
- bool isInvalid() const { return !isValid(); }
-
- /// \brief Determine what kind of name we have.
- IdKind getKind() const { return Kind; }
-
- /// \brief Specify that this unqualified-id was parsed as an identifier.
- ///
- /// \param Id the parsed identifier.
- /// \param IdLoc the location of the parsed identifier.
- void setIdentifier(const IdentifierInfo *Id, SourceLocation IdLoc) {
- Kind = IK_Identifier;
- Identifier = const_cast<IdentifierInfo *>(Id);
- StartLocation = EndLocation = IdLoc;
- }
-
- /// \brief Specify that this unqualified-id was parsed as an
- /// operator-function-id.
- ///
- /// \param OperatorLoc the location of the 'operator' keyword.
- ///
- /// \param Op the overloaded operator.
- ///
- /// \param SymbolLocations the locations of the individual operator symbols
- /// in the operator.
- void setOperatorFunctionId(SourceLocation OperatorLoc,
- OverloadedOperatorKind Op,
- SourceLocation SymbolLocations[3]);
-
- /// \brief Specify that this unqualified-id was parsed as a
- /// conversion-function-id.
- ///
- /// \param OperatorLoc the location of the 'operator' keyword.
- ///
- /// \param Ty the type to which this conversion function is converting.
- ///
- /// \param EndLoc the location of the last token that makes up the type name.
- void setConversionFunctionId(SourceLocation OperatorLoc,
- ActionBase::TypeTy *Ty,
- SourceLocation EndLoc) {
- Kind = IK_ConversionFunctionId;
- StartLocation = OperatorLoc;
- EndLocation = EndLoc;
- ConversionFunctionId = Ty;
- }
-
- /// \brief Specific that this unqualified-id was parsed as a
- /// literal-operator-id.
- ///
- /// \param Id the parsed identifier.
- ///
- /// \param OpLoc the location of the 'operator' keyword.
- ///
- /// \param IdLoc the location of the identifier.
- void setLiteralOperatorId(const IdentifierInfo *Id, SourceLocation OpLoc,
- SourceLocation IdLoc) {
- Kind = IK_LiteralOperatorId;
- Identifier = const_cast<IdentifierInfo *>(Id);
- StartLocation = OpLoc;
- EndLocation = IdLoc;
- }
-
- /// \brief Specify that this unqualified-id was parsed as a constructor name.
- ///
- /// \param ClassType the class type referred to by the constructor name.
- ///
- /// \param ClassNameLoc the location of the class name.
- ///
- /// \param EndLoc the location of the last token that makes up the type name.
- void setConstructorName(ActionBase::TypeTy *ClassType,
- SourceLocation ClassNameLoc,
- SourceLocation EndLoc) {
- Kind = IK_ConstructorName;
- StartLocation = ClassNameLoc;
- EndLocation = EndLoc;
- ConstructorName = ClassType;
- }
-
- /// \brief Specify that this unqualified-id was parsed as a
- /// template-id that names a constructor.
- ///
- /// \param TemplateId the template-id annotation that describes the parsed
- /// template-id. This UnqualifiedId instance will take ownership of the
- /// \p TemplateId and will free it on destruction.
- void setConstructorTemplateId(TemplateIdAnnotation *TemplateId);
-
- /// \brief Specify that this unqualified-id was parsed as a destructor name.
- ///
- /// \param TildeLoc the location of the '~' that introduces the destructor
- /// name.
- ///
- /// \param ClassType the name of the class referred to by the destructor name.
- void setDestructorName(SourceLocation TildeLoc, ActionBase::TypeTy *ClassType,
- SourceLocation EndLoc) {
- Kind = IK_DestructorName;
- StartLocation = TildeLoc;
- EndLocation = EndLoc;
- DestructorName = ClassType;
- }
-
- /// \brief Specify that this unqualified-id was parsed as a template-id.
- ///
- /// \param TemplateId the template-id annotation that describes the parsed
- /// template-id. This UnqualifiedId instance will take ownership of the
- /// \p TemplateId and will free it on destruction.
- void setTemplateId(TemplateIdAnnotation *TemplateId);
-
- /// \brief Return the source range that covers this unqualified-id.
- SourceRange getSourceRange() const {
- return SourceRange(StartLocation, EndLocation);
- }
-};
-
-/// CachedTokens - A set of tokens that has been cached for later
-/// parsing.
-typedef llvm::SmallVector<Token, 4> CachedTokens;
-
-/// DeclaratorChunk - One instance of this struct is used for each type in a
-/// declarator that is parsed.
-///
-/// This is intended to be a small value object.
-struct DeclaratorChunk {
- enum {
- Pointer, Reference, Array, Function, BlockPointer, MemberPointer
- } Kind;
-
- /// Loc - The place where this type was defined.
- SourceLocation Loc;
- /// EndLoc - If valid, the place where this chunck ends.
- SourceLocation EndLoc;
-
- struct PointerTypeInfo {
- /// The type qualifiers: const/volatile/restrict.
- unsigned TypeQuals : 3;
- AttributeList *AttrList;
- void destroy() {
- delete AttrList;
- }
- };
-
- struct ReferenceTypeInfo {
- /// The type qualifier: restrict. [GNU] C++ extension
- bool HasRestrict : 1;
- /// True if this is an lvalue reference, false if it's an rvalue reference.
- bool LValueRef : 1;
- AttributeList *AttrList;
- void destroy() {
- delete AttrList;
- }
- };
-
- struct ArrayTypeInfo {
- /// The type qualifiers for the array: const/volatile/restrict.
- unsigned TypeQuals : 3;
-
- /// True if this dimension included the 'static' keyword.
- bool hasStatic : 1;
-
- /// True if this dimension was [*]. In this case, NumElts is null.
- bool isStar : 1;
-
- /// This is the size of the array, or null if [] or [*] was specified.
- /// Since the parser is multi-purpose, and we don't want to impose a root
- /// expression class on all clients, NumElts is untyped.
- ActionBase::ExprTy *NumElts;
- void destroy() {}
- };
-
- /// ParamInfo - An array of paraminfo objects is allocated whenever a function
- /// declarator is parsed. There are two interesting styles of arguments here:
- /// K&R-style identifier lists and parameter type lists. K&R-style identifier
- /// lists will have information about the identifier, but no type information.
- /// Parameter type lists will have type info (if the actions module provides
- /// it), but may have null identifier info: e.g. for 'void foo(int X, int)'.
- struct ParamInfo {
- IdentifierInfo *Ident;
- SourceLocation IdentLoc;
- ActionBase::DeclPtrTy Param;
-
- /// DefaultArgTokens - When the parameter's default argument
- /// cannot be parsed immediately (because it occurs within the
- /// declaration of a member function), it will be stored here as a
- /// sequence of tokens to be parsed once the class definition is
- /// complete. Non-NULL indicates that there is a default argument.
- CachedTokens *DefaultArgTokens;
-
- ParamInfo() {}
- ParamInfo(IdentifierInfo *ident, SourceLocation iloc,
- ActionBase::DeclPtrTy param,
- CachedTokens *DefArgTokens = 0)
- : Ident(ident), IdentLoc(iloc), Param(param),
- DefaultArgTokens(DefArgTokens) {}
- };
-
- struct TypeAndRange {
- ActionBase::TypeTy *Ty;
- SourceRange Range;
- };
-
- struct FunctionTypeInfo {
- /// hasPrototype - This is true if the function had at least one typed
- /// argument. If the function is () or (a,b,c), then it has no prototype,
- /// and is treated as a K&R-style function.
- bool hasPrototype : 1;
-
- /// isVariadic - If this function has a prototype, and if that
- /// proto ends with ',...)', this is true. When true, EllipsisLoc
- /// contains the location of the ellipsis.
- bool isVariadic : 1;
-
- /// The type qualifiers: const/volatile/restrict.
- /// The qualifier bitmask values are the same as in QualType.
- unsigned TypeQuals : 3;
-
- /// hasExceptionSpec - True if the function has an exception specification.
- bool hasExceptionSpec : 1;
-
- /// hasAnyExceptionSpec - True if the function has a throw(...) specifier.
- bool hasAnyExceptionSpec : 1;
-
- /// DeleteArgInfo - If this is true, we need to delete[] ArgInfo.
- bool DeleteArgInfo : 1;
-
- /// When isVariadic is true, the location of the ellipsis in the source.
- unsigned EllipsisLoc;
-
- /// NumArgs - This is the number of formal arguments provided for the
- /// declarator.
- unsigned NumArgs;
-
- /// NumExceptions - This is the number of types in the exception-decl, if
- /// the function has one.
- unsigned NumExceptions;
-
- /// ThrowLoc - When hasExceptionSpec is true, the location of the throw
- /// keyword introducing the spec.
- unsigned ThrowLoc;
-
- /// ArgInfo - This is a pointer to a new[]'d array of ParamInfo objects that
- /// describe the arguments for this function declarator. This is null if
- /// there are no arguments specified.
- ParamInfo *ArgInfo;
-
- /// Exceptions - This is a pointer to a new[]'d array of TypeAndRange
- /// objects that contain the types in the function's exception
- /// specification and their locations.
- TypeAndRange *Exceptions;
-
- /// freeArgs - reset the argument list to having zero arguments. This is
- /// used in various places for error recovery.
- void freeArgs() {
- if (DeleteArgInfo) {
- delete[] ArgInfo;
- DeleteArgInfo = false;
- }
- NumArgs = 0;
- }
-
- void destroy() {
- if (DeleteArgInfo)
- delete[] ArgInfo;
- delete[] Exceptions;
- }
-
- /// isKNRPrototype - Return true if this is a K&R style identifier list,
- /// like "void foo(a,b,c)". In a function definition, this will be followed
- /// by the argument type definitions.
- bool isKNRPrototype() const {
- return !hasPrototype && NumArgs != 0;
- }
-
- SourceLocation getEllipsisLoc() const {
- return SourceLocation::getFromRawEncoding(EllipsisLoc);
- }
- SourceLocation getThrowLoc() const {
- return SourceLocation::getFromRawEncoding(ThrowLoc);
- }
- };
-
- struct BlockPointerTypeInfo {
- /// For now, sema will catch these as invalid.
- /// The type qualifiers: const/volatile/restrict.
- unsigned TypeQuals : 3;
- AttributeList *AttrList;
- void destroy() {
- delete AttrList;
- }
- };
-
- struct MemberPointerTypeInfo {
- /// The type qualifiers: const/volatile/restrict.
- unsigned TypeQuals : 3;
- AttributeList *AttrList;
- // CXXScopeSpec has a constructor, so it can't be a direct member.
- // So we need some pointer-aligned storage and a bit of trickery.
- union {
- void *Aligner;
- char Mem[sizeof(CXXScopeSpec)];
- } ScopeMem;
- CXXScopeSpec &Scope() {
- return *reinterpret_cast<CXXScopeSpec*>(ScopeMem.Mem);
- }
- const CXXScopeSpec &Scope() const {
- return *reinterpret_cast<const CXXScopeSpec*>(ScopeMem.Mem);
- }
- void destroy() {
- delete AttrList;
- Scope().~CXXScopeSpec();
- }
- };
-
- union {
- PointerTypeInfo Ptr;
- ReferenceTypeInfo Ref;
- ArrayTypeInfo Arr;
- FunctionTypeInfo Fun;
- BlockPointerTypeInfo Cls;
- MemberPointerTypeInfo Mem;
- };
-
- void destroy() {
- switch (Kind) {
- default: assert(0 && "Unknown decl type!");
- case DeclaratorChunk::Function: return Fun.destroy();
- case DeclaratorChunk::Pointer: return Ptr.destroy();
- case DeclaratorChunk::BlockPointer: return Cls.destroy();
- case DeclaratorChunk::Reference: return Ref.destroy();
- case DeclaratorChunk::Array: return Arr.destroy();
- case DeclaratorChunk::MemberPointer: return Mem.destroy();
- }
- }
-
- /// getAttrs - If there are attributes applied to this declaratorchunk, return
- /// them.
- const AttributeList *getAttrs() const {
- switch (Kind) {
- default: assert(0 && "Unknown declarator kind!");
- case Pointer: return Ptr.AttrList;
- case Reference: return Ref.AttrList;
- case MemberPointer: return Mem.AttrList;
- case Array: return 0;
- case Function: return 0;
- case BlockPointer: return Cls.AttrList;
- }
- }
-
-
- /// getPointer - Return a DeclaratorChunk for a pointer.
- ///
- static DeclaratorChunk getPointer(unsigned TypeQuals, SourceLocation Loc,
- AttributeList *AL) {
- DeclaratorChunk I;
- I.Kind = Pointer;
- I.Loc = Loc;
- I.Ptr.TypeQuals = TypeQuals;
- I.Ptr.AttrList = AL;
- return I;
- }
-
- /// getReference - Return a DeclaratorChunk for a reference.
- ///
- static DeclaratorChunk getReference(unsigned TypeQuals, SourceLocation Loc,
- AttributeList *AL, bool lvalue) {
- DeclaratorChunk I;
- I.Kind = Reference;
- I.Loc = Loc;
- I.Ref.HasRestrict = (TypeQuals & DeclSpec::TQ_restrict) != 0;
- I.Ref.LValueRef = lvalue;
- I.Ref.AttrList = AL;
- return I;
- }
-
- /// getArray - Return a DeclaratorChunk for an array.
- ///
- static DeclaratorChunk getArray(unsigned TypeQuals, bool isStatic,
- bool isStar, void *NumElts,
- SourceLocation LBLoc, SourceLocation RBLoc) {
- DeclaratorChunk I;
- I.Kind = Array;
- I.Loc = LBLoc;
- I.EndLoc = RBLoc;
- I.Arr.TypeQuals = TypeQuals;
- I.Arr.hasStatic = isStatic;
- I.Arr.isStar = isStar;
- I.Arr.NumElts = NumElts;
- return I;
- }
-
- /// DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.
- /// "TheDeclarator" is the declarator that this will be added to.
- static DeclaratorChunk getFunction(bool hasProto, bool isVariadic,
- SourceLocation EllipsisLoc,
- ParamInfo *ArgInfo, unsigned NumArgs,
- unsigned TypeQuals, bool hasExceptionSpec,
- SourceLocation ThrowLoc,
- bool hasAnyExceptionSpec,
- ActionBase::TypeTy **Exceptions,
- SourceRange *ExceptionRanges,
- unsigned NumExceptions,
- SourceLocation LPLoc, SourceLocation RPLoc,
- Declarator &TheDeclarator);
-
- /// getBlockPointer - Return a DeclaratorChunk for a block.
- ///
- static DeclaratorChunk getBlockPointer(unsigned TypeQuals, SourceLocation Loc,
- AttributeList *AL) {
- DeclaratorChunk I;
- I.Kind = BlockPointer;
- I.Loc = Loc;
- I.Cls.TypeQuals = TypeQuals;
- I.Cls.AttrList = AL;
- return I;
- }
-
- static DeclaratorChunk getMemberPointer(const CXXScopeSpec &SS,
- unsigned TypeQuals,
- SourceLocation Loc,
- AttributeList *AL) {
- DeclaratorChunk I;
- I.Kind = MemberPointer;
- I.Loc = Loc;
- I.Mem.TypeQuals = TypeQuals;
- I.Mem.AttrList = AL;
- new (I.Mem.ScopeMem.Mem) CXXScopeSpec(SS);
- return I;
- }
-};
-
-/// Declarator - Information about one declarator, including the parsed type
-/// information and the identifier. When the declarator is fully formed, this
-/// is turned into the appropriate Decl object.
-///
-/// Declarators come in two types: normal declarators and abstract declarators.
-/// Abstract declarators are used when parsing types, and don't have an
-/// identifier. Normal declarators do have ID's.
-///
-/// Instances of this class should be a transient object that lives on the
-/// stack, not objects that are allocated in large quantities on the heap.
-class Declarator {
-public:
- enum TheContext {
- FileContext, // File scope declaration.
- PrototypeContext, // Within a function prototype.
- KNRTypeListContext, // K&R type definition list for formals.
- TypeNameContext, // Abstract declarator for types.
- MemberContext, // Struct/Union field.
- BlockContext, // Declaration within a block in a function.
- ForContext, // Declaration within first part of a for loop.
- ConditionContext, // Condition declaration in a C++ if/switch/while/for.
- TemplateParamContext,// Within a template parameter list.
- CXXCatchContext, // C++ catch exception-declaration
- BlockLiteralContext // Block literal declarator.
- };
-
-private:
- const DeclSpec &DS;
- CXXScopeSpec SS;
- UnqualifiedId Name;
- SourceRange Range;
-
- /// Context - Where we are parsing this declarator.
- ///
- TheContext Context;
-
- /// DeclTypeInfo - This holds each type that the declarator includes as it is
- /// parsed. This is pushed from the identifier out, which means that element
- /// #0 will be the most closely bound to the identifier, and
- /// DeclTypeInfo.back() will be the least closely bound.
- llvm::SmallVector<DeclaratorChunk, 8> DeclTypeInfo;
-
- /// InvalidType - Set by Sema::GetTypeForDeclarator().
- bool InvalidType : 1;
-
- /// GroupingParens - Set by Parser::ParseParenDeclarator().
- bool GroupingParens : 1;
-
- /// AttrList - Attributes.
- AttributeList *AttrList;
-
- /// AsmLabel - The asm label, if specified.
- ActionBase::ExprTy *AsmLabel;
-
- /// InlineParams - This is a local array used for the first function decl
- /// chunk to avoid going to the heap for the common case when we have one
- /// function chunk in the declarator.
- DeclaratorChunk::ParamInfo InlineParams[16];
- bool InlineParamsUsed;
-
- /// Extension - true if the declaration is preceded by __extension__.
- bool Extension : 1;
-
- friend struct DeclaratorChunk;
-
-public:
- Declarator(const DeclSpec &ds, TheContext C)
- : DS(ds), Range(ds.getSourceRange()), Context(C),
- InvalidType(DS.getTypeSpecType() == DeclSpec::TST_error),
- GroupingParens(false), AttrList(0), AsmLabel(0),
- InlineParamsUsed(false), Extension(false) {
- }
-
- ~Declarator() {
- clear();
- }
-
- /// getDeclSpec - Return the declaration-specifier that this declarator was
- /// declared with.
- const DeclSpec &getDeclSpec() const { return DS; }
-
- /// getMutableDeclSpec - Return a non-const version of the DeclSpec. This
- /// should be used with extreme care: declspecs can often be shared between
- /// multiple declarators, so mutating the DeclSpec affects all of the
- /// Declarators. This should only be done when the declspec is known to not
- /// be shared or when in error recovery etc.
- DeclSpec &getMutableDeclSpec() { return const_cast<DeclSpec &>(DS); }
-
- /// getCXXScopeSpec - Return the C++ scope specifier (global scope or
- /// nested-name-specifier) that is part of the declarator-id.
- const CXXScopeSpec &getCXXScopeSpec() const { return SS; }
- CXXScopeSpec &getCXXScopeSpec() { return SS; }
-
- /// \brief Retrieve the name specified by this declarator.
- UnqualifiedId &getName() { return Name; }
-
- TheContext getContext() const { return Context; }
-
- /// getSourceRange - Get the source range that spans this declarator.
- const SourceRange &getSourceRange() const { return Range; }
-
- void SetSourceRange(SourceRange R) { Range = R; }
- /// SetRangeBegin - Set the start of the source range to Loc, unless it's
- /// invalid.
- void SetRangeBegin(SourceLocation Loc) {
- if (!Loc.isInvalid())
- Range.setBegin(Loc);
- }
- /// SetRangeEnd - Set the end of the source range to Loc, unless it's invalid.
- void SetRangeEnd(SourceLocation Loc) {
- if (!Loc.isInvalid())
- Range.setEnd(Loc);
- }
- /// ExtendWithDeclSpec - Extend the declarator source range to include the
- /// given declspec, unless its location is invalid. Adopts the range start if
- /// the current range start is invalid.
- void ExtendWithDeclSpec(const DeclSpec &DS) {
- const SourceRange &SR = DS.getSourceRange();
- if (Range.getBegin().isInvalid())
- Range.setBegin(SR.getBegin());
- if (!SR.getEnd().isInvalid())
- Range.setEnd(SR.getEnd());
- }
-
- /// clear - Reset the contents of this Declarator.
- void clear() {
- SS.clear();
- Name.clear();
- Range = DS.getSourceRange();
-
- for (unsigned i = 0, e = DeclTypeInfo.size(); i != e; ++i)
- DeclTypeInfo[i].destroy();
- DeclTypeInfo.clear();
- delete AttrList;
- AttrList = 0;
- AsmLabel = 0;
- InlineParamsUsed = false;
- }
-
- /// mayOmitIdentifier - Return true if the identifier is either optional or
- /// not allowed. This is true for typenames, prototypes, and template
- /// parameter lists.
- bool mayOmitIdentifier() const {
- return Context == TypeNameContext || Context == PrototypeContext ||
- Context == TemplateParamContext || Context == CXXCatchContext ||
- Context == BlockLiteralContext;
- }
-
- /// mayHaveIdentifier - Return true if the identifier is either optional or
- /// required. This is true for normal declarators and prototypes, but not
- /// typenames.
- bool mayHaveIdentifier() const {
- return Context != TypeNameContext && Context != BlockLiteralContext;
- }
-
- /// mayBeFollowedByCXXDirectInit - Return true if the declarator can be
- /// followed by a C++ direct initializer, e.g. "int x(1);".
- bool mayBeFollowedByCXXDirectInit() const {
- return !hasGroupingParens() &&
- (Context == FileContext ||
- Context == BlockContext ||
- Context == ForContext);
- }
-
- /// isPastIdentifier - Return true if we have parsed beyond the point where
- /// the
- bool isPastIdentifier() const { return Name.isValid(); }
-
- /// hasName - Whether this declarator has a name, which might be an
- /// identifier (accessible via getIdentifier()) or some kind of
- /// special C++ name (constructor, destructor, etc.).
- bool hasName() const {
- return Name.getKind() != UnqualifiedId::IK_Identifier || Name.Identifier;
- }
-
- IdentifierInfo *getIdentifier() const {
- if (Name.getKind() == UnqualifiedId::IK_Identifier)
- return Name.Identifier;
-
- return 0;
- }
- SourceLocation getIdentifierLoc() const { return Name.StartLocation; }
-
- /// \brief Set the name of this declarator to be the given identifier.
- void SetIdentifier(IdentifierInfo *Id, SourceLocation IdLoc) {
- Name.setIdentifier(Id, IdLoc);
- }
-
- /// AddTypeInfo - Add a chunk to this declarator. Also extend the range to
- /// EndLoc, which should be the last token of the chunk.
- void AddTypeInfo(const DeclaratorChunk &TI, SourceLocation EndLoc) {
- DeclTypeInfo.push_back(TI);
- if (!EndLoc.isInvalid())
- SetRangeEnd(EndLoc);
- }
-
- /// getNumTypeObjects() - Return the number of types applied to this
- /// declarator.
- unsigned getNumTypeObjects() const { return DeclTypeInfo.size(); }
-
- /// Return the specified TypeInfo from this declarator. TypeInfo #0 is
- /// closest to the identifier.
- const DeclaratorChunk &getTypeObject(unsigned i) const {
- assert(i < DeclTypeInfo.size() && "Invalid type chunk");
- return DeclTypeInfo[i];
- }
- DeclaratorChunk &getTypeObject(unsigned i) {
- assert(i < DeclTypeInfo.size() && "Invalid type chunk");
- return DeclTypeInfo[i];
- }
-
- void DropFirstTypeObject()
- {
- assert(!DeclTypeInfo.empty() && "No type chunks to drop.");
- DeclTypeInfo.front().destroy();
- DeclTypeInfo.erase(DeclTypeInfo.begin());
- }
-
- /// isFunctionDeclarator - Once this declarator is fully parsed and formed,
- /// this method returns true if the identifier is a function declarator.
- bool isFunctionDeclarator() const {
- return !DeclTypeInfo.empty() &&
- DeclTypeInfo[0].Kind == DeclaratorChunk::Function;
- }
-
- /// AddAttributes - simply adds the attribute list to the Declarator.
- /// These examples both add 3 attributes to "var":
- /// short int var __attribute__((aligned(16),common,deprecated));
- /// short int x, __attribute__((aligned(16)) var
- /// __attribute__((common,deprecated));
- ///
- /// Also extends the range of the declarator.
- void AddAttributes(AttributeList *alist, SourceLocation LastLoc) {
- AttrList = addAttributeLists(AttrList, alist);
-
- if (!LastLoc.isInvalid())
- SetRangeEnd(LastLoc);
- }
-
- const AttributeList *getAttributes() const { return AttrList; }
- AttributeList *getAttributes() { return AttrList; }
-
- /// hasAttributes - do we contain any attributes?
- bool hasAttributes() const {
- if (getAttributes() || getDeclSpec().getAttributes()) return true;
- for (unsigned i = 0, e = getNumTypeObjects(); i != e; ++i)
- if (getTypeObject(i).getAttrs())
- return true;
- return false;
- }
-
- void setAsmLabel(ActionBase::ExprTy *E) { AsmLabel = E; }
- ActionBase::ExprTy *getAsmLabel() const { return AsmLabel; }
-
- void setExtension(bool Val = true) { Extension = Val; }
- bool getExtension() const { return Extension; }
-
- void setInvalidType(bool Val = true) { InvalidType = Val; }
- bool isInvalidType() const {
- return InvalidType || DS.getTypeSpecType() == DeclSpec::TST_error;
- }
-
- void setGroupingParens(bool flag) { GroupingParens = flag; }
- bool hasGroupingParens() const { return GroupingParens; }
-};
-
-/// FieldDeclarator - This little struct is used to capture information about
-/// structure field declarators, which is basically just a bitfield size.
-struct FieldDeclarator {
- Declarator D;
- ActionBase::ExprTy *BitfieldSize;
- explicit FieldDeclarator(DeclSpec &DS) : D(DS, Declarator::MemberContext) {
- BitfieldSize = 0;
- }
-};
-
-} // end namespace clang
-
-#endif
Removed: cfe/trunk/include/clang/Parse/Designator.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Designator.h?rev=111666&view=auto
==============================================================================
--- cfe/trunk/include/clang/Parse/Designator.h (original)
+++ cfe/trunk/include/clang/Parse/Designator.h (removed)
@@ -1,239 +0,0 @@
-//===--- Designator.h - Initialization Designator ---------------*- 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 interfaces used to represent Designators in the parser and
-// is the input to Actions module.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_PARSE_DESIGNATOR_H
-#define LLVM_CLANG_PARSE_DESIGNATOR_H
-
-#include "clang/Parse/Action.h"
-
-namespace clang {
-
-/// Designator - This class is a discriminated union which holds the various
-/// different sorts of designators possible. A Designation is an array of
-/// these. An example of a designator are things like this:
-/// [8] .field [47] // C99 designation: 3 designators
-/// [8 ... 47] field: // GNU extensions: 2 designators
-/// These occur in initializers, e.g.:
-/// int a[10] = {2, 4, [8]=9, 10};
-///
-class Designator {
-public:
- enum DesignatorKind {
- FieldDesignator, ArrayDesignator, ArrayRangeDesignator
- };
-private:
- DesignatorKind Kind;
-
- struct FieldDesignatorInfo {
- const IdentifierInfo *II;
- unsigned DotLoc;
- unsigned NameLoc;
- };
- struct ArrayDesignatorInfo {
- ActionBase::ExprTy *Index;
- unsigned LBracketLoc;
- mutable unsigned RBracketLoc;
- };
- struct ArrayRangeDesignatorInfo {
- ActionBase::ExprTy *Start, *End;
- unsigned LBracketLoc, EllipsisLoc;
- mutable unsigned RBracketLoc;
- };
-
- union {
- FieldDesignatorInfo FieldInfo;
- ArrayDesignatorInfo ArrayInfo;
- ArrayRangeDesignatorInfo ArrayRangeInfo;
- };
-
-public:
-
- DesignatorKind getKind() const { return Kind; }
- bool isFieldDesignator() const { return Kind == FieldDesignator; }
- bool isArrayDesignator() const { return Kind == ArrayDesignator; }
- bool isArrayRangeDesignator() const { return Kind == ArrayRangeDesignator; }
-
- const IdentifierInfo *getField() const {
- assert(isFieldDesignator() && "Invalid accessor");
- return FieldInfo.II;
- }
-
- SourceLocation getDotLoc() const {
- assert(isFieldDesignator() && "Invalid accessor");
- return SourceLocation::getFromRawEncoding(FieldInfo.DotLoc);
- }
-
- SourceLocation getFieldLoc() const {
- assert(isFieldDesignator() && "Invalid accessor");
- return SourceLocation::getFromRawEncoding(FieldInfo.NameLoc);
- }
-
- ActionBase::ExprTy *getArrayIndex() const {
- assert(isArrayDesignator() && "Invalid accessor");
- return ArrayInfo.Index;
- }
-
- ActionBase::ExprTy *getArrayRangeStart() const {
- assert(isArrayRangeDesignator() && "Invalid accessor");
- return ArrayRangeInfo.Start;
- }
- ActionBase::ExprTy *getArrayRangeEnd() const {
- assert(isArrayRangeDesignator() && "Invalid accessor");
- return ArrayRangeInfo.End;
- }
-
- SourceLocation getLBracketLoc() const {
- assert((isArrayDesignator() || isArrayRangeDesignator()) &&
- "Invalid accessor");
- if (isArrayDesignator())
- return SourceLocation::getFromRawEncoding(ArrayInfo.LBracketLoc);
- else
- return SourceLocation::getFromRawEncoding(ArrayRangeInfo.LBracketLoc);
- }
-
- SourceLocation getRBracketLoc() const {
- assert((isArrayDesignator() || isArrayRangeDesignator()) &&
- "Invalid accessor");
- if (isArrayDesignator())
- return SourceLocation::getFromRawEncoding(ArrayInfo.RBracketLoc);
- else
- return SourceLocation::getFromRawEncoding(ArrayRangeInfo.RBracketLoc);
- }
-
- SourceLocation getEllipsisLoc() const {
- assert(isArrayRangeDesignator() && "Invalid accessor");
- return SourceLocation::getFromRawEncoding(ArrayRangeInfo.EllipsisLoc);
- }
-
- static Designator getField(const IdentifierInfo *II, SourceLocation DotLoc,
- SourceLocation NameLoc) {
- Designator D;
- D.Kind = FieldDesignator;
- D.FieldInfo.II = II;
- D.FieldInfo.DotLoc = DotLoc.getRawEncoding();
- D.FieldInfo.NameLoc = NameLoc.getRawEncoding();
- return D;
- }
-
- static Designator getArray(ActionBase::ExprTy *Index,
- SourceLocation LBracketLoc) {
- Designator D;
- D.Kind = ArrayDesignator;
- D.ArrayInfo.Index = Index;
- D.ArrayInfo.LBracketLoc = LBracketLoc.getRawEncoding();
- D.ArrayInfo.RBracketLoc = 0;
- return D;
- }
-
- static Designator getArrayRange(ActionBase::ExprTy *Start,
- ActionBase::ExprTy *End,
- SourceLocation LBracketLoc,
- SourceLocation EllipsisLoc) {
- Designator D;
- D.Kind = ArrayRangeDesignator;
- D.ArrayRangeInfo.Start = Start;
- D.ArrayRangeInfo.End = End;
- D.ArrayRangeInfo.LBracketLoc = LBracketLoc.getRawEncoding();
- D.ArrayRangeInfo.EllipsisLoc = EllipsisLoc.getRawEncoding();
- D.ArrayRangeInfo.RBracketLoc = 0;
- return D;
- }
-
- void setRBracketLoc(SourceLocation RBracketLoc) const {
- assert((isArrayDesignator() || isArrayRangeDesignator()) &&
- "Invalid accessor");
- if (isArrayDesignator())
- ArrayInfo.RBracketLoc = RBracketLoc.getRawEncoding();
- else
- ArrayRangeInfo.RBracketLoc = RBracketLoc.getRawEncoding();
- }
-
- /// ClearExprs - Null out any expression references, which prevents them from
- /// being 'delete'd later.
- void ClearExprs(Action &Actions) {
- switch (Kind) {
- case FieldDesignator: return;
- case ArrayDesignator:
- ArrayInfo.Index = 0;
- return;
- case ArrayRangeDesignator:
- ArrayRangeInfo.Start = 0;
- ArrayRangeInfo.End = 0;
- return;
- }
- }
-
- /// FreeExprs - Release any unclaimed memory for the expressions in this
- /// designator.
- void FreeExprs(Action &Actions) {
- switch (Kind) {
- case FieldDesignator: return; // nothing to free.
- case ArrayDesignator:
- Actions.DeleteExpr(getArrayIndex());
- return;
- case ArrayRangeDesignator:
- Actions.DeleteExpr(getArrayRangeStart());
- Actions.DeleteExpr(getArrayRangeEnd());
- return;
- }
- }
-};
-
-
-/// Designation - Represent a full designation, which is a sequence of
-/// designators. This class is mostly a helper for InitListDesignations.
-class Designation {
- /// InitIndex - The index of the initializer expression this is for. For
- /// example, if the initializer were "{ A, .foo=B, C }" a Designation would
- /// exist with InitIndex=1, because element #1 has a designation.
- unsigned InitIndex;
-
- /// Designators - The actual designators for this initializer.
- llvm::SmallVector<Designator, 2> Designators;
-
- Designation(unsigned Idx) : InitIndex(Idx) {}
-public:
- Designation() : InitIndex(4000) {}
-
- /// AddDesignator - Add a designator to the end of this list.
- void AddDesignator(Designator D) {
- Designators.push_back(D);
- }
-
- bool empty() const { return Designators.empty(); }
-
- unsigned getNumDesignators() const { return Designators.size(); }
- const Designator &getDesignator(unsigned Idx) const {
- assert(Idx < Designators.size());
- return Designators[Idx];
- }
-
- /// ClearExprs - Null out any expression references, which prevents them from
- /// being 'delete'd later.
- void ClearExprs(Action &Actions) {
- for (unsigned i = 0, e = Designators.size(); i != e; ++i)
- Designators[i].ClearExprs(Actions);
- }
-
- /// FreeExprs - Release any unclaimed memory for the expressions in this
- /// designation.
- void FreeExprs(Action &Actions) {
- for (unsigned i = 0, e = Designators.size(); i != e; ++i)
- Designators[i].FreeExprs(Actions);
- }
-};
-
-} // end namespace clang
-
-#endif
Removed: cfe/trunk/include/clang/Parse/Ownership.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Ownership.h?rev=111666&view=auto
==============================================================================
--- cfe/trunk/include/clang/Parse/Ownership.h (original)
+++ cfe/trunk/include/clang/Parse/Ownership.h (removed)
@@ -1,523 +0,0 @@
-//===--- Ownership.h - Parser Ownership Helpers -----------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains classes for managing ownership of Stmt and Expr nodes.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_PARSE_OWNERSHIP_H
-#define LLVM_CLANG_PARSE_OWNERSHIP_H
-
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/PointerIntPair.h"
-
-//===----------------------------------------------------------------------===//
-// OpaquePtr
-//===----------------------------------------------------------------------===//
-
-namespace clang {
- class ActionBase;
-
- /// OpaquePtr - This is a very simple POD type that wraps a pointer that the
- /// Parser doesn't know about but that Sema or another client does. The UID
- /// template argument is used to make sure that "Decl" pointers are not
- /// compatible with "Type" pointers for example.
- template<int UID>
- class OpaquePtr {
- void *Ptr;
- public:
- OpaquePtr() : Ptr(0) {}
-
- template <typename T>
- T* getAs() const {
- return llvm::PointerLikeTypeTraits<T*>::getFromVoidPointer(Ptr);
- }
-
- template <typename T>
- T getAsVal() const {
- return llvm::PointerLikeTypeTraits<T>::getFromVoidPointer(Ptr);
- }
-
- void *get() const { return Ptr; }
-
- template<typename T>
- static OpaquePtr make(T P) {
- OpaquePtr R; R.set(P); return R;
- }
-
- template<typename T>
- void set(T P) {
- Ptr = llvm::PointerLikeTypeTraits<T>::getAsVoidPointer(P);
- }
-
- operator bool() const { return Ptr != 0; }
- };
-}
-
-namespace llvm {
- template <int UID>
- class PointerLikeTypeTraits<clang::OpaquePtr<UID> > {
- public:
- static inline void *getAsVoidPointer(clang::OpaquePtr<UID> P) {
- // FIXME: Doesn't work? return P.getAs< void >();
- return P.get();
- }
- static inline clang::OpaquePtr<UID> getFromVoidPointer(void *P) {
- return clang::OpaquePtr<UID>::make(P);
- }
- enum { NumLowBitsAvailable = 3 };
- };
-}
-
-
-
-// -------------------------- About Move Emulation -------------------------- //
-// The smart pointer classes in this file attempt to emulate move semantics
-// as they appear in C++0x with rvalue references. Since C++03 doesn't have
-// rvalue references, some tricks are needed to get similar results.
-// Move semantics in C++0x have the following properties:
-// 1) "Moving" means transferring the value of an object to another object,
-// similar to copying, but without caring what happens to the old object.
-// In particular, this means that the new object can steal the old object's
-// resources instead of creating a copy.
-// 2) Since moving can modify the source object, it must either be explicitly
-// requested by the user, or the modifications must be unnoticeable.
-// 3) As such, C++0x moving is only allowed in three contexts:
-// * By explicitly using std::move() to request it.
-// * From a temporary object, since that object cannot be accessed
-// afterwards anyway, thus making the state unobservable.
-// * On function return, since the object is not observable afterwards.
-//
-// To sum up: moving from a named object should only be possible with an
-// explicit std::move(), or on function return. Moving from a temporary should
-// be implicitly done. Moving from a const object is forbidden.
-//
-// The emulation is not perfect, and has the following shortcomings:
-// * move() is not in namespace std.
-// * move() is required on function return.
-// * There are difficulties with implicit conversions.
-// * Microsoft's compiler must be given the /Za switch to successfully compile.
-//
-// -------------------------- Implementation -------------------------------- //
-// The move emulation relies on the peculiar reference binding semantics of
-// C++03: as a rule, a non-const reference may not bind to a temporary object,
-// except for the implicit object parameter in a member function call, which
-// can refer to a temporary even when not being const.
-// The moveable object has five important functions to facilitate moving:
-// * A private, unimplemented constructor taking a non-const reference to its
-// own class. This constructor serves a two-fold purpose.
-// - It prevents the creation of a copy constructor that takes a const
-// reference. Temporaries would be able to bind to the argument of such a
-// constructor, and that would be bad.
-// - Named objects will bind to the non-const reference, but since it's
-// private, this will fail to compile. This prevents implicit moving from
-// named objects.
-// There's also a copy assignment operator for the same purpose.
-// * An implicit, non-const conversion operator to a special mover type. This
-// type represents the rvalue reference of C++0x. Being a non-const member,
-// its implicit this parameter can bind to temporaries.
-// * A constructor that takes an object of this mover type. This constructor
-// performs the actual move operation. There is an equivalent assignment
-// operator.
-// There is also a free move() function that takes a non-const reference to
-// an object and returns a temporary. Internally, this function uses explicit
-// constructor calls to move the value from the referenced object to the return
-// value.
-//
-// There are now three possible scenarios of use.
-// * Copying from a const object. Constructor overload resolution will find the
-// non-const copy constructor, and the move constructor. The first is not
-// viable because the const object cannot be bound to the non-const reference.
-// The second fails because the conversion to the mover object is non-const.
-// Moving from a const object fails as intended.
-// * Copying from a named object. Constructor overload resolution will select
-// the non-const copy constructor, but fail as intended, because this
-// constructor is private.
-// * Copying from a temporary. Constructor overload resolution cannot select
-// the non-const copy constructor, because the temporary cannot be bound to
-// the non-const reference. It thus selects the move constructor. The
-// temporary can be bound to the implicit this parameter of the conversion
-// operator, because of the special binding rule. Construction succeeds.
-// Note that the Microsoft compiler, as an extension, allows binding
-// temporaries against non-const references. The compiler thus selects the
-// non-const copy constructor and fails, because the constructor is private.
-// Passing /Za (disable extensions) disables this behaviour.
-// The free move() function is used to move from a named object.
-//
-// Note that when passing an object of a different type (the classes below
-// have OwningResult and OwningPtr, which should be mixable), you get a problem.
-// Argument passing and function return use copy initialization rules. The
-// effect of this is that, when the source object is not already of the target
-// type, the compiler will first seek a way to convert the source object to the
-// target type, and only then attempt to copy the resulting object. This means
-// that when passing an OwningResult where an OwningPtr is expected, the
-// compiler will first seek a conversion from OwningResult to OwningPtr, then
-// copy the OwningPtr. The resulting conversion sequence is:
-// OwningResult object -> ResultMover -> OwningResult argument to
-// OwningPtr(OwningResult) -> OwningPtr -> PtrMover -> final OwningPtr
-// This conversion sequence is too complex to be allowed. Thus the special
-// move_* functions, which help the compiler out with some explicit
-// conversions.
-
-namespace llvm {
- template<>
- class PointerLikeTypeTraits<clang::ActionBase*> {
- typedef clang::ActionBase* PT;
- public:
- static inline void *getAsVoidPointer(PT P) { return P; }
- static inline PT getFromVoidPointer(void *P) {
- return static_cast<PT>(P);
- }
- enum { NumLowBitsAvailable = 2 };
- };
-}
-
-namespace clang {
- // Basic
- class DiagnosticBuilder;
-
- // Determines whether the low bit of the result pointer for the
- // given UID is always zero. If so, ActionResult will use that bit
- // for it's "invalid" flag.
- template<unsigned UID>
- struct IsResultPtrLowBitFree {
- static const bool value = false;
- };
-
- /// ActionBase - A small part split from Action because of the horrible
- /// definition order dependencies between Action and the smart pointers.
- class ActionBase {
- public:
- /// Out-of-line virtual destructor to provide home for this class.
- virtual ~ActionBase();
-
- // Types - Though these don't actually enforce strong typing, they document
- // what types are required to be identical for the actions.
- typedef OpaquePtr<0> DeclPtrTy;
- typedef OpaquePtr<1> DeclGroupPtrTy;
- typedef OpaquePtr<2> TemplateTy;
- typedef void AttrTy;
- typedef void BaseTy;
- typedef void MemInitTy;
- typedef void ExprTy;
- typedef void StmtTy;
- typedef void TemplateParamsTy;
- typedef void CXXScopeTy;
- typedef void TypeTy; // FIXME: Change TypeTy to use OpaquePtr<N>.
-
- /// ActionResult - This structure is used while parsing/acting on
- /// expressions, stmts, etc. It encapsulates both the object returned by
- /// the action, plus a sense of whether or not it is valid.
- /// When CompressInvalid is true, the "invalid" flag will be
- /// stored in the low bit of the Val pointer.
- template<unsigned UID,
- typename PtrTy = void*,
- bool CompressInvalid = IsResultPtrLowBitFree<UID>::value>
- class ActionResult {
- PtrTy Val;
- bool Invalid;
-
- public:
- ActionResult(bool Invalid = false) : Val(PtrTy()), Invalid(Invalid) {}
- template<typename ActualExprTy>
- ActionResult(ActualExprTy val) : Val(val), Invalid(false) {}
- ActionResult(const DiagnosticBuilder &) : Val(PtrTy()), Invalid(true) {}
-
- PtrTy get() const { return Val; }
- void set(PtrTy V) { Val = V; }
- bool isInvalid() const { return Invalid; }
-
- const ActionResult &operator=(PtrTy RHS) {
- Val = RHS;
- Invalid = false;
- return *this;
- }
- };
-
- // This ActionResult partial specialization places the "invalid"
- // flag into the low bit of the pointer.
- template<unsigned UID, typename PtrTy>
- class ActionResult<UID, PtrTy, true> {
- // A pointer whose low bit is 1 if this result is invalid, 0
- // otherwise.
- uintptr_t PtrWithInvalid;
- typedef llvm::PointerLikeTypeTraits<PtrTy> PtrTraits;
- public:
- ActionResult(bool Invalid = false)
- : PtrWithInvalid(static_cast<uintptr_t>(Invalid)) { }
-
- template<typename ActualExprTy>
- ActionResult(ActualExprTy *val) {
- PtrTy V(val);
- void *VP = PtrTraits::getAsVoidPointer(V);
- PtrWithInvalid = reinterpret_cast<uintptr_t>(VP);
- assert((PtrWithInvalid & 0x01) == 0 && "Badly aligned pointer");
- }
-
- ActionResult(PtrTy V) {
- void *VP = PtrTraits::getAsVoidPointer(V);
- PtrWithInvalid = reinterpret_cast<uintptr_t>(VP);
- assert((PtrWithInvalid & 0x01) == 0 && "Badly aligned pointer");
- }
-
- ActionResult(const DiagnosticBuilder &) : PtrWithInvalid(0x01) { }
-
- PtrTy get() const {
- void *VP = reinterpret_cast<void *>(PtrWithInvalid & ~0x01);
- return PtrTraits::getFromVoidPointer(VP);
- }
-
- void set(PtrTy V) {
- void *VP = PtrTraits::getAsVoidPointer(V);
- PtrWithInvalid = reinterpret_cast<uintptr_t>(VP);
- assert((PtrWithInvalid & 0x01) == 0 && "Badly aligned pointer");
- }
-
- bool isInvalid() const { return PtrWithInvalid & 0x01; }
-
- const ActionResult &operator=(PtrTy RHS) {
- void *VP = PtrTraits::getAsVoidPointer(RHS);
- PtrWithInvalid = reinterpret_cast<uintptr_t>(VP);
- assert((PtrWithInvalid & 0x01) == 0 && "Badly aligned pointer");
- return *this;
- }
- };
-
- /// Deletion callbacks - Since the parser doesn't know the concrete types of
- /// the AST nodes being generated, it must do callbacks to delete objects
- /// when recovering from errors. These are in ActionBase because the smart
- /// pointers need access to them.
- virtual void DeleteExpr(ExprTy *E) {}
- virtual void DeleteStmt(StmtTy *S) {}
- virtual void DeleteTemplateParams(TemplateParamsTy *P) {}
- };
-
- /// ASTDestroyer - The type of an AST node destruction function pointer.
- typedef void (ActionBase::*ASTDestroyer)(void *);
-
- /// For the transition phase: translate from an ASTDestroyer to its
- /// ActionResult UID.
- template <ASTDestroyer Destroyer> struct DestroyerToUID;
- template <> struct DestroyerToUID<&ActionBase::DeleteExpr> {
- static const unsigned UID = 0;
- };
- template <> struct DestroyerToUID<&ActionBase::DeleteStmt> {
- static const unsigned UID = 1;
- };
- /// ASTOwningResult - A moveable smart pointer for AST nodes that also
- /// has an extra flag to indicate an additional success status.
- template <ASTDestroyer Destroyer> class ASTOwningResult;
-
- /// ASTMultiPtr - A moveable smart pointer to multiple AST nodes. Only owns
- /// the individual pointers, not the array holding them.
- template <ASTDestroyer Destroyer> class ASTMultiPtr;
-
- /// Kept only as a type-safe wrapper for a void pointer.
- template <ASTDestroyer Destroyer>
- class ASTOwningPtr {
- void *Node;
-
- public:
- explicit ASTOwningPtr(ActionBase &) : Node(0) {}
- ASTOwningPtr(ActionBase &, void *node) : Node(node) {}
- // Normal copying operators are defined implicitly.
- ASTOwningPtr(const ASTOwningResult<Destroyer> &o);
-
- ASTOwningPtr & operator =(void *raw) {
- Node = raw;
- return *this;
- }
-
- /// Access to the raw pointer.
- void * get() const { return Node; }
-
- /// Release the raw pointer.
- void * take() {
- return Node;
- }
-
- /// Take outside ownership of the raw pointer and cast it down.
- template<typename T>
- T *takeAs() {
- return static_cast<T*>(Node);
- }
-
- /// Alias for interface familiarity with unique_ptr.
- void * release() {
- return take();
- }
- };
-
- template <ASTDestroyer Destroyer>
- class ASTOwningResult {
- public:
- typedef ActionBase::ActionResult<DestroyerToUID<Destroyer>::UID> DumbResult;
-
- private:
- DumbResult Result;
-
- public:
- explicit ASTOwningResult(ActionBase &actions, bool invalid = false)
- : Result(invalid) { }
- ASTOwningResult(ActionBase &actions, void *node) : Result(node) { }
- ASTOwningResult(ActionBase &actions, const DumbResult &res) : Result(res) { }
- // Normal copying semantics are defined implicitly.
- ASTOwningResult(const ASTOwningPtr<Destroyer> &o) : Result(o.get()) { }
-
- /// Assignment from a raw pointer. Takes ownership - beware!
- ASTOwningResult & operator =(void *raw) {
- Result = raw;
- return *this;
- }
-
- /// Assignment from an ActionResult. Takes ownership - beware!
- ASTOwningResult & operator =(const DumbResult &res) {
- Result = res;
- return *this;
- }
-
- /// Access to the raw pointer.
- void * get() const { return Result.get(); }
-
- bool isInvalid() const { return Result.isInvalid(); }
-
- /// Does this point to a usable AST node? To be usable, the node must be
- /// valid and non-null.
- bool isUsable() const { return !Result.isInvalid() && get(); }
-
- /// Take outside ownership of the raw pointer.
- void * take() {
- return Result.get();
- }
-
- /// Take outside ownership of the raw pointer and cast it down.
- template<typename T>
- T *takeAs() {
- return static_cast<T*>(take());
- }
-
- /// Alias for interface familiarity with unique_ptr.
- void * release() { return take(); }
-
- /// Pass ownership to a classical ActionResult.
- DumbResult result() { return Result; }
- };
-
- template <ASTDestroyer Destroyer>
- class ASTMultiPtr {
- void **Nodes;
- unsigned Count;
-
- public:
- // Normal copying implicitly defined
- explicit ASTMultiPtr(ActionBase &) : Nodes(0), Count(0) {}
- ASTMultiPtr(ActionBase &, void **nodes, unsigned count)
- : Nodes(nodes), Count(count) {}
- // Fake mover in Parse/AstGuard.h needs this:
- ASTMultiPtr(void **nodes, unsigned count) : Nodes(nodes), Count(count) {}
-
- /// Access to the raw pointers.
- void ** get() const { return Nodes; }
-
- /// Access to the count.
- unsigned size() const { return Count; }
-
- void ** release() {
- return Nodes;
- }
- };
-
- class ParsedTemplateArgument;
-
- class ASTTemplateArgsPtr {
- ParsedTemplateArgument *Args;
- mutable unsigned Count;
-
- public:
- ASTTemplateArgsPtr(ActionBase &actions, ParsedTemplateArgument *args,
- unsigned count) :
- Args(args), Count(count) { }
-
- // FIXME: Lame, not-fully-type-safe emulation of 'move semantics'.
- ASTTemplateArgsPtr(ASTTemplateArgsPtr &Other) :
- Args(Other.Args), Count(Other.Count) {
- }
-
- // FIXME: Lame, not-fully-type-safe emulation of 'move semantics'.
- ASTTemplateArgsPtr& operator=(ASTTemplateArgsPtr &Other) {
- Args = Other.Args;
- Count = Other.Count;
- return *this;
- }
-
- ParsedTemplateArgument *getArgs() const { return Args; }
- unsigned size() const { return Count; }
-
- void reset(ParsedTemplateArgument *args, unsigned count) {
- Args = args;
- Count = count;
- }
-
- const ParsedTemplateArgument &operator[](unsigned Arg) const;
-
- ParsedTemplateArgument *release() const {
- return Args;
- }
- };
-
- /// \brief A small vector that owns a set of AST nodes.
- template <ASTDestroyer Destroyer, unsigned N = 8>
- class ASTOwningVector : public llvm::SmallVector<void *, N> {
- ASTOwningVector(ASTOwningVector &); // do not implement
- ASTOwningVector &operator=(ASTOwningVector &); // do not implement
-
- public:
- explicit ASTOwningVector(ActionBase &Actions)
- { }
-
- void **take() {
- return &this->front();
- }
-
- template<typename T> T **takeAs() { return (T**)take(); }
- };
-
- /// A SmallVector of statements, with stack size 32 (as that is the only one
- /// used.)
- typedef ASTOwningVector<&ActionBase::DeleteStmt, 32> StmtVector;
- /// A SmallVector of expressions, with stack size 12 (the maximum used.)
- typedef ASTOwningVector<&ActionBase::DeleteExpr, 12> ExprVector;
-
- template <ASTDestroyer Destroyer, unsigned N> inline
- ASTMultiPtr<Destroyer> move_arg(ASTOwningVector<Destroyer, N> &vec) {
- return ASTMultiPtr<Destroyer>(vec.take(), vec.size());
- }
-
- template <ASTDestroyer Destroyer> inline
- ASTOwningPtr<Destroyer>::ASTOwningPtr(const ASTOwningResult<Destroyer> &o)
- : Node(o.get()) { }
-
- // These versions are hopefully no-ops.
- template <ASTDestroyer Destroyer> inline
- ASTOwningResult<Destroyer>& move(ASTOwningResult<Destroyer> &ptr) {
- return ptr;
- }
-
- template <ASTDestroyer Destroyer> inline
- ASTOwningPtr<Destroyer>& move(ASTOwningPtr<Destroyer> &ptr) {
- return ptr;
- }
-
- template <ASTDestroyer Destroyer> inline
- ASTMultiPtr<Destroyer>& move(ASTMultiPtr<Destroyer> &ptr) {
- return ptr;
- }
-}
-
-#endif
Copied: cfe/trunk/include/clang/Parse/ParseAST.h (from r111642, cfe/trunk/include/clang/Sema/ParseAST.h)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/ParseAST.h?p2=cfe/trunk/include/clang/Parse/ParseAST.h&p1=cfe/trunk/include/clang/Sema/ParseAST.h&r1=111642&r2=111667&rev=111667&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/ParseAST.h (original)
+++ cfe/trunk/include/clang/Parse/ParseAST.h Fri Aug 20 13:27:03 2010
@@ -11,8 +11,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_SEMA_PARSEAST_H
-#define LLVM_CLANG_SEMA_PARSEAST_H
+#ifndef LLVM_CLANG_PARSE_PARSEAST_H
+#define LLVM_CLANG_PARSE_PARSEAST_H
namespace clang {
class Preprocessor;
Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Fri Aug 20 13:27:03 2010
@@ -16,8 +16,8 @@
#include "clang/Basic/Specifiers.h"
#include "clang/Lex/Preprocessor.h"
-#include "clang/Parse/Action.h"
-#include "clang/Parse/DeclSpec.h"
+#include "clang/Sema/Action.h"
+#include "clang/Sema/DeclSpec.h"
#include "llvm/ADT/OwningPtr.h"
#include <stack>
#include <list>
Removed: cfe/trunk/include/clang/Parse/Scope.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Scope.h?rev=111666&view=auto
==============================================================================
--- cfe/trunk/include/clang/Parse/Scope.h (original)
+++ cfe/trunk/include/clang/Parse/Scope.h (removed)
@@ -1,325 +0,0 @@
-//===--- Scope.h - Scope 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 Scope interface.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_PARSE_SCOPE_H
-#define LLVM_CLANG_PARSE_SCOPE_H
-
-#include "clang/Parse/Action.h"
-#include "llvm/ADT/SmallPtrSet.h"
-
-namespace clang {
-
-/// Scope - A scope is a transient data structure that is used while parsing the
-/// program. It assists with resolving identifiers to the appropriate
-/// declaration.
-///
-class Scope {
-public:
- /// ScopeFlags - These are bitfields that are or'd together when creating a
- /// scope, which defines the sorts of things the scope contains.
- enum ScopeFlags {
- /// FnScope - This indicates that the scope corresponds to a function, which
- /// means that labels are set here.
- FnScope = 0x01,
-
- /// BreakScope - This is a while,do,switch,for, etc that can have break
- /// stmts embedded into it.
- BreakScope = 0x02,
-
- /// ContinueScope - This is a while,do,for, which can have continue
- /// stmt embedded into it.
- ContinueScope = 0x04,
-
- /// DeclScope - This is a scope that can contain a declaration. Some scopes
- /// just contain loop constructs but don't contain decls.
- DeclScope = 0x08,
-
- /// ControlScope - The controlling scope in a if/switch/while/for statement.
- ControlScope = 0x10,
-
- /// ClassScope - The scope of a struct/union/class definition.
- ClassScope = 0x20,
-
- /// BlockScope - This is a scope that corresponds to a block object.
- /// Blocks serve as top-level scopes for some objects like labels, they
- /// also prevent things like break and continue. BlockScopes always have
- /// the FnScope, BreakScope, ContinueScope, and DeclScope flags set as well.
- BlockScope = 0x40,
-
- /// TemplateParamScope - This is a scope that corresponds to the
- /// template parameters of a C++ template. Template parameter
- /// scope starts at the 'template' keyword and ends when the
- /// template declaration ends.
- TemplateParamScope = 0x80,
-
- /// FunctionPrototypeScope - This is a scope that corresponds to the
- /// parameters within a function prototype.
- FunctionPrototypeScope = 0x100,
-
- /// AtCatchScope - This is a scope that corresponds to the Objective-C
- /// @catch statement.
- AtCatchScope = 0x200,
-
- /// ObjCMethodScope - This scope corresponds to an Objective-C method body.
- /// It always has FnScope and DeclScope set as well.
- ObjCMethodScope = 0x400
- };
-private:
- /// The parent scope for this scope. This is null for the translation-unit
- /// scope.
- Scope *AnyParent;
-
- /// Depth - This is the depth of this scope. The translation-unit scope has
- /// depth 0.
- unsigned short Depth;
-
- /// Flags - This contains a set of ScopeFlags, which indicates how the scope
- /// interrelates with other control flow statements.
- unsigned short Flags;
-
- /// FnParent - If this scope has a parent scope that is a function body, this
- /// pointer is non-null and points to it. This is used for label processing.
- Scope *FnParent;
-
- /// BreakParent/ContinueParent - This is a direct link to the immediately
- /// preceeding BreakParent/ContinueParent if this scope is not one, or null if
- /// there is no containing break/continue scope.
- Scope *BreakParent, *ContinueParent;
-
- /// ControlParent - This is a direct link to the immediately
- /// preceeding ControlParent if this scope is not one, or null if
- /// there is no containing control scope.
- Scope *ControlParent;
-
- /// BlockParent - This is a direct link to the immediately containing
- /// BlockScope if this scope is not one, or null if there is none.
- Scope *BlockParent;
-
- /// TemplateParamParent - This is a direct link to the
- /// immediately containing template parameter scope. In the
- /// case of nested templates, template parameter scopes can have
- /// other template parameter scopes as parents.
- Scope *TemplateParamParent;
-
- /// DeclsInScope - This keeps track of all declarations in this scope. When
- /// the declaration is added to the scope, it is set as the current
- /// declaration for the identifier in the IdentifierTable. When the scope is
- /// popped, these declarations are removed from the IdentifierTable's notion
- /// of current declaration. It is up to the current Action implementation to
- /// implement these semantics.
- typedef llvm::SmallPtrSet<Action::DeclPtrTy, 32> DeclSetTy;
- DeclSetTy DeclsInScope;
-
- /// Entity - The entity with which this scope is associated. For
- /// example, the entity of a class scope is the class itself, the
- /// entity of a function scope is a function, etc. This field is
- /// maintained by the Action implementation.
- void *Entity;
-
- typedef llvm::SmallVector<Action::DeclPtrTy, 2> UsingDirectivesTy;
- UsingDirectivesTy UsingDirectives;
-
- /// \brief The number of errors at the start of the given scope.
- unsigned NumErrorsAtStart;
-
-public:
- Scope(Scope *Parent, unsigned ScopeFlags) {
- Init(Parent, ScopeFlags);
- }
-
- /// getFlags - Return the flags for this scope.
- ///
- unsigned getFlags() const { return Flags; }
- void setFlags(unsigned F) { Flags = F; }
-
- /// isBlockScope - Return true if this scope does not correspond to a
- /// closure.
- bool isBlockScope() const { return Flags & BlockScope; }
-
- /// getParent - Return the scope that this is nested in.
- ///
- const Scope *getParent() const { return AnyParent; }
- Scope *getParent() { return AnyParent; }
-
- /// getFnParent - Return the closest scope that is a function body.
- ///
- const Scope *getFnParent() const { return FnParent; }
- Scope *getFnParent() { return FnParent; }
-
- /// getContinueParent - Return the closest scope that a continue statement
- /// would be affected by. If the closest scope is a closure scope, we know
- /// that there is no loop *inside* the closure.
- Scope *getContinueParent() {
- if (ContinueParent && !ContinueParent->isBlockScope())
- return ContinueParent;
- return 0;
- }
-
- const Scope *getContinueParent() const {
- return const_cast<Scope*>(this)->getContinueParent();
- }
-
- /// getBreakParent - Return the closest scope that a break statement
- /// would be affected by. If the closest scope is a block scope, we know
- /// that there is no loop *inside* the block.
- Scope *getBreakParent() {
- if (BreakParent && !BreakParent->isBlockScope())
- return BreakParent;
- return 0;
- }
- const Scope *getBreakParent() const {
- return const_cast<Scope*>(this)->getBreakParent();
- }
-
- Scope *getControlParent() { return ControlParent; }
- const Scope *getControlParent() const { return ControlParent; }
-
- Scope *getBlockParent() { return BlockParent; }
- const Scope *getBlockParent() const { return BlockParent; }
-
- Scope *getTemplateParamParent() { return TemplateParamParent; }
- const Scope *getTemplateParamParent() const { return TemplateParamParent; }
-
- typedef DeclSetTy::iterator decl_iterator;
- decl_iterator decl_begin() const { return DeclsInScope.begin(); }
- decl_iterator decl_end() const { return DeclsInScope.end(); }
- bool decl_empty() const { return DeclsInScope.empty(); }
-
- void AddDecl(Action::DeclPtrTy D) {
- DeclsInScope.insert(D);
- }
-
- void RemoveDecl(Action::DeclPtrTy D) {
- DeclsInScope.erase(D);
- }
-
- /// isDeclScope - Return true if this is the scope that the specified decl is
- /// declared in.
- bool isDeclScope(Action::DeclPtrTy D) {
- return DeclsInScope.count(D) != 0;
- }
-
- void* getEntity() const { return Entity; }
- void setEntity(void *E) { Entity = E; }
-
- /// \brief Retrieve the number of errors that had been emitted when we
- /// entered this scope.
- unsigned getNumErrorsAtStart() const { return NumErrorsAtStart; }
-
- void setNumErrorsAtStart(unsigned NumErrors) {
- NumErrorsAtStart = NumErrors;
- }
-
- /// isClassScope - Return true if this scope is a class/struct/union scope.
- bool isClassScope() const {
- return (getFlags() & Scope::ClassScope);
- }
-
- /// isInCXXInlineMethodScope - Return true if this scope is a C++ inline
- /// method scope or is inside one.
- bool isInCXXInlineMethodScope() const {
- if (const Scope *FnS = getFnParent()) {
- assert(FnS->getParent() && "TUScope not created?");
- return FnS->getParent()->isClassScope();
- }
- return false;
- }
-
- /// isInObjcMethodScope - Return true if this scope is, or is contained in, an
- /// Objective-C method body. Note that this method is not constant time.
- bool isInObjcMethodScope() const {
- for (const Scope *S = this; S; S = S->getParent()) {
- // If this scope is an objc method scope, then we succeed.
- if (S->getFlags() & ObjCMethodScope)
- return true;
- }
- return false;
- }
-
- /// isTemplateParamScope - Return true if this scope is a C++
- /// template parameter scope.
- bool isTemplateParamScope() const {
- return getFlags() & Scope::TemplateParamScope;
- }
-
- /// isFunctionPrototypeScope - Return true if this scope is a
- /// function prototype scope.
- bool isFunctionPrototypeScope() const {
- return getFlags() & Scope::FunctionPrototypeScope;
- }
-
- /// isAtCatchScope - Return true if this scope is @catch.
- bool isAtCatchScope() const {
- return getFlags() & Scope::AtCatchScope;
- }
-
- typedef UsingDirectivesTy::iterator udir_iterator;
- typedef UsingDirectivesTy::const_iterator const_udir_iterator;
-
- void PushUsingDirective(Action::DeclPtrTy UDir) {
- UsingDirectives.push_back(UDir);
- }
-
- udir_iterator using_directives_begin() {
- return UsingDirectives.begin();
- }
-
- udir_iterator using_directives_end() {
- return UsingDirectives.end();
- }
-
- const_udir_iterator using_directives_begin() const {
- return UsingDirectives.begin();
- }
-
- const_udir_iterator using_directives_end() const {
- return UsingDirectives.end();
- }
-
- /// Init - This is used by the parser to implement scope caching.
- ///
- void Init(Scope *Parent, unsigned ScopeFlags) {
- AnyParent = Parent;
- Depth = AnyParent ? AnyParent->Depth+1 : 0;
- Flags = ScopeFlags;
-
- if (AnyParent) {
- FnParent = AnyParent->FnParent;
- BreakParent = AnyParent->BreakParent;
- ContinueParent = AnyParent->ContinueParent;
- ControlParent = AnyParent->ControlParent;
- BlockParent = AnyParent->BlockParent;
- TemplateParamParent = AnyParent->TemplateParamParent;
- } else {
- FnParent = BreakParent = ContinueParent = BlockParent = 0;
- ControlParent = 0;
- TemplateParamParent = 0;
- }
-
- // If this scope is a function or contains breaks/continues, remember it.
- if (Flags & FnScope) FnParent = this;
- if (Flags & BreakScope) BreakParent = this;
- if (Flags & ContinueScope) ContinueParent = this;
- if (Flags & ControlScope) ControlParent = this;
- if (Flags & BlockScope) BlockParent = this;
- if (Flags & TemplateParamScope) TemplateParamParent = this;
- DeclsInScope.clear();
- UsingDirectives.clear();
- Entity = 0;
- NumErrorsAtStart = 0;
- }
-};
-
-} // end namespace clang
-
-#endif
Removed: cfe/trunk/include/clang/Parse/Template.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Template.h?rev=111666&view=auto
==============================================================================
--- cfe/trunk/include/clang/Parse/Template.h (original)
+++ cfe/trunk/include/clang/Parse/Template.h (removed)
@@ -1,171 +0,0 @@
-//===--- Template.h - Template Parsing Data Types -------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file provides data structures that store the parsed representation of
-// templates.
-//
-//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_PARSE_TEMPLATE_H
-#define LLVM_CLANG_PARSE_TEMPLATE_H
-
-#include "clang/Parse/DeclSpec.h"
-#include "clang/Parse/Ownership.h"
-#include <cassert>
-
-namespace clang {
- /// \brief Represents the parsed form of a C++ template argument.
- class ParsedTemplateArgument {
- public:
- /// \brief Describes the kind of template argument that was parsed.
- enum KindType {
- /// \brief A template type parameter, stored as a type.
- Type,
- /// \brief A non-type template parameter, stored as an expression.
- NonType,
- /// \brief A template template argument, stored as a template name.
- Template
- };
-
- /// \brief Build an empty template argument. This template argument
- ParsedTemplateArgument() : Kind(Type), Arg(0) { }
-
- /// \brief Create a template type argument or non-type template argument.
- ///
- /// \param Arg the template type argument or non-type template argument.
- /// \param Loc the location of the type.
- ParsedTemplateArgument(KindType Kind, void *Arg, SourceLocation Loc)
- : Kind(Kind), Arg(Arg), Loc(Loc) { }
-
- /// \brief Create a template template argument.
- ///
- /// \param SS the C++ scope specifier that precedes the template name, if
- /// any.
- ///
- /// \param Template the template to which this template template
- /// argument refers.
- ///
- /// \param TemplateLoc the location of the template name.
- ParsedTemplateArgument(const CXXScopeSpec &SS,
- ActionBase::TemplateTy Template,
- SourceLocation TemplateLoc)
- : Kind(ParsedTemplateArgument::Template), Arg(Template.get()),
- Loc(TemplateLoc), SS(SS) { }
-
- /// \brief Determine whether the given template argument is invalid.
- bool isInvalid() const { return Arg == 0; }
-
- /// \brief Determine what kind of template argument we have.
- KindType getKind() const { return Kind; }
-
- /// \brief Retrieve the template type argument's type.
- ActionBase::TypeTy *getAsType() const {
- assert(Kind == Type && "Not a template type argument");
- return Arg;
- }
-
- /// \brief Retrieve the non-type template argument's expression.
- ActionBase::ExprTy *getAsExpr() const {
- assert(Kind == NonType && "Not a non-type template argument");
- return Arg;
- }
-
- /// \brief Retrieve the template template argument's template name.
- ActionBase::TemplateTy getAsTemplate() const {
- assert(Kind == Template && "Not a template template argument");
- return ActionBase::TemplateTy::make(Arg);
- }
-
- /// \brief Retrieve the location of the template argument.
- SourceLocation getLocation() const { return Loc; }
-
- /// \brief Retrieve the nested-name-specifier that precedes the template
- /// name in a template template argument.
- const CXXScopeSpec &getScopeSpec() const {
- assert(Kind == Template &&
- "Only template template arguments can have a scope specifier");
- return SS;
- }
-
- private:
- KindType Kind;
-
- /// \brief The actual template argument representation, which may be
- /// an \c ActionBase::TypeTy* (for a type), an ActionBase::ExprTy* (for an
- /// expression), or an ActionBase::TemplateTy (for a template).
- void *Arg;
-
- /// \brief the location of the template argument.
- SourceLocation Loc;
-
- /// \brief The nested-name-specifier that can accompany a template template
- /// argument.
- CXXScopeSpec SS;
- };
-
- /// \brief Information about a template-id annotation
- /// token.
- ///
- /// A template-id annotation token contains the template declaration,
- /// template arguments, whether those template arguments were types,
- /// expressions, or template names, and the source locations for important
- /// tokens. All of the information about template arguments is allocated
- /// directly after this structure.
- struct TemplateIdAnnotation {
- /// TemplateNameLoc - The location of the template name within the
- /// source.
- SourceLocation TemplateNameLoc;
-
- /// FIXME: Temporarily stores the name of a specialization
- IdentifierInfo *Name;
-
- /// FIXME: Temporarily stores the overloaded operator kind.
- OverloadedOperatorKind Operator;
-
- /// The declaration of the template corresponding to the
- /// template-name. This is an Action::TemplateTy.
- void *Template;
-
- /// The kind of template that Template refers to.
- TemplateNameKind Kind;
-
- /// The location of the '<' before the template argument
- /// list.
- SourceLocation LAngleLoc;
-
- /// The location of the '>' after the template argument
- /// list.
- SourceLocation RAngleLoc;
-
- /// NumArgs - The number of template arguments.
- unsigned NumArgs;
-
- /// \brief Retrieves a pointer to the template arguments
- ParsedTemplateArgument *getTemplateArgs() {
- return reinterpret_cast<ParsedTemplateArgument *>(this + 1);
- }
-
- static TemplateIdAnnotation* Allocate(unsigned NumArgs) {
- TemplateIdAnnotation *TemplateId
- = (TemplateIdAnnotation *)std::malloc(sizeof(TemplateIdAnnotation) +
- sizeof(ParsedTemplateArgument) * NumArgs);
- TemplateId->NumArgs = NumArgs;
- return TemplateId;
- }
-
- void Destroy() { free(this); }
- };
-
-
- inline const ParsedTemplateArgument &
- ASTTemplateArgsPtr::operator[](unsigned Arg) const {
- return Args[Arg];
- }
-}
-
-#endif
Copied: cfe/trunk/include/clang/Sema/Action.h (from r111642, cfe/trunk/include/clang/Parse/Action.h)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Action.h?p2=cfe/trunk/include/clang/Sema/Action.h&p1=cfe/trunk/include/clang/Parse/Action.h&r1=111642&r2=111667&rev=111667&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Sema/Action.h Fri Aug 20 13:27:03 2010
@@ -11,16 +11,16 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_PARSE_ACTION_H
-#define LLVM_CLANG_PARSE_ACTION_H
+#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/Parse/DeclSpec.h"
-#include "clang/Parse/Ownership.h"
+#include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/Ownership.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/ADT/PointerUnion.h"
Copied: cfe/trunk/include/clang/Sema/AttributeList.h (from r111642, cfe/trunk/include/clang/Parse/AttributeList.h)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/AttributeList.h?p2=cfe/trunk/include/clang/Sema/AttributeList.h&p1=cfe/trunk/include/clang/Parse/AttributeList.h&r1=111642&r2=111667&rev=111667&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/AttributeList.h (original)
+++ cfe/trunk/include/clang/Sema/AttributeList.h Fri Aug 20 13:27:03 2010
@@ -1,4 +1,4 @@
-//===--- AttributeList.h ----------------------------------------*- C++ -*-===//
+//===--- AttributeList.h - Parsed attribute sets ----------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,14 +7,15 @@
//
//===----------------------------------------------------------------------===//
//
-// This file defines the AttributeList class interface.
+// This file defines the AttributeList class, which is used to collect
+// parsed attributes.
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_ATTRLIST_H
-#define LLVM_CLANG_ATTRLIST_H
+#ifndef LLVM_CLANG_SEMA_ATTRLIST_H
+#define LLVM_CLANG_SEMA_ATTRLIST_H
-#include "clang/Parse/Ownership.h"
+#include "clang/Sema/Ownership.h"
#include "clang/Basic/SourceLocation.h"
#include <cassert>
Copied: cfe/trunk/include/clang/Sema/DeclSpec.h (from r111642, cfe/trunk/include/clang/Parse/DeclSpec.h)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?p2=cfe/trunk/include/clang/Sema/DeclSpec.h&p1=cfe/trunk/include/clang/Parse/DeclSpec.h&r1=111642&r2=111667&rev=111667&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/DeclSpec.h (original)
+++ cfe/trunk/include/clang/Sema/DeclSpec.h Fri Aug 20 13:27:03 2010
@@ -1,4 +1,4 @@
-//===--- SemaDeclSpec.h - Declaration Specifier Semantic Analys -*- C++ -*-===//
+//===--- DeclSpec.h - Parsed declaration specifiers -------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,14 +7,20 @@
//
//===----------------------------------------------------------------------===//
//
-// This file defines interfaces used for Declaration Specifiers and Declarators.
+// This file defines the classes used to store parsed information about
+// declaration-specifiers and declarators.
+//
+// static const int volatile x, *y, *(*(*z)[10])(const void *x);
+// ------------------------- - -- ---------------------------
+// declaration-specifiers \ | /
+// declarators
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_PARSE_DECLSPEC_H
-#define LLVM_CLANG_PARSE_DECLSPEC_H
+#ifndef LLVM_CLANG_SEMA_DECLSPEC_H
+#define LLVM_CLANG_SEMA_DECLSPEC_H
-#include "clang/Parse/AttributeList.h"
+#include "clang/Sema/AttributeList.h"
#include "clang/Lex/Token.h"
#include "clang/Basic/OperatorKinds.h"
#include "clang/Basic/Specifiers.h"
Copied: cfe/trunk/include/clang/Sema/Designator.h (from r111642, cfe/trunk/include/clang/Parse/Designator.h)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Designator.h?p2=cfe/trunk/include/clang/Sema/Designator.h&p1=cfe/trunk/include/clang/Parse/Designator.h&r1=111642&r2=111667&rev=111667&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Designator.h (original)
+++ cfe/trunk/include/clang/Sema/Designator.h Fri Aug 20 13:27:03 2010
@@ -12,10 +12,10 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_PARSE_DESIGNATOR_H
-#define LLVM_CLANG_PARSE_DESIGNATOR_H
+#ifndef LLVM_CLANG_SEMA_DESIGNATOR_H
+#define LLVM_CLANG_SEMA_DESIGNATOR_H
-#include "clang/Parse/Action.h"
+#include "clang/Sema/Action.h"
namespace clang {
Modified: cfe/trunk/include/clang/Sema/IdentifierResolver.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/IdentifierResolver.h?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/IdentifierResolver.h (original)
+++ cfe/trunk/include/clang/Sema/IdentifierResolver.h Fri Aug 20 13:27:03 2010
@@ -16,7 +16,7 @@
#define LLVM_CLANG_AST_SEMA_IDENTIFIERRESOLVER_H
#include "clang/Basic/IdentifierTable.h"
-#include "clang/Parse/Scope.h"
+#include "clang/Sema/Scope.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/DeclCXX.h"
Modified: cfe/trunk/include/clang/Sema/Initialization.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Initialization.h?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Initialization.h (original)
+++ cfe/trunk/include/clang/Sema/Initialization.h Fri Aug 20 13:27:03 2010
@@ -13,10 +13,10 @@
#ifndef LLVM_CLANG_SEMA_INITIALIZATION_H
#define LLVM_CLANG_SEMA_INITIALIZATION_H
+#include "clang/Sema/Action.h"
#include "clang/Sema/Overload.h"
#include "clang/AST/Type.h"
#include "clang/AST/UnresolvedSet.h"
-#include "clang/Parse/Action.h"
#include "clang/Basic/SourceLocation.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/SmallVector.h"
Copied: cfe/trunk/include/clang/Sema/Ownership.h (from r111642, cfe/trunk/include/clang/Parse/Ownership.h)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Ownership.h?p2=cfe/trunk/include/clang/Sema/Ownership.h&p1=cfe/trunk/include/clang/Parse/Ownership.h&r1=111642&r2=111667&rev=111667&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Ownership.h (original)
+++ cfe/trunk/include/clang/Sema/Ownership.h Fri Aug 20 13:27:03 2010
@@ -1,4 +1,4 @@
-//===--- Ownership.h - Parser Ownership Helpers -----------------*- C++ -*-===//
+//===--- Ownership.h - Parser ownership helpers -----------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -11,8 +11,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_PARSE_OWNERSHIP_H
-#define LLVM_CLANG_PARSE_OWNERSHIP_H
+#ifndef LLVM_CLANG_SEMA_OWNERSHIP_H
+#define LLVM_CLANG_SEMA_OWNERSHIP_H
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/PointerIntPair.h"
Removed: cfe/trunk/include/clang/Sema/ParseAST.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/ParseAST.h?rev=111666&view=auto
==============================================================================
--- cfe/trunk/include/clang/Sema/ParseAST.h (original)
+++ cfe/trunk/include/clang/Sema/ParseAST.h (removed)
@@ -1,47 +0,0 @@
-//===--- ParseAST.h - Define the ParseAST method ----------------*- 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 clang::ParseAST method.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_SEMA_PARSEAST_H
-#define LLVM_CLANG_SEMA_PARSEAST_H
-
-namespace clang {
- class Preprocessor;
- class ASTConsumer;
- class ASTContext;
- class CodeCompleteConsumer;
- class Sema;
-
- /// \brief Parse the entire file specified, notifying the ASTConsumer as
- /// the file is parsed.
- ///
- /// This operation inserts the parsed decls into the translation
- /// unit held by Ctx.
- ///
- /// \param CompleteTranslationUnit When true, the parsed file is
- /// considered to be a complete translation unit, and any
- /// end-of-translation-unit wrapup will be performed.
- ///
- /// \param CompletionConsumer If given, an object to consume code completion
- /// results.
- void ParseAST(Preprocessor &pp, ASTConsumer *C,
- ASTContext &Ctx, bool PrintStats = false,
- bool CompleteTranslationUnit = true,
- CodeCompleteConsumer *CompletionConsumer = 0);
-
- /// \brief Parse the main file known to the preprocessor, producing an
- /// abstract syntax tree.
- void ParseAST(Sema &S, bool PrintStats = false);
-
-} // end namespace clang
-
-#endif
Copied: cfe/trunk/include/clang/Sema/ParsedTemplate.h (from r111642, cfe/trunk/include/clang/Parse/Template.h)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/ParsedTemplate.h?p2=cfe/trunk/include/clang/Sema/ParsedTemplate.h&p1=cfe/trunk/include/clang/Parse/Template.h&r1=111642&r2=111667&rev=111667&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Template.h (original)
+++ cfe/trunk/include/clang/Sema/ParsedTemplate.h Fri Aug 20 13:27:03 2010
@@ -1,4 +1,4 @@
-//===--- Template.h - Template Parsing Data Types -------------------------===//
+//===--- ParsedTemplate.h - Template Parsing Data Types -------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -11,11 +11,11 @@
// templates.
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_PARSE_TEMPLATE_H
-#define LLVM_CLANG_PARSE_TEMPLATE_H
+#ifndef LLVM_CLANG_SEMA_PARSEDTEMPLATE_H
+#define LLVM_CLANG_SEMA_PARSEDTEMPLATE_H
-#include "clang/Parse/DeclSpec.h"
-#include "clang/Parse/Ownership.h"
+#include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/Ownership.h"
#include <cassert>
namespace clang {
Copied: cfe/trunk/include/clang/Sema/Scope.h (from r111642, cfe/trunk/include/clang/Parse/Scope.h)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Scope.h?p2=cfe/trunk/include/clang/Sema/Scope.h&p1=cfe/trunk/include/clang/Parse/Scope.h&r1=111642&r2=111667&rev=111667&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Scope.h (original)
+++ cfe/trunk/include/clang/Sema/Scope.h Fri Aug 20 13:27:03 2010
@@ -11,10 +11,10 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_PARSE_SCOPE_H
-#define LLVM_CLANG_PARSE_SCOPE_H
+#ifndef LLVM_CLANG_SEMA_SCOPE_H
+#define LLVM_CLANG_SEMA_SCOPE_H
-#include "clang/Parse/Action.h"
+#include "clang/Sema/Action.h"
#include "llvm/ADT/SmallPtrSet.h"
namespace clang {
Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Fri Aug 20 13:27:03 2010
@@ -15,6 +15,7 @@
#ifndef LLVM_CLANG_AST_SEMA_H
#define LLVM_CLANG_AST_SEMA_H
+#include "clang/Sema/Action.h"
#include "clang/Sema/IdentifierResolver.h"
#include "clang/Sema/CodeCompleteConsumer.h"
#include "clang/Sema/CXXFieldCollector.h"
@@ -28,7 +29,6 @@
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/FullExpr.h"
-#include "clang/Parse/Action.h"
#include "clang/Sema/SemaDiagnostic.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/DenseSet.h"
Modified: cfe/trunk/lib/Frontend/DiagChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/DiagChecker.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/DiagChecker.cpp (original)
+++ cfe/trunk/lib/Frontend/DiagChecker.cpp Fri Aug 20 13:27:03 2010
@@ -13,7 +13,7 @@
#include "clang/Frontend/Utils.h"
#include "clang/Frontend/TextDiagnosticBuffer.h"
-#include "clang/Sema/ParseAST.h"
+#include "clang/Parse/ParseAST.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/Preprocessor.h"
Modified: cfe/trunk/lib/Frontend/FrontendAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendAction.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendAction.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendAction.cpp Fri Aug 20 13:27:03 2010
@@ -15,7 +15,7 @@
#include "clang/Frontend/ASTUnit.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendDiagnostic.h"
-#include "clang/Sema/ParseAST.h"
+#include "clang/Parse/ParseAST.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/ErrorHandling.h"
Removed: cfe/trunk/lib/Parse/Action.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Action.cpp?rev=111666&view=auto
==============================================================================
--- cfe/trunk/lib/Parse/Action.cpp (original)
+++ cfe/trunk/lib/Parse/Action.cpp (removed)
@@ -1,104 +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/Parse/Parser.h"
-#include "clang/Parse/DeclSpec.h"
-#include "clang/Parse/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 ActionBase class.
-ActionBase::~ActionBase() {}
-
-/// Out-of-line virtual destructor to provide home for Action class.
-Action::~Action() {}
-
-Action::ObjCMessageKind Action::getObjCMessageKind(Scope *S,
- IdentifierInfo *Name,
- SourceLocation NameLoc,
- bool IsSuper,
- bool HasTrailingDot,
- TypeTy *&ReceiverType) {
- ReceiverType = 0;
-
- if (IsSuper && !HasTrailingDot && S->isInObjcMethodScope())
- return ObjCSuperMessage;
-
- if (TypeTy *TyName = getTypeName(*Name, NameLoc, S)) {
- DeclSpec DS;
- const char *PrevSpec = 0;
- unsigned DiagID = 0;
- if (!DS.SetTypeSpecType(DeclSpec::TST_typename, NameLoc, PrevSpec,
- DiagID, TyName)) {
- DS.SetRangeEnd(NameLoc);
- Declarator DeclaratorInfo(DS, Declarator::TypeNameContext);
- TypeResult Ty = ActOnTypeName(S, DeclaratorInfo);
- if (!Ty.isInvalid())
- ReceiverType = Ty.get();
- }
- return ObjCClassMessage;
- }
-
- return ObjCInstanceMessage;
-}
-
-// Defined out-of-line here because of dependecy on AttributeList
-Action::DeclPtrTy Action::ActOnUsingDirective(Scope *CurScope,
- SourceLocation UsingLoc,
- SourceLocation NamespcLoc,
- CXXScopeSpec &SS,
- SourceLocation IdentLoc,
- IdentifierInfo *NamespcName,
- AttributeList *AttrList) {
-
- // FIXME: Parser seems to assume that Action::ActOn* takes ownership over
- // passed AttributeList, however other actions don't free it, is it
- // temporary state or bug?
- delete AttrList;
- return DeclPtrTy();
-}
-
-// Defined out-of-line here because of dependency on AttributeList
-Action::DeclPtrTy Action::ActOnUsingDeclaration(Scope *CurScope,
- AccessSpecifier AS,
- bool HasUsingKeyword,
- SourceLocation UsingLoc,
- CXXScopeSpec &SS,
- UnqualifiedId &Name,
- AttributeList *AttrList,
- bool IsTypeName,
- SourceLocation TypenameLoc) {
-
- // FIXME: Parser seems to assume that Action::ActOn* takes ownership over
- // passed AttributeList, however other actions don't free it, is it
- // temporary state or bug?
- delete AttrList;
- return DeclPtrTy();
-}
Removed: cfe/trunk/lib/Parse/AttributeList.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/AttributeList.cpp?rev=111666&view=auto
==============================================================================
--- cfe/trunk/lib/Parse/AttributeList.cpp (original)
+++ cfe/trunk/lib/Parse/AttributeList.cpp (removed)
@@ -1,134 +0,0 @@
-//===--- AttributeList.cpp --------------------------------------*- 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 AttributeList class implementation
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Parse/AttributeList.h"
-#include "clang/Basic/IdentifierTable.h"
-#include "llvm/ADT/StringSwitch.h"
-using namespace clang;
-
-AttributeList::AttributeList(IdentifierInfo *aName, SourceLocation aLoc,
- IdentifierInfo *sName, SourceLocation sLoc,
- IdentifierInfo *pName, SourceLocation pLoc,
- ActionBase::ExprTy **ExprList, unsigned numArgs,
- AttributeList *n, bool declspec, bool cxx0x)
- : AttrName(aName), AttrLoc(aLoc), ScopeName(sName), ScopeLoc(sLoc),
- ParmName(pName), ParmLoc(pLoc), NumArgs(numArgs), Next(n),
- DeclspecAttribute(declspec), CXX0XAttribute(cxx0x), Invalid(false) {
-
- if (numArgs == 0)
- Args = 0;
- else {
- Args = new ActionBase::ExprTy*[numArgs];
- memcpy(Args, ExprList, numArgs*sizeof(Args[0]));
- }
-}
-
-AttributeList::~AttributeList() {
- if (Args) {
- // FIXME: before we delete the vector, we need to make sure the Expr's
- // have been deleted. Since ActionBase::ExprTy is "void", we are dependent
- // on the actions module for actually freeing the memory. The specific
- // hooks are ActOnDeclarator, ActOnTypeName, ActOnParamDeclaratorType,
- // ParseField, ParseTag. Once these routines have freed the expression,
- // they should zero out the Args slot (to indicate the memory has been
- // freed). If any element of the vector is non-null, we should assert.
- delete [] Args;
- }
- delete Next;
-}
-
-AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) {
- llvm::StringRef AttrName = Name->getName();
-
- // Normalize the attribute name, __foo__ becomes foo.
- if (AttrName.startswith("__") && AttrName.endswith("__"))
- AttrName = AttrName.substr(2, AttrName.size() - 4);
-
- return llvm::StringSwitch<AttributeList::Kind>(AttrName)
- .Case("weak", AT_weak)
- .Case("weakref", AT_weakref)
- .Case("pure", AT_pure)
- .Case("mode", AT_mode)
- .Case("used", AT_used)
- .Case("alias", AT_alias)
- .Case("align", AT_aligned)
- .Case("final", AT_final)
- .Case("cdecl", AT_cdecl)
- .Case("const", AT_const)
- .Case("blocks", AT_blocks)
- .Case("format", AT_format)
- .Case("hiding", AT_hiding)
- .Case("malloc", AT_malloc)
- .Case("packed", AT_packed)
- .Case("unused", AT_unused)
- .Case("aligned", AT_aligned)
- .Case("cleanup", AT_cleanup)
- .Case("nodebug", AT_nodebug)
- .Case("nonnull", AT_nonnull)
- .Case("nothrow", AT_nothrow)
- .Case("objc_gc", AT_objc_gc)
- .Case("regparm", AT_regparm)
- .Case("section", AT_section)
- .Case("stdcall", AT_stdcall)
- .Case("annotate", AT_annotate)
- .Case("fastcall", AT_fastcall)
- .Case("ibaction", AT_IBAction)
- .Case("iboutlet", AT_IBOutlet)
- .Case("iboutletcollection", AT_IBOutletCollection)
- .Case("noreturn", AT_noreturn)
- .Case("noinline", AT_noinline)
- .Case("override", AT_override)
- .Case("sentinel", AT_sentinel)
- .Case("NSObject", AT_nsobject)
- .Case("dllimport", AT_dllimport)
- .Case("dllexport", AT_dllexport)
- .Case("may_alias", IgnoredAttribute) // FIXME: TBAA
- .Case("base_check", AT_base_check)
- .Case("deprecated", AT_deprecated)
- .Case("visibility", AT_visibility)
- .Case("destructor", AT_destructor)
- .Case("format_arg", AT_format_arg)
- .Case("gnu_inline", AT_gnu_inline)
- .Case("weak_import", AT_weak_import)
- .Case("vecreturn", AT_vecreturn)
- .Case("vector_size", AT_vector_size)
- .Case("constructor", AT_constructor)
- .Case("unavailable", AT_unavailable)
- .Case("overloadable", AT_overloadable)
- .Case("address_space", AT_address_space)
- .Case("always_inline", AT_always_inline)
- .Case("returns_twice", IgnoredAttribute)
- .Case("vec_type_hint", IgnoredAttribute)
- .Case("objc_exception", AT_objc_exception)
- .Case("ext_vector_type", AT_ext_vector_type)
- .Case("transparent_union", AT_transparent_union)
- .Case("analyzer_noreturn", AT_analyzer_noreturn)
- .Case("warn_unused_result", AT_warn_unused_result)
- .Case("carries_dependency", AT_carries_dependency)
- .Case("ns_returns_not_retained", AT_ns_returns_not_retained)
- .Case("ns_returns_retained", AT_ns_returns_retained)
- .Case("cf_returns_not_retained", AT_cf_returns_not_retained)
- .Case("cf_returns_retained", AT_cf_returns_retained)
- .Case("ownership_returns", AT_ownership_returns)
- .Case("ownership_holds", AT_ownership_holds)
- .Case("ownership_takes", AT_ownership_takes)
- .Case("reqd_work_group_size", AT_reqd_wg_size)
- .Case("init_priority", AT_init_priority)
- .Case("no_instrument_function", AT_no_instrument_function)
- .Case("thiscall", AT_thiscall)
- .Case("__cdecl", AT_cdecl)
- .Case("__stdcall", AT_stdcall)
- .Case("__fastcall", AT_fastcall)
- .Case("__thiscall", AT_thiscall)
- .Default(UnknownAttribute);
-}
Modified: cfe/trunk/lib/Parse/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/CMakeLists.txt?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/CMakeLists.txt (original)
+++ cfe/trunk/lib/Parse/CMakeLists.txt Fri Aug 20 13:27:03 2010
@@ -1,9 +1,7 @@
set(LLVM_NO_RTTI 1)
add_clang_library(clangParse
- Action.cpp
- AttributeList.cpp
- DeclSpec.cpp
+ ParseAST.cpp
ParseCXXInlineMethods.cpp
ParseDecl.cpp
ParseDeclCXX.cpp
Removed: cfe/trunk/lib/Parse/DeclSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/DeclSpec.cpp?rev=111666&view=auto
==============================================================================
--- cfe/trunk/lib/Parse/DeclSpec.cpp (original)
+++ cfe/trunk/lib/Parse/DeclSpec.cpp (removed)
@@ -1,610 +0,0 @@
-//===--- SemaDeclSpec.cpp - Declaration Specifier Semantic Analysis -------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements semantic analysis for declaration specifiers.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Parse/DeclSpec.h"
-#include "clang/Parse/ParseDiagnostic.h"
-#include "clang/Parse/Template.h"
-#include "clang/Lex/Preprocessor.h"
-#include "clang/Basic/LangOptions.h"
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/Support/ErrorHandling.h"
-#include <cstring>
-using namespace clang;
-
-
-static DiagnosticBuilder Diag(Diagnostic &D, SourceLocation Loc,
- SourceManager &SrcMgr, unsigned DiagID) {
- return D.Report(FullSourceLoc(Loc, SrcMgr), DiagID);
-}
-
-
-void UnqualifiedId::setTemplateId(TemplateIdAnnotation *TemplateId) {
- assert(TemplateId && "NULL template-id annotation?");
- Kind = IK_TemplateId;
- this->TemplateId = TemplateId;
- StartLocation = TemplateId->TemplateNameLoc;
- EndLocation = TemplateId->RAngleLoc;
-}
-
-void UnqualifiedId::setConstructorTemplateId(TemplateIdAnnotation *TemplateId) {
- assert(TemplateId && "NULL template-id annotation?");
- Kind = IK_ConstructorTemplateId;
- this->TemplateId = TemplateId;
- StartLocation = TemplateId->TemplateNameLoc;
- EndLocation = TemplateId->RAngleLoc;
-}
-
-/// DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.
-/// "TheDeclarator" is the declarator that this will be added to.
-DeclaratorChunk DeclaratorChunk::getFunction(bool hasProto, bool isVariadic,
- SourceLocation EllipsisLoc,
- ParamInfo *ArgInfo,
- unsigned NumArgs,
- unsigned TypeQuals,
- bool hasExceptionSpec,
- SourceLocation ThrowLoc,
- bool hasAnyExceptionSpec,
- ActionBase::TypeTy **Exceptions,
- SourceRange *ExceptionRanges,
- unsigned NumExceptions,
- SourceLocation LPLoc,
- SourceLocation RPLoc,
- Declarator &TheDeclarator) {
- DeclaratorChunk I;
- I.Kind = Function;
- I.Loc = LPLoc;
- I.EndLoc = RPLoc;
- I.Fun.hasPrototype = hasProto;
- I.Fun.isVariadic = isVariadic;
- I.Fun.EllipsisLoc = EllipsisLoc.getRawEncoding();
- I.Fun.DeleteArgInfo = false;
- I.Fun.TypeQuals = TypeQuals;
- I.Fun.NumArgs = NumArgs;
- I.Fun.ArgInfo = 0;
- I.Fun.hasExceptionSpec = hasExceptionSpec;
- I.Fun.ThrowLoc = ThrowLoc.getRawEncoding();
- I.Fun.hasAnyExceptionSpec = hasAnyExceptionSpec;
- I.Fun.NumExceptions = NumExceptions;
- I.Fun.Exceptions = 0;
-
- // new[] an argument array if needed.
- if (NumArgs) {
- // If the 'InlineParams' in Declarator is unused and big enough, put our
- // parameter list there (in an effort to avoid new/delete traffic). If it
- // is already used (consider a function returning a function pointer) or too
- // small (function taking too many arguments), go to the heap.
- if (!TheDeclarator.InlineParamsUsed &&
- NumArgs <= llvm::array_lengthof(TheDeclarator.InlineParams)) {
- I.Fun.ArgInfo = TheDeclarator.InlineParams;
- I.Fun.DeleteArgInfo = false;
- TheDeclarator.InlineParamsUsed = true;
- } else {
- I.Fun.ArgInfo = new DeclaratorChunk::ParamInfo[NumArgs];
- I.Fun.DeleteArgInfo = true;
- }
- memcpy(I.Fun.ArgInfo, ArgInfo, sizeof(ArgInfo[0])*NumArgs);
- }
- // new[] an exception array if needed
- if (NumExceptions) {
- I.Fun.Exceptions = new DeclaratorChunk::TypeAndRange[NumExceptions];
- for (unsigned i = 0; i != NumExceptions; ++i) {
- I.Fun.Exceptions[i].Ty = Exceptions[i];
- I.Fun.Exceptions[i].Range = ExceptionRanges[i];
- }
- }
- return I;
-}
-
-/// getParsedSpecifiers - Return a bitmask of which flavors of specifiers this
-/// declaration specifier includes.
-///
-unsigned DeclSpec::getParsedSpecifiers() const {
- unsigned Res = 0;
- if (StorageClassSpec != SCS_unspecified ||
- SCS_thread_specified)
- Res |= PQ_StorageClassSpecifier;
-
- if (TypeQualifiers != TQ_unspecified)
- Res |= PQ_TypeQualifier;
-
- if (hasTypeSpecifier())
- Res |= PQ_TypeSpecifier;
-
- if (FS_inline_specified || FS_virtual_specified || FS_explicit_specified)
- Res |= PQ_FunctionSpecifier;
- return Res;
-}
-
-template <class T> static bool BadSpecifier(T TNew, T TPrev,
- const char *&PrevSpec,
- unsigned &DiagID) {
- PrevSpec = DeclSpec::getSpecifierName(TPrev);
- DiagID = (TNew == TPrev ? diag::ext_duplicate_declspec
- : diag::err_invalid_decl_spec_combination);
- return true;
-}
-
-const char *DeclSpec::getSpecifierName(DeclSpec::SCS S) {
- switch (S) {
- case DeclSpec::SCS_unspecified: return "unspecified";
- case DeclSpec::SCS_typedef: return "typedef";
- case DeclSpec::SCS_extern: return "extern";
- case DeclSpec::SCS_static: return "static";
- case DeclSpec::SCS_auto: return "auto";
- case DeclSpec::SCS_register: return "register";
- case DeclSpec::SCS_private_extern: return "__private_extern__";
- case DeclSpec::SCS_mutable: return "mutable";
- }
- llvm_unreachable("Unknown typespec!");
-}
-
-const char *DeclSpec::getSpecifierName(TSW W) {
- switch (W) {
- case TSW_unspecified: return "unspecified";
- case TSW_short: return "short";
- case TSW_long: return "long";
- case TSW_longlong: return "long long";
- }
- llvm_unreachable("Unknown typespec!");
-}
-
-const char *DeclSpec::getSpecifierName(TSC C) {
- switch (C) {
- case TSC_unspecified: return "unspecified";
- case TSC_imaginary: return "imaginary";
- case TSC_complex: return "complex";
- }
- llvm_unreachable("Unknown typespec!");
-}
-
-
-const char *DeclSpec::getSpecifierName(TSS S) {
- switch (S) {
- case TSS_unspecified: return "unspecified";
- case TSS_signed: return "signed";
- case TSS_unsigned: return "unsigned";
- }
- llvm_unreachable("Unknown typespec!");
-}
-
-const char *DeclSpec::getSpecifierName(DeclSpec::TST T) {
- switch (T) {
- case DeclSpec::TST_unspecified: return "unspecified";
- case DeclSpec::TST_void: return "void";
- case DeclSpec::TST_char: return "char";
- case DeclSpec::TST_wchar: return "wchar_t";
- case DeclSpec::TST_char16: return "char16_t";
- case DeclSpec::TST_char32: return "char32_t";
- case DeclSpec::TST_int: return "int";
- case DeclSpec::TST_float: return "float";
- case DeclSpec::TST_double: return "double";
- case DeclSpec::TST_bool: return "_Bool";
- case DeclSpec::TST_decimal32: return "_Decimal32";
- case DeclSpec::TST_decimal64: return "_Decimal64";
- case DeclSpec::TST_decimal128: return "_Decimal128";
- case DeclSpec::TST_enum: return "enum";
- case DeclSpec::TST_class: return "class";
- case DeclSpec::TST_union: return "union";
- case DeclSpec::TST_struct: return "struct";
- case DeclSpec::TST_typename: return "type-name";
- case DeclSpec::TST_typeofType:
- case DeclSpec::TST_typeofExpr: return "typeof";
- case DeclSpec::TST_auto: return "auto";
- case DeclSpec::TST_decltype: return "(decltype)";
- case DeclSpec::TST_error: return "(error)";
- }
- llvm_unreachable("Unknown typespec!");
-}
-
-const char *DeclSpec::getSpecifierName(TQ T) {
- switch (T) {
- case DeclSpec::TQ_unspecified: return "unspecified";
- case DeclSpec::TQ_const: return "const";
- case DeclSpec::TQ_restrict: return "restrict";
- case DeclSpec::TQ_volatile: return "volatile";
- }
- llvm_unreachable("Unknown typespec!");
-}
-
-bool DeclSpec::SetStorageClassSpec(SCS S, SourceLocation Loc,
- const char *&PrevSpec,
- unsigned &DiagID) {
- if (StorageClassSpec != SCS_unspecified) {
- // Changing storage class is allowed only if the previous one
- // was the 'extern' that is part of a linkage specification and
- // the new storage class is 'typedef'.
- if (!(SCS_extern_in_linkage_spec &&
- StorageClassSpec == SCS_extern &&
- S == SCS_typedef))
- return BadSpecifier(S, (SCS)StorageClassSpec, PrevSpec, DiagID);
- }
- StorageClassSpec = S;
- StorageClassSpecLoc = Loc;
- assert((unsigned)S == StorageClassSpec && "SCS constants overflow bitfield");
- return false;
-}
-
-bool DeclSpec::SetStorageClassSpecThread(SourceLocation Loc,
- const char *&PrevSpec,
- unsigned &DiagID) {
- if (SCS_thread_specified) {
- PrevSpec = "__thread";
- DiagID = diag::ext_duplicate_declspec;
- return true;
- }
- SCS_thread_specified = true;
- SCS_threadLoc = Loc;
- return false;
-}
-
-/// These methods set the specified attribute of the DeclSpec, but return true
-/// and ignore the request if invalid (e.g. "extern" then "auto" is
-/// specified).
-bool DeclSpec::SetTypeSpecWidth(TSW W, SourceLocation Loc,
- const char *&PrevSpec,
- unsigned &DiagID) {
- if (TypeSpecWidth != TSW_unspecified &&
- // Allow turning long -> long long.
- (W != TSW_longlong || TypeSpecWidth != TSW_long))
- return BadSpecifier(W, (TSW)TypeSpecWidth, PrevSpec, DiagID);
- TypeSpecWidth = W;
- TSWLoc = Loc;
- if (TypeAltiVecVector && !TypeAltiVecBool &&
- ((TypeSpecWidth == TSW_long) || (TypeSpecWidth == TSW_longlong))) {
- PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType);
- DiagID = diag::warn_vector_long_decl_spec_combination;
- return true;
- }
- return false;
-}
-
-bool DeclSpec::SetTypeSpecComplex(TSC C, SourceLocation Loc,
- const char *&PrevSpec,
- unsigned &DiagID) {
- if (TypeSpecComplex != TSC_unspecified)
- return BadSpecifier(C, (TSC)TypeSpecComplex, PrevSpec, DiagID);
- TypeSpecComplex = C;
- TSCLoc = Loc;
- return false;
-}
-
-bool DeclSpec::SetTypeSpecSign(TSS S, SourceLocation Loc,
- const char *&PrevSpec,
- unsigned &DiagID) {
- if (TypeSpecSign != TSS_unspecified)
- return BadSpecifier(S, (TSS)TypeSpecSign, PrevSpec, DiagID);
- TypeSpecSign = S;
- TSSLoc = Loc;
- return false;
-}
-
-bool DeclSpec::SetTypeSpecType(TST T, SourceLocation Loc,
- const char *&PrevSpec,
- unsigned &DiagID,
- void *Rep, bool Owned) {
- if (TypeSpecType != TST_unspecified) {
- PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType);
- DiagID = diag::err_invalid_decl_spec_combination;
- return true;
- }
- if (TypeAltiVecVector && (T == TST_bool) && !TypeAltiVecBool) {
- TypeAltiVecBool = true;
- TSTLoc = Loc;
- return false;
- }
- TypeSpecType = T;
- TypeRep = Rep;
- TSTLoc = Loc;
- TypeSpecOwned = Owned;
- if (TypeAltiVecVector && !TypeAltiVecBool && (TypeSpecType == TST_double)) {
- PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType);
- DiagID = diag::err_invalid_vector_decl_spec;
- return true;
- }
- return false;
-}
-
-bool DeclSpec::SetTypeAltiVecVector(bool isAltiVecVector, SourceLocation Loc,
- const char *&PrevSpec, unsigned &DiagID) {
- if (TypeSpecType != TST_unspecified) {
- PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType);
- DiagID = diag::err_invalid_vector_decl_spec_combination;
- return true;
- }
- TypeAltiVecVector = isAltiVecVector;
- AltiVecLoc = Loc;
- return false;
-}
-
-bool DeclSpec::SetTypeAltiVecPixel(bool isAltiVecPixel, SourceLocation Loc,
- const char *&PrevSpec, unsigned &DiagID) {
- if (!TypeAltiVecVector || TypeAltiVecPixel ||
- (TypeSpecType != TST_unspecified)) {
- PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType);
- DiagID = diag::err_invalid_pixel_decl_spec_combination;
- return true;
- }
- TypeAltiVecPixel = isAltiVecPixel;
- TSTLoc = Loc;
- return false;
-}
-
-bool DeclSpec::SetTypeSpecError() {
- TypeSpecType = TST_error;
- TypeRep = 0;
- TSTLoc = SourceLocation();
- return false;
-}
-
-bool DeclSpec::SetTypeQual(TQ T, SourceLocation Loc, const char *&PrevSpec,
- unsigned &DiagID, const LangOptions &Lang) {
- // Duplicates turn into warnings pre-C99.
- if ((TypeQualifiers & T) && !Lang.C99)
- return BadSpecifier(T, T, PrevSpec, DiagID);
- TypeQualifiers |= T;
-
- switch (T) {
- default: assert(0 && "Unknown type qualifier!");
- case TQ_const: TQ_constLoc = Loc; break;
- case TQ_restrict: TQ_restrictLoc = Loc; break;
- case TQ_volatile: TQ_volatileLoc = Loc; break;
- }
- return false;
-}
-
-bool DeclSpec::SetFunctionSpecInline(SourceLocation Loc, const char *&PrevSpec,
- unsigned &DiagID) {
- // 'inline inline' is ok.
- FS_inline_specified = true;
- FS_inlineLoc = Loc;
- return false;
-}
-
-bool DeclSpec::SetFunctionSpecVirtual(SourceLocation Loc, const char *&PrevSpec,
- unsigned &DiagID) {
- // 'virtual virtual' is ok.
- FS_virtual_specified = true;
- FS_virtualLoc = Loc;
- return false;
-}
-
-bool DeclSpec::SetFunctionSpecExplicit(SourceLocation Loc, const char *&PrevSpec,
- unsigned &DiagID) {
- // 'explicit explicit' is ok.
- FS_explicit_specified = true;
- FS_explicitLoc = Loc;
- return false;
-}
-
-bool DeclSpec::SetFriendSpec(SourceLocation Loc, const char *&PrevSpec,
- unsigned &DiagID) {
- if (Friend_specified) {
- PrevSpec = "friend";
- DiagID = diag::ext_duplicate_declspec;
- return true;
- }
-
- Friend_specified = true;
- FriendLoc = Loc;
- return false;
-}
-
-bool DeclSpec::SetConstexprSpec(SourceLocation Loc, const char *&PrevSpec,
- unsigned &DiagID) {
- // 'constexpr constexpr' is ok.
- Constexpr_specified = true;
- ConstexprLoc = Loc;
- return false;
-}
-
-void DeclSpec::setProtocolQualifiers(const ActionBase::DeclPtrTy *Protos,
- unsigned NP,
- SourceLocation *ProtoLocs,
- SourceLocation LAngleLoc) {
- if (NP == 0) return;
- ProtocolQualifiers = new ActionBase::DeclPtrTy[NP];
- ProtocolLocs = new SourceLocation[NP];
- memcpy((void*)ProtocolQualifiers, Protos, sizeof(ActionBase::DeclPtrTy)*NP);
- memcpy(ProtocolLocs, ProtoLocs, sizeof(SourceLocation)*NP);
- NumProtocolQualifiers = NP;
- ProtocolLAngleLoc = LAngleLoc;
-}
-
-void DeclSpec::SaveWrittenBuiltinSpecs() {
- writtenBS.Sign = getTypeSpecSign();
- writtenBS.Width = getTypeSpecWidth();
- writtenBS.Type = getTypeSpecType();
- // Search the list of attributes for the presence of a mode attribute.
- writtenBS.ModeAttr = false;
- AttributeList* attrs = getAttributes();
- while (attrs) {
- if (attrs->getKind() == AttributeList::AT_mode) {
- writtenBS.ModeAttr = true;
- break;
- }
- attrs = attrs->getNext();
- }
-}
-
-void DeclSpec::SaveStorageSpecifierAsWritten() {
- if (SCS_extern_in_linkage_spec && StorageClassSpec == SCS_extern)
- // If 'extern' is part of a linkage specification,
- // then it is not a storage class "as written".
- StorageClassSpecAsWritten = SCS_unspecified;
- else
- StorageClassSpecAsWritten = StorageClassSpec;
-}
-
-/// Finish - This does final analysis of the declspec, rejecting things like
-/// "_Imaginary" (lacking an FP type). This returns a diagnostic to issue or
-/// diag::NUM_DIAGNOSTICS if there is no error. After calling this method,
-/// DeclSpec is guaranteed self-consistent, even if an error occurred.
-void DeclSpec::Finish(Diagnostic &D, Preprocessor &PP) {
- // Before possibly changing their values, save specs as written.
- SaveWrittenBuiltinSpecs();
- SaveStorageSpecifierAsWritten();
-
- // Check the type specifier components first.
- SourceManager &SrcMgr = PP.getSourceManager();
-
- // Validate and finalize AltiVec vector declspec.
- if (TypeAltiVecVector) {
- if (TypeAltiVecBool) {
- // Sign specifiers are not allowed with vector bool. (PIM 2.1)
- if (TypeSpecSign != TSS_unspecified) {
- Diag(D, TSSLoc, SrcMgr, diag::err_invalid_vector_bool_decl_spec)
- << getSpecifierName((TSS)TypeSpecSign);
- }
-
- // Only char/int are valid with vector bool. (PIM 2.1)
- if (((TypeSpecType != TST_unspecified) && (TypeSpecType != TST_char) &&
- (TypeSpecType != TST_int)) || TypeAltiVecPixel) {
- Diag(D, TSTLoc, SrcMgr, diag::err_invalid_vector_bool_decl_spec)
- << (TypeAltiVecPixel ? "__pixel" :
- getSpecifierName((TST)TypeSpecType));
- }
-
- // Only 'short' is valid with vector bool. (PIM 2.1)
- if ((TypeSpecWidth != TSW_unspecified) && (TypeSpecWidth != TSW_short))
- Diag(D, TSWLoc, SrcMgr, diag::err_invalid_vector_bool_decl_spec)
- << getSpecifierName((TSW)TypeSpecWidth);
-
- // Elements of vector bool are interpreted as unsigned. (PIM 2.1)
- if ((TypeSpecType == TST_char) || (TypeSpecType == TST_int) ||
- (TypeSpecWidth != TSW_unspecified))
- TypeSpecSign = TSS_unsigned;
- }
-
- if (TypeAltiVecPixel) {
- //TODO: perform validation
- TypeSpecType = TST_int;
- TypeSpecSign = TSS_unsigned;
- TypeSpecWidth = TSW_short;
- }
- }
-
- // signed/unsigned are only valid with int/char/wchar_t.
- if (TypeSpecSign != TSS_unspecified) {
- if (TypeSpecType == TST_unspecified)
- TypeSpecType = TST_int; // unsigned -> unsigned int, signed -> signed int.
- else if (TypeSpecType != TST_int &&
- TypeSpecType != TST_char && TypeSpecType != TST_wchar) {
- Diag(D, TSSLoc, SrcMgr, diag::err_invalid_sign_spec)
- << getSpecifierName((TST)TypeSpecType);
- // signed double -> double.
- TypeSpecSign = TSS_unspecified;
- }
- }
-
- // Validate the width of the type.
- switch (TypeSpecWidth) {
- case TSW_unspecified: break;
- case TSW_short: // short int
- case TSW_longlong: // long long int
- if (TypeSpecType == TST_unspecified)
- TypeSpecType = TST_int; // short -> short int, long long -> long long int.
- else if (TypeSpecType != TST_int) {
- Diag(D, TSWLoc, SrcMgr,
- TypeSpecWidth == TSW_short ? diag::err_invalid_short_spec
- : diag::err_invalid_longlong_spec)
- << getSpecifierName((TST)TypeSpecType);
- TypeSpecType = TST_int;
- }
- break;
- case TSW_long: // long double, long int
- if (TypeSpecType == TST_unspecified)
- TypeSpecType = TST_int; // long -> long int.
- else if (TypeSpecType != TST_int && TypeSpecType != TST_double) {
- Diag(D, TSWLoc, SrcMgr, diag::err_invalid_long_spec)
- << getSpecifierName((TST)TypeSpecType);
- TypeSpecType = TST_int;
- }
- break;
- }
-
- // TODO: if the implementation does not implement _Complex or _Imaginary,
- // disallow their use. Need information about the backend.
- if (TypeSpecComplex != TSC_unspecified) {
- if (TypeSpecType == TST_unspecified) {
- Diag(D, TSCLoc, SrcMgr, diag::ext_plain_complex)
- << FixItHint::CreateInsertion(
- PP.getLocForEndOfToken(getTypeSpecComplexLoc()),
- " double");
- TypeSpecType = TST_double; // _Complex -> _Complex double.
- } else if (TypeSpecType == TST_int || TypeSpecType == TST_char) {
- // Note that this intentionally doesn't include _Complex _Bool.
- Diag(D, TSTLoc, SrcMgr, diag::ext_integer_complex);
- } else if (TypeSpecType != TST_float && TypeSpecType != TST_double) {
- Diag(D, TSCLoc, SrcMgr, diag::err_invalid_complex_spec)
- << getSpecifierName((TST)TypeSpecType);
- TypeSpecComplex = TSC_unspecified;
- }
- }
-
- // C++ [class.friend]p6:
- // No storage-class-specifier shall appear in the decl-specifier-seq
- // of a friend declaration.
- if (isFriendSpecified() && getStorageClassSpec()) {
- DeclSpec::SCS SC = getStorageClassSpec();
- const char *SpecName = getSpecifierName(SC);
-
- SourceLocation SCLoc = getStorageClassSpecLoc();
- SourceLocation SCEndLoc = SCLoc.getFileLocWithOffset(strlen(SpecName));
-
- Diag(D, SCLoc, SrcMgr, diag::err_friend_storage_spec)
- << SpecName
- << FixItHint::CreateRemoval(SourceRange(SCLoc, SCEndLoc));
-
- ClearStorageClassSpecs();
- }
-
- // Okay, now we can infer the real type.
-
- // TODO: return "auto function" and other bad things based on the real type.
-
- // 'data definition has no type or storage class'?
-}
-
-bool DeclSpec::isMissingDeclaratorOk() {
- TST tst = getTypeSpecType();
- return (tst == TST_union
- || tst == TST_struct
- || tst == TST_class
- || tst == TST_enum
- ) && getTypeRep() != 0 && StorageClassSpec != DeclSpec::SCS_typedef;
-}
-
-void UnqualifiedId::clear() {
- if (Kind == IK_TemplateId)
- TemplateId->Destroy();
-
- Kind = IK_Identifier;
- Identifier = 0;
- StartLocation = SourceLocation();
- EndLocation = SourceLocation();
-}
-
-void UnqualifiedId::setOperatorFunctionId(SourceLocation OperatorLoc,
- OverloadedOperatorKind Op,
- SourceLocation SymbolLocations[3]) {
- Kind = IK_OperatorFunctionId;
- StartLocation = OperatorLoc;
- EndLocation = OperatorLoc;
- OperatorFunctionId.Operator = Op;
- for (unsigned I = 0; I != 3; ++I) {
- OperatorFunctionId.SymbolLocations[I] = SymbolLocations[I].getRawEncoding();
-
- if (SymbolLocations[I].isValid())
- EndLocation = SymbolLocations[I];
- }
-}
Copied: cfe/trunk/lib/Parse/ParseAST.cpp (from r111642, cfe/trunk/lib/Sema/ParseAST.cpp)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseAST.cpp?p2=cfe/trunk/lib/Parse/ParseAST.cpp&p1=cfe/trunk/lib/Sema/ParseAST.cpp&r1=111642&r2=111667&rev=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/ParseAST.cpp (original)
+++ cfe/trunk/lib/Parse/ParseAST.cpp Fri Aug 20 13:27:03 2010
@@ -11,7 +11,7 @@
//
//===----------------------------------------------------------------------===//
-#include "clang/Sema/ParseAST.h"
+#include "clang/Parse/ParseAST.h"
#include "clang/Sema/Sema.h"
#include "clang/Sema/CodeCompleteConsumer.h"
#include "clang/Sema/SemaConsumer.h"
Modified: cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp (original)
+++ cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp Fri Aug 20 13:27:03 2010
@@ -13,8 +13,8 @@
#include "clang/Parse/ParseDiagnostic.h"
#include "clang/Parse/Parser.h"
-#include "clang/Parse/DeclSpec.h"
-#include "clang/Parse/Scope.h"
+#include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/Scope.h"
using namespace clang;
/// ParseCXXInlineMethodDef - We parsed and verified that the specified
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Fri Aug 20 13:27:03 2010
@@ -13,8 +13,8 @@
#include "clang/Parse/Parser.h"
#include "clang/Parse/ParseDiagnostic.h"
-#include "clang/Parse/Scope.h"
-#include "clang/Parse/Template.h"
+#include "clang/Sema/Scope.h"
+#include "clang/Sema/ParsedTemplate.h"
#include "RAIIObjectsForParser.h"
#include "llvm/ADT/SmallSet.h"
using namespace clang;
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Fri Aug 20 13:27:03 2010
@@ -14,9 +14,9 @@
#include "clang/Basic/OperatorKinds.h"
#include "clang/Parse/Parser.h"
#include "clang/Parse/ParseDiagnostic.h"
-#include "clang/Parse/DeclSpec.h"
-#include "clang/Parse/Scope.h"
-#include "clang/Parse/Template.h"
+#include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/Scope.h"
+#include "clang/Sema/ParsedTemplate.h"
#include "RAIIObjectsForParser.h"
using namespace clang;
Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Fri Aug 20 13:27:03 2010
@@ -20,9 +20,9 @@
//===----------------------------------------------------------------------===//
#include "clang/Parse/Parser.h"
-#include "clang/Parse/DeclSpec.h"
-#include "clang/Parse/Scope.h"
-#include "clang/Parse/Template.h"
+#include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/Scope.h"
+#include "clang/Sema/ParsedTemplate.h"
#include "clang/Basic/PrettyStackTrace.h"
#include "RAIIObjectsForParser.h"
#include "llvm/ADT/SmallVector.h"
Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Fri Aug 20 13:27:03 2010
@@ -13,8 +13,8 @@
#include "clang/Parse/ParseDiagnostic.h"
#include "clang/Parse/Parser.h"
-#include "clang/Parse/DeclSpec.h"
-#include "clang/Parse/Template.h"
+#include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/ParsedTemplate.h"
#include "llvm/Support/ErrorHandling.h"
using namespace clang;
Modified: cfe/trunk/lib/Parse/ParseInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseInit.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseInit.cpp (original)
+++ cfe/trunk/lib/Parse/ParseInit.cpp Fri Aug 20 13:27:03 2010
@@ -11,10 +11,10 @@
//
//===----------------------------------------------------------------------===//
-#include "clang/Parse/Designator.h"
#include "clang/Parse/Parser.h"
#include "clang/Parse/ParseDiagnostic.h"
-#include "clang/Parse/Scope.h"
+#include "clang/Sema/Designator.h"
+#include "clang/Sema/Scope.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/raw_ostream.h"
using namespace clang;
Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Fri Aug 20 13:27:03 2010
@@ -11,10 +11,10 @@
//
//===----------------------------------------------------------------------===//
-#include "clang/Parse/Parser.h"
-#include "clang/Parse/DeclSpec.h"
-#include "clang/Parse/Scope.h"
#include "clang/Parse/ParseDiagnostic.h"
+#include "clang/Parse/Parser.h"
+#include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/Scope.h"
#include "llvm/ADT/SmallVector.h"
using namespace clang;
Modified: cfe/trunk/lib/Parse/ParsePragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParsePragma.cpp (original)
+++ cfe/trunk/lib/Parse/ParsePragma.cpp Fri Aug 20 13:27:03 2010
@@ -13,9 +13,9 @@
#include "ParsePragma.h"
#include "clang/Parse/ParseDiagnostic.h"
-#include "clang/Lex/Preprocessor.h"
-#include "clang/Parse/Action.h"
#include "clang/Parse/Parser.h"
+#include "clang/Lex/Preprocessor.h"
+#include "clang/Sema/Action.h"
using namespace clang;
Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Fri Aug 20 13:27:03 2010
@@ -14,8 +14,8 @@
#include "clang/Parse/Parser.h"
#include "RAIIObjectsForParser.h"
-#include "clang/Parse/DeclSpec.h"
-#include "clang/Parse/Scope.h"
+#include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/Scope.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/PrettyStackTrace.h"
#include "clang/Basic/SourceManager.h"
Modified: cfe/trunk/lib/Parse/ParseTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTemplate.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseTemplate.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTemplate.cpp Fri Aug 20 13:27:03 2010
@@ -13,9 +13,9 @@
#include "clang/Parse/Parser.h"
#include "clang/Parse/ParseDiagnostic.h"
-#include "clang/Parse/DeclSpec.h"
-#include "clang/Parse/Scope.h"
-#include "clang/Parse/Template.h"
+#include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/ParsedTemplate.h"
+#include "clang/Sema/Scope.h"
#include "RAIIObjectsForParser.h"
using namespace clang;
Modified: cfe/trunk/lib/Parse/ParseTentative.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTentative.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseTentative.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTentative.cpp Fri Aug 20 13:27:03 2010
@@ -14,7 +14,7 @@
#include "clang/Parse/Parser.h"
#include "clang/Parse/ParseDiagnostic.h"
-#include "clang/Parse/Template.h"
+#include "clang/Sema/ParsedTemplate.h"
using namespace clang;
/// isCXXDeclarationStatement - C++-specialized function that disambiguates
Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Fri Aug 20 13:27:03 2010
@@ -13,9 +13,9 @@
#include "clang/Parse/Parser.h"
#include "clang/Parse/ParseDiagnostic.h"
-#include "clang/Parse/DeclSpec.h"
-#include "clang/Parse/Scope.h"
-#include "clang/Parse/Template.h"
+#include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/Scope.h"
+#include "clang/Sema/ParsedTemplate.h"
#include "llvm/Support/raw_ostream.h"
#include "RAIIObjectsForParser.h"
#include "ParsePragma.h"
Copied: cfe/trunk/lib/Sema/Action.cpp (from r111642, cfe/trunk/lib/Parse/Action.cpp)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Action.cpp?p2=cfe/trunk/lib/Sema/Action.cpp&p1=cfe/trunk/lib/Parse/Action.cpp&r1=111642&r2=111667&rev=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/Action.cpp (original)
+++ cfe/trunk/lib/Sema/Action.cpp Fri Aug 20 13:27:03 2010
@@ -11,9 +11,8 @@
//
//===----------------------------------------------------------------------===//
-#include "clang/Parse/Parser.h"
-#include "clang/Parse/DeclSpec.h"
-#include "clang/Parse/Scope.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"
Copied: cfe/trunk/lib/Sema/AttributeList.cpp (from r111642, cfe/trunk/lib/Parse/AttributeList.cpp)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AttributeList.cpp?p2=cfe/trunk/lib/Sema/AttributeList.cpp&p1=cfe/trunk/lib/Parse/AttributeList.cpp&r1=111642&r2=111667&rev=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/AttributeList.cpp (original)
+++ cfe/trunk/lib/Sema/AttributeList.cpp Fri Aug 20 13:27:03 2010
@@ -11,7 +11,7 @@
//
//===----------------------------------------------------------------------===//
-#include "clang/Parse/AttributeList.h"
+#include "clang/Sema/AttributeList.h"
#include "clang/Basic/IdentifierTable.h"
#include "llvm/ADT/StringSwitch.h"
using namespace clang;
Modified: cfe/trunk/lib/Sema/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/CMakeLists.txt?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/CMakeLists.txt (original)
+++ cfe/trunk/lib/Sema/CMakeLists.txt Fri Aug 20 13:27:03 2010
@@ -1,11 +1,13 @@
set(LLVM_NO_RTTI 1)
add_clang_library(clangSema
+ Action.cpp
AnalysisBasedWarnings.cpp
+ AttributeList.cpp
CodeCompleteConsumer.cpp
+ DeclSpec.cpp
IdentifierResolver.cpp
JumpDiagnostics.cpp
- ParseAST.cpp
Sema.cpp
SemaAccess.cpp
SemaAttr.cpp
Modified: cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp (original)
+++ cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp Fri Aug 20 13:27:03 2010
@@ -11,9 +11,9 @@
//
//===----------------------------------------------------------------------===//
#include "clang/Sema/CodeCompleteConsumer.h"
+#include "clang/Sema/Scope.h"
#include "clang/Sema/Sema.h"
#include "clang/AST/DeclCXX.h"
-#include "clang/Parse/Scope.h"
#include "clang/Lex/Preprocessor.h"
#include "clang-c/Index.h"
#include "llvm/ADT/STLExtras.h"
Copied: cfe/trunk/lib/Sema/DeclSpec.cpp (from r111642, cfe/trunk/lib/Parse/DeclSpec.cpp)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?p2=cfe/trunk/lib/Sema/DeclSpec.cpp&p1=cfe/trunk/lib/Parse/DeclSpec.cpp&r1=111642&r2=111667&rev=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/DeclSpec.cpp (original)
+++ cfe/trunk/lib/Sema/DeclSpec.cpp Fri Aug 20 13:27:03 2010
@@ -11,9 +11,9 @@
//
//===----------------------------------------------------------------------===//
-#include "clang/Parse/DeclSpec.h"
-#include "clang/Parse/ParseDiagnostic.h"
-#include "clang/Parse/Template.h"
+#include "clang/Parse/ParseDiagnostic.h" // FIXME: remove this back-dependency!
+#include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/ParsedTemplate.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Basic/LangOptions.h"
#include "llvm/ADT/STLExtras.h"
Removed: cfe/trunk/lib/Sema/ParseAST.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/ParseAST.cpp?rev=111666&view=auto
==============================================================================
--- cfe/trunk/lib/Sema/ParseAST.cpp (original)
+++ cfe/trunk/lib/Sema/ParseAST.cpp (removed)
@@ -1,113 +0,0 @@
-//===--- ParseAST.cpp - Provide the clang::ParseAST method ----------------===//
-//
-// 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 clang::ParseAST method.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Sema/ParseAST.h"
-#include "clang/Sema/Sema.h"
-#include "clang/Sema/CodeCompleteConsumer.h"
-#include "clang/Sema/SemaConsumer.h"
-#include "clang/Sema/ExternalSemaSource.h"
-#include "clang/AST/ASTConsumer.h"
-#include "clang/AST/ExternalASTSource.h"
-#include "clang/AST/Stmt.h"
-#include "clang/Parse/Parser.h"
-#include <cstdio>
-
-using namespace clang;
-
-static void DumpRecordLayouts(ASTContext &C) {
- for (ASTContext::type_iterator I = C.types_begin(), E = C.types_end();
- I != E; ++I) {
- const RecordType *RT = dyn_cast<RecordType>(*I);
- if (!RT)
- continue;
-
- const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(RT->getDecl());
- if (!RD || RD->isImplicit() || RD->isDependentType() ||
- RD->isInvalidDecl() || !RD->getDefinition())
- continue;
-
- // FIXME: Do we really need to hard code this?
- if (RD->getQualifiedNameAsString() == "__va_list_tag")
- continue;
-
- C.DumpRecordLayout(RD, llvm::errs());
- }
-}
-
-//===----------------------------------------------------------------------===//
-// Public interface to the file
-//===----------------------------------------------------------------------===//
-
-/// ParseAST - Parse the entire file specified, notifying the ASTConsumer as
-/// the file is parsed. This inserts the parsed decls into the translation unit
-/// held by Ctx.
-///
-void clang::ParseAST(Preprocessor &PP, ASTConsumer *Consumer,
- ASTContext &Ctx, bool PrintStats,
- bool CompleteTranslationUnit,
- CodeCompleteConsumer *CompletionConsumer) {
- Sema S(PP, Ctx, *Consumer, CompleteTranslationUnit, CompletionConsumer);
- ParseAST(S, PrintStats);
-}
-
-void clang::ParseAST(Sema &S, bool PrintStats) {
- // Collect global stats on Decls/Stmts (until we have a module streamer).
- if (PrintStats) {
- Decl::CollectingStats(true);
- Stmt::CollectingStats(true);
- }
-
- ASTConsumer *Consumer = &S.getASTConsumer();
-
- Parser P(S.getPreprocessor(), S);
- S.getPreprocessor().EnterMainSourceFile();
- P.Initialize();
- S.Initialize();
-
- if (ExternalASTSource *External = S.getASTContext().getExternalSource())
- External->StartTranslationUnit(Consumer);
-
- Parser::DeclGroupPtrTy ADecl;
-
- while (!P.ParseTopLevelDecl(ADecl)) { // Not end of file.
- // If we got a null return and something *was* parsed, ignore it. This
- // is due to a top-level semicolon, an action override, or a parse error
- // skipping something.
- if (ADecl)
- Consumer->HandleTopLevelDecl(ADecl.getAsVal<DeclGroupRef>());
- };
- // Check for any pending objective-c implementation decl.
- while ((ADecl = P.FinishPendingObjCActions()))
- Consumer->HandleTopLevelDecl(ADecl.getAsVal<DeclGroupRef>());
-
- // Process any TopLevelDecls generated by #pragma weak.
- for (llvm::SmallVector<Decl*,2>::iterator
- I = S.WeakTopLevelDecls().begin(),
- E = S.WeakTopLevelDecls().end(); I != E; ++I)
- Consumer->HandleTopLevelDecl(DeclGroupRef(*I));
-
- // Dump record layouts, if requested.
- if (S.getLangOptions().DumpRecordLayouts)
- DumpRecordLayouts(S.getASTContext());
-
- Consumer->HandleTranslationUnit(S.getASTContext());
-
- if (PrintStats) {
- fprintf(stderr, "\nSTATISTICS:\n");
- P.getActions().PrintStats();
- S.getASTContext().PrintStats();
- Decl::PrintStats();
- Stmt::PrintStats();
- Consumer->PrintStats();
- }
-}
Modified: cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp Fri Aug 20 13:27:03 2010
@@ -18,7 +18,7 @@
#include "clang/AST/ExprCXX.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/Basic/PartialDiagnostic.h"
-#include "clang/Parse/DeclSpec.h"
+#include "clang/Sema/DeclSpec.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/raw_ostream.h"
using namespace clang;
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Aug 20 13:27:03 2010
@@ -21,9 +21,9 @@
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/StmtCXX.h"
-#include "clang/Parse/DeclSpec.h"
+#include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/ParsedTemplate.h"
#include "clang/Parse/ParseDiagnostic.h"
-#include "clang/Parse/Template.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Aug 20 13:27:03 2010
@@ -17,7 +17,7 @@
#include "clang/AST/DeclObjC.h"
#include "clang/AST/Expr.h"
#include "clang/Basic/TargetInfo.h"
-#include "clang/Parse/DeclSpec.h"
+#include "clang/Sema/DeclSpec.h"
#include "llvm/ADT/StringExtras.h"
using namespace clang;
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Aug 20 13:27:03 2010
@@ -23,8 +23,8 @@
#include "clang/AST/StmtVisitor.h"
#include "clang/AST/TypeLoc.h"
#include "clang/AST/TypeOrdering.h"
-#include "clang/Parse/DeclSpec.h"
-#include "clang/Parse/Template.h"
+#include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/ParsedTemplate.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Lex/Preprocessor.h"
#include "llvm/ADT/STLExtras.h"
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Fri Aug 20 13:27:03 2010
@@ -17,7 +17,7 @@
#include "clang/AST/Expr.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclObjC.h"
-#include "clang/Parse/DeclSpec.h"
+#include "clang/Sema/DeclSpec.h"
using namespace clang;
/// ActOnStartOfObjCMethodDef - This routine sets up parameters; invisible
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Aug 20 13:27:03 2010
@@ -29,10 +29,10 @@
#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/LiteralSupport.h"
#include "clang/Lex/Preprocessor.h"
-#include "clang/Parse/DeclSpec.h"
-#include "clang/Parse/Designator.h"
-#include "clang/Parse/Scope.h"
-#include "clang/Parse/Template.h"
+#include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/Designator.h"
+#include "clang/Sema/Scope.h"
+#include "clang/Sema/ParsedTemplate.h"
using namespace clang;
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Fri Aug 20 13:27:03 2010
@@ -22,8 +22,8 @@
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/Preprocessor.h"
-#include "clang/Parse/DeclSpec.h"
-#include "clang/Parse/Template.h"
+#include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/ParsedTemplate.h"
#include "llvm/ADT/STLExtras.h"
using namespace clang;
Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Fri Aug 20 13:27:03 2010
@@ -15,11 +15,11 @@
//
//===----------------------------------------------------------------------===//
+#include "clang/Sema/Designator.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/Sema.h"
#include "clang/Lex/Preprocessor.h"
-#include "clang/Parse/Designator.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Fri Aug 20 13:27:03 2010
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include "clang/Sema/Sema.h"
#include "clang/Sema/Lookup.h"
+#include "clang/Sema/DeclSpec.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/Decl.h"
@@ -21,7 +22,6 @@
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
-#include "clang/Parse/DeclSpec.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/LangOptions.h"
#include "llvm/ADT/STLExtras.h"
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Fri Aug 20 13:27:03 2010
@@ -17,8 +17,8 @@
#include "clang/AST/ExprCXX.h"
#include "clang/AST/DeclFriend.h"
#include "clang/AST/DeclTemplate.h"
-#include "clang/Parse/DeclSpec.h"
-#include "clang/Parse/Template.h"
+#include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/ParsedTemplate.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "llvm/ADT/StringExtras.h"
Modified: cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp Fri Aug 20 13:27:03 2010
@@ -11,12 +11,12 @@
//===----------------------------------------------------------------------===/
#include "clang/Sema/Sema.h"
+#include "clang/Sema/DeclSpec.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
-#include "clang/Parse/DeclSpec.h"
#include <algorithm>
namespace clang {
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Fri Aug 20 13:27:03 2010
@@ -12,12 +12,12 @@
#include "clang/Sema/Sema.h"
#include "TreeTransform.h"
+#include "clang/Sema/DeclSpec.h"
#include "clang/Sema/Lookup.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Expr.h"
#include "clang/AST/DeclTemplate.h"
-#include "clang/Parse/DeclSpec.h"
#include "clang/Basic/LangOptions.h"
using namespace clang;
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Fri Aug 20 13:27:03 2010
@@ -21,7 +21,7 @@
#include "clang/AST/Expr.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/TargetInfo.h"
-#include "clang/Parse/DeclSpec.h"
+#include "clang/Sema/DeclSpec.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/ErrorHandling.h"
using namespace clang;
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Fri Aug 20 13:27:03 2010
@@ -24,8 +24,8 @@
#include "clang/AST/StmtCXX.h"
#include "clang/AST/StmtObjC.h"
#include "clang/AST/TypeLocBuilder.h"
-#include "clang/Parse/Ownership.h"
-#include "clang/Parse/Designator.h"
+#include "clang/Sema/Ownership.h"
+#include "clang/Sema/Designator.h"
#include "clang/Lex/Preprocessor.h"
#include "llvm/Support/ErrorHandling.h"
#include <algorithm>
Modified: cfe/trunk/tools/c-index-test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/CMakeLists.txt?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/tools/c-index-test/CMakeLists.txt (original)
+++ cfe/trunk/tools/c-index-test/CMakeLists.txt Fri Aug 20 13:27:03 2010
@@ -6,10 +6,10 @@
clangFrontend
clangDriver
clangSerialization
+ clangParse
clangSema
clangAnalysis
clangAST
- clangParse
clangLex
clangBasic
)
Modified: cfe/trunk/tools/c-index-test/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/Makefile?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/tools/c-index-test/Makefile (original)
+++ cfe/trunk/tools/c-index-test/Makefile Fri Aug 20 13:27:03 2010
@@ -15,7 +15,7 @@
LINK_COMPONENTS := bitreader mc core
USEDLIBS = clang.a clangIndex.a clangFrontend.a clangDriver.a \
- clangSerialization.a clangSema.a clangAnalysis.a clangAST.a \
- clangParse.a clangLex.a clangBasic.a
+ clangSerialization.a clangParse.a clangSema.a clangAnalysis.a \
+ clangAST.a clangLex.a clangBasic.a
include $(CLANG_LEVEL)/Makefile
Modified: cfe/trunk/tools/driver/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/CMakeLists.txt?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/tools/driver/CMakeLists.txt (original)
+++ cfe/trunk/tools/driver/CMakeLists.txt Fri Aug 20 13:27:03 2010
@@ -5,13 +5,13 @@
clangDriver
clangSerialization
clangCodeGen
+ clangParse
clangSema
clangChecker
clangAnalysis
clangIndex
clangRewrite
clangAST
- clangParse
clangLex
clangBasic
)
Modified: cfe/trunk/tools/driver/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/Makefile?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/tools/driver/Makefile (original)
+++ cfe/trunk/tools/driver/Makefile Fri Aug 20 13:27:03 2010
@@ -28,8 +28,8 @@
LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader bitwriter codegen \
ipo selectiondag
USEDLIBS = clangFrontend.a clangDriver.a clangSerialization.a clangCodeGen.a \
- clangSema.a clangChecker.a clangAnalysis.a clangIndex.a \
- clangRewrite.a clangAST.a clangParse.a clangLex.a clangBasic.a
+ clangParse.a clangSema.a clangChecker.a clangAnalysis.a \
+ clangIndex.a clangRewrite.a clangAST.a clangLex.a clangBasic.a
include $(CLANG_LEVEL)/Makefile
Modified: cfe/trunk/tools/libclang/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CMakeLists.txt?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CMakeLists.txt (original)
+++ cfe/trunk/tools/libclang/CMakeLists.txt Fri Aug 20 13:27:03 2010
@@ -6,10 +6,10 @@
clangFrontend
clangDriver
clangSerialization
+ clangParse
clangSema
clangAnalysis
clangAST
- clangParse
clangLex
clangBasic)
Modified: cfe/trunk/tools/libclang/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/Makefile?rev=111667&r1=111666&r2=111667&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/Makefile (original)
+++ cfe/trunk/tools/libclang/Makefile Fri Aug 20 13:27:03 2010
@@ -16,8 +16,8 @@
SHARED_LIBRARY = 1
LINK_COMPONENTS := bitreader mc core
-USEDLIBS = clangFrontend.a clangDriver.a clangSerialization.a clangSema.a \
- clangAnalysis.a clangAST.a clangParse.a clangLex.a clangBasic.a
+USEDLIBS = clangFrontend.a clangDriver.a clangSerialization.a clangParse.a \
+ clangSema.a clangAnalysis.a clangAST.a clangLex.a clangBasic.a
include $(CLANG_LEVEL)/Makefile
More information about the cfe-commits
mailing list