<div dir="ltr">It sounds like you want the DeclContext. Use the function Decl::getDeclContext() to get a DeclContext pointer. See <a href="http://clang.llvm.org/doxygen/classclang_1_1DeclContext.html" target="_blank">http://clang.llvm.org/doxy<wbr>gen/classclang_1_1DeclContext.<wbr>html</a> for details about DeclContext. DeclContext::<wbr>isTranslationUnit() for globals and DeclContext::<wbr>isFunctionOrMethod() for function/method scope. DeclContext can also be cast to other Decl types, so for example you could use dyn_cast<FunctionDecl> to get the function scope.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 11, 2016 at 4:06 AM, folkert via cfe-users <span dir="ltr"><<a href="mailto:cfe-users@lists.llvm.org" target="_blank">cfe-users@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
How can I find the parent of a VarDecl? The scope it is in. E.g.<br>
function/method or a global.<br>
<br>
<br>
Folkert van Heusden<br>
______________________________<wbr>_________________<br>
cfe-users mailing list<br>
<a href="mailto:cfe-users@lists.llvm.org">cfe-users@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-users</a><br>
</blockquote></div><br></div>