[PATCH] RE: [cfe-dev] missing return statement for non-void functions in C++

Sjoerd Meijer via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 24 02:37:27 PDT 2015


I've taken the latest suggestions into account, see attached patch. Could you have a look?
Thanks.

-----Original Message-----
From: scott douglass [mailto:sdouglass at arm.com] 
Sent: 18 August 2015 14:16
To: Sjoerd Meijer
Cc: 'Marshall Clow'; 'Gabriel Dos Reis'; 'Richard Smith'; 'cfe-commits'
Subject: RE: [PATCH] RE: [cfe-dev] missing return statement for non-void functions in C++

> Please see updated patch file attached, which now includes a 
> fixed/added regression test.

I think it's a good idea; two minor remarks:

+    if (!CGM.getCodeGenOpts().OptimizeSize) {
Should this be 'else if'?  I imagine there's no use emitting a trap after the sanitizer has emitted a missing_return check.

In the regression test, the CHECK-OPT case is now essentially the same as the CHECK case, so remove ' --check-prefix=CHECK-OPT' (but leave the RUN:) and these lines
  // CHECK-OPT: call void @llvm.trap
  // CHECK-OPT:     unreachable



-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Always-trap-for-missing-return-statements-except-whe.patch
Type: application/octet-stream
Size: 2324 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150824/bd890930/attachment.obj>


More information about the cfe-commits mailing list