Skip to content

Commit

Permalink
don't pull in llvm namespace
Browse files Browse the repository at this point in the history
It's unnecessary for using llvm namespace.
  • Loading branch information
chenyang78 committed Sep 13, 2017
1 parent b55710c commit 243c75f
Show file tree
Hide file tree
Showing 48 changed files with 26 additions and 74 deletions.
1 change: 0 additions & 1 deletion clang_delta/AggregateToScalar.cpp
Expand Up @@ -23,7 +23,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"Replace accesses to an aggregate member with \
Expand Down
1 change: 0 additions & 1 deletion clang_delta/CallExprToValue.cpp
Expand Up @@ -21,7 +21,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"Replace a call expression with a value or variable which \
Expand Down
9 changes: 4 additions & 5 deletions clang_delta/ClassTemplateToClass.cpp
Expand Up @@ -21,7 +21,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"Change a class template to a class if this class template: \n\
Expand Down Expand Up @@ -68,9 +67,9 @@ class TemplateParameterTypeVisitor : public
RecursiveASTVisitor<TemplateParameterTypeVisitor> {

public:
typedef SmallPtrSet<TemplateTypeParmDecl *, 8> TypeParmDeclSet;
typedef llvm::SmallPtrSet<TemplateTypeParmDecl *, 8> TypeParmDeclSet;

typedef SmallPtrSet<TemplateName *, 8> TemplateNameSet;
typedef llvm::SmallPtrSet<TemplateName *, 8> TemplateNameSet;

~TemplateParameterTypeVisitor(void) {
for (TemplateNameSet::iterator I = TmplNames.begin(), E = TmplNames.end();
Expand Down Expand Up @@ -301,7 +300,7 @@ bool ClassTemplateToClass::hasUsedNameDecl(
if (!PartialD->isCompleteDefinition())
return false;

SmallPtrSet<NamedDecl *, 8> Params;
llvm::SmallPtrSet<NamedDecl *, 8> Params;
TemplateParameterList *PartialTPList = PartialD->getTemplateParameters();
for (unsigned PI = 0; PI < PartialTPList->size(); ++PI) {
NamedDecl *ND = PartialTPList->getParam(PI);
Expand All @@ -324,7 +323,7 @@ bool ClassTemplateToClass::hasUsedNameDecl(
ParamVisitor.TraverseDecl(*DI);
}

for (SmallPtrSet<NamedDecl *, 8>::iterator I = Params.begin(),
for (llvm::SmallPtrSet<NamedDecl *, 8>::iterator I = Params.begin(),
E = Params.end(); I != E; ++I) {
if (ParamVisitor.isAUsedParameter(*I))
return true;
Expand Down
1 change: 0 additions & 1 deletion clang_delta/CombineGlobalVarDecl.cpp
Expand Up @@ -23,7 +23,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"Combine global variable declarations with the same type. \
Expand Down
3 changes: 1 addition & 2 deletions clang_delta/CombineLocalVarDecl.cpp
Expand Up @@ -23,7 +23,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"Combine local variable declarations with the same type. \
Expand Down Expand Up @@ -103,7 +102,7 @@ bool CombLocalVarCollectionVisitor::VisitCompoundStmt(CompoundStmt *CS)

const Type *CanonicalT =
ConsumerInstance->Context->getCanonicalType(T);
DenseMap<const Type *, DeclStmt *>::iterator TI =
llvm::DenseMap<const Type *, DeclStmt *>::iterator TI =
ConsumerInstance->DeclStmts.find(CanonicalT);
if (TI == ConsumerInstance->DeclStmts.end()) {
ConsumerInstance->DeclStmts[CanonicalT] = DS;
Expand Down
1 change: 0 additions & 1 deletion clang_delta/EmptyStructToInt.cpp
Expand Up @@ -24,7 +24,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"Replace an empty struct with type of int. A struct is defined to be empty if \
Expand Down
7 changes: 3 additions & 4 deletions clang_delta/ExpressionDetector.cpp
Expand Up @@ -23,7 +23,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"Insert a printf statement to print out the value of an expression. \
Expand Down Expand Up @@ -126,7 +125,7 @@ bool LocalTmpVarCollector::VisitDeclRefExpr(DeclRefExpr *DRE)
// (2) the LHS of a binary operator;
class LocalUOBOVisitor : public RecursiveASTVisitor<LocalUOBOVisitor> {
public:
explicit LocalUOBOVisitor(SmallPtrSet<const Expr *, 10> &ES)
explicit LocalUOBOVisitor(llvm::SmallPtrSet<const Expr *, 10> &ES)
: InvalidExprs(ES)
{ }

Expand All @@ -135,7 +134,7 @@ class LocalUOBOVisitor : public RecursiveASTVisitor<LocalUOBOVisitor> {
bool VisitBinaryOperator(BinaryOperator *BO);

private:
SmallPtrSet<const Expr *, 10> &InvalidExprs;
llvm::SmallPtrSet<const Expr *, 10> &InvalidExprs;
};

bool LocalUOBOVisitor::VisitUnaryOperator(UnaryOperator *UO)
Expand Down Expand Up @@ -575,7 +574,7 @@ bool ExpressionDetector::isValidExpr(Stmt *S, const Expr *E)
// statement many times. Gain a log of performance improvement.
auto EI = InvalidExprsInUOBO.find(S);
if (EI == InvalidExprsInUOBO.end()) {
SmallPtrSet<const Expr *, 10> InvalidExprs;
llvm::SmallPtrSet<const Expr *, 10> InvalidExprs;
LocalUOBOVisitor UOBOVisitor(InvalidExprs);
UOBOVisitor.TraverseStmt(S);
InvalidExprsInUOBO[S] = InvalidExprs;
Expand Down
1 change: 0 additions & 1 deletion clang_delta/InstantiateTemplateParam.cpp
Expand Up @@ -21,7 +21,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"This pass tries to instantiate a template parameter with \
Expand Down
1 change: 0 additions & 1 deletion clang_delta/InstantiateTemplateTypeParamToInt.cpp
Expand Up @@ -21,7 +21,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

// TODO: probably need to handle more cases where this transformation
// generates invalid code, e.g.:
Expand Down
1 change: 0 additions & 1 deletion clang_delta/LocalToGlobal.cpp
Expand Up @@ -21,7 +21,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"Move the declaraion of a non-static local variable from \
Expand Down
1 change: 0 additions & 1 deletion clang_delta/ReduceArrayDim.cpp
Expand Up @@ -23,7 +23,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"Reduce the dimension of an array. Each transformation iteration \
Expand Down
1 change: 0 additions & 1 deletion clang_delta/ReduceArraySize.cpp
Expand Up @@ -23,7 +23,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"Reduce the size of an array to the maximum index of \
Expand Down
3 changes: 1 addition & 2 deletions clang_delta/ReduceClassTemplateParameter.cpp
Expand Up @@ -23,7 +23,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"This pass tries to remove one unused parameter from a class template \
Expand Down Expand Up @@ -53,7 +52,7 @@ class ReduceClassTemplateParameterASTVisitor : public

namespace {

typedef SmallPtrSet<const NamedDecl *, 8> TemplateParameterSet;
typedef llvm::SmallPtrSet<const NamedDecl *, 8> TemplateParameterSet;

class TemplateParameterVisitor : public
RecursiveASTVisitor<TemplateParameterVisitor> {
Expand Down
1 change: 0 additions & 1 deletion clang_delta/ReducePointerLevel.cpp
Expand Up @@ -21,7 +21,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"Reduce pointer indirect level for a global/local variable. \
Expand Down
1 change: 0 additions & 1 deletion clang_delta/ReducePointerPairs.cpp
Expand Up @@ -21,7 +21,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"Reduce a pair of pointers at the same time if they have the following shape:\n\
Expand Down
1 change: 0 additions & 1 deletion clang_delta/RemoveAddrTaken.cpp
Expand Up @@ -21,7 +21,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"Remove an addr-taken operator if \n\
Expand Down
1 change: 0 additions & 1 deletion clang_delta/RemoveArray.cpp
Expand Up @@ -21,7 +21,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"Change an array var to a corresponding non-array one. \
Expand Down
1 change: 0 additions & 1 deletion clang_delta/RemoveBaseClass.cpp
Expand Up @@ -21,7 +21,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;
using namespace clang_delta_common_visitor;

static const char *DescriptionMsg =
Expand Down
1 change: 0 additions & 1 deletion clang_delta/RemoveCtorInitializer.cpp
Expand Up @@ -21,7 +21,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"This pass tries to remove an initializer from a Ctor. \n";
Expand Down
1 change: 0 additions & 1 deletion clang_delta/RemoveNamespace.cpp
Expand Up @@ -22,7 +22,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"Remove namespaces. This pass tries to remove namespace without \
Expand Down
1 change: 0 additions & 1 deletion clang_delta/RemovePointer.cpp
Expand Up @@ -21,7 +21,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"Only reduce the level of a pointer var if this pointer is \
Expand Down
1 change: 0 additions & 1 deletion clang_delta/RemoveTrivialBaseTemplate.cpp
Expand Up @@ -21,7 +21,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"This pass removes a base class if it is an instantiation from a class \
Expand Down
1 change: 0 additions & 1 deletion clang_delta/RemoveUnresolvedBase.cpp
Expand Up @@ -20,7 +20,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"This pass tries to remove a base specifier if we cannot \
Expand Down
1 change: 0 additions & 1 deletion clang_delta/RemoveUnusedOuterClass.cpp
Expand Up @@ -22,7 +22,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"This pass an unused outer class if \n\
Expand Down
1 change: 0 additions & 1 deletion clang_delta/RenameCXXMethod.cpp
Expand Up @@ -23,7 +23,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"Another pass to increase readability of reduced code. \
Expand Down
1 change: 0 additions & 1 deletion clang_delta/RenameClass.cpp
Expand Up @@ -21,7 +21,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;
using namespace clang_delta_common_visitor;

static const char *DescriptionMsg =
Expand Down
1 change: 0 additions & 1 deletion clang_delta/RenameFun.cpp
Expand Up @@ -23,7 +23,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"Another pass to increase readability of reduced code. \
Expand Down
7 changes: 3 additions & 4 deletions clang_delta/RenameParam.cpp
Expand Up @@ -23,7 +23,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"Another pass to increase readability of reduced code. \
Expand Down Expand Up @@ -62,7 +61,7 @@ class RenameParamVisitor : public RecursiveASTVisitor<RenameParamVisitor> {

RenameParam *ConsumerInstance;

DenseMap<ParmVarDecl *, std::string> ParamNameMap;
llvm::DenseMap<ParmVarDecl *, std::string> ParamNameMap;

};

Expand Down Expand Up @@ -221,7 +220,7 @@ void RenameParam::addLocalVar(VarDecl *VD)
FunctionDecl *CanonicalFD = FD->getCanonicalDecl();

ExistingNumberSet *CurrSet;
DenseMap<FunctionDecl *, ExistingNumberSet *>::iterator I =
llvm::DenseMap<FunctionDecl *, ExistingNumberSet *>::iterator I =
FunExistingVarsMap.find(CanonicalFD);

if (I == FunExistingVarsMap.end()) {
Expand Down Expand Up @@ -278,7 +277,7 @@ RenameParam::~RenameParam(void)
if (RenameVisitor)
delete RenameVisitor;

for (DenseMap<FunctionDecl *, ExistingNumberSet *>::iterator
for (llvm::DenseMap<FunctionDecl *, ExistingNumberSet *>::iterator
I = FunExistingVarsMap.begin(), E = FunExistingVarsMap.end();
I != E; ++I) {
delete (*I).second;
Expand Down
1 change: 0 additions & 1 deletion clang_delta/RenameVar.cpp
Expand Up @@ -24,7 +24,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"To increase readability, rename global and local variables \
Expand Down
1 change: 0 additions & 1 deletion clang_delta/ReplaceArrayAccessWithIndex.cpp
Expand Up @@ -23,7 +23,6 @@
#include <iostream>

using namespace clang;
using namespace llvm;


static const char *Description =
Expand Down
7 changes: 3 additions & 4 deletions clang_delta/ReplaceArrayIndexVar.cpp
Expand Up @@ -22,7 +22,6 @@
#include "TransformationManager.h"

using namespace clang;
using namespace llvm;

static const char *DescriptionMsg =
"Looking for the pattern like below: \n\
Expand All @@ -34,10 +33,10 @@ if is less than 15, then replace a[i] with a[0] ... a[num-1]";
static RegisterTransformation<ReplaceArrayIndexVar>
Trans("replace-array-index-var", DescriptionMsg);

typedef SmallPtrSet<const clang::ArraySubscriptExpr *, 10>
typedef llvm::SmallPtrSet<const clang::ArraySubscriptExpr *, 10>
ArraySubscriptExprSet;

typedef DenseMap<const clang::VarDecl *, ArraySubscriptExprSet *>
typedef llvm::DenseMap<const clang::VarDecl *, ArraySubscriptExprSet *>
VarDeclToASESetMap;

typedef llvm::DenseMap<const clang::VarDecl *, unsigned>
Expand Down Expand Up @@ -105,7 +104,7 @@ bool ReplaceArrayIndexVarCollectionVisitor::VisitVarDecl(VarDecl *VD)
if (dyn_cast<ArrayType>(ElemTy))
return true;

APInt APSz = CstArrayTy->getSize();
llvm::APInt APSz = CstArrayTy->getSize();
unsigned Sz = (unsigned int)(*APSz.getRawData());
if (Sz <= ConsumerInstance->MaxSize)
ConsumerInstance->CstArrayVars[CanonicalVD] = Sz;
Expand Down

0 comments on commit 243c75f

Please sign in to comment.