Get symbol properties

Hi,

I’m new at clang and llvm. I want to build an IDE thats show the symbol properties when the user select it on the code.

How can I get information about a symbol by giving the SourceLocation?
(Like if the symbol is an identifier, the type…)

Regards,
Makslane

The best way to do this is to do a walk over the AST, building up a reverse mapping from location → decl (or location → expr). This will allow efficient lookup with a SourceLocation.

-Chris

Hi,

I’ve get the lastest version of clang in svn and I’m trying to compile with the LLVM2.3, but I’m getting a lot of erros.
Some samples:

…..\lib\Lex\PPExpressions.cpp(473) : error C2660: ‘llvm::APSInt::toString’ : function does not take 2 arguments
clang/AST/Expr.h(100) : error C2512: ‘llvm::APSInt’ : no appropriate default constructor available
clang\lib\codegen\CGDebugInfo.h(108) : error C2061: syntax error : identifier ‘BuilderType’

Can I compile the clang with the LLVM2.3 or I need to use other version?
Regards,
Makslane

clang only works with TOT llvm.

snaroff

Thank you for your response snaroff.
Can you tell me what’s the TOT version of LLVM?

Regards,
Makslane

That means ‘the latest version of LLVM in svn’.

At this moment, TOT is revision 55118.

Since clang is under active development, we only build/test with the latest/greatest LLVM development branch.

snaroff

Thank you all :slight_smile: