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: +31-6-4127812
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.
>
> You can call BinaryOperator::getOpcode, which will return an Opcode,
> which is a typedef of t
> > 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.
> >
>
> You can call BinaryOperator::getOpcode, which will return an Opcode,
> which is a typedef of th
Hi,
What is the order of the clang libraries when linking?
Currently I'm doing:
clang++ -fno-rtti `llvm-config --cxxflags` \
iterate.cpp \
`llvm-config --ldflags --libs --system-libs` \
-I/usr/lib/llvm-3.8/include -ggdb3 -std=c++11
-I/usr/include/llvm-3.8/llvm/Support -L
gt; return rso.str();
> }
>
> It shoudl work for any C or C++ declaration.
>
> Thank you,
>
> [0] https://github.com/esbmc/esbmc
> [1]
> https://github.com/esbmc/esbmc/blob/master/scripts/build-aux/m4/ax_clang.m4
> [2]
> https://github.com/esbmc/esbmc/blob/master/s
Hi,
I would like to parse a windows source. Using clang/llvm and
preferably under Linux.
I'm using:
std::vector arguments;
arguments.push_back("-fms-compatibility");
arguments.push_back("-fms-extensions");
arguments.push_back("-Wno-error=invalid-token-paste");
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* c
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 Traverse...-me
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 func
tions, etc))
>
> On Fri, Aug 26, 2016 at 5:11 AM folkert via cfe-users <
> cfe-users@lists.llvm.org> wrote:
>
> > 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
ch time it defines a
> >> > different function, but all those functions would appear to be defined on
> >> > the same line/file of that included file - or a macro that defines
> >> > multiple
> >> > functions - both can be resolved by looking at
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 doe
Hi,
When I retrieve CastExpr::getType().getAsString() then I can get
something like:
const mytype_t *const **
Can I also somehow retrieve this tokenized?
Folkert van Heusden
--
--
Phone: +31-6-41278122, PGP-key: 1F28D8AE, ww
Hi,
Finding the name and position of a function/method is easy:
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
> 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 a
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 -> getNameInf
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,
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 and
Hi,
I maybe very well not understanding something but it looks like a label
targetted by a goto, in a switch statement, gets missing: if I iterate
through the ast and emit all the stmt/expr/decls, then no label-type is
emitted.
#include
void myfunc(int a)
{
switch(a) {
The problem is that you were using CaseStmt::getRHS instead of
CaseStmt::getSubStmt.
No idea what getRHS is supposed to return then.
On Wed, Nov 09, 2016 at 09:53:28AM +0100, folkert via cfe-users wrote:
> Hi,
>
> I maybe very well not understanding something but it looks lik
Hi,
How can I find the parent of a VarDecl? The scope it is in. E.g.
function/method or a global.
Folkert van Heusden
___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
21 matches
Mail list logo