summaryrefslogtreecommitdiffstats
path: root/include/clang/Parse
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Parse')
-rw-r--r--include/clang/Parse/Action.h74
-rw-r--r--include/clang/Parse/AttributeList.h2
-rw-r--r--include/clang/Parse/Ownership.h17
-rw-r--r--include/clang/Parse/Parser.h35
-rw-r--r--include/clang/Parse/Scope.h2
5 files changed, 113 insertions, 17 deletions
diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h
index 3d68d80..e21da81 100644
--- a/include/clang/Parse/Action.h
+++ b/include/clang/Parse/Action.h
@@ -105,12 +105,19 @@ public:
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);
}
@@ -279,13 +286,18 @@ public:
/// \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,
UnqualifiedId &Name,
TypeTy *ObjectType,
bool EnteringContext,
- TemplateTy &Template) = 0;
+ 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
@@ -566,7 +578,9 @@ public:
/// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
/// no declarator (e.g. "struct foo;") is parsed.
- virtual DeclPtrTy ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) {
+ virtual DeclPtrTy ParsedFreeStandingDeclSpec(Scope *S,
+ AccessSpecifier Access,
+ DeclSpec &DS) {
return DeclPtrTy();
}
@@ -826,21 +840,19 @@ public:
/// \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(FullExprArg Cond,
+ virtual OwningStmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc,
+ ExprArg Cond,
DeclPtrTy CondVar) {
return StmtEmpty();
}
- /// ActOnSwitchBodyError - This is called if there is an error parsing the
- /// body of the switch stmt instead of ActOnFinishSwitchStmt.
- virtual void ActOnSwitchBodyError(SourceLocation SwitchLoc, StmtArg Switch,
- StmtArg Body) {}
-
virtual OwningStmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc,
StmtArg Switch, StmtArg Body) {
return StmtEmpty();
@@ -1609,6 +1621,22 @@ public:
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);
+ }
+
/// ActOnCXXNew - Parsed a C++ 'new' expression. UseGlobal is true if the
/// new was qualified (::new). In a full new like
/// @code new (p1, p2) type(c1, c2) @endcode
@@ -2303,6 +2331,7 @@ public:
}
// 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
@@ -2346,7 +2375,7 @@ public:
// 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(SourceRange AtEnd,
+ virtual void ActOnAtEnd(Scope *S, SourceRange AtEnd,
DeclPtrTy classDecl,
DeclPtrTy *allMethods = 0,
unsigned allNum = 0,
@@ -2535,6 +2564,21 @@ public:
//===---------------------------- Pragmas -------------------------------===//
+ enum PragmaOptionsAlignKind {
+ POAK_Natural, // #pragma options align=natural
+ 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.
@@ -2620,9 +2664,13 @@ public:
/// \brief Code completion occurs at the beginning of the
/// initialization statement (or expression) in a for loop.
CCC_ForInit,
- /// \brief Code completion ocurs within the condition of an if,
+ /// \brief Code completion occurs within the condition of an if,
/// while, switch, or for statement.
- CCC_Condition
+ CCC_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.
+ CCC_RecoveryInFunction
};
/// \brief Code completion for an ordinary name that occurs within the given
@@ -3003,7 +3051,9 @@ public:
UnqualifiedId &Name,
TypeTy *ObjectType,
bool EnteringContext,
- TemplateTy &Template);
+ TemplateTy &Template,
+ bool &MemberOfUnknownSpecialization);
+
/// ActOnDeclarator - If this is a typedef declarator, we modify the
/// IdentifierInfo::FETokenInfo field to keep track of this fact, until S is
diff --git a/include/clang/Parse/AttributeList.h b/include/clang/Parse/AttributeList.h
index 12512f3..1e6d3ab 100644
--- a/include/clang/Parse/AttributeList.h
+++ b/include/clang/Parse/AttributeList.h
@@ -55,6 +55,7 @@ public:
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,
@@ -102,6 +103,7 @@ public:
AT_section,
AT_sentinel,
AT_stdcall,
+ AT_thiscall,
AT_transparent_union,
AT_unavailable,
AT_unused,
diff --git a/include/clang/Parse/Ownership.h b/include/clang/Parse/Ownership.h
index 5eb9635..e9a20b7 100644
--- a/include/clang/Parse/Ownership.h
+++ b/include/clang/Parse/Ownership.h
@@ -166,7 +166,7 @@ namespace llvm {
// conversions.
// Flip this switch to measure performance impact of the smart pointers.
-//#define DISABLE_SMART_POINTERS
+// #define DISABLE_SMART_POINTERS
namespace llvm {
template<>
@@ -403,8 +403,10 @@ namespace clang {
friend class moving::ASTResultMover<Destroyer>;
+#if !(defined(_MSC_VER) && _MSC_VER >= 1600)
ASTOwningResult(ASTOwningResult&); // DO NOT IMPLEMENT
ASTOwningResult& operator =(ASTOwningResult&); // DO NOT IMPLEMENT
+#endif
void destroy() {
if (Ptr) {
@@ -444,6 +446,19 @@ namespace clang {
return *this;
}
+#if defined(_MSC_VER) && _MSC_VER >= 1600
+ // Emulated move semantics don't work with msvc.
+ ASTOwningResult(ASTOwningResult &&mover)
+ : ActionInv(mover.ActionInv),
+ Ptr(mover.Ptr) {
+ mover.Ptr = 0;
+ }
+ ASTOwningResult &operator=(ASTOwningResult &&mover) {
+ *this = moving::ASTResultMover<Destroyer>(mover);
+ return *this;
+ }
+#endif
+
/// Assignment from a raw pointer. Takes ownership - beware!
ASTOwningResult &operator=(void *raw) {
destroy();
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h
index 42a41d6..8081c24 100644
--- a/include/clang/Parse/Parser.h
+++ b/include/clang/Parse/Parser.h
@@ -110,6 +110,7 @@ class Parser {
IdentifierInfo *Ident_vector;
IdentifierInfo *Ident_pixel;
+ llvm::OwningPtr<PragmaHandler> OptionsHandler;
llvm::OwningPtr<PragmaHandler> PackHandler;
llvm::OwningPtr<PragmaHandler> UnusedHandler;
llvm::OwningPtr<PragmaHandler> WeakHandler;
@@ -234,6 +235,11 @@ private:
assert(!isTokenStringLiteral() && !isTokenParen() && !isTokenBracket() &&
!isTokenBrace() &&
"Should consume special tokens with Consume*Token");
+ if (Tok.is(tok::code_completion)) {
+ CodeCompletionRecovery();
+ return ConsumeCodeCompletionToken();
+ }
+
PrevTokLocation = Tok.getLocation();
PP.Lex(Tok);
return PrevTokLocation;
@@ -308,6 +314,22 @@ private:
return PrevTokLocation;
}
+ /// \brief Consume the current code-completion token.
+ ///
+ /// This routine should be called to consume the code-completion token once
+ /// a code-completion action has already been invoked.
+ SourceLocation ConsumeCodeCompletionToken() {
+ assert(Tok.is(tok::code_completion));
+ PrevTokLocation = Tok.getLocation();
+ PP.Lex(Tok);
+ return PrevTokLocation;
+ }
+
+ ///\ brief When we are consuming a code-completion token within having
+ /// matched specific position in the grammar, provide code-completion results
+ /// based on context.
+ void CodeCompletionRecovery();
+
/// GetLookAheadToken - This peeks ahead N tokens and returns that token
/// without consuming any tokens. LookAhead(0) returns 'Tok', LookAhead(1)
/// returns the token after Tok, etc.
@@ -1004,7 +1026,8 @@ private:
//===--------------------------------------------------------------------===//
// C++ if/switch/while condition expression.
- bool ParseCXXCondition(OwningExprResult &ExprResult, DeclPtrTy &DeclResult);
+ bool ParseCXXCondition(OwningExprResult &ExprResult, DeclPtrTy &DeclResult,
+ SourceLocation Loc, bool ConvertToBoolean);
//===--------------------------------------------------------------------===//
// C++ types
@@ -1060,7 +1083,9 @@ private:
bool isStmtExpr = false);
OwningStmtResult ParseCompoundStatementBody(bool isStmtExpr = false);
bool ParseParenExprOrCondition(OwningExprResult &ExprResult,
- DeclPtrTy &DeclResult);
+ DeclPtrTy &DeclResult,
+ SourceLocation Loc,
+ bool ConvertToBoolean);
OwningStmtResult ParseIfStatement(AttributeList *Attr);
OwningStmtResult ParseSwitchStatement(AttributeList *Attr);
OwningStmtResult ParseWhileStatement(AttributeList *Attr);
@@ -1348,6 +1373,8 @@ private:
AttributeList *AttrList = 0,
bool RequiresArg = false);
void ParseFunctionDeclaratorIdentifierList(SourceLocation LParenLoc,
+ IdentifierInfo *FirstIdent,
+ SourceLocation FirstIdentLoc,
Declarator &D);
void ParseBracketDeclarator(Declarator &D);
@@ -1403,7 +1430,8 @@ private:
bool EnteringContext,
TypeTy *ObjectType,
UnqualifiedId &Id,
- bool AssumeTemplateId = false);
+ bool AssumeTemplateId,
+ SourceLocation TemplateKWLoc);
bool ParseUnqualifiedIdOperator(CXXScopeSpec &SS, bool EnteringContext,
TypeTy *ObjectType,
UnqualifiedId &Result);
@@ -1457,6 +1485,7 @@ private:
SourceLocation TemplateKWLoc = SourceLocation(),
bool AllowTypeAnnotation = true);
void AnnotateTemplateIdTokenAsType(const CXXScopeSpec *SS = 0);
+ bool IsTemplateArgumentList(unsigned Skip = 0);
bool ParseTemplateArgumentList(TemplateArgList &TemplateArgs);
ParsedTemplateArgument ParseTemplateTemplateArgument();
ParsedTemplateArgument ParseTemplateArgument();
diff --git a/include/clang/Parse/Scope.h b/include/clang/Parse/Scope.h
index d7a0e35..023f40d 100644
--- a/include/clang/Parse/Scope.h
+++ b/include/clang/Parse/Scope.h
@@ -74,7 +74,7 @@ public:
/// It always has FnScope and DeclScope set as well.
ObjCMethodScope = 0x400,
- /// ElseScope - This scoep corresponds to an 'else' scope of an if/then/else
+ /// ElseScope - This scope corresponds to an 'else' scope of an if/then/else
/// statement.
ElseScope = 0x800
};
OpenPOWER on IntegriCloud