<div dir="ltr">That's because the function itself doesn't have a qualifier. You should be looking at return type and parameter types in case of FunctionDecl. I can't tell you how to do this exactly but there should be a way to do it. Also take a look at CXXScopeSpecifier, if you can get this from the type NestedNameSpecifier can be obtained from it.</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 1, 2014 at 4:26 PM, Manasij Mukherjee <span dir="ltr"><<a href="mailto:manasij7479@gmail.com" target="_blank">manasij7479@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div>I have a FunctionDecl while overriding VisitFunctionDecl of ASTVisitor.<br>
<br></div>I did Decl->getQualifier()->getKind() == NestedNameSpecifier::TypeSpec<br></div>But it segfaults in getKind<br>
</div>So, I am probably calling getQualifier from the wrong thing.<br></div>Decl->getQualifier() is always returning a null value.<br></div><br>When is a valid qualifier returned?<br><br>My input code is:<br>namespace test { //nested name specifier<br>
class HasSubType {<br> public:<br> class SubType {};<br> };<br> HasSubType::SubType FunctionUsingSubtype(HasSubType::SubType s){return s;}<br> extern HasSubType::SubType variable;<br> HasSubType FunctionNotUsingSubType(HasSubType h){return h;}<br>
}<br></div>I want to filter out FunctionUsingSubType and the variable. <br><div><div><div><div><div><div><br><br></div><div><div>Thanks<br></div></div></div></div></div></div></div></div><div class="HOEnZb"><div class="h5">
<div class="gmail_extra"><br><br>
<div class="gmail_quote">
On Tue, Jul 1, 2014 at 10:28 AM, Nikola Smiljanic <span dir="ltr"><<a href="mailto:popizdeh@gmail.com" target="_blank">popizdeh@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">It looks like you're looking for NestedNameSpecifier. You should check the Kind and traverse the Prefix. I don't know how you obtain the type as it can appear in various contexts, but assuming you have some kind of Decl object on your hands you can call the the getQualifier() method.</div>
<div><div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jun 29, 2014 at 5:30 PM, Manasij Mukherjee <span dir="ltr"><<a href="mailto:manasij7479@gmail.com" target="_blank">manasij7479@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>It seems I made a mistake in terminology.<br><br></div>What is the following called?<br></div>
<div>Suppose I have the types:<br></div><div>MyNamespace::ClassName <br></div><div>MyNamespace::ClassName::iterator<br>
</div><div>The second type has MyNamespace::ClassName as its scope (?).<br><br></div><div>I want to detect if there are only namespaces there or a class somewhere in the scope .<br></div><div><br></div></div><div>
<div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Sun, Jun 29, 2014 at 9:59 AM, Nikola Smiljanic <span dir="ltr"><<a href="mailto:popizdeh@gmail.com" target="_blank">popizdeh@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">What do you mean by 'if the qualifiers include a class name"?<div><br></div><div>Qualifiers class deals with const, volatile, etc. </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
<div><div>
On Sun, Jun 29, 2014 at 12:40 AM, Manasij Mukherjee <span dir="ltr"><<a href="mailto:manasij7479@gmail.com" target="_blank">manasij7479@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div>
<div dir="ltr"><div><div>Hi<br>I get the
qualifiers like this:<br>Qualifiers q = qualifiedType.getQualifiers();
<br><br></div>How can I check whether if the qualifiers include a class name ? <br><br></div>I can not figure out how to find this information from the Qualifiers interface. <br><div><br><div><div>Types in namespaces ..single or nested.. should not trigger this check.<br>
<br></div><div>Thanks<span><font color="#888888"><br></font></span></div><span><font color="#888888"><div>Manasij Mukherjee<br></div></font></span></div></div></div>
<br></div></div>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>