[cfe-dev] clang-format and BSD KNF

Daniel Jasper djasper at google.com
Tue Jun 10 23:27:12 PDT 2014


On Tue, Jun 10, 2014 at 10:50 PM, Daniel Dilts <diltsman at gmail.com> wrote:

> > For example:
> >
> > int foo(int i);
> >
> > int
> > foo(int i)
> > {
> > …
> > }
> >
> > I’m having trouble distinguishing between function prototypes and
> definitions.
>
> I doubt that it is possible to distinguish between these cases.
> clang-format works on a stream of tokens, not the AST.  I do not believe
> that there is any reliable way to distinguish between function prototypes
> and definitions without at least a partial AST.
>

Why not? One ends in a semicolon, the other in an open curly brace.
clang-format has to make basically all of its decisions this way..


>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140611/46e9535e/attachment.html>


More information about the cfe-dev mailing list