]> granicus.if.org Git - clang/commitdiff
Don't give a default argument to ASTContext::getFunctionType for the TypeQuals parame...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 26 Oct 2008 16:43:14 +0000 (16:43 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 26 Oct 2008 16:43:14 +0000 (16:43 +0000)
-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

Driver/RewriteObjC.cpp
include/clang/AST/ASTContext.h
lib/AST/ASTContext.cpp
lib/AST/Builtins.cpp
lib/AST/TypeSerialization.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaType.cpp

index 821bf2d9c3e9088a776f7adbcce3901f36063048..3e8216e6679f1e7d018dfad7ece73e71e9b2e8b1 100644 (file)
@@ -1750,7 +1750,7 @@ void RewriteObjC::SynthSelGetUidFunctionDecl() {
     Context->CharTy.getQualifiedType(QualType::Const)));
   QualType getFuncType = Context->getFunctionType(Context->getObjCSelType(),
                                                    &ArgTys[0], ArgTys.size(),
-                                                   false /*isVariadic*/);
+                                                   false /*isVariadic*/, 0);
   SelGetUidFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
                                            SourceLocation(), 
                                            SelGetUidIdent, getFuncType,
@@ -1765,7 +1765,7 @@ void RewriteObjC::SynthGetProtocolFunctionDecl() {
     Context->CharTy.getQualifiedType(QualType::Const)));
   QualType getFuncType = Context->getFunctionType(Context->getObjCProtoType(),
                                                   &ArgTys[0], ArgTys.size(),
-                                                  false /*isVariadic*/);
+                                                  false /*isVariadic*/, 0);
   GetProtocolFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
                                              SourceLocation(), 
                                              SelGetProtoIdent, getFuncType,
@@ -1793,7 +1793,7 @@ void RewriteObjC::SynthSuperContructorFunctionDecl() {
   ArgTys.push_back(argT);
   QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(),
                                                   &ArgTys[0], ArgTys.size(),
-                                                  false);
+                                                  false, 0);
   SuperContructorFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
                                          SourceLocation(), 
                                          msgSendIdent, msgSendType,
@@ -1812,7 +1812,7 @@ void RewriteObjC::SynthMsgSendFunctionDecl() {
   ArgTys.push_back(argT);
   QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(),
                                                   &ArgTys[0], ArgTys.size(),
-                                                  true /*isVariadic*/);
+                                                  true /*isVariadic*/, 0);
   MsgSendFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
                                          SourceLocation(),
                                          msgSendIdent, msgSendType,
@@ -1834,7 +1834,7 @@ void RewriteObjC::SynthMsgSendSuperFunctionDecl() {
   ArgTys.push_back(argT);
   QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(),
                                                   &ArgTys[0], ArgTys.size(),
-                                                  true /*isVariadic*/);
+                                                  true /*isVariadic*/, 0);
   MsgSendSuperFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
                                               SourceLocation(), 
                                               msgSendIdent, msgSendType,
@@ -1853,7 +1853,7 @@ void RewriteObjC::SynthMsgSendStretFunctionDecl() {
   ArgTys.push_back(argT);
   QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(),
                                                   &ArgTys[0], ArgTys.size(),
-                                                  true /*isVariadic*/);
+                                                  true /*isVariadic*/, 0);
   MsgSendStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
                                          SourceLocation(), 
                                          msgSendIdent, msgSendType,
@@ -1877,7 +1877,7 @@ void RewriteObjC::SynthMsgSendSuperStretFunctionDecl() {
   ArgTys.push_back(argT);
   QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(),
                                                   &ArgTys[0], ArgTys.size(),
-                                                  true /*isVariadic*/);
+                                                  true /*isVariadic*/, 0);
   MsgSendSuperStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
                                                        SourceLocation(), 
                                               msgSendIdent, msgSendType,
@@ -1896,7 +1896,7 @@ void RewriteObjC::SynthMsgSendFpretFunctionDecl() {
   ArgTys.push_back(argT);
   QualType msgSendType = Context->getFunctionType(Context->DoubleTy,
                                                   &ArgTys[0], ArgTys.size(),
-                                                  true /*isVariadic*/);
+                                                  true /*isVariadic*/, 0);
   MsgSendFpretFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
                                               SourceLocation(), 
                                               msgSendIdent, msgSendType,
@@ -1911,7 +1911,7 @@ void RewriteObjC::SynthGetClassFunctionDecl() {
                      Context->CharTy.getQualifiedType(QualType::Const)));
   QualType getClassType = Context->getFunctionType(Context->getObjCIdType(),
                                                    &ArgTys[0], ArgTys.size(),
-                                                   false /*isVariadic*/);
+                                                   false /*isVariadic*/, 0);
   GetClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
                                           SourceLocation(), 
                                           getClassIdent, getClassType,
@@ -1926,7 +1926,7 @@ void RewriteObjC::SynthGetMetaClassFunctionDecl() {
                      Context->CharTy.getQualifiedType(QualType::Const)));
   QualType getClassType = Context->getFunctionType(Context->getObjCIdType(),
                                                    &ArgTys[0], ArgTys.size(),
-                                                   false /*isVariadic*/);
+                                                   false /*isVariadic*/, 0);
   GetMetaClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
                                               SourceLocation(), 
                                               getClassIdent, getClassType,
@@ -2284,7 +2284,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp) {
   QualType castType = Context->getFunctionType(returnType, 
     &ArgTypes[0], ArgTypes.size(),
     // If we don't have a method decl, force a variadic cast.
-    Exp->getMethodDecl() ? Exp->getMethodDecl()->isVariadic() : true);
+    Exp->getMethodDecl() ? Exp->getMethodDecl()->isVariadic() : true, 0);
   castType = Context->getPointerType(castType);
   cast = new ExplicitCastExpr(castType, cast, SourceLocation());
 
@@ -2310,7 +2310,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp) {
     // Now do the "normal" pointer to function cast.
     castType = Context->getFunctionType(returnType, 
       &ArgTypes[0], ArgTypes.size(),
-      Exp->getMethodDecl() ? Exp->getMethodDecl()->isVariadic() : false);
+      Exp->getMethodDecl() ? Exp->getMethodDecl()->isVariadic() : false, 0);
     castType = Context->getPointerType(castType);
     cast = new ExplicitCastExpr(castType, cast, SourceLocation());
     
index 99ff107d8daa36e3c44ef3dfdbdb1d4f53053a62..b30fbfa4441325058b351f2c61e77ca7da998748 100644 (file)
@@ -209,7 +209,7 @@ public:
   /// list.  isVariadic indicates whether the argument list includes '...'.
   QualType getFunctionType(QualType ResultTy, const QualType *ArgArray,
                            unsigned NumArgs, bool isVariadic,
-                           unsigned TypeQuals = 0);
+                           unsigned TypeQuals);
 
   /// getTypeDeclType - Return the unique reference to the type for
   /// the specified type declaration.
index f8129969b7b6b8969f1702ac801f27e916b1d68f..095414bde1036e116393adc50098791629709976 100644 (file)
@@ -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;
index 1823ee6055962a769c117be0d7c647b573d7f913..a721c6ea8c187d69851e37b2d3832857508ccd44 100644 (file)
@@ -203,5 +203,5 @@ QualType Builtin::Context::GetBuiltinType(unsigned id,
   if (ArgTypes.size() == 0 && TypeStr[0] == '.')
     return Context.getFunctionTypeNoProto(ResType);
   return Context.getFunctionType(ResType, &ArgTypes[0], ArgTypes.size(),
-                                 TypeStr[0] == '.');
+                                 TypeStr[0] == '.', 0);
 }
index ff784ccc27920d60752a010c4ec69771516394c7..b336722763eb34db81a20ec2b4e6f211cecf7906 100644 (file)
@@ -194,6 +194,7 @@ Type* FunctionTypeNoProto::CreateImpl(ASTContext& Context, Deserializer& D) {
 void FunctionTypeProto::EmitImpl(Serializer& S) const {
   S.Emit(getResultType());
   S.EmitBool(isVariadic());
+  S.EmitInt(getTypeQuals());
   S.EmitInt(getNumArgs());
   
   for (arg_type_iterator I=arg_type_begin(), E=arg_type_end(); I!=E; ++I)
@@ -203,6 +204,7 @@ void FunctionTypeProto::EmitImpl(Serializer& S) const {
 Type* FunctionTypeProto::CreateImpl(ASTContext& Context, Deserializer& D) {
   QualType ResultType = QualType::ReadVal(D);
   bool isVariadic = D.ReadBool();
+  unsigned TypeQuals = D.ReadInt();
   unsigned NumArgs = D.ReadInt();
   
   llvm::SmallVector<QualType,15> Args;
@@ -211,7 +213,7 @@ Type* FunctionTypeProto::CreateImpl(ASTContext& Context, Deserializer& D) {
     Args.push_back(QualType::ReadVal(D));
   
   return Context.getFunctionType(ResultType,&*Args.begin(), 
-                                 NumArgs,isVariadic).getTypePtr();
+                                 NumArgs,isVariadic,TypeQuals).getTypePtr();
 }
 
 //===----------------------------------------------------------------------===//
index 6fd1c5cc2fdd445439dcad557efe2c9fc4b5a224..13b3959d8c3576a0f0bb5e45b64983d85d0e47bc 100644 (file)
@@ -3033,7 +3033,7 @@ Sema::ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc, StmtTy *body,
     BlockTy = Context.getFunctionTypeNoProto(RetTy);
   else
     BlockTy = Context.getFunctionType(RetTy, &ArgTypes[0], ArgTypes.size(),
-                                      BSI->isVariadic);
+                                      BSI->isVariadic, 0);
   
   BlockTy = Context.getBlockPointerType(BlockTy);
   
index 7bcd1e5765fdfa74544cf9718c23163d4e2df5fb..93f182c27e6507f31a107b5c0f4d13c4a7b9f0e1 100644 (file)
@@ -513,7 +513,7 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
 
       // Strip the cv-quals from the type.
       T = Context.getFunctionType(FnTy->getResultType(), FnTy->arg_type_begin(),
-                                  FnTy->getNumArgs(), FnTy->isVariadic());
+                                  FnTy->getNumArgs(), FnTy->isVariadic(), 0);
     }
   }
   
@@ -556,7 +556,7 @@ QualType Sema::ObjCGetTypeForMethodDefinition(DeclTy *D) {
     ArgTys.push_back(ArgTy);
   }
   T = Context.getFunctionType(T, &ArgTys[0], ArgTys.size(),
-                              MDecl->isVariadic());
+                              MDecl->isVariadic(), 0);
   return T;
 }