some namespacing improvements

Change-Id: I95bd78340519bc1457385561b64c74e938b40bb2
This commit is contained in:
Luboš Luňák
2012-10-15 14:58:19 +02:00
parent 683928f27c
commit 41d6a0ea2d
6 changed files with 6 additions and 8 deletions

View File

@@ -25,7 +25,7 @@ class BodyNotInBlock
void run(); void run();
bool VisitFunctionDecl( FunctionDecl* declaration ); bool VisitFunctionDecl( FunctionDecl* declaration );
private: private:
typedef std::vector< const Stmt* > StmtParents; typedef vector< const Stmt* > StmtParents;
void traverseStatement( const Stmt* stmt, StmtParents& parents ); void traverseStatement( const Stmt* stmt, StmtParents& parents );
void checkBody( const Stmt* body, const StmtParents& parents, int stmtType, bool dontGoUp = false ); void checkBody( const Stmt* body, const StmtParents& parents, int stmtType, bool dontGoUp = false );
}; };

View File

@@ -21,8 +21,6 @@
#include "sallogareas.hxx" #include "sallogareas.hxx"
#include "unusedvariablecheck.hxx" #include "unusedvariablecheck.hxx"
using namespace clang;
namespace loplugin namespace loplugin
{ {

View File

@@ -14,6 +14,8 @@
#include <clang/AST/RecursiveASTVisitor.h> #include <clang/AST/RecursiveASTVisitor.h>
using namespace clang; using namespace clang;
using namespace llvm;
using namespace std;
namespace loplugin namespace loplugin
{ {

View File

@@ -14,8 +14,6 @@
#include <fstream> #include <fstream>
using namespace std;
namespace loplugin namespace loplugin
{ {
@@ -50,7 +48,7 @@ bool SalLogAreas::VisitCallExpr( CallExpr* call )
if( func->getNumParams() == 4 && func->getIdentifier() != NULL if( func->getNumParams() == 4 && func->getIdentifier() != NULL
&& ( func->getName() == "sal_detail_log" || func->getName() == "log" )) && ( func->getName() == "sal_detail_log" || func->getName() == "log" ))
{ {
std::string qualifiedName = func->getQualifiedNameAsString(); string qualifiedName = func->getQualifiedNameAsString();
if( qualifiedName == "sal_detail_log" || qualifiedName == "sal::detail::log" ) if( qualifiedName == "sal_detail_log" || qualifiedName == "sal::detail::log" )
{ {
if( const StringLiteral* area = dyn_cast< StringLiteral >( call->getArg( 1 )->IgnoreParenImpCasts())) if( const StringLiteral* area = dyn_cast< StringLiteral >( call->getArg( 1 )->IgnoreParenImpCasts()))

View File

@@ -31,7 +31,7 @@ class SalLogAreas
void checkArea( StringRef area, SourceLocation location ); void checkArea( StringRef area, SourceLocation location );
void readLogAreas(); void readLogAreas();
const FunctionDecl* inFunction; const FunctionDecl* inFunction;
std::set< std::string > logAreas; set< string > logAreas;
}; };
} // namespace } // namespace

View File

@@ -67,7 +67,7 @@ bool UnusedVariableCheck::VisitVarDecl( VarDecl* var )
} }
if( !warn_unused ) if( !warn_unused )
{ {
std::string n = type->getQualifiedNameAsString(); string n = type->getQualifiedNameAsString();
// Check some common non-LO types. // Check some common non-LO types.
if( n == "std::string" || n == "std::basic_string" if( n == "std::string" || n == "std::basic_string"
|| n == "std::list" || n == "std::__debug::list" || n == "std::list" || n == "std::__debug::list"