Fix a crash mangling decayed val argument-typed function.

// rdar: //8620510 and PR7666

llvm-svn: 118019
This commit is contained in:
Fariborz Jahanian 2010-11-02 16:54:00 +00:00
parent 5d7be2e617
commit dc9bc5aeb8
2 changed files with 9 additions and 1 deletions

View File

@ -1324,7 +1324,9 @@ void CXXNameMangler::mangleType(const ConstantArrayType *T) {
}
void CXXNameMangler::mangleType(const VariableArrayType *T) {
Out << 'A';
mangleExpression(T->getSizeExpr());
// decayed vla types (size 0) will just be skipped.
if (T->getSizeExpr())
mangleExpression(T->getSizeExpr());
Out << '_';
mangleType(T->getElementType());
}

View File

@ -624,3 +624,9 @@ namespace test20 {
template <class T> void test1(decltype(f<>(T()))) {}
template void test1<int>(decltype(f<>(int())));
}
// rdar:// 8620510
namespace test21 {
// CHECK: define void @_ZN6test2112vla_arg_funcEiPA_i(
void vla_arg_func(int X, int a[X][X]) {}
}