<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 29, 2011, at 9:29 AM, David Blaikie wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div class="h5">>  I can't seem to figure out how to get the<br>
> SourceRange of the static/inline keyword from the FunctionDecl. Is<br>
> this possible? Could someone point me to the right place to find those<br>
> SourceRanges?<br>
<br>
</div></div>I don't think we maintain that information in the FunctionDecl. It's in the DeclSpec, if it's still hanging around.<br></blockquote><div><br></div><div>Thanks Doug - that at least got me looking for the right type (the DeclSpec). <br>
<br>It seems (according to <a href="http://clang.llvm.org/doxygen/classclang_1_1Sema.html#a9b8436b6e81170462bf184c4755ba180">http://clang.llvm.org/doxygen/classclang_1_1Sema.html#a9b8436b6e81170462bf184c4755ba180</a> ) there are 3 callers of CheckFunctionDeclaration:</div>
<div><br></div><div><span class="Apple-style-span" style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 14px; background-color: rgb(255, 255, 255); ">* <a class="el" href="http://clang.llvm.org/doxygen/SemaDecl_8cpp_source.html#l04280" style="color: rgb(37, 46, 120); text-decoration: none; font-weight: bold; cursor: pointer; ">ActOnFunctionDeclarator()</a></span></div>
<div><span class="Apple-style-span" style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 14px; background-color: rgb(255, 255, 255); ">* <a class="el" href="http://clang.llvm.org/doxygen/SemaTemplateInstantiateDecl_8cpp_source.html#l01298" style="color: rgb(37, 46, 120); text-decoration: none; font-weight: bold; cursor: pointer; ">clang::TemplateDeclInstantiator::VisitCXXMethodDecl()</a></span></div>
<div><span class="Apple-style-span" style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 14px; background-color: rgb(255, 255, 255); ">* <a class="el" href="http://clang.llvm.org/doxygen/SemaTemplateInstantiateDecl_8cpp_source.html#l01012" style="color: rgb(37, 46, 120); text-decoration: none; font-weight: bold; cursor: pointer; ">clang::TemplateDeclInstantiator::VisitFunctionDecl()</a>.</span></div>
<div><span class="Apple-style-span" style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 14px; background-color: rgb(255, 255, 255); "><br></span></div><div><font class="Apple-style-span" face="Verdana, Geneva, Arial, Helvetica, sans-serif"><span class="Apple-style-span" style="font-size: 14px;">The first actually has access to the DeclSpec (through the Declarator parameter).<br>
The latter two are for member functions and templates - & I don't believe main can be templated, can it?<br></span></font></div></div></blockquote><div><br></div><div>No, main cannot be a template.</div><br><blockquote type="cite"><div class="gmail_quote"><div><font class="Apple-style-span" face="Verdana, Geneva, Arial, Helvetica, sans-serif"><span class="Apple-style-span" style="font-size: 14px;">So should we just push the isMain/checkMain checking up into ActOnFunctionDeclarator instead? Then it wouldn't add any overhead to irrelevant contexts (methods & templates) & the checking could be more descriptive.</span></font></div>
</div></blockquote><br></div><div>Works for me!</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">    </span>- Doug</div><br></body></html>