[llvm-branch-commits] [cfe-branch] r127611 - in /cfe/branches/release_29: include/clang/AST/ include/clang/Basic/ include/clang/Parse/ include/clang/Sema/ lib/AST/ lib/Parse/ lib/Sema/ lib/Serialization/ test/CXX/except/except.spec/ test/Parser/

Bill Wendling isanbard at gmail.com
Mon Mar 14 13:16:09 PDT 2011


Author: void
Date: Mon Mar 14 15:16:08 2011
New Revision: 127611

URL: http://llvm.org/viewvc/llvm-project?rev=127611&view=rev
Log:
noexcept isn't finished just yet:

--- Reverse-merging r127118 into '.':
D    include/clang/Basic/ExceptionSpecificationType.h
U    include/clang/Sema/DeclSpec.h
U    include/clang/AST/Type.h
U    lib/Sema/SemaDeclCXX.cpp
U    lib/Sema/SemaExprCXX.cpp
U    lib/Sema/SemaTemplateInstantiateDecl.cpp
U    lib/Sema/SemaType.cpp
U    lib/Sema/SemaExceptionSpec.cpp
U    lib/Sema/SemaLookup.cpp
U    lib/AST/Type.cpp
U    lib/AST/ASTContext.cpp
U    lib/Serialization/ASTReader.cpp

--- Reverse-merging r127111 into '.':
G    include/clang/Sema/DeclSpec.h
U    lib/Sema/SemaDecl.cpp
U    lib/Sema/DeclSpec.cpp
G    lib/Sema/SemaType.cpp
U    lib/Parse/ParseDecl.cpp
U    lib/Parse/ParseExpr.cpp

--- Reverse-merging r127086 into '.':
A    test/Parser/cxx-exception-spec.cpp
D    test/CXX/except/except.spec/p1.cpp
U    include/clang/Basic/DiagnosticParseKinds.td
G    include/clang/Sema/DeclSpec.h
U    include/clang/Parse/Parser.h
G    lib/Parse/ParseDecl.cpp
U    lib/Parse/ParseDeclCXX.cpp

Added:
    cfe/branches/release_29/test/Parser/cxx-exception-spec.cpp
      - copied unchanged from r127085, cfe/trunk/test/Parser/cxx-exception-spec.cpp
Removed:
    cfe/branches/release_29/include/clang/Basic/ExceptionSpecificationType.h
    cfe/branches/release_29/test/CXX/except/except.spec/p1.cpp
Modified:
    cfe/branches/release_29/include/clang/AST/Type.h
    cfe/branches/release_29/include/clang/Basic/DiagnosticParseKinds.td
    cfe/branches/release_29/include/clang/Parse/Parser.h
    cfe/branches/release_29/include/clang/Sema/DeclSpec.h
    cfe/branches/release_29/lib/AST/ASTContext.cpp
    cfe/branches/release_29/lib/AST/Type.cpp
    cfe/branches/release_29/lib/Parse/ParseDecl.cpp
    cfe/branches/release_29/lib/Parse/ParseDeclCXX.cpp
    cfe/branches/release_29/lib/Parse/ParseExpr.cpp
    cfe/branches/release_29/lib/Sema/DeclSpec.cpp
    cfe/branches/release_29/lib/Sema/SemaDecl.cpp
    cfe/branches/release_29/lib/Sema/SemaDeclCXX.cpp
    cfe/branches/release_29/lib/Sema/SemaExceptionSpec.cpp
    cfe/branches/release_29/lib/Sema/SemaExprCXX.cpp
    cfe/branches/release_29/lib/Sema/SemaLookup.cpp
    cfe/branches/release_29/lib/Sema/SemaTemplateInstantiateDecl.cpp
    cfe/branches/release_29/lib/Sema/SemaType.cpp
    cfe/branches/release_29/lib/Serialization/ASTReader.cpp

Modified: cfe/branches/release_29/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/include/clang/AST/Type.h?rev=127611&r1=127610&r2=127611&view=diff
==============================================================================
--- cfe/branches/release_29/include/clang/AST/Type.h (original)
+++ cfe/branches/release_29/include/clang/AST/Type.h Mon Mar 14 15:16:08 2011
@@ -15,7 +15,6 @@
 #define LLVM_CLANG_AST_TYPE_H
 
 #include "clang/Basic/Diagnostic.h"
-#include "clang/Basic/ExceptionSpecificationType.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/Linkage.h"
 #include "clang/Basic/PartialDiagnostic.h"
@@ -2404,17 +2403,17 @@
   /// ExtProtoInfo - Extra information about a function prototype.
   struct ExtProtoInfo {
     ExtProtoInfo() :
-      Variadic(false), ExceptionSpecType(EST_None), TypeQuals(0),
-      RefQualifier(RQ_None), NumExceptions(0), Exceptions(0), NoexceptExpr(0) {}
+      Variadic(false), HasExceptionSpec(false), HasAnyExceptionSpec(false),
+      TypeQuals(0), RefQualifier(RQ_None), NumExceptions(0), Exceptions(0) {}
 
     FunctionType::ExtInfo ExtInfo;
     bool Variadic;
-    ExceptionSpecificationType ExceptionSpecType;
+    bool HasExceptionSpec;
+    bool HasAnyExceptionSpec;
     unsigned char TypeQuals;
     RefQualifierKind RefQualifier;
     unsigned NumExceptions;
     const QualType *Exceptions;
-    Expr *NoexceptExpr;
   };
 
 private:
@@ -2463,8 +2462,8 @@
     ExtProtoInfo EPI;
     EPI.ExtInfo = getExtInfo();
     EPI.Variadic = isVariadic();
-    EPI.ExceptionSpecType = hasExceptionSpec() ?
-        (hasAnyExceptionSpec() ? EST_DynamicAny : EST_Dynamic) : EST_None;
+    EPI.HasExceptionSpec = hasExceptionSpec();
+    EPI.HasAnyExceptionSpec = hasAnyExceptionSpec();
     EPI.TypeQuals = static_cast<unsigned char>(getTypeQuals());
     EPI.RefQualifier = getRefQualifier();
     EPI.NumExceptions = NumExceptions;

