[cfe-dev] Help with clang AST matchers: find semicolon after a decl statement

Frederico Araujo araujof at gmail.com
Wed Jul 30 15:37:33 PDT 2014


I found the problem!

I forgot to update my make file to link against the ARCMigrate library.
I realized that after adding -I$(LLVM_SRC_PATH)/tools/clang/lib/ARCMigrate
to my CLANG_INCLUDES, I also had to add -lclangARCMigrate to my CLANG_LIBS,
which solved the problem.
I wonder why Transforms.h isn't included in clang's tools build directory?

So, in conclusion, answering my first question, the following code can be
used to find the location just after the semicolon:

*SourceLocation SemiLoc =
clang::arcmt::trans::findSemiAfterLocation(D->getLocEnd(),
D->getASTContext());*

Regards,
Fred


On Wed, Jul 30, 2014 at 5:18 PM, Frederico Araujo <araujof at gmail.com> wrote:

> Dear list,
>
> I'm implementing a small source-to-source rewriter using clang tooling and
> AST matchers.
> I'd like to ask if there is a way to use clang's API to find the source
> location after a semicolon of a matched declaration statement?
>
> Looking in the documentation, I found the "*findLocationAfterSemi*"
> function which seems to be exactly what I want. However, I'm not being able
> to use it. Searching my llvm sources, I see its corresponding header file
> Transforms.h in <llvm_src_dir>/tools/clang/lib/ARCMigrate/ but not inside
> any sub-directory inside the directory I compiled clang (using cmake).
>
> The function I mentioned can be found here:
> http://clang.llvm.org/doxygen/Transforms_8h.html
>
> Any help will be much appreciated!
>
> Thanks,
> Fred
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140730/a247a829/attachment.html>


More information about the cfe-dev mailing list