[cfe-dev] Accessing some particular source locations in the AST
Mihai Draghicioiu
mihai.draghicioiu at gmail.com
Wed Sep 17 15:55:11 PDT 2014
Hi guys. I'm trying to get a SourceLocation for a couple of points in the
source. So for:
class Foo*<HERE>*: public Bar *<AND HERE>*{
Starting from a CXXRecordDecl (which I get from
RecursiveASTVisitor::VisitCXXRecordDecl()), currently I am only able to get
the location before the *class* keyword (with TagDecl::getInnerLocStart())
and after it (TagDecl::getOuterLocStart()).
I've been struggling with this for a while now, and the documentation
really isn't helping. There are many missing enums and member functions in
the docs. Am I supposed to use the lexer somehow? How? Am I supposed to use
VisitTypeLoc()? I dunno, help!
This is for a source translation tool that translates a small subset of C++
to JS. So:
class Foo: public Bar {
Foo(int x, float y) {
Becomes:
function Foo(x, y) {
...
}
// Do some inheritance stuff for Bar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140918/923695ff/attachment.html>
More information about the cfe-dev
mailing list