bump product version to 6.3.0.0.beta1
[LibreOffice.git] / compilerplugins / clang / store / lclstaticfix.cxx
blob01e4171fc4f42739668fb6516fce4c2eef4dfe7c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * Based on LLVM/Clang.
7 * This file is distributed under the University of Illinois Open Source
8 * License. See LICENSE.TXT for details.
12 #include "lclstaticfix.hxx"
15 This is a rewriter.
17 Check all lcl_ functions and prepend static if needed.
20 namespace loplugin
23 LclStaticFix::LclStaticFix( CompilerInstance& compiler, Rewriter& rewriter )
24 : FilteringRewritePlugin( compiler, rewriter )
28 void LclStaticFix::run()
30 TraverseDecl( compiler.getASTContext().getTranslationUnitDecl());
33 bool LclStaticFix::VisitFunctionDecl( const FunctionDecl* declaration )
35 if( ignoreLocation( declaration ))
36 return true;
37 if( declaration->isCXXClassMember())
38 return true;
39 if( declaration->getStorageClass() == SC_Static )
40 return true;
41 string name = declaration->getQualifiedNameAsString();
42 if( name.find( "::" ) != string::npos )
43 return true;
44 if( name.compare( 0, 4, "lcl_" ) != 0 )
45 return true;
46 insertText( declaration->getLocStart(), "static " );
47 return true;
50 static Plugin::Registration< LclStaticFix > X( "lclstaticfix" );
52 } // namespace
54 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */