[cfe-dev] [clang-tidy] Some possible contributions
Piotr Dziwinski via cfe-dev
cfe-dev at lists.llvm.org
Tue Dec 15 13:33:06 PST 2015
Thanks, I could use your code. My checker only handles local variables
declared in functions so that parser or transformer doesn't have to work
for globals necessarily.
Best regards,
Piotr Dziwinski
On 15/12/15 11:01, Firat Kasmis via cfe-dev wrote:
> >> I am going to debug this. Meanwhile, I think instead of matching
> for DeclStmt and iterating through the DeclGroup, looking for all
> VarDecl's with the same line location should work too.
>
> Hmm, this won't work, since you can spread the statement over multiple
> lines. Anyway, I will prepare the Group-Example for you.
>
> 2015-12-15 1:00 GMT+01:00 Firat Kasmis <firat.kasmis at gmail.com
> <mailto:firat.kasmis at gmail.com>>:
>
> Hi Piotr,
>
> regarding your issue #1: I have already implemented a transformer
> which performs exactly this, including a possible initializer. I
> can provide you tomorrow with a simple snippet guiding you in the
> right direction. Basically, I am matching for DeclStmt and
> iterating through its DeclGroup. The group members are VarDecl as
> you can see by using "clang-check -ast-dump file.c --". Once you
> have the VarDecl there is any type and initialzer information you
> need. Unfortunately, this works only for init-declarator lists,
> which are defined in a scope and not globally (a
> DeclStmt/Statement just exists in a scope). See my post:
> http://lists.llvm.org/pipermail/cfe-dev/2015-November/046262.html
>
> I am going to debug this. Meanwhile, I think instead of matching
> for DeclStmt and iterating through the DeclGroup, looking for all
> VarDecl's with the same line location should work too.
>
> 2015-12-14 22:56 GMT+01:00 Richard via cfe-dev
> <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>>:
>
>
> [Please reply *only* to the list and do not include my email
> directly
> in the To: or Cc: of your reply; otherwise I will not see your
> reply.
> Thanks.]
>
> In article <566F436A.2080902 at gmail.com
> <mailto:566F436A.2080902 at gmail.com>>,
> Piotr Dziwinski via cfe-dev <cfe-dev at lists.llvm.org
> <mailto:cfe-dev at lists.llvm.org>> writes:
>
> > On 14/12/15 20:42, Richard via cfe-dev wrote:
> > > IMO, the proper place to fix this is in the AST itself. I would like
> > > to see the AST node should provide an iterator API that
> allows you to
> > > walk over all the identifiers (SourceLocation begin/end
> for each
> > > identifier) in a single declaration and obtain their
> actual types:
> > >
> > > a -> long int
> > > b -> long int *
> > > c -> long int[10]
> > > [...]
> >
> > Well, in a way, we do have this information, as part of
> QualType and
> > Type components of AST which I can access for these
> declarations.
>
> Great!
>
> > But the crux of the problem is the correct generation of
> removals in
> > FixIt hints.
> > [...]
> > This is where I need to know the locations where the cuts are to be made.
>
> Yes, this is what I tried to find in the parser before, but I was
> unsuccessful being unfamiliar with the parser code.
> --
> "The Direct3D Graphics Pipeline" free book
> <http://tinyurl.com/d3d-pipeline>
> The Computer Graphics Museum
> <http://ComputerGraphicsMuseum.org>
> The Terminals Wiki <http://terminals.classiccmp.org>
> Legalize Adulthood! (my blog)
> <http://LegalizeAdulthood.wordpress.com>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151215/68aac914/attachment.html>
More information about the cfe-dev
mailing list