[cfe-dev] Fixits for invalid main declarations

David Blaikie dblaikie at gmail.com
Mon Aug 29 09:30:04 PDT 2011


[sorry Doug, meant to reply to the list]

On Mon, Aug 29, 2011 at 9:29 AM, David Blaikie <dblaikie at gmail.com> wrote:

> >  I can't seem to figure out how to get the
>> > SourceRange of the static/inline keyword from the FunctionDecl. Is
>> > this possible? Could someone point me to the right place to find those
>> > SourceRanges?
>>
>> I don't think we maintain that information in the FunctionDecl. It's in
>> the DeclSpec, if it's still hanging around.
>>
>
> Thanks Doug - that at least got me looking for the right type (the
> DeclSpec).
>
> It seems (according to
> http://clang.llvm.org/doxygen/classclang_1_1Sema.html#a9b8436b6e81170462bf184c4755ba180 )
> there are 3 callers of CheckFunctionDeclaration:
>
> * ActOnFunctionDeclarator()<http://clang.llvm.org/doxygen/SemaDecl_8cpp_source.html#l04280>
> * clang::TemplateDeclInstantiator::VisitCXXMethodDecl()<http://clang.llvm.org/doxygen/SemaTemplateInstantiateDecl_8cpp_source.html#l01298>
> * clang::TemplateDeclInstantiator::VisitFunctionDecl()<http://clang.llvm.org/doxygen/SemaTemplateInstantiateDecl_8cpp_source.html#l01012>
> .
>
> The first actually has access to the DeclSpec (through the Declarator
> parameter).
> The latter two are for member functions and templates - & I don't believe
> main can be templated, can it?
>
> 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.
>
> - David
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110829/ff904002/attachment.html>


More information about the cfe-dev mailing list