1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
7 * This file is distributed under the University of Illinois Open Source
8 * License. See LICENSE.TXT for details.
12 #include "lclstaticfix.hxx"
17 Check all lcl_ functions and prepend static if needed.
23 LclStaticFix::LclStaticFix( CompilerInstance
& compiler
, Rewriter
& rewriter
)
24 : RewritePlugin( compiler
, rewriter
)
28 void LclStaticFix::run()
30 TraverseDecl( compiler
.getASTContext().getTranslationUnitDecl());
33 bool LclStaticFix::VisitFunctionDecl( const FunctionDecl
* declaration
)
35 if( ignoreLocation( declaration
))
37 if( declaration
->isCXXClassMember())
39 if( declaration
->getStorageClass() == SC_Static
)
41 string name
= declaration
->getQualifiedNameAsString();
42 if( name
.find( "::" ) != string::npos
)
44 if( name
.compare( 0, 4, "lcl_" ) != 0 )
46 insertText( declaration
->getLocStart(), "static " );
50 static Plugin::Registration
< LclStaticFix
> X( "lclstaticfix" );
54 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */