diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-02-12 07:32:17 +0000 | 
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-02-12 07:32:17 +0000 | 
| commit | f40863caff5a29b5dc5e1de7833529c009c76669 (patch) | |
| tree | 347a632a45b2a610772453fb5a8b3d6a6ebb10b8 /clang/lib/Sema/SemaDeclCXX.cpp | |
| parent | 84c416b9f64c977cf29ef800ac83bb0a25ff4212 (diff) | |
| download | bcm5719-llvm-f40863caff5a29b5dc5e1de7833529c009c76669.tar.gz bcm5719-llvm-f40863caff5a29b5dc5e1de7833529c009c76669.zip  | |
Work around an annoying, non-standard optimization in the glibc
headers, where malloc (and many other libc functions) are declared
with empty throw specifications, e.g.,  
  extern void *malloc (__SIZE_TYPE__ __size) throw () __attribute__
  ((__malloc__)) ;
The C++ standard doesn't seem to allow this, and redeclaring malloc as
the standard permits (as follows) resulted in Clang (rightfully!)
complaining about mis-matched exception specifications.
  void *malloc(size_t size);
We work around this by silently propagating an empty throw
specification "throw()" from a function with C linkage declared in a
system header to a redeclaration that has no throw specifier.
Ick.
llvm-svn: 95969
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 4 | 
1 files changed, 1 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 00bc453e840..a062724ee41 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -356,9 +356,7 @@ bool Sema::MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old) {      }    } -  if (CheckEquivalentExceptionSpec( -          Old->getType()->getAs<FunctionProtoType>(), Old->getLocation(), -          New->getType()->getAs<FunctionProtoType>(), New->getLocation())) +  if (CheckEquivalentExceptionSpec(Old, New))      Invalid = true;    return Invalid;  | 

