diff options
author | dim <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
commit | 3176e97f130184ece0e1a21352c8124cc83ff24a (patch) | |
tree | 0a5b74c0b9ca73aded34df95c91fcaf3815230d8 /include/clang/Sema/DeclSpec.h | |
parent | 1e9b8d38881c3213d1e67b0c47ab9b2c00721a5c (diff) | |
download | FreeBSD-src-3176e97f130184ece0e1a21352c8124cc83ff24a.zip FreeBSD-src-3176e97f130184ece0e1a21352c8124cc83ff24a.tar.gz |
Vendor import of clang trunk r256633:
https://llvm.org/svn/llvm-project/cfe/trunk@256633
Diffstat (limited to 'include/clang/Sema/DeclSpec.h')
-rw-r--r-- | include/clang/Sema/DeclSpec.h | 66 |
1 files changed, 43 insertions, 23 deletions
diff --git a/include/clang/Sema/DeclSpec.h b/include/clang/Sema/DeclSpec.h index 41d4900..e9fdb70 100644 --- a/include/clang/Sema/DeclSpec.h +++ b/include/clang/Sema/DeclSpec.h @@ -31,7 +31,6 @@ #include "clang/Lex/Token.h" #include "clang/Sema/AttributeList.h" #include "clang/Sema/Ownership.h" -#include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorHandling.h" @@ -41,14 +40,10 @@ namespace clang { class CXXRecordDecl; class TypeLoc; class LangOptions; - class DiagnosticsEngine; class IdentifierInfo; class NamespaceAliasDecl; class NamespaceDecl; - class NestedNameSpecifier; - class NestedNameSpecifierLoc; class ObjCDeclSpec; - class Preprocessor; class Sema; class Declarator; struct TemplateIdAnnotation; @@ -70,8 +65,8 @@ class CXXScopeSpec { NestedNameSpecifierLocBuilder Builder; public: - const SourceRange &getRange() const { return Range; } - void setRange(const SourceRange &R) { Range = R; } + SourceRange getRange() const { return Range; } + void setRange(SourceRange R) { Range = R; } void setBeginLoc(SourceLocation Loc) { Range.setBegin(Loc); } void setEndLoc(SourceLocation Loc) { Range.setEnd(Loc); } SourceLocation getBeginLoc() const { return Range.getBegin(); } @@ -301,6 +296,7 @@ public: static const TST TST_decltype_auto = clang::TST_decltype_auto; static const TST TST_underlyingType = clang::TST_underlyingType; static const TST TST_auto = clang::TST_auto; + static const TST TST_auto_type = clang::TST_auto_type; static const TST TST_unknown_anytype = clang::TST_unknown_anytype; static const TST TST_atomic = clang::TST_atomic; static const TST TST_error = clang::TST_error; @@ -493,7 +489,7 @@ public: CXXScopeSpec &getTypeSpecScope() { return TypeScope; } const CXXScopeSpec &getTypeSpecScope() const { return TypeScope; } - const SourceRange &getSourceRange() const LLVM_READONLY { return Range; } + SourceRange getSourceRange() const LLVM_READONLY { return Range; } SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); } SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); } @@ -512,7 +508,8 @@ public: void setTypeofParensRange(SourceRange range) { TypeofParensRange = range; } bool containsPlaceholderType() const { - return TypeSpecType == TST_auto || TypeSpecType == TST_decltype_auto; + return (TypeSpecType == TST_auto || TypeSpecType == TST_auto_type || + TypeSpecType == TST_decltype_auto); } bool hasTagDefinition() const; @@ -742,8 +739,7 @@ public: /// 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(DiagnosticsEngine &D, Preprocessor &PP, - const PrintingPolicy &Policy); + void Finish(Sema &S, const PrintingPolicy &Policy); const WrittenBuiltinSpecs& getWrittenBuiltinSpecs() const { return writtenBS; @@ -1255,8 +1251,11 @@ struct DeclaratorChunk { /// any. unsigned MutableLoc; - /// \brief The location of the keyword introducing the spec, if any. - unsigned ExceptionSpecLoc; + /// \brief The beginning location of the exception specification, if any. + unsigned ExceptionSpecLocBeg; + + /// \brief The end location of the exception specification, if any. + unsigned ExceptionSpecLocEnd; /// Params - This is a pointer to a new[]'d array of ParamInfo objects that /// describe the parameters specified by this function declarator. null if @@ -1323,8 +1322,16 @@ struct DeclaratorChunk { return SourceLocation::getFromRawEncoding(RParenLoc); } - SourceLocation getExceptionSpecLoc() const { - return SourceLocation::getFromRawEncoding(ExceptionSpecLoc); + SourceLocation getExceptionSpecLocBeg() const { + return SourceLocation::getFromRawEncoding(ExceptionSpecLocBeg); + } + + SourceLocation getExceptionSpecLocEnd() const { + return SourceLocation::getFromRawEncoding(ExceptionSpecLocEnd); + } + + SourceRange getExceptionSpecRange() const { + return SourceRange(getExceptionSpecLocBeg(), getExceptionSpecLocEnd()); } /// \brief Retrieve the location of the ref-qualifier, if any. @@ -1496,7 +1503,7 @@ struct DeclaratorChunk { SourceLocation RestrictQualifierLoc, SourceLocation MutableLoc, ExceptionSpecificationType ESpecType, - SourceLocation ESpecLoc, + SourceRange ESpecRange, ParsedType *Exceptions, SourceRange *ExceptionRanges, unsigned NumExceptions, @@ -1704,7 +1711,7 @@ public: } /// \brief Get the source range that spans this declarator. - const SourceRange &getSourceRange() const LLVM_READONLY { return Range; } + SourceRange getSourceRange() const LLVM_READONLY { return Range; } SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); } SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); } @@ -1724,7 +1731,7 @@ public: /// 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(); + SourceRange SR = DS.getSourceRange(); if (Range.getBegin().isInvalid()) Range.setBegin(SR.getBegin()); if (!SR.getEnd().isInvalid()) @@ -2197,6 +2204,9 @@ public: /// redeclaration time if the decl is static. bool isStaticMember(); + /// Returns true if this declares a constructor or a destructor. + bool isCtorOrDtor(); + void setRedeclaration(bool Val) { Redeclaration = Val; } bool isRedeclaration() const { return Redeclaration; } }; @@ -2251,6 +2261,13 @@ private: SourceLocation LastLocation; }; +enum class LambdaCaptureInitKind { + NoInit, //!< [a] + CopyInit, //!< [a = b], [a = {b}] + DirectInit, //!< [a(b)] + ListInit //!< [a{b}] +}; + /// \brief Represents a complete lambda introducer. struct LambdaIntroducer { /// \brief An individual capture in a lambda introducer. @@ -2259,13 +2276,15 @@ struct LambdaIntroducer { SourceLocation Loc; IdentifierInfo *Id; SourceLocation EllipsisLoc; + LambdaCaptureInitKind InitKind; ExprResult Init; ParsedType InitCaptureType; LambdaCapture(LambdaCaptureKind Kind, SourceLocation Loc, IdentifierInfo *Id, SourceLocation EllipsisLoc, - ExprResult Init, ParsedType InitCaptureType) - : Kind(Kind), Loc(Loc), Id(Id), EllipsisLoc(EllipsisLoc), Init(Init), - InitCaptureType(InitCaptureType) {} + LambdaCaptureInitKind InitKind, ExprResult Init, + ParsedType InitCaptureType) + : Kind(Kind), Loc(Loc), Id(Id), EllipsisLoc(EllipsisLoc), + InitKind(InitKind), Init(Init), InitCaptureType(InitCaptureType) {} }; SourceRange Range; @@ -2281,10 +2300,11 @@ struct LambdaIntroducer { SourceLocation Loc, IdentifierInfo* Id, SourceLocation EllipsisLoc, + LambdaCaptureInitKind InitKind, ExprResult Init, ParsedType InitCaptureType) { - Captures.push_back(LambdaCapture(Kind, Loc, Id, EllipsisLoc, Init, - InitCaptureType)); + Captures.push_back(LambdaCapture(Kind, Loc, Id, EllipsisLoc, InitKind, Init, + InitCaptureType)); } }; |