[cfe-dev] Warning generation for non-static inline functions.

arsen hakobyan.ars at gmail.com
Tue Sep 11 02:29:37 PDT 2012

Hi all,

I am trying to generate a warning message when the there is a non-static
inline function in source code. For instance I have the following case.
inline int foo (int);
int main()
    int b = 2;
    int c = foo(b);
    return 0;
int foo(int a)
    return a;

I Need to add the checking (and also the warning message generation) in
ParseAST phase. I have looked into the source codes and I guess that the
checking can be placed in ../source/tools/clang/lib/Parse/Parser.cpp  in
function Parser::DeclGroupPtrTy
Parser::ParseDeclarationOrFunctionDefinition(ParsingDeclSpec &DS,
AccessSpecifier AS) {} (at line ~772)
There is a "ParseDeclarationSpecifiers(DS, ParsedTemplateInfo(), AS,
DSC_top_level);" function call here. And I thing after this it is possible
to check has function inlinehint attribute and the static keyword is
specifies for the function (I am going to check that by StorageClassSpec).

Can anybody give me an advice am I right to do that here, or if there is
another better solution I will be very thankful if someone could help me
with this.


View this message in context: http://clang-developers.42468.n3.nabble.com/Warning-generation-for-non-static-inline-functions-tp4026598.html
Sent from the Clang Developers mailing list archive at Nabble.com.

More information about the cfe-dev mailing list