[cfe-commits] [PATCH] Improve diagnostic for -Wmissing-noreturn

Joerg Sonnenberger joerg at britannica.bec.de
Mon Aug 29 15:49:24 PDT 2011

On Sat, Aug 27, 2011 at 04:24:33PM -0700, Chandler Carruth wrote:
> I note that there are no tests updated in this patch... if we're going to
> touch this warning, we should add some good test coverage for it.

Updated patch reflects the changes in the test cases.

> This wording is awkward. Maybe "could be marked with the 'noreturn'
> attribute"? "could be marked with attribute 'noreturn'"? Essentially,
> 'attribute' doesn't seem like a good verb here. ;]


> +          if (const FunctionDecl *FC = dyn_cast<FunctionDecl>(D)) {
> FC? not FD?


> +            std::string str;
> +            FC->getNameForDiagnostic(str, S.Context.PrintingPolicy, true);
> I'm surprised this is necessary. Naively I would expect simply "<< FC" below
> to end up calling this exact function for us. Does that not work?

It doesn't, not exactly sure why. I'm using getNameAsString() now.
Also added assertions for the expected values of the diagnostic type.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: noreturn.diff
Type: text/x-diff
Size: 4984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110830/4b3c3a6a/attachment.diff>

More information about the cfe-commits mailing list