Hi,
I have an Expr object. How can I know if I can invoke
EvaluateAsBooleanCondition, EvaluateAsRValue, EvaluateAsInt and
EvaluateAsFloat ?
Because if I just call them on any Expr object, I get assertions like:
llvm/tools/clang/include/clang/AST/Type.h:612: const
clang::ExtQualsTypeCommonBase*
Hi,
When I want to walk over the complete ast and visit each node (by using
a RecursiveASTVisitor<...>), do I need to implement all of TraverseDecl,
TraverseStmt and TraverseType? Because with all of those it looks like
some code is processed twice.
Second question: there are other
Hi,
When iterating through the AST I encounter BinaryOperator-s, part of an
IfStmt.
My question now is: how can I find which operator it is? E.g. ==, >=,
etc.
I'm using libclang.
Folkert van Heusden
--
--
Phone:
Hi,
Something strange is happening while parsing using
std::unique_ptr au = clang::tooling::buildASTFromCodeWithArgs(code,
arguments, llvm::Twine(argv[i]));
I get a lot of errors and warning written to stderr (how can I stop that
apart from redirecting fd 2 to /dev/null?) but the following
The problem can be reproduced with this small example code:
http://files.slimwinnen.nl/n-nns.tgz
Just run make and then ./parse and you'll see it saying that "! NO
NestedNameSpecifier".
The test-code is test.cpp and the file it parses is example.cpp.
> > DeclarationNameInfo dni = fd ->
> DeclarationNameInfo dni = fd -> getNameInfo();
> SourceRange dniSr = dni.getSourceRange(); // dniSr is position and length of
> name in source file
> std::string name = dni.getName().getAsString(); // name of function/method
>
> But how can I get this information for variables? Both the name
Hi,
I have a VarDecl instance for which I want to dissect the type.
E.g. a const int a would be a const, an int and the name a /
std::vector would be namespace std, vector and so on.
The first one is easy but the second one: I have no idea where to begin.
Sofar I have the following:
#include
Hi,
The Sun java compiler allows you to (from java) walk the AST and
investigate it. Each token is stored in an object. Each object has a
hash() method which uniquely identifies it.
Now I was wondering: can I do so with the LLVM tooling as well? I could
of course if I want to identify e.g. a
Hi,
Given:
#define W(A) while(A)
void myfunc()
{
W(1) {
}
}
I would like retrieve a string for the "1" parameter of the while-macro.
Usually I would use:
Lexer::getSourceText(CharSourceRange::getCharRange(sr), sm,
LangOptions(), 0);
(with 'sr' being a SourceRange