summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2011-03-05 14:45:16 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2011-03-05 14:45:16 +0000
commit7acafd032e145dbdbbed9274ca57ec2c86b912bc (patch)
treeb73974f2c6ede1cebe101a1f5dd33ac75dacbcaa /include
parentb6ab6c1ca733fda2302a1c5066bdfc6218c89e41 (diff)
downloadclang-7acafd032e145dbdbbed9274ca57ec2c86b912bc.tar.gz
clang-7acafd032e145dbdbbed9274ca57ec2c86b912bc.tar.bz2
clang-7acafd032e145dbdbbed9274ca57ec2c86b912bc.tar.xz
Parser support for noexcept specifications.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127086 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/clang/Basic/DiagnosticParseKinds.td2
-rw-r--r--include/clang/Parse/Parser.h15
-rw-r--r--include/clang/Sema/DeclSpec.h9
3 files changed, 22 insertions, 4 deletions
diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td
index 9a68af9c45..acf38e4f0f 100644
--- a/include/clang/Basic/DiagnosticParseKinds.td
+++ b/include/clang/Basic/DiagnosticParseKinds.td
@@ -300,6 +300,8 @@ def err_expected_lbrace_after_base_specifiers : Error<
"expected '{' after base class list">;
def ext_ellipsis_exception_spec : Extension<
"exception specification of '...' is a Microsoft extension">;
+def err_dynamic_and_noexcept_specification : Error<
+ "cannot have both throw() and noexcept() clause on the same function">;
def err_expected_catch : Error<"expected catch">;
def err_expected_lbrace_or_comma : Error<"expected '{' or ','">;
def err_using_namespace_in_class : Error<
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h
index 78bd04b6bd..b8ae999fe5 100644
--- a/include/clang/Parse/Parser.h
+++ b/include/clang/Parse/Parser.h
@@ -1114,11 +1114,18 @@ private:
//===--------------------------------------------------------------------===//
// C++ 15: C++ Throw Expression
ExprResult ParseThrowExpression();
+
+ ExceptionSpecificationType MaybeParseExceptionSpecification(
+ SourceRange &SpecificationRange,
+ llvm::SmallVectorImpl<ParsedType> &DynamicExceptions,
+ llvm::SmallVectorImpl<SourceRange> &DynamicExceptionRanges,
+ ExprResult &NoexceptExpr);
+
// EndLoc is filled with the location of the last token of the specification.
- bool ParseExceptionSpecification(SourceLocation &EndLoc,
- llvm::SmallVectorImpl<ParsedType> &Exns,
- llvm::SmallVectorImpl<SourceRange> &Ranges,
- bool &hasAnyExceptionSpec);
+ ExceptionSpecificationType ParseDynamicExceptionSpecification(
+ SourceRange &SpecificationRange,
+ llvm::SmallVectorImpl<ParsedType> &Exceptions,
+ llvm::SmallVectorImpl<SourceRange> &Ranges);
//===--------------------------------------------------------------------===//
// C++0x 8: Function declaration trailing-return-type
diff --git a/include/clang/Sema/DeclSpec.h b/include/clang/Sema/DeclSpec.h
index 2f34347533..1567baaaad 100644
--- a/include/clang/Sema/DeclSpec.h
+++ b/include/clang/Sema/DeclSpec.h
@@ -907,6 +907,15 @@ public:
/// parsing.
typedef llvm::SmallVector<Token, 4> CachedTokens;
+/// \brief The various types of exception specifications that exist in C++0x.
+enum ExceptionSpecificationType {
+ EST_None, ///< no exception specification
+ EST_Dynamic, ///< throw() or throw(T1, T2)
+ EST_DynamicAny, ///< Microsoft throw(...) extension
+ EST_BasicNoexcept, ///< noexcept
+ EST_ComputedNoexcept ///< noexcept(expression)
+};
+
/// DeclaratorChunk - One instance of this struct is used for each type in a
/// declarator that is parsed.
///