r218053 - Use exceptions() instead of getNumExceptions()/getExceptionType() to avoid
Alexander Kornienko
alexfh at google.com
Thu Sep 18 08:19:53 PDT 2014
Author: alexfh
Date: Thu Sep 18 10:19:53 2014
New Revision: 218053
URL: http://llvm.org/viewvc/llvm-project?rev=218053&view=rev
Log:
Use exceptions() instead of getNumExceptions()/getExceptionType() to avoid
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.
Modified:
cfe/trunk/lib/AST/Type.cpp
Modified: cfe/trunk/lib/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=218053&r1=218052&r2=218053&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Type.cpp (original)
+++ cfe/trunk/lib/AST/Type.cpp Thu Sep 18 10:19:53 2014
@@ -1673,12 +1673,11 @@ FunctionProtoType::FunctionProtoType(Qua
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;
}
More information about the cfe-commits
mailing list