[cfe-dev] CFGElement to CFGStmt

David Blaikie dblaikie at gmail.com
Fri Jul 5 08:49:05 PDT 2013


On Jul 5, 2013 5:01 AM, "Vadium" <vabrva at gmail.com> wrote:
>
> >On Thu, Jul 4, 2013 at 9:36 AM, David Blaikie <dblaikie@> wrote:
> >> On Thu, Jul 4, 2013 at 8:38 AM, Vadium <vabrva@> wrote:
> >>> Hi David,
> >>>
> >>>I am trying to do the same anikau31 was trying to do, using your code:
> >>>
> >>>> +  if (Optional<CFGStmt> CS = E.getAs<CFGStmt>()) {
> >>>> +    const Stmt *S = CS->getStmt();
> >>>
> >>> but I'm getting following error on second line:
> >>>
> >>> " error: cannot convert 'clang::CFGStmt::getStmt' from type 'const
> >>> clang::Stmt* (clang::CFGStmt::)()const' to type 'const clang::Stmt*' "
> >>
> >>
> >> Looks like you wrote:
> >>
> >> const Stmt *S = CS->getStmt;
> >>
> >> And forgot the '()' where you should've written:
> >>
> >> const Stmt *S = CS->getStmt();
>
> Oh, thanks it was real reason.
>
> >(& might I suggest self-hosting Clang as your compiler, in part
> >because it has better error messages for this particular case (&
> >others), if my guess is correct & the above is the problem. For
> >example:
> >
> >call.cpp:7:24: error: reference to non-static member function must be
> >called; did you mean to call it with no arguments?
> >  const foo *f = bar().f;
> >                 ~~~~~~^
> >                        ()
>
> You see I am building with ninja, which was noted to be preferable way
> building plugins, checkers, tools for clang, and it has been noted there
to
> change cmake compiler to clang(++) what I actually did due to lack of
> experience in catching my own bug, and previously clang showed me reasons
> for all of them.

So you are using clang as your compiler? And you still got that less
helpful error message? Perhaps you're using an old/out of date version.

>
> >
> >>
> >>>
> >>> Thank you in advance,
> >>>
> >>>
> >>>
> >>> --
> >>> View this message in context:
> >>>
http://clang-developers.42468.n3.nabble.com/CFGElement-to-CFGStmt-tp4031123p4033020.html
> >>> Sent from the Clang Developers mailing list archive at Nabble.com.
> >>> _______________________________________________
> >>> cfe-dev mailing list
> >>> cfe-dev at .uiuc
> >>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> >_______________________________________________
> >cfe-dev mailing list
> >cfe-dev at .uiuc
> >http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
>
>
> -----
> Since speech has been invented, people still can't understand each other.
> --
> View this message in context:
http://clang-developers.42468.n3.nabble.com/CFGElement-to-CFGStmt-tp4031123p4033033.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> 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/20130705/0ccd3032/attachment.html>


More information about the cfe-dev mailing list