Don't give a default argument to ASTContext::getFunctionType for the TypeQuals parameter, it causes subtle bugs where TypeQuals, while necessary, are omitted from the call.
-Remove the default argument.
-Update all call sites of ASTContext::getFunctionType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58187 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index f812996..095414b 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -913,7 +913,7 @@
Canonical = getFunctionType(getCanonicalType(ResultTy),
&CanonicalArgs[0], NumArgs,
- isVariadic);
+ isVariadic, TypeQuals);
// Get the new insert position for the node we care about.
FunctionTypeProto *NewIP =
@@ -1947,6 +1947,9 @@
if (lproto->isVariadic() != rproto->isVariadic())
return QualType();
+ if (lproto->getTypeQuals() != rproto->getTypeQuals())
+ return QualType();
+
// Check argument compatibility
llvm::SmallVector<QualType, 10> types;
for (unsigned i = 0; i < lproto_nargs; i++) {
@@ -1963,7 +1966,7 @@
if (allLTypes) return lhs;
if (allRTypes) return rhs;
return getFunctionType(retType, types.begin(), types.size(),
- lproto->isVariadic());
+ lproto->isVariadic(), lproto->getTypeQuals());
}
if (lproto) allRTypes = false;
@@ -1988,7 +1991,8 @@
if (allLTypes) return lhs;
if (allRTypes) return rhs;
return getFunctionType(retType, proto->arg_type_begin(),
- proto->getNumArgs(), lproto->isVariadic());
+ proto->getNumArgs(), lproto->isVariadic(),
+ lproto->getTypeQuals());
}
if (allLTypes) return lhs;