]> granicus.if.org Git - clang/commitdiff
Use exceptions() instead of getNumExceptions()/getExceptionType() to avoid
authorAlexander Kornienko <alexfh@google.com>
Thu, 18 Sep 2014 15:19:53 +0000 (15:19 +0000)
committerAlexander Kornienko <alexfh@google.com>
Thu, 18 Sep 2014 15:19:53 +0000 (15:19 +0000)
accesses to incorrect exception types when getExceptionSpecType() != EST_Dynamic

This fixes a crash in test/CXX/except/except.spec/template.cpp that happens in
certain build configurations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218053 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Type.cpp

index 07be285ee063ec4885ebc2a12f74155edf11db8a..7834bfda6da45af4efdcb7e3bbbb7ff65aee701c 100644 (file)
@@ -1673,12 +1673,11 @@ FunctionProtoType::FunctionProtoType(QualType result, ArrayRef<QualType> params,
 bool FunctionProtoType::hasDependentExceptionSpec() const {
   if (Expr *NE = getNoexceptExpr())
     return NE->isValueDependent();
-  for (unsigned I = 0, N = getNumExceptions(); I != N; ++I)
+  for (QualType ET : exceptions())
     // A pack expansion with a non-dependent pattern is still dependent,
     // because we don't know whether the pattern is in the exception spec
     // or not (that depends on whether the pack has 0 expansions).
-    if (getExceptionType(I)->isDependentType() ||
-        getExceptionType(I)->getAs<PackExpansionType>())
+    if (ET->isDependentType() || ET->getAs<PackExpansionType>())
       return true;
   return false;
 }