aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-10-26 16:43:14 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-10-26 16:43:14 +0000
commit7fb5e4888221cd36652d078c6b171ac55e7f406d (patch)
tree90d8bb74030debd15c7b4920f686c79fc0d6d30a /lib/AST/ASTContext.cpp
parent197fa58ab40e3fee2137715e96d9bb1c59340837 (diff)
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
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r--lib/AST/ASTContext.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index f8129969b7..095414bde1 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -913,7 +913,7 @@ QualType ASTContext::getFunctionType(QualType ResultTy,const QualType *ArgArray,
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 @@ QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs) {
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 @@ QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs) {
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 @@ QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs) {
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;