diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-12-19 23:59:34 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-12-19 23:59:34 +0000 |
commit | 836de6babb7846e08476988c8b2cf3ced0b09a1e (patch) | |
tree | eec032705d2c271fe0d7abbc5e71f9b40a9303f8 /clang/lib/Sema/SemaExceptionSpec.cpp | |
parent | ebfc2f90d0a12eac664e5978de905e09ca483b2f (diff) | |
download | bcm5719-llvm-836de6babb7846e08476988c8b2cf3ced0b09a1e.tar.gz bcm5719-llvm-836de6babb7846e08476988c8b2cf3ced0b09a1e.zip |
Fix completely bogus types for some builtins:
* In C++, never create a FunctionNoProtoType for a builtin (fixes C++1z
crasher from r289754).
* Fix type of __sync_synchronize to be a no-parameter function rather than a
varargs function. This matches GCC.
* Fix type of vfprintf to match its actual type. We gave it a wrong type due
to PR4290 (apparently autoconf generates invalid code and expects compilers
to choke it down or it miscompiles the program; the relevant error in clang
was downgraded to a warning in r122744 to fix other occurrences of this
autoconf brokenness, so we don't need this workaround any more).
* Turn off vararg argument checking for __noop, since it's not *really* a
varargs function. Alternatively we could add custom type checking for it
and synthesize parameter types matching the actual arguments in each call,
but that seemed like overkill.
llvm-svn: 290146
Diffstat (limited to 'clang/lib/Sema/SemaExceptionSpec.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExceptionSpec.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp index 781f78018b4..2ac2aca6f66 100644 --- a/clang/lib/Sema/SemaExceptionSpec.cpp +++ b/clang/lib/Sema/SemaExceptionSpec.cpp @@ -288,14 +288,15 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { // The new function declaration is only missing an empty exception // specification "throw()". If the throw() specification came from a // function in a system header that has C linkage, just add an empty - // exception specification to the "new" declaration. This is an - // egregious workaround for glibc, which adds throw() specifications - // to many libc functions as an optimization. Unfortunately, that - // optimization isn't permitted by the C++ standard, so we're forced - // to work around it here. + // exception specification to the "new" declaration. Note that C library + // implementations are permitted to add these nothrow exception + // specifications. + // + // Likewise if the old function is a builtin. if (MissingEmptyExceptionSpecification && NewProto && (Old->getLocation().isInvalid() || - Context.getSourceManager().isInSystemHeader(Old->getLocation())) && + Context.getSourceManager().isInSystemHeader(Old->getLocation()) || + Old->getBuiltinID()) && Old->isExternC()) { New->setType(Context.getFunctionType( NewProto->getReturnType(), NewProto->getParamTypes(), |