Modified: cfe/branches/release_29/include/clang/Basic/DiagnosticParseKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/include/clang/Basic/DiagnosticParseKinds.td?rev=127611&r1=127610&r2=127611&view=diff
==============================================================================
--- cfe/branches/release_29/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/branches/release_29/include/clang/Basic/DiagnosticParseKinds.td Mon Mar 14 15:16:08 2011
@@ -300,8 +300,6 @@
   "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<

Removed: cfe/branches/release_29/include/clang/Basic/ExceptionSpecificationType.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/include/clang/Basic/ExceptionSpecificationType.h?rev=127610&view=auto
==============================================================================
--- cfe/branches/release_29/include/clang/Basic/ExceptionSpecificationType.h (original)
+++ cfe/branches/release_29/include/clang/Basic/ExceptionSpecificationType.h (removed)
@@ -1,38 +0,0 @@
-//===--- ExceptionSpecificationType.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 ExceptionSpecificationType enumeration and various
-// utility functions.
-//
-//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H
-#define LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H
-
-namespace clang {
-
-/// \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)
-};
-
-inline bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType) {
-  return ESpecType == EST_Dynamic || ESpecType == EST_DynamicAny;
-}
-
-inline bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType) {
-  return ESpecType == EST_BasicNoexcept || ESpecType == EST_ComputedNoexcept;
-}
-
-} // end namespace clang
-
-#endif // LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H

Modified: cfe/branches/release_29/include/clang/Parse/Parser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/include/clang/Parse/Parser.h?rev=127611&r1=127610&r2=127611&view=diff
==============================================================================
--- cfe/branches/release_29/include/clang/Parse/Parser.h (original)
+++ cfe/branches/release_29/include/clang/Parse/Parser.h Mon Mar 14 15:16:08 2011
@@ -1114,18 +1114,11 @@
   //===--------------------------------------------------------------------===//
   // 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.
-  ExceptionSpecificationType ParseDynamicExceptionSpecification(
-                                  SourceRange &SpecificationRange,
-                                  llvm::SmallVectorImpl<ParsedType> &Exceptions,
-                                  llvm::SmallVectorImpl<SourceRange> &Ranges);
+  bool ParseExceptionSpecification(SourceLocation &EndLoc,
+                                   llvm::SmallVectorImpl<ParsedType> &Exns,
+                                   llvm::SmallVectorImpl<SourceRange> &Ranges,
+                                   bool &hasAnyExceptionSpec);
 
   //===--------------------------------------------------------------------===//
   // C++0x 8: Function declaration trailing-return-type

Modified: cfe/branches/release_29/include/clang/Sema/DeclSpec.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/include/clang/Sema/DeclSpec.h?rev=127611&r1=127610&r2=127611&view=diff
==============================================================================
--- cfe/branches/release_29/include/clang/Sema/DeclSpec.h (original)
+++ cfe/branches/release_29/include/clang/Sema/DeclSpec.h Mon Mar 14 15:16:08 2011
@@ -24,7 +24,6 @@
 #include "clang/Sema/Ownership.h"
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/Lex/Token.h"
-#include "clang/Basic/ExceptionSpecificationType.h"
 #include "clang/Basic/OperatorKinds.h"
 #include "clang/Basic/Specifiers.h"
 #include "llvm/ADT/SmallVector.h"
@@ -1020,8 +1019,11 @@
     /// The qualifier bitmask values are the same as in QualType.
     unsigned TypeQuals : 3;
 
-    /// ExceptionSpecType - An ExceptionSpecificationType value.
-    unsigned ExceptionSpecType : 3;
+    /// hasExceptionSpec - True if the function has an exception specification.
+    unsigned hasExceptionSpec : 1;
+
+    /// hasAnyExceptionSpec - True if the function has a throw(...) specifier.
+    unsigned hasAnyExceptionSpec : 1;
 
     /// DeleteArgInfo - If this is true, we need to delete[] ArgInfo.
     unsigned DeleteArgInfo : 1;
@@ -1033,34 +1035,28 @@
     /// declarator.
     unsigned NumArgs;
 
-    /// NumExceptions - This is the number of types in the dynamic-exception-
-    /// decl, if the function has one.
+    /// NumExceptions - This is the number of types in the exception-decl, if
+    /// the function has one.
     unsigned NumExceptions;
 
     /// \brief The location of the ref-qualifier, if any.
     ///
     /// If this is an invalid location, there is no ref-qualifier.
     unsigned RefQualifierLoc;
-
-    /// \brief When ExceptionSpecType isn't EST_None, the location of the
+    
+    /// ThrowLoc - When hasExceptionSpec is true, the location of the throw
     /// keyword introducing the spec.
-    unsigned ExceptionSpecLoc;
+    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;
 
-    union {
-      /// \brief Pointer to a new[]'d array of TypeAndRange objects that
-      /// contain the types in the function's dynamic exception specification
-      /// and their locations, if there is one.
-      TypeAndRange *Exceptions;
-
-      /// \brief Pointer to the expression in the noexcept-specifier of this
-      /// function, if it has one.
-      Expr *NoexceptExpr;
-    };
+    /// 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;
 
     /// TrailingReturnType - If this isn't null, it's the trailing return type
     /// specified. This is actually a ParsedType, but stored as void* to
@@ -1080,8 +1076,7 @@
     void destroy() {
       if (DeleteArgInfo)
         delete[] ArgInfo;
-      if (getExceptionSpecType() == EST_Dynamic)
-        delete[] Exceptions;
+      delete[] Exceptions;
     }
 
     /// isKNRPrototype - Return true if this is a K&R style identifier list,
@@ -1094,23 +1089,18 @@
     SourceLocation getEllipsisLoc() const {
       return SourceLocation::getFromRawEncoding(EllipsisLoc);
     }
-    SourceLocation getExceptionSpecLoc() const {
-      return SourceLocation::getFromRawEncoding(ExceptionSpecLoc);
+    SourceLocation getThrowLoc() const {
+      return SourceLocation::getFromRawEncoding(ThrowLoc);
     }
-
+    
     /// \brief Retrieve the location of the ref-qualifier, if any.
     SourceLocation getRefQualifierLoc() const {
       return SourceLocation::getFromRawEncoding(RefQualifierLoc);
     }
-
+    
     /// \brief Determine whether this function declaration contains a 
     /// ref-qualifier.
     bool hasRefQualifier() const { return getRefQualifierLoc().isValid(); }
-
-    /// \brief Get the type of exception specification this function has.
-    ExceptionSpecificationType getExceptionSpecType() const {
-      return static_cast<ExceptionSpecificationType>(ExceptionSpecType);
-    }
   };
 
   struct BlockPointerTypeInfo : TypeInfoCommon {
@@ -1234,16 +1224,15 @@
                                      unsigned TypeQuals, 
                                      bool RefQualifierIsLvalueRef,
                                      SourceLocation RefQualifierLoc,
-                                     ExceptionSpecificationType ESpecType,
-                                     SourceLocation ESpecLoc,
+                                     bool hasExceptionSpec,
+                                     SourceLocation ThrowLoc,
+                                     bool hasAnyExceptionSpec,
                                      ParsedType *Exceptions,
                                      SourceRange *ExceptionRanges,
                                      unsigned NumExceptions,
-                                     Expr *NoexceptExpr,
                                      SourceLocation LPLoc, SourceLocation RPLoc,
                                      Declarator &TheDeclarator,
-                                     ParsedType TrailingReturnType =
-                                                    ParsedType());
+                                     ParsedType TrailingReturnType = ParsedType());
 
   /// getBlockPointer - Return a DeclaratorChunk for a block.
   ///

Modified: cfe/branches/release_29/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/lib/AST/ASTContext.cpp?rev=127611&r1=127610&r2=127611&view=diff
==============================================================================
--- cfe/branches/release_29/lib/AST/ASTContext.cpp (original)
+++ cfe/branches/release_29/lib/AST/ASTContext.cpp Mon Mar 14 15:16:08 2011
@@ -1915,7 +1915,7 @@
     return QualType(FTP, 0);
 
   // Determine whether the type being created is already canonical or not.
-  bool isCanonical= EPI.ExceptionSpecType == EST_None && ResultTy.isCanonical();
+  bool isCanonical = !EPI.HasExceptionSpec && ResultTy.isCanonical();
   for (unsigned i = 0; i != NumArgs && isCanonical; ++i)
     if (!ArgArray[i].isCanonicalAsParam())
       isCanonical = false;
@@ -1934,8 +1934,11 @@
       CanonicalArgs.push_back(getCanonicalParamType(ArgArray[i]));
 
     FunctionProtoType::ExtProtoInfo CanonicalEPI = EPI;
-    CanonicalEPI.ExceptionSpecType = EST_None;
-    CanonicalEPI.NumExceptions = 0;
+    if (CanonicalEPI.HasExceptionSpec) {
+      CanonicalEPI.HasExceptionSpec = false;
+      CanonicalEPI.HasAnyExceptionSpec = false;
+      CanonicalEPI.NumExceptions = 0;
+    }
     CanonicalEPI.ExtInfo
       = CanonicalEPI.ExtInfo.withCallingConv(getCanonicalCallConv(CallConv));
 

Modified: cfe/branches/release_29/lib/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/lib/AST/Type.cpp?rev=127611&r1=127610&r2=127611&view=diff
==============================================================================
--- cfe/branches/release_29/lib/AST/Type.cpp (original)
+++ cfe/branches/release_29/lib/AST/Type.cpp Mon Mar 14 15:16:08 2011
@@ -1173,8 +1173,8 @@
                  result->containsUnexpandedParameterPack(),
                  epi.ExtInfo),
     NumArgs(numArgs), NumExceptions(epi.NumExceptions),
-    HasExceptionSpec(isDynamicExceptionSpec(epi.ExceptionSpecType)),
-    HasAnyExceptionSpec(epi.ExceptionSpecType == EST_DynamicAny)
+    HasExceptionSpec(epi.HasExceptionSpec),
+    HasAnyExceptionSpec(epi.HasAnyExceptionSpec)
 {
   // Fill in the trailing argument array.
   QualType *argSlot = reinterpret_cast<QualType*>(this+1);
@@ -1218,8 +1218,8 @@
   ID.AddBoolean(epi.Variadic);
   ID.AddInteger(epi.TypeQuals);
   ID.AddInteger(epi.RefQualifier);
-  if (isDynamicExceptionSpec(epi.ExceptionSpecType)) {
-    ID.AddBoolean(epi.ExceptionSpecType == EST_DynamicAny);
+  if (epi.HasExceptionSpec) {
+    ID.AddBoolean(epi.HasAnyExceptionSpec);
     for (unsigned i = 0; i != epi.NumExceptions; ++i)
       ID.AddPointer(epi.Exceptions[i].getAsOpaquePtr());
   }

Modified: cfe/branches/release_29/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/lib/Parse/ParseDecl.cpp?rev=127611&r1=127610&r2=127611&view=diff
==============================================================================
--- cfe/branches/release_29/lib/Parse/ParseDecl.cpp (original)
+++ cfe/branches/release_29/lib/Parse/ParseDecl.cpp Mon Mar 14 15:16:08 2011
@@ -3127,10 +3127,6 @@
 /// For C++, after the parameter-list, it also parses "cv-qualifier-seq[opt]",
 /// C++0x "ref-qualifier[opt]" and "exception-specification[opt]".
 ///
-/// [C++0x] exception-specification:
-///           dynamic-exception-specification
-///           noexcept-specification
-///
 void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D,
                                      ParsedAttributes &attrs,
                                      bool RequiresArg) {
@@ -3151,11 +3147,11 @@
     DeclSpec DS;
     SourceLocation RefQualifierLoc;
     bool RefQualifierIsLValueRef = true;
-    ExceptionSpecificationType ESpecType = EST_None;
-    SourceRange ESpecRange;
-    llvm::SmallVector<ParsedType, 2> DynamicExceptions;
-    llvm::SmallVector<SourceRange, 2> DynamicExceptionRanges;
-    ExprResult NoexceptExpr;
+    bool hasExceptionSpec = false;
+    SourceLocation ThrowLoc;
+    bool hasAnyExceptionSpec = false;
+    llvm::SmallVector<ParsedType, 2> Exceptions;
+    llvm::SmallVector<SourceRange, 2> ExceptionRanges;
     if (getLang().CPlusPlus) {
       MaybeParseCXX0XAttributes(attrs);
 
@@ -3172,14 +3168,16 @@
         RefQualifierLoc = ConsumeToken();
         EndLoc = RefQualifierLoc;
       }
-
+      
       // Parse exception-specification[opt].
-      ESpecType = MaybeParseExceptionSpecification(ESpecRange,
-                                                   DynamicExceptions,
-                                                   DynamicExceptionRanges,
-                                                   NoexceptExpr);
-      if (ESpecType != EST_None)
-        EndLoc = ESpecRange.getEnd();
+      if (Tok.is(tok::kw_throw)) {
+        hasExceptionSpec = true;
+        ThrowLoc = Tok.getLocation();
+        ParseExceptionSpecification(EndLoc, Exceptions, ExceptionRanges,
+                                    hasAnyExceptionSpec);
+        assert(Exceptions.size() == ExceptionRanges.size() &&
+               "Produced different number of exception types and ranges.");
+      }
 
       // Parse trailing-return-type.
       if (getLang().CPlusPlus0x && Tok.is(tok::arrow)) {
@@ -3197,12 +3195,11 @@
                                                DS.getTypeQualifiers(),
                                                RefQualifierIsLValueRef,
                                                RefQualifierLoc,
-                                               ESpecType, ESpecRange.getBegin(),
-                                               DynamicExceptions.data(),
-                                               DynamicExceptionRanges.data(),
-                                               DynamicExceptions.size(),
-                                               NoexceptExpr.isUsable() ?
-                                                 NoexceptExpr.get() : 0,
+                                               hasExceptionSpec, ThrowLoc,
+                                               hasAnyExceptionSpec,
+                                               Exceptions.data(),
+                                               ExceptionRanges.data(),
+                                               Exceptions.size(),
                                                LParenLoc, RParenLoc, D,
                                                TrailingReturnType),
                   EndLoc);
@@ -3399,11 +3396,11 @@
   DeclSpec DS;
   SourceLocation RefQualifierLoc;
   bool RefQualifierIsLValueRef = true;
-  ExceptionSpecificationType ESpecType = EST_None;
-  SourceRange ESpecRange;
-  llvm::SmallVector<ParsedType, 2> DynamicExceptions;
-  llvm::SmallVector<SourceRange, 2> DynamicExceptionRanges;
-  ExprResult NoexceptExpr;
+  bool hasExceptionSpec = false;
+  SourceLocation ThrowLoc;
+  bool hasAnyExceptionSpec = false;
+  llvm::SmallVector<ParsedType, 2> Exceptions;
+  llvm::SmallVector<SourceRange, 2> ExceptionRanges;
   
   if (getLang().CPlusPlus) {
     MaybeParseCXX0XAttributes(attrs);
@@ -3423,17 +3420,15 @@
       EndLoc = RefQualifierLoc;
     }
 
-    // FIXME: We should leave the prototype scope before parsing the exception
-    // specification, and then reenter it when parsing the trailing return type.
-    // FIXMEFIXME: Why? That wouldn't be right for the noexcept clause.
-
     // Parse exception-specification[opt].
-    ESpecType = MaybeParseExceptionSpecification(ESpecRange,
-                                                 DynamicExceptions,
-                                                 DynamicExceptionRanges,
-                                                 NoexceptExpr);
-    if (ESpecType != EST_None)
-      EndLoc = ESpecRange.getEnd();
+    if (Tok.is(tok::kw_throw)) {
+      hasExceptionSpec = true;
+      ThrowLoc = Tok.getLocation();
+      ParseExceptionSpecification(EndLoc, Exceptions, ExceptionRanges,
+                                  hasAnyExceptionSpec);
+      assert(Exceptions.size() == ExceptionRanges.size() &&
+             "Produced different number of exception types and ranges.");
+    }
 
     // Parse trailing-return-type.
     if (getLang().CPlusPlus0x && Tok.is(tok::arrow)) {
@@ -3441,6 +3436,9 @@
     }
   }
 
+  // FIXME: We should leave the prototype scope before parsing the exception
+  // specification, and then reenter it when parsing the trailing return type.
+
   // Leave prototype scope.
   PrototypeScope.Exit();
 
@@ -3452,12 +3450,11 @@
                                              DS.getTypeQualifiers(),
                                              RefQualifierIsLValueRef,
                                              RefQualifierLoc,
-                                             ESpecType, ESpecRange.getBegin(),
-                                             DynamicExceptions.data(),
-                                             DynamicExceptionRanges.data(),
-                                             DynamicExceptions.size(),
-                                             NoexceptExpr.isUsable() ?
-                                               NoexceptExpr.get() : 0,
+                                             hasExceptionSpec, ThrowLoc,
+                                             hasAnyExceptionSpec,
+                                             Exceptions.data(),
+                                             ExceptionRanges.data(),
+                                             Exceptions.size(),
                                              LParenLoc, RParenLoc, D,
                                              TrailingReturnType),
                 EndLoc);
@@ -3535,8 +3532,9 @@
                                              &ParamInfo[0], ParamInfo.size(),
                                              /*TypeQuals*/0,
                                              true, SourceLocation(),
-                                             EST_None, SourceLocation(), 0, 0,
-                                             0, 0, LParenLoc, RLoc, D),
+                                             /*exception*/false,
+                                             SourceLocation(), false, 0, 0, 0,
+                                             LParenLoc, RLoc, D),
                 RLoc);
 }
 

Modified: cfe/branches/release_29/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/lib/Parse/ParseDeclCXX.cpp?rev=127611&r1=127610&r2=127611&view=diff
==============================================================================
--- cfe/branches/release_29/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/branches/release_29/lib/Parse/ParseDeclCXX.cpp Mon Mar 14 15:16:08 2011
@@ -2001,76 +2001,10 @@
                                      EllipsisLoc);
 }
 
-/// \brief Parse a C++ exception-specification if present (C++0x [except.spec]).
+/// ParseExceptionSpecification - Parse a C++ exception-specification
+/// (C++ [except.spec]).
 ///
 ///       exception-specification:
-///         dynamic-exception-specification
-///         noexcept-specification
-///
-///       noexcept-specification:
-///         'noexcept'
-///         'noexcept' '(' constant-expression ')'
-ExceptionSpecificationType
-Parser::MaybeParseExceptionSpecification(SourceRange &SpecificationRange,
-                    llvm::SmallVectorImpl<ParsedType> &DynamicExceptions,
-                    llvm::SmallVectorImpl<SourceRange> &DynamicExceptionRanges,
-                    ExprResult &NoexceptExpr) {
-  ExceptionSpecificationType Result = EST_None;
-
-  // See if there's a dynamic specification.
-  if (Tok.is(tok::kw_throw)) {
-    Result = ParseDynamicExceptionSpecification(SpecificationRange,
-                                                DynamicExceptions,
-                                                DynamicExceptionRanges);
-    assert(DynamicExceptions.size() == DynamicExceptionRanges.size() &&
-           "Produced different number of exception types and ranges.");
-  }
-
-  // If there's no noexcept specification, we're done.
-  if (Tok.isNot(tok::kw_noexcept))
-    return Result;
-
-  // If we already had a dynamic specification, parse the noexcept for,
-  // recovery, but emit a diagnostic and don't store the results.
-  SourceRange NoexceptRange;
-  ExceptionSpecificationType NoexceptType = EST_None;
-
-  SourceLocation KeywordLoc = ConsumeToken();
-  if (Tok.is(tok::l_paren)) {
-    // There is an argument.
-    SourceLocation LParenLoc = ConsumeParen();
-    NoexceptType = EST_ComputedNoexcept;
-    NoexceptExpr = ParseConstantExpression();
-    SourceLocation RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc);
-    NoexceptRange = SourceRange(KeywordLoc, RParenLoc);
-  } else {
-    // There is no argument.
-    NoexceptType = EST_BasicNoexcept;
-    NoexceptRange = SourceRange(KeywordLoc, KeywordLoc);
-  }
-
-  if (Result == EST_None) {
-    SpecificationRange = NoexceptRange;
-    Result = NoexceptType;
-
-    // If there's a dynamic specification after a noexcept specification,
-    // parse that and ignore the results.
-    if (Tok.is(tok::kw_throw)) {
-      Diag(Tok.getLocation(), diag::err_dynamic_and_noexcept_specification);
-      ParseDynamicExceptionSpecification(NoexceptRange, DynamicExceptions,
-                                         DynamicExceptionRanges);
-    }
-  } else {
-    Diag(Tok.getLocation(), diag::err_dynamic_and_noexcept_specification);
-  }
-
-  return Result;
-}
-
-/// ParseDynamicExceptionSpecification - Parse a C++
-/// dynamic-exception-specification (C++ [except.spec]).
-///
-///       dynamic-exception-specification:
 ///         'throw' '(' type-id-list [opt] ')'
 /// [MS]    'throw' '(' '...' ')'
 ///
@@ -2078,47 +2012,46 @@
 ///         type-id ... [opt]
 ///         type-id-list ',' type-id ... [opt]
 ///
-ExceptionSpecificationType Parser::ParseDynamicExceptionSpecification(
-                                  SourceRange &SpecificationRange,
-                                  llvm::SmallVectorImpl<ParsedType> &Exceptions,
-                                  llvm::SmallVectorImpl<SourceRange> &Ranges) {
+bool Parser::ParseExceptionSpecification(SourceLocation &EndLoc,
+                                         llvm::SmallVectorImpl<ParsedType>
+                                             &Exceptions,
+                                         llvm::SmallVectorImpl<SourceRange>
+                                             &Ranges,
+                                         bool &hasAnyExceptionSpec) {
   assert(Tok.is(tok::kw_throw) && "expected throw");
 
-  SpecificationRange.setBegin(ConsumeToken());
+  ConsumeToken();
 
   if (!Tok.is(tok::l_paren)) {
-    Diag(Tok, diag::err_expected_lparen_after) << "throw";
-    SpecificationRange.setEnd(SpecificationRange.getBegin());
-    return EST_Dynamic;
+    return Diag(Tok, diag::err_expected_lparen_after) << "throw";
   }
   SourceLocation LParenLoc = ConsumeParen();
 
   // Parse throw(...), a Microsoft extension that means "this function
   // can throw anything".
   if (Tok.is(tok::ellipsis)) {
+    hasAnyExceptionSpec = true;
     SourceLocation EllipsisLoc = ConsumeToken();
     if (!getLang().Microsoft)
       Diag(EllipsisLoc, diag::ext_ellipsis_exception_spec);
-    SourceLocation RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc);
-    SpecificationRange.setEnd(RParenLoc);
-    return EST_DynamicAny;
+    EndLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc);
+    return false;
   }
 
   // Parse the sequence of type-ids.
   SourceRange Range;
   while (Tok.isNot(tok::r_paren)) {
     TypeResult Res(ParseTypeName(&Range));
-
+    
     if (Tok.is(tok::ellipsis)) {
       // C++0x [temp.variadic]p5:
       //   - In a dynamic-exception-specification (15.4); the pattern is a 
       //     type-id.
       SourceLocation Ellipsis = ConsumeToken();
-      Range.setEnd(Ellipsis);
       if (!Res.isInvalid())
         Res = Actions.ActOnPackExpansion(Res.get(), Ellipsis);
     }
-
+    
     if (!Res.isInvalid()) {
       Exceptions.push_back(Res.get());
       Ranges.push_back(Range);
@@ -2130,8 +2063,8 @@
       break;
   }
 
-  SpecificationRange.setEnd(MatchRHSPunctuation(tok::r_paren, LParenLoc));
-  return EST_Dynamic;
+  EndLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc);
+  return false;
 }
 
 /// ParseTrailingReturnType - Parse a trailing return type on a new-style

Modified: cfe/branches/release_29/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/lib/Parse/ParseExpr.cpp?rev=127611&r1=127610&r2=127611&view=diff
==============================================================================
--- cfe/branches/release_29/lib/Parse/ParseExpr.cpp (original)
+++ cfe/branches/release_29/lib/Parse/ParseExpr.cpp Mon Mar 14 15:16:08 2011
@@ -1918,9 +1918,8 @@
                                                        SourceLocation(),
                                                        0, 0, 0,
                                                        true, SourceLocation(),
-                                                       EST_None,
-                                                       SourceLocation(),
-                                                       0, 0, 0, 0,
+                                                       false, SourceLocation(),
+                                                       false, 0, 0, 0,
                                                        CaretLoc, CaretLoc,
                                                        ParamInfo),
                           CaretLoc);

Modified: cfe/branches/release_29/lib/Sema/DeclSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/lib/Sema/DeclSpec.cpp?rev=127611&r1=127610&r2=127611&view=diff
==============================================================================
--- cfe/branches/release_29/lib/Sema/DeclSpec.cpp (original)
+++ cfe/branches/release_29/lib/Sema/DeclSpec.cpp Mon Mar 14 15:16:08 2011
@@ -142,36 +142,35 @@
                                              unsigned TypeQuals,
                                              bool RefQualifierIsLvalueRef,
                                              SourceLocation RefQualifierLoc,
-                                             ExceptionSpecificationType
-                                                 ESpecType,
-                                             SourceLocation ESpecLoc,
+                                             bool hasExceptionSpec,
+                                             SourceLocation ThrowLoc,
+                                             bool hasAnyExceptionSpec,
                                              ParsedType *Exceptions,
                                              SourceRange *ExceptionRanges,
                                              unsigned NumExceptions,
-                                             Expr *NoexceptExpr,
                                              SourceLocation LPLoc,
                                              SourceLocation RPLoc,
                                              Declarator &TheDeclarator,
                                              ParsedType TrailingReturnType) {
   DeclaratorChunk I;
-  I.Kind                        = Function;
-  I.Loc                         = LPLoc;
-  I.EndLoc                      = RPLoc;
-  I.Fun.AttrList                = attrs.getList();
-  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.Kind                 = Function;
+  I.Loc                  = LPLoc;
+  I.EndLoc               = RPLoc;
+  I.Fun.AttrList         = attrs.getList();
+  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.RefQualifierIsLValueRef = RefQualifierIsLvalueRef;
-  I.Fun.RefQualifierLoc         = RefQualifierLoc.getRawEncoding();
-  I.Fun.ExceptionSpecType       = ESpecType;
-  I.Fun.ExceptionSpecLoc        = ESpecLoc.getRawEncoding();
-  I.Fun.NumExceptions           = 0;
-  I.Fun.Exceptions              = 0;
-  I.Fun.NoexceptExpr            = 0;
+  I.Fun.RefQualifierLoc = RefQualifierLoc.getRawEncoding();
+  I.Fun.hasExceptionSpec = hasExceptionSpec;
+  I.Fun.ThrowLoc         = ThrowLoc.getRawEncoding();
+  I.Fun.hasAnyExceptionSpec = hasAnyExceptionSpec;
+  I.Fun.NumExceptions    = NumExceptions;
+  I.Fun.Exceptions       = 0;
   I.Fun.TrailingReturnType   = TrailingReturnType.getAsOpaquePtr();
 
   // new[] an argument array if needed.
@@ -191,25 +190,13 @@
     }
     memcpy(I.Fun.ArgInfo, ArgInfo, sizeof(ArgInfo[0])*NumArgs);
   }
-
-  // Check what exception specification information we should actually store.
-  switch (ESpecType) {
-  default: break; // By default, save nothing.
-  case EST_Dynamic:
-    // new[] an exception array if needed
-    if (NumExceptions) {
-      I.Fun.NumExceptions = 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];
-      }
+  // 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];
     }
-    break;
-
-  case EST_ComputedNoexcept:
-    I.Fun.NoexceptExpr = NoexceptExpr;
-    break;
   }
   return I;
 }

Modified: cfe/branches/release_29/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/lib/Sema/SemaDecl.cpp?rev=127611&r1=127610&r2=127611&view=diff
==============================================================================
--- cfe/branches/release_29/lib/Sema/SemaDecl.cpp (original)
+++ cfe/branches/release_29/lib/Sema/SemaDecl.cpp Mon Mar 14 15:16:08 2011
@@ -5771,8 +5771,8 @@
   D.AddTypeInfo(DeclaratorChunk::getFunction(ParsedAttributes(),
                                              false, false, SourceLocation(), 0,
                                              0, 0, true, SourceLocation(),
-                                             EST_None, SourceLocation(),
-                                             0, 0, 0, 0, Loc, Loc, D),
+                                             false, SourceLocation(),
+                                             false, 0,0,0, Loc, Loc, D),
                 SourceLocation());
   D.SetIdentifier(&II, Loc);
 

Modified: cfe/branches/release_29/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/lib/Sema/SemaDeclCXX.cpp?rev=127611&r1=127610&r2=127611&view=diff
==============================================================================
--- cfe/branches/release_29/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/branches/release_29/lib/Sema/SemaDeclCXX.cpp Mon Mar 14 15:16:08 2011
@@ -4712,12 +4712,11 @@
   }
 
   FunctionProtoType::ExtProtoInfo EPI;
-  EPI.ExceptionSpecType = ExceptSpec.hasExceptionSpecification() ?
-    (ExceptSpec.hasAnyExceptionSpecification() ? EST_DynamicAny : EST_Dynamic) :
-    EST_None;
+  EPI.HasExceptionSpec = ExceptSpec.hasExceptionSpecification();
+  EPI.HasAnyExceptionSpec = ExceptSpec.hasAnyExceptionSpecification();
   EPI.NumExceptions = ExceptSpec.size();
   EPI.Exceptions = ExceptSpec.data();
-
+  
   // Create the actual constructor declaration.
   CanQualType ClassType
     = Context.getCanonicalType(Context.getTypeDeclType(ClassDecl));
@@ -4990,9 +4989,8 @@
   
   // Create the actual destructor declaration.
   FunctionProtoType::ExtProtoInfo EPI;
-  EPI.ExceptionSpecType = ExceptSpec.hasExceptionSpecification() ?
-    (ExceptSpec.hasAnyExceptionSpecification() ? EST_DynamicAny : EST_Dynamic) :
-    EST_None;
+  EPI.HasExceptionSpec = ExceptSpec.hasExceptionSpecification();
+  EPI.HasAnyExceptionSpec = ExceptSpec.hasAnyExceptionSpecification();
   EPI.NumExceptions = ExceptSpec.size();
   EPI.Exceptions = ExceptSpec.data();
   QualType Ty = Context.getFunctionType(Context.VoidTy, 0, 0, EPI);
@@ -5389,9 +5387,8 @@
   //   An implicitly-declared copy assignment operator is an inline public
   //   member of its class.
   FunctionProtoType::ExtProtoInfo EPI;
-  EPI.ExceptionSpecType = ExceptSpec.hasExceptionSpecification() ?
-    (ExceptSpec.hasAnyExceptionSpecification() ? EST_DynamicAny : EST_Dynamic) :
-    EST_None;
+  EPI.HasExceptionSpec = ExceptSpec.hasExceptionSpecification();
+  EPI.HasAnyExceptionSpec = ExceptSpec.hasAnyExceptionSpecification();
   EPI.NumExceptions = ExceptSpec.size();
   EPI.Exceptions = ExceptSpec.data();
   DeclarationName Name = Context.DeclarationNames.getCXXOperatorName(OO_Equal);
@@ -5852,9 +5849,8 @@
   //   An implicitly-declared copy constructor is an inline public
   //   member of its class.
   FunctionProtoType::ExtProtoInfo EPI;
-  EPI.ExceptionSpecType = ExceptSpec.hasExceptionSpecification() ?
-    (ExceptSpec.hasAnyExceptionSpecification() ? EST_DynamicAny : EST_Dynamic) :
-    EST_None;
+  EPI.HasExceptionSpec = ExceptSpec.hasExceptionSpecification();
+  EPI.HasAnyExceptionSpec = ExceptSpec.hasAnyExceptionSpecification();
   EPI.NumExceptions = ExceptSpec.size();
   EPI.Exceptions = ExceptSpec.data();
   DeclarationName Name

Modified: cfe/branches/release_29/lib/Sema/SemaExceptionSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/lib/Sema/SemaExceptionSpec.cpp?rev=127611&r1=127610&r2=127611&view=diff
==============================================================================
--- cfe/branches/release_29/lib/Sema/SemaExceptionSpec.cpp (original)
+++ cfe/branches/release_29/lib/Sema/SemaExceptionSpec.cpp Mon Mar 14 15:16:08 2011
@@ -129,7 +129,8 @@
        Context.getSourceManager().isInSystemHeader(Old->getLocation())) &&
       Old->isExternC()) {
     FunctionProtoType::ExtProtoInfo EPI = NewProto->getExtProtoInfo();
-    EPI.ExceptionSpecType = EST_Dynamic;
+    EPI.HasExceptionSpec = true;
+    EPI.HasAnyExceptionSpec = false;
     EPI.NumExceptions = 0;
     QualType NewType = Context.getFunctionType(NewProto->getResultType(),
                                                NewProto->arg_type_begin(),
@@ -144,9 +145,8 @@
       = Old->getType()->getAs<FunctionProtoType>();
 
     FunctionProtoType::ExtProtoInfo EPI = NewProto->getExtProtoInfo();
-    EPI.ExceptionSpecType = OldProto->hasExceptionSpec() ?
-      (OldProto->hasAnyExceptionSpec() ? EST_DynamicAny : EST_Dynamic) :
-      EST_None;
+    EPI.HasExceptionSpec = OldProto->hasExceptionSpec();
+    EPI.HasAnyExceptionSpec = OldProto->hasAnyExceptionSpec();
     EPI.NumExceptions = OldProto->getNumExceptions();
     EPI.Exceptions = OldProto->exception_begin();
 

Modified: cfe/branches/release_29/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/lib/Sema/SemaExprCXX.cpp?rev=127611&r1=127610&r2=127611&view=diff
==============================================================================
--- cfe/branches/release_29/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/branches/release_29/lib/Sema/SemaExprCXX.cpp Mon Mar 14 15:16:08 2011
@@ -1501,7 +1501,7 @@
   }
 
   FunctionProtoType::ExtProtoInfo EPI;
-  EPI.ExceptionSpecType = EST_Dynamic;
+  EPI.HasExceptionSpec = true;
   if (HasBadAllocExceptionSpec) {
     EPI.NumExceptions = 1;
     EPI.Exceptions = &BadAllocType;

Modified: cfe/branches/release_29/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/lib/Sema/SemaLookup.cpp?rev=127611&r1=127610&r2=127611&view=diff
==============================================================================
--- cfe/branches/release_29/lib/Sema/SemaLookup.cpp (original)
+++ cfe/branches/release_29/lib/Sema/SemaLookup.cpp Mon Mar 14 15:16:08 2011
@@ -686,7 +686,8 @@
     // FIXME: Calling convention!
     FunctionProtoType::ExtProtoInfo EPI = ConvProto->getExtProtoInfo();
     EPI.ExtInfo = EPI.ExtInfo.withCallingConv(CC_Default);
-    EPI.ExceptionSpecType = EST_None;
+    EPI.HasExceptionSpec = false;
+    EPI.HasAnyExceptionSpec = false;
     EPI.NumExceptions = 0;
     QualType ExpectedType
       = R.getSema().Context.getFunctionType(R.getLookupName().getCXXNameType(),

Modified: cfe/branches/release_29/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=127611&r1=127610&r2=127611&view=diff
==============================================================================
--- cfe/branches/release_29/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/branches/release_29/lib/Sema/SemaTemplateInstantiateDecl.cpp Mon Mar 14 15:16:08 2011
@@ -2159,9 +2159,8 @@
     // Rebuild the function type 
 
     FunctionProtoType::ExtProtoInfo EPI = Proto->getExtProtoInfo();
-    EPI.ExceptionSpecType = Proto->hasExceptionSpec() ?
-      (Proto->hasAnyExceptionSpec() ? EST_DynamicAny : EST_Dynamic) :
-      EST_None;
+    EPI.HasExceptionSpec = Proto->hasExceptionSpec();
+    EPI.HasAnyExceptionSpec = Proto->hasAnyExceptionSpec();
     EPI.NumExceptions = Exceptions.size();
     EPI.Exceptions = Exceptions.data();
     EPI.ExtInfo = Proto->getExtInfo();

Modified: cfe/branches/release_29/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/lib/Sema/SemaType.cpp?rev=127611&r1=127610&r2=127611&view=diff
==============================================================================
--- cfe/branches/release_29/lib/Sema/SemaType.cpp (original)
+++ cfe/branches/release_29/lib/Sema/SemaType.cpp Mon Mar 14 15:16:08 2011
@@ -511,7 +511,7 @@
                              /*args*/ 0, 0,
                              /*type quals*/ 0,
                              /*ref-qualifier*/true, SourceLocation(),
-                             /*EH*/ EST_None, SourceLocation(), 0, 0, 0, 0,
+                             /*EH*/ false, SourceLocation(), false, 0, 0, 0,
                              /*parens*/ loc, loc,
                              declarator));
 
@@ -1765,9 +1765,9 @@
 
       // Exception specs are not allowed in typedefs. Complain, but add it
       // anyway.
-      if (FTI.getExceptionSpecType() != EST_None &&
+      if (FTI.hasExceptionSpec &&
           D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_typedef)
-        Diag(FTI.getExceptionSpecLoc(), diag::err_exception_spec_in_typedef);
+        Diag(FTI.getThrowLoc(), diag::err_exception_spec_in_typedef);
 
       if (!FTI.NumArgs && !FTI.isVariadic && !getLangOptions().CPlusPlus) {
         // Simple void foo(), where the incoming T is the result type.
@@ -1856,8 +1856,9 @@
         }
 
         llvm::SmallVector<QualType, 4> Exceptions;
-        EPI.ExceptionSpecType = FTI.getExceptionSpecType();
-        if (FTI.getExceptionSpecType() == EST_Dynamic) {
+        if (FTI.hasExceptionSpec) {
+          EPI.HasExceptionSpec = FTI.hasExceptionSpec;
+          EPI.HasAnyExceptionSpec = FTI.hasAnyExceptionSpec;
           Exceptions.reserve(FTI.NumExceptions);
           for (unsigned ei = 0, ee = FTI.NumExceptions; ei != ee; ++ei) {
             // FIXME: Preserve type source info.
@@ -1869,8 +1870,6 @@
           }
           EPI.NumExceptions = Exceptions.size();
           EPI.Exceptions = Exceptions.data();
-        } else if (FTI.getExceptionSpecType() == EST_ComputedNoexcept) {
-          EPI.NoexceptExpr = FTI.NoexceptExpr;
         }
 
         T = Context.getFunctionType(T, ArgTys.data(), ArgTys.size(), EPI);

Modified: cfe/branches/release_29/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/lib/Serialization/ASTReader.cpp?rev=127611&r1=127610&r2=127611&view=diff
==============================================================================
--- cfe/branches/release_29/lib/Serialization/ASTReader.cpp (original)
+++ cfe/branches/release_29/lib/Serialization/ASTReader.cpp Mon Mar 14 15:16:08 2011
@@ -3111,10 +3111,8 @@
     EPI.Variadic = Record[Idx++];
     EPI.TypeQuals = Record[Idx++];
     EPI.RefQualifier = static_cast<RefQualifierKind>(Record[Idx++]);
-    bool HasExceptionSpec = Record[Idx++];
-    bool HasAnyExceptionSpec = Record[Idx++];
-    EPI.ExceptionSpecType = HasExceptionSpec ?
-        (HasAnyExceptionSpec ? EST_DynamicAny : EST_Dynamic) : EST_None;
+    EPI.HasExceptionSpec = Record[Idx++];
+    EPI.HasAnyExceptionSpec = Record[Idx++];
     EPI.NumExceptions = Record[Idx++];
     llvm::SmallVector<QualType, 2> Exceptions;
     for (unsigned I = 0; I != EPI.NumExceptions; ++I)

Removed: cfe/branches/release_29/test/CXX/except/except.spec/p1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/test/CXX/except/except.spec/p1.cpp?rev=127610&view=auto
==============================================================================
--- cfe/branches/release_29/test/CXX/except/except.spec/p1.cpp (original)
+++ cfe/branches/release_29/test/CXX/except/except.spec/p1.cpp (removed)
@@ -1,49 +0,0 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
-
-// Simple parser tests, dynamic specification.
-
-namespace dyn {
-
-  struct X { };
-
-  struct Y { };
-
-  void f() throw() { }
-
-  void g(int) throw(X) { }
-
-  void h() throw(X, Y) { }
-
-  class Class {
-    void foo() throw (X, Y) { }
-  };
-
-  void (*fptr)() throw();
-
-}
-
-// Simple parser tests, noexcept specification.
-
-namespace noex {
-
-  void f() noexcept { }
-  void g() noexcept (true) { }
-  void h() noexcept (false) { }
-  void i() noexcept (1 < 2) { }
-
-  class Class {
-    void foo() noexcept { }
-    void bar() noexcept (true) { }
-  };
-
-  void (*fptr)() noexcept;
-  void (*gptr)() noexcept (true);
-
-}
-
-namespace bad {
-
-  void f() throw(int) noexcept { } // expected-error {{cannot have both}}
-  void g() noexcept throw(int) { } // expected-error {{cannot have both}}
-
-}





More information about the llvm-branch-commits mailing list