diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-04-28 16:20:58 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-04-28 16:20:58 +0000 |
commit | 6a15c8586cc3e5d6e01c4c4e8b4374584569b58f (patch) | |
tree | 605dcd1d573348a6314c6da52f45e3418af3b72e /lib/AST/ASTContext.cpp | |
parent | e4498c6d66a8f472cba29b6158a2e86dfc60d0ef (diff) |
Revert "Fix for PR6953: per gcc, regparm and noreturn affect the compatibility of", it is breaking the builds of quite a few projects (emacs, dovecot, gnutar, bison).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102501 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 868054fe0e..4d7ea40079 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -4311,16 +4311,21 @@ QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs, allLTypes = false; if (getCanonicalType(retType) != getCanonicalType(rbase->getResultType())) allRTypes = false; - - // Check misc function attributes + // FIXME: double check this + // FIXME: should we error if lbase->getRegParmAttr() != 0 && + // rbase->getRegParmAttr() != 0 && + // lbase->getRegParmAttr() != rbase->getRegParmAttr()? FunctionType::ExtInfo lbaseInfo = lbase->getExtInfo(); FunctionType::ExtInfo rbaseInfo = rbase->getExtInfo(); - // Per gcc, compatible functions must have compatible regparm and noreturn - // attributes. - unsigned RegParm = lbaseInfo.getRegParm(); - bool NoReturn = lbaseInfo.getNoReturn(); - if (NoReturn != rbaseInfo.getNoReturn() || RegParm != rbaseInfo.getRegParm()) - return QualType(); + unsigned RegParm = lbaseInfo.getRegParm() == 0 ? rbaseInfo.getRegParm() : + lbaseInfo.getRegParm(); + bool NoReturn = lbaseInfo.getNoReturn() || rbaseInfo.getNoReturn(); + if (NoReturn != lbaseInfo.getNoReturn() || + RegParm != lbaseInfo.getRegParm()) + allLTypes = false; + if (NoReturn != rbaseInfo.getNoReturn() || + RegParm != rbaseInfo.getRegParm()) + allRTypes = false; CallingConv lcc = lbaseInfo.getCC(); CallingConv rcc = rbaseInfo.getCC(); // Compatible functions must have compatible calling conventions |