[cfe-users] finding in which function/method/scope a Decl is in, the parent so to say

2016-11-11 Thread folkert via cfe-users
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


[cfe-users] Avoid all system include paths

2016-11-11 Thread Emilio Pombo via cfe-users
Hi,

I want to make clang parser to avoid all default and builtin include path
in my system (Ubuntu 14.04.5 LTS) for lib C and C++ stl (GNU, LLVM or
whatever). I'm using the two most canonical options for doing that (I
think): -*nobuiltininc* and -*nostdinc++*, also tried to change some roots
or prefixes with -isysroot , -iwithprefix or --gcc-toolchain, but still
with no luck.

A simple example of my clang unwanted behavior could be:

*$* echo '#include ' > aio.cc
*$* clang++ -nobuiltininc -nostdinc++ -v aio.cc
clang version 3.9.1-svn281634-1~exp1 (branches/release_39)
...
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 */usr/local/include*
* /usr/include/x86_64-linux-gnu*
* /usr/include*
End of search list.
...

So in this execution clang ends up finding the header aio.h (in
/usr/include/), while this is just the behavior I'm looking forward to
modify. Any ideas to change it?

With the clang verbose option, you can see that those paths are included
before the parser starts, using flags like: -*internal*-isystem and -
*internal*-externc-isystem, there is a way to change or turn-off those
internal settings?

Thanks in advance!

Emilio.
___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users


Re: [cfe-users] Avoid all system include paths

2016-11-11 Thread Douglas Katzman via cfe-users
Remove '-nobuiltininc' and substitute '-nostdinc'.  That's in addition to
'-nostdinc++'

On Fri, Nov 11, 2016 at 11:00 AM, Emilio Pombo via cfe-users <
cfe-users@lists.llvm.org> wrote:

> Hi,
>
> I want to make clang parser to avoid all default and builtin include path
> in my system (Ubuntu 14.04.5 LTS) for lib C and C++ stl (GNU, LLVM or
> whatever). I'm using the two most canonical options for doing that (I
> think): -*nobuiltininc* and -*nostdinc++*, also tried to change some
> roots or prefixes with -isysroot , -iwithprefix or --gcc-toolchain, but
> still with no luck.
>
> A simple example of my clang unwanted behavior could be:
>
> *$* echo '#include ' > aio.cc
> *$* clang++ -nobuiltininc -nostdinc++ -v aio.cc
> clang version 3.9.1-svn281634-1~exp1 (branches/release_39)
> ...
> ignoring nonexistent directory "/include"
> #include "..." search starts here:
> #include <...> search starts here:
>  */usr/local/include*
> * /usr/include/x86_64-linux-gnu*
> * /usr/include*
> End of search list.
> ...
>
> So in this execution clang ends up finding the header aio.h (in
> /usr/include/), while this is just the behavior I'm looking forward to
> modify. Any ideas to change it?
>
> With the clang verbose option, you can see that those paths are included
> before the parser starts, using flags like: -*internal*-isystem and -
> *internal*-externc-isystem, there is a way to change or turn-off those
> internal settings?
>
> Thanks in advance!
>
> Emilio.
>
> ___
> cfe-users mailing list
> cfe-users@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>
>
___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users


Re: [cfe-users] finding in which function/method/scope a Decl is in, the parent so to say

2016-11-11 Thread Richard Trieu via cfe-users
It sounds like you want the DeclContext.  Use the function
Decl::getDeclContext() to get a DeclContext pointer.  See
http://clang.llvm.org/doxygen/classclang_1_1DeclContext.html for details
about DeclContext.  DeclContext::isTranslationUnit() for globals and
DeclContext::isFunctionOrMethod() for function/method scope.  DeclContext
can also be cast to other Decl types, so for example you could use
dyn_cast to get the function scope.

On Fri, Nov 11, 2016 at 4:06 AM, folkert via cfe-users <
cfe-users@lists.llvm.org> wrote:

> 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
>
___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users