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 | edd5bae86c6ded0b41c077b8269b75e6dc3d6fce (patch) | |
| tree | 28ad4c8089b187cec3f188da021900538e1ef88c /clang/lib | |
| parent | c83726e64ef657e49bdfe9b75f5e41bdfbd6a962 (diff) | |
| download | bcm5719-llvm-edd5bae86c6ded0b41c077b8269b75e6dc3d6fce.tar.gz bcm5719-llvm-edd5bae86c6ded0b41c077b8269b75e6dc3d6fce.zip | |
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).
llvm-svn: 102501
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/ASTContext.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 868054fe0ec..4d7ea40079c 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/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 |

