[PATCH] D18657: Propagate missing empty exception spec from function declared in system header
Denis Zobnin via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 12 09:16:28 PDT 2016
d.zobnin.bugzilla updated this revision to Diff 53414.
d.zobnin.bugzilla added a comment.
John, thanks for the review!
Please take a look at the updated patch -- did I understand your comments correctly?
The test passes and ds2 application is compiled successfully.
Thank you,
Denis Zobnin
http://reviews.llvm.org/D18657
Files:
lib/Sema/SemaExceptionSpec.cpp
test/SemaCXX/Inputs/malloc.h
test/SemaCXX/builtin-exception-spec.cpp
Index: lib/Sema/SemaExceptionSpec.cpp
===================================================================
--- lib/Sema/SemaExceptionSpec.cpp
+++ lib/Sema/SemaExceptionSpec.cpp
@@ -254,10 +254,10 @@
// 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.
- if (MissingEmptyExceptionSpecification && NewProto &&
- (Old->getLocation().isInvalid() ||
- Context.getSourceManager().isInSystemHeader(Old->getLocation())) &&
- Old->isExternC()) {
+ FunctionDecl *First = Old->getFirstDecl();
+ if (MissingEmptyExceptionSpecification && NewProto && First->isExternC() &&
+ (First->getLocation().isInvalid() ||
+ Context.getSourceManager().isInSystemHeader(First->getLocation()))) {
New->setType(Context.getFunctionType(
NewProto->getReturnType(), NewProto->getParamTypes(),
NewProto->getExtProtoInfo().withExceptionSpec(EST_DynamicNone)));
Index: test/SemaCXX/builtin-exception-spec.cpp
===================================================================
--- test/SemaCXX/builtin-exception-spec.cpp
+++ test/SemaCXX/builtin-exception-spec.cpp
@@ -4,4 +4,7 @@
extern "C" {
void *malloc(__SIZE_TYPE__);
+
+void MyFunc() __attribute__((__weak__));
+void MyFunc() { return; }
}
Index: test/SemaCXX/Inputs/malloc.h
===================================================================
--- test/SemaCXX/Inputs/malloc.h
+++ test/SemaCXX/Inputs/malloc.h
@@ -1,3 +1,5 @@
extern "C" {
extern void *malloc (__SIZE_TYPE__ __size) throw () __attribute__ ((__malloc__)) ;
+
+void MyFunc() throw();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18657.53414.patch
Type: text/x-patch
Size: 1651 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160412/8794235c/attachment.bin>
More information about the cfe-commits
mailing list