summaryrefslogtreecommitdiffstats
path: root/clang/lib/ARCMigrate
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/ARCMigrate')
-rw-r--r--clang/lib/ARCMigrate/ARCMT.cpp40
-rw-r--r--clang/lib/ARCMigrate/ARCMTActions.cpp4
-rw-r--r--clang/lib/ARCMigrate/FileRemapper.cpp20
-rw-r--r--clang/lib/ARCMigrate/PlistReporter.cpp16
-rw-r--r--clang/lib/ARCMigrate/TransAPIUses.cpp1
-rw-r--r--clang/lib/ARCMigrate/TransARCAssign.cpp1
-rw-r--r--clang/lib/ARCMigrate/TransAutoreleasePool.cpp21
-rw-r--r--clang/lib/ARCMigrate/TransBlockObjCVariable.cpp3
-rw-r--r--clang/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp1
-rw-r--r--clang/lib/ARCMigrate/TransProperties.cpp17
-rw-r--r--clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp1
-rw-r--r--clang/lib/ARCMigrate/TransUnbridgedCasts.cpp1
-rw-r--r--clang/lib/ARCMigrate/TransUnusedInitDelegate.cpp1
-rw-r--r--clang/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp1
-rw-r--r--clang/lib/ARCMigrate/TransformActions.cpp44
-rw-r--r--clang/lib/ARCMigrate/Transforms.cpp3
16 files changed, 79 insertions, 96 deletions
diff --git a/clang/lib/ARCMigrate/ARCMT.cpp b/clang/lib/ARCMigrate/ARCMT.cpp
index 6b28d3d7dd3..f2dba72e661 100644
--- a/clang/lib/ARCMigrate/ARCMT.cpp
+++ b/clang/lib/ARCMigrate/ARCMT.cpp
@@ -19,10 +19,8 @@
#include "clang/Lex/Preprocessor.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/ADT/Triple.h"
-
using namespace clang;
using namespace arcmt;
-using llvm::StringRef;
bool CapturedDiagList::clearDiagnostic(llvm::ArrayRef<unsigned> IDs,
SourceRange range) {
@@ -113,7 +111,7 @@ public:
} // end anonymous namespace
-static inline llvm::StringRef SimulatorVersionDefineName() {
+static inline StringRef SimulatorVersionDefineName() {
return "__IPHONE_OS_VERSION_MIN_REQUIRED=";
}
@@ -122,11 +120,11 @@ static inline llvm::StringRef SimulatorVersionDefineName() {
// and return the grouped values as integers, e.g:
// __IPHONE_OS_VERSION_MIN_REQUIRED=40201
// will return Major=4, Minor=2, Micro=1.
-static bool GetVersionFromSimulatorDefine(llvm::StringRef define,
+static bool GetVersionFromSimulatorDefine(StringRef define,
unsigned &Major, unsigned &Minor,
unsigned &Micro) {
assert(define.startswith(SimulatorVersionDefineName()));
- llvm::StringRef name, version;
+ StringRef name, version;
llvm::tie(name, version) = define.split('=');
if (version.empty())
return false;
@@ -214,10 +212,10 @@ void emitPremigrationErrors(const CapturedDiagList &arcDiags,
//===----------------------------------------------------------------------===//
bool arcmt::checkForManualIssues(CompilerInvocation &origCI,
- llvm::StringRef Filename, InputKind Kind,
+ StringRef Filename, InputKind Kind,
DiagnosticClient *DiagClient,
bool emitPremigrationARCErrors,
- llvm::StringRef plistOut) {
+ StringRef plistOut) {
if (!origCI.getLangOpts().ObjC1)
return false;
@@ -262,7 +260,7 @@ bool arcmt::checkForManualIssues(CompilerInvocation &origCI,
emitPremigrationErrors(capturedDiags, origCI.getDiagnosticOpts(),
Unit->getPreprocessor());
if (!plistOut.empty()) {
- llvm::SmallVector<StoredDiagnostic, 8> arcDiags;
+ SmallVector<StoredDiagnostic, 8> arcDiags;
for (CapturedDiagList::iterator
I = capturedDiags.begin(), E = capturedDiags.end(); I != E; ++I)
arcDiags.push_back(*I);
@@ -303,11 +301,11 @@ bool arcmt::checkForManualIssues(CompilerInvocation &origCI,
//===----------------------------------------------------------------------===//
static bool applyTransforms(CompilerInvocation &origCI,
- llvm::StringRef Filename, InputKind Kind,
+ StringRef Filename, InputKind Kind,
DiagnosticClient *DiagClient,
- llvm::StringRef outputDir,
+ StringRef outputDir,
bool emitPremigrationARCErrors,
- llvm::StringRef plistOut) {
+ StringRef plistOut) {
if (!origCI.getLangOpts().ObjC1)
return false;
@@ -347,18 +345,18 @@ static bool applyTransforms(CompilerInvocation &origCI,
}
bool arcmt::applyTransformations(CompilerInvocation &origCI,
- llvm::StringRef Filename, InputKind Kind,
+ StringRef Filename, InputKind Kind,
DiagnosticClient *DiagClient) {
return applyTransforms(origCI, Filename, Kind, DiagClient,
- llvm::StringRef(), false, llvm::StringRef());
+ StringRef(), false, StringRef());
}
bool arcmt::migrateWithTemporaryFiles(CompilerInvocation &origCI,
- llvm::StringRef Filename, InputKind Kind,
+ StringRef Filename, InputKind Kind,
DiagnosticClient *DiagClient,
- llvm::StringRef outputDir,
+ StringRef outputDir,
bool emitPremigrationARCErrors,
- llvm::StringRef plistOut) {
+ StringRef plistOut) {
assert(!outputDir.empty() && "Expected output directory path");
return applyTransforms(origCI, Filename, Kind, DiagClient,
outputDir, emitPremigrationARCErrors, plistOut);
@@ -366,7 +364,7 @@ bool arcmt::migrateWithTemporaryFiles(CompilerInvocation &origCI,
bool arcmt::getFileRemappings(std::vector<std::pair<std::string,std::string> > &
remap,
- llvm::StringRef outputDir,
+ StringRef outputDir,
DiagnosticClient *DiagClient) {
assert(!outputDir.empty());
@@ -414,7 +412,7 @@ public:
: ARCMTMacroLocs(ARCMTMacroLocs) { }
virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
- llvm::StringRef InFile) {
+ StringRef InFile) {
CI.getPreprocessor().addPPCallbacks(
new ARCMTMacroTrackerPPCallbacks(ARCMTMacroLocs));
return new ASTConsumer();
@@ -438,7 +436,7 @@ public:
Listener->finish();
}
- virtual void insert(SourceLocation loc, llvm::StringRef text) {
+ virtual void insert(SourceLocation loc, StringRef text) {
bool err = rewriter.InsertText(loc, text, /*InsertAfter=*/true,
/*indentNewLines=*/true);
if (!err && Listener)
@@ -469,7 +467,7 @@ MigrationProcess::RewriteListener::~RewriteListener() { }
MigrationProcess::MigrationProcess(const CompilerInvocation &CI,
DiagnosticClient *diagClient,
- llvm::StringRef outputDir)
+ StringRef outputDir)
: OrigCI(CI), DiagClient(diagClient) {
if (!outputDir.empty()) {
llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
@@ -558,7 +556,7 @@ bool MigrationProcess::applyTransform(TransformFn trans,
buf.write(vecOS);
vecOS.flush();
llvm::MemoryBuffer *memBuf = llvm::MemoryBuffer::getMemBufferCopy(
- llvm::StringRef(newText.data(), newText.size()), newFname);
+ StringRef(newText.data(), newText.size()), newFname);
llvm::SmallString<64> filePath(file->getName());
Unit->getFileManager().FixupRelativePath(filePath);
Remapper.remap(filePath.str(), memBuf);
diff --git a/clang/lib/ARCMigrate/ARCMTActions.cpp b/clang/lib/ARCMigrate/ARCMTActions.cpp
index e4761f692b2..dea867af659 100644
--- a/clang/lib/ARCMigrate/ARCMTActions.cpp
+++ b/clang/lib/ARCMigrate/ARCMTActions.cpp
@@ -53,8 +53,8 @@ bool MigrateAction::BeginInvocation(CompilerInstance &CI) {
}
MigrateAction::MigrateAction(FrontendAction *WrappedAction,
- llvm::StringRef migrateDir,
- llvm::StringRef plistOut,
+ StringRef migrateDir,
+ StringRef plistOut,
bool emitPremigrationARCErrors)
: WrapperFrontendAction(WrappedAction), MigrateDir(migrateDir),
PlistOut(plistOut), EmitPremigrationARCErros(emitPremigrationARCErrors) {
diff --git a/clang/lib/ARCMigrate/FileRemapper.cpp b/clang/lib/ARCMigrate/FileRemapper.cpp
index db26c29a3dd..55ba3710604 100644
--- a/clang/lib/ARCMigrate/FileRemapper.cpp
+++ b/clang/lib/ARCMigrate/FileRemapper.cpp
@@ -27,7 +27,7 @@ FileRemapper::~FileRemapper() {
clear();
}
-void FileRemapper::clear(llvm::StringRef outputDir) {
+void FileRemapper::clear(StringRef outputDir) {
for (MappingsTy::iterator
I = FromToMappings.begin(), E = FromToMappings.end(); I != E; ++I)
resetTarget(I->second);
@@ -40,7 +40,7 @@ void FileRemapper::clear(llvm::StringRef outputDir) {
}
}
-std::string FileRemapper::getRemapInfoFile(llvm::StringRef outputDir) {
+std::string FileRemapper::getRemapInfoFile(StringRef outputDir) {
assert(!outputDir.empty());
llvm::sys::Path dir(outputDir);
llvm::sys::Path infoFile = dir;
@@ -48,7 +48,7 @@ std::string FileRemapper::getRemapInfoFile(llvm::StringRef outputDir) {
return infoFile.str();
}
-bool FileRemapper::initFromDisk(llvm::StringRef outputDir, Diagnostic &Diag,
+bool FileRemapper::initFromDisk(StringRef outputDir, Diagnostic &Diag,
bool ignoreIfFilesChanged) {
assert(FromToMappings.empty() &&
"initFromDisk should be called before any remap calls");
@@ -102,7 +102,7 @@ bool FileRemapper::initFromDisk(llvm::StringRef outputDir, Diagnostic &Diag,
return false;
}
-bool FileRemapper::flushToDisk(llvm::StringRef outputDir, Diagnostic &Diag) {
+bool FileRemapper::flushToDisk(StringRef outputDir, Diagnostic &Diag) {
using namespace llvm::sys;
bool existed;
@@ -121,13 +121,13 @@ bool FileRemapper::flushToDisk(llvm::StringRef outputDir, Diagnostic &Diag) {
I = FromToMappings.begin(), E = FromToMappings.end(); I != E; ++I) {
const FileEntry *origFE = I->first;
- llvm::SmallString<200> origPath = llvm::StringRef(origFE->getName());
+ llvm::SmallString<200> origPath = StringRef(origFE->getName());
fs::make_absolute(origPath);
infoOut << origPath << '\n';
infoOut << (uint64_t)origFE->getModificationTime() << '\n';
if (const FileEntry *FE = I->second.dyn_cast<const FileEntry *>()) {
- llvm::SmallString<200> newPath = llvm::StringRef(FE->getName());
+ llvm::SmallString<200> newPath = StringRef(FE->getName());
fs::make_absolute(newPath);
infoOut << newPath << '\n';
} else {
@@ -157,7 +157,7 @@ bool FileRemapper::flushToDisk(llvm::StringRef outputDir, Diagnostic &Diag) {
}
bool FileRemapper::overwriteOriginal(Diagnostic &Diag,
- llvm::StringRef outputDir) {
+ StringRef outputDir) {
using namespace llvm::sys;
for (MappingsTy::iterator
@@ -229,11 +229,11 @@ void FileRemapper::transferMappingsAndClear(CompilerInvocation &CI) {
clear();
}
-void FileRemapper::remap(llvm::StringRef filePath, llvm::MemoryBuffer *memBuf) {
+void FileRemapper::remap(StringRef filePath, llvm::MemoryBuffer *memBuf) {
remap(getOriginalFile(filePath), memBuf);
}
-void FileRemapper::remap(llvm::StringRef filePath, llvm::StringRef newPath) {
+void FileRemapper::remap(StringRef filePath, StringRef newPath) {
const FileEntry *file = getOriginalFile(filePath);
const FileEntry *newfile = FileMgr->getFile(newPath);
remap(file, newfile);
@@ -254,7 +254,7 @@ void FileRemapper::remap(const FileEntry *file, const FileEntry *newfile) {
ToFromMappings[newfile] = file;
}
-const FileEntry *FileRemapper::getOriginalFile(llvm::StringRef filePath) {
+const FileEntry *FileRemapper::getOriginalFile(StringRef filePath) {
const FileEntry *file = FileMgr->getFile(filePath);
// If we are updating a file that overriden an original file,
// actually update the original file.
diff --git a/clang/lib/ARCMigrate/PlistReporter.cpp b/clang/lib/ARCMigrate/PlistReporter.cpp
index 6abc3922278..95ef14ac593 100644
--- a/clang/lib/ARCMigrate/PlistReporter.cpp
+++ b/clang/lib/ARCMigrate/PlistReporter.cpp
@@ -11,17 +11,15 @@
#include "clang/Lex/Lexer.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/FileManager.h"
-
using namespace clang;
using namespace arcmt;
-using llvm::StringRef;
// FIXME: This duplicates significant functionality from PlistDiagnostics.cpp,
// it would be jolly good if there was a reusable PlistWriter or something.
typedef llvm::DenseMap<FileID, unsigned> FIDMap;
-static void AddFID(FIDMap &FIDs, llvm::SmallVectorImpl<FileID> &V,
+static void AddFID(FIDMap &FIDs, SmallVectorImpl<FileID> &V,
const SourceManager &SM, SourceLocation L) {
FileID FID = SM.getFileID(SM.getInstantiationLoc(L));
@@ -39,12 +37,12 @@ static unsigned GetFID(const FIDMap& FIDs, const SourceManager &SM,
return I->second;
}
-static llvm::raw_ostream& Indent(llvm::raw_ostream& o, const unsigned indent) {
+static raw_ostream& Indent(raw_ostream& o, const unsigned indent) {
for (unsigned i = 0; i < indent; ++i) o << ' ';
return o;
}
-static void EmitLocation(llvm::raw_ostream& o, const SourceManager &SM,
+static void EmitLocation(raw_ostream& o, const SourceManager &SM,
const LangOptions &LangOpts,
SourceLocation L, const FIDMap &FM,
unsigned indent, bool extend = false) {
@@ -65,7 +63,7 @@ static void EmitLocation(llvm::raw_ostream& o, const SourceManager &SM,
Indent(o, indent) << "</dict>\n";
}
-static void EmitRange(llvm::raw_ostream& o, const SourceManager &SM,
+static void EmitRange(raw_ostream& o, const SourceManager &SM,
const LangOptions &LangOpts,
CharSourceRange R, const FIDMap &FM,
unsigned indent) {
@@ -75,7 +73,7 @@ static void EmitRange(llvm::raw_ostream& o, const SourceManager &SM,
Indent(o, indent) << "</array>\n";
}
-static llvm::raw_ostream& EmitString(llvm::raw_ostream& o,
+static raw_ostream& EmitString(raw_ostream& o,
StringRef s) {
o << "<string>";
for (StringRef::const_iterator I=s.begin(), E=s.end(); I!=E; ++I) {
@@ -102,7 +100,7 @@ void arcmt::writeARCDiagsToPlist(const std::string &outPath,
// Build up a set of FIDs that we use by scanning the locations and
// ranges of the diagnostics.
FIDMap FM;
- llvm::SmallVector<FileID, 10> Fids;
+ SmallVector<FileID, 10> Fids;
for (llvm::ArrayRef<StoredDiagnostic>::iterator
I = diags.begin(), E = diags.end(); I != E; ++I) {
@@ -137,7 +135,7 @@ void arcmt::writeARCDiagsToPlist(const std::string &outPath,
" <key>files</key>\n"
" <array>\n";
- for (llvm::SmallVectorImpl<FileID>::iterator I=Fids.begin(), E=Fids.end();
+ for (SmallVectorImpl<FileID>::iterator I=Fids.begin(), E=Fids.end();
I!=E; ++I) {
o << " ";
EmitString(o, SM.getFileEntryForID(*I)->getName()) << '\n';
diff --git a/clang/lib/ARCMigrate/TransAPIUses.cpp b/clang/lib/ARCMigrate/TransAPIUses.cpp
index 296aa070004..228ca3e091b 100644
--- a/clang/lib/ARCMigrate/TransAPIUses.cpp
+++ b/clang/lib/ARCMigrate/TransAPIUses.cpp
@@ -24,7 +24,6 @@
using namespace clang;
using namespace arcmt;
using namespace trans;
-using llvm::StringRef;
namespace {
diff --git a/clang/lib/ARCMigrate/TransARCAssign.cpp b/clang/lib/ARCMigrate/TransARCAssign.cpp
index 8c00df5daa0..1f10196f9da 100644
--- a/clang/lib/ARCMigrate/TransARCAssign.cpp
+++ b/clang/lib/ARCMigrate/TransARCAssign.cpp
@@ -28,7 +28,6 @@
using namespace clang;
using namespace arcmt;
using namespace trans;
-using llvm::StringRef;
namespace {
diff --git a/clang/lib/ARCMigrate/TransAutoreleasePool.cpp b/clang/lib/ARCMigrate/TransAutoreleasePool.cpp
index 5b8485432c5..b9c22b0308a 100644
--- a/clang/lib/ARCMigrate/TransAutoreleasePool.cpp
+++ b/clang/lib/ARCMigrate/TransAutoreleasePool.cpp
@@ -36,16 +36,15 @@
using namespace clang;
using namespace arcmt;
using namespace trans;
-using llvm::StringRef;
namespace {
class ReleaseCollector : public RecursiveASTVisitor<ReleaseCollector> {
Decl *Dcl;
- llvm::SmallVectorImpl<ObjCMessageExpr *> &Releases;
+ SmallVectorImpl<ObjCMessageExpr *> &Releases;
public:
- ReleaseCollector(Decl *D, llvm::SmallVectorImpl<ObjCMessageExpr *> &releases)
+ ReleaseCollector(Decl *D, SmallVectorImpl<ObjCMessageExpr *> &releases)
: Dcl(D), Releases(releases) { }
bool VisitObjCMessageExpr(ObjCMessageExpr *E) {
@@ -82,7 +81,7 @@ public:
}
~AutoreleasePoolRewriter() {
- llvm::SmallVector<VarDecl *, 8> VarsToHandle;
+ SmallVector<VarDecl *, 8> VarsToHandle;
for (std::map<VarDecl *, PoolVarInfo>::iterator
I = PoolVars.begin(), E = PoolVars.end(); I != E; ++I) {
@@ -92,7 +91,7 @@ public:
// Check that we can handle/rewrite all references of the pool.
clearRefsIn(info.Dcl, info.Refs);
- for (llvm::SmallVectorImpl<PoolScope>::iterator
+ for (SmallVectorImpl<PoolScope>::iterator
scpI = info.Scopes.begin(),
scpE = info.Scopes.end(); scpI != scpE; ++scpI) {
PoolScope &scope = *scpI;
@@ -116,7 +115,7 @@ public:
Pass.TA.removeStmt(info.Dcl);
// Add "@autoreleasepool { }"
- for (llvm::SmallVectorImpl<PoolScope>::iterator
+ for (SmallVectorImpl<PoolScope>::iterator
scpI = info.Scopes.begin(),
scpE = info.Scopes.end(); scpI != scpE; ++scpI) {
PoolScope &scope = *scpI;
@@ -147,11 +146,11 @@ public:
}
// Remove rest of pool var references.
- for (llvm::SmallVectorImpl<PoolScope>::iterator
+ for (SmallVectorImpl<PoolScope>::iterator
scpI = info.Scopes.begin(),
scpE = info.Scopes.end(); scpI != scpE; ++scpI) {
PoolScope &scope = *scpI;
- for (llvm::SmallVectorImpl<ObjCMessageExpr *>::iterator
+ for (SmallVectorImpl<ObjCMessageExpr *>::iterator
relI = scope.Releases.begin(),
relE = scope.Releases.end(); relI != relE; ++relI) {
clearUnavailableDiags(*relI);
@@ -162,7 +161,7 @@ public:
}
bool VisitCompoundStmt(CompoundStmt *S) {
- llvm::SmallVector<PoolScope, 4> Scopes;
+ SmallVector<PoolScope, 4> Scopes;
for (Stmt::child_iterator
I = S->body_begin(), E = S->body_end(); I != E; ++I) {
@@ -228,7 +227,7 @@ private:
Stmt::child_iterator Begin;
Stmt::child_iterator End;
bool IsFollowedBySimpleReturnStmt;
- llvm::SmallVector<ObjCMessageExpr *, 4> Releases;
+ SmallVector<ObjCMessageExpr *, 4> Releases;
PoolScope() : PoolVar(0), CompoundParent(0), Begin(), End(),
IsFollowedBySimpleReturnStmt(false) { }
@@ -420,7 +419,7 @@ private:
struct PoolVarInfo {
DeclStmt *Dcl;
ExprSet Refs;
- llvm::SmallVector<PoolScope, 2> Scopes;
+ SmallVector<PoolScope, 2> Scopes;
PoolVarInfo() : Dcl(0) { }
};
diff --git a/clang/lib/ARCMigrate/TransBlockObjCVariable.cpp b/clang/lib/ARCMigrate/TransBlockObjCVariable.cpp
index 0e342b7a8f8..505b4ef8a0c 100644
--- a/clang/lib/ARCMigrate/TransBlockObjCVariable.cpp
+++ b/clang/lib/ARCMigrate/TransBlockObjCVariable.cpp
@@ -32,7 +32,6 @@
using namespace clang;
using namespace arcmt;
using namespace trans;
-using llvm::StringRef;
namespace {
@@ -75,7 +74,7 @@ public:
RootBlockObjCVarRewriter(MigrationPass &pass) : Pass(pass) { }
bool VisitBlockDecl(BlockDecl *block) {
- llvm::SmallVector<VarDecl *, 4> BlockVars;
+ SmallVector<VarDecl *, 4> BlockVars;
for (BlockDecl::capture_iterator
I = block->capture_begin(), E = block->capture_end(); I != E; ++I) {
diff --git a/clang/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp b/clang/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp
index d0bc332ff16..b896c4898a1 100644
--- a/clang/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp
+++ b/clang/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp
@@ -26,7 +26,6 @@
using namespace clang;
using namespace arcmt;
using namespace trans;
-using llvm::StringRef;
namespace {
diff --git a/clang/lib/ARCMigrate/TransProperties.cpp b/clang/lib/ARCMigrate/TransProperties.cpp
index 872c95e1a44..365168e933b 100644
--- a/clang/lib/ARCMigrate/TransProperties.cpp
+++ b/clang/lib/ARCMigrate/TransProperties.cpp
@@ -40,7 +40,6 @@
using namespace clang;
using namespace arcmt;
using namespace trans;
-using llvm::StringRef;
namespace {
@@ -55,7 +54,7 @@ class PropertiesRewriter {
PropData(ObjCPropertyDecl *propD) : PropD(propD), IvarD(0), ImplD(0) { }
};
- typedef llvm::SmallVector<PropData, 2> PropsTy;
+ typedef SmallVector<PropData, 2> PropsTy;
typedef std::map<unsigned, PropsTy> AtPropDeclsTy;
AtPropDeclsTy AtProps;
@@ -187,7 +186,7 @@ private:
}
}
- bool rewriteAttribute(llvm::StringRef fromAttr, llvm::StringRef toAttr,
+ bool rewriteAttribute(StringRef fromAttr, StringRef toAttr,
SourceLocation atLoc) const {
if (atLoc.isMacroID())
return false;
@@ -199,7 +198,7 @@ private:
// Try to load the file buffer.
bool invalidTemp = false;
- llvm::StringRef file = SM.getBufferData(locInfo.first, &invalidTemp);
+ StringRef file = SM.getBufferData(locInfo.first, &invalidTemp);
if (invalidTemp)
return false;
@@ -214,7 +213,7 @@ private:
if (tok.isNot(tok::at)) return false;
lexer.LexFromRawLexer(tok);
if (tok.isNot(tok::raw_identifier)) return false;
- if (llvm::StringRef(tok.getRawIdentifierData(), tok.getLength())
+ if (StringRef(tok.getRawIdentifierData(), tok.getLength())
!= "property")
return false;
lexer.LexFromRawLexer(tok);
@@ -226,7 +225,7 @@ private:
while (1) {
if (tok.isNot(tok::raw_identifier)) return false;
- llvm::StringRef ident(tok.getRawIdentifierData(), tok.getLength());
+ StringRef ident(tok.getRawIdentifierData(), tok.getLength());
if (ident == fromAttr) {
Pass.TA.replaceText(tok.getLocation(), fromAttr, toAttr);
return true;
@@ -243,7 +242,7 @@ private:
return false;
}
- bool addAttribute(llvm::StringRef attr, SourceLocation atLoc) const {
+ bool addAttribute(StringRef attr, SourceLocation atLoc) const {
if (atLoc.isMacroID())
return false;
@@ -254,7 +253,7 @@ private:
// Try to load the file buffer.
bool invalidTemp = false;
- llvm::StringRef file = SM.getBufferData(locInfo.first, &invalidTemp);
+ StringRef file = SM.getBufferData(locInfo.first, &invalidTemp);
if (invalidTemp)
return false;
@@ -269,7 +268,7 @@ private:
if (tok.isNot(tok::at)) return false;
lexer.LexFromRawLexer(tok);
if (tok.isNot(tok::raw_identifier)) return false;
- if (llvm::StringRef(tok.getRawIdentifierData(), tok.getLength())
+ if (StringRef(tok.getRawIdentifierData(), tok.getLength())
!= "property")
return false;
lexer.LexFromRawLexer(tok);
diff --git a/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp b/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp
index ed6ed0adfdf..4a5cdf80566 100644
--- a/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp
+++ b/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp
@@ -25,7 +25,6 @@
using namespace clang;
using namespace arcmt;
using namespace trans;
-using llvm::StringRef;
namespace {
diff --git a/clang/lib/ARCMigrate/TransUnbridgedCasts.cpp b/clang/lib/ARCMigrate/TransUnbridgedCasts.cpp
index 1cacd6d84e6..74bad5e1809 100644
--- a/clang/lib/ARCMigrate/TransUnbridgedCasts.cpp
+++ b/clang/lib/ARCMigrate/TransUnbridgedCasts.cpp
@@ -41,7 +41,6 @@
using namespace clang;
using namespace arcmt;
using namespace trans;
-using llvm::StringRef;
namespace {
diff --git a/clang/lib/ARCMigrate/TransUnusedInitDelegate.cpp b/clang/lib/ARCMigrate/TransUnusedInitDelegate.cpp
index 1019ab4ff1f..e2aa6ff93cf 100644
--- a/clang/lib/ARCMigrate/TransUnusedInitDelegate.cpp
+++ b/clang/lib/ARCMigrate/TransUnusedInitDelegate.cpp
@@ -27,7 +27,6 @@
using namespace clang;
using namespace arcmt;
using namespace trans;
-using llvm::StringRef;
namespace {
diff --git a/clang/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp b/clang/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp
index 07ccf70d4df..1dbe8111494 100644
--- a/clang/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp
+++ b/clang/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp
@@ -19,7 +19,6 @@
using namespace clang;
using namespace arcmt;
using namespace trans;
-using llvm::StringRef;
namespace {
diff --git a/clang/lib/ARCMigrate/TransformActions.cpp b/clang/lib/ARCMigrate/TransformActions.cpp
index 5f3605d7340..f521358c8e4 100644
--- a/clang/lib/ARCMigrate/TransformActions.cpp
+++ b/clang/lib/ARCMigrate/TransformActions.cpp
@@ -13,10 +13,8 @@
#include "clang/Basic/SourceManager.h"
#include "llvm/ADT/DenseSet.h"
#include <map>
-
using namespace clang;
using namespace arcmt;
-using llvm::StringRef;
namespace {
@@ -46,9 +44,9 @@ class TransformActionsImpl {
ActionKind Kind;
SourceLocation Loc;
SourceRange R1, R2;
- llvm::StringRef Text1, Text2;
+ StringRef Text1, Text2;
Stmt *S;
- llvm::SmallVector<unsigned, 2> DiagIDs;
+ SmallVector<unsigned, 2> DiagIDs;
};
std::vector<ActionData> CachedActions;
@@ -104,7 +102,7 @@ class TransformActionsImpl {
}
};
- typedef llvm::SmallVector<StringRef, 2> TextsVec;
+ typedef SmallVector<StringRef, 2> TextsVec;
typedef std::map<FullSourceLoc, TextsVec, FullSourceLoc::BeforeThanCompare>
InsertsMap;
InsertsMap Inserts;
@@ -130,15 +128,15 @@ public:
bool isInTransaction() const { return IsInTransaction; }
- void insert(SourceLocation loc, llvm::StringRef text);
- void insertAfterToken(SourceLocation loc, llvm::StringRef text);
+ void insert(SourceLocation loc, StringRef text);
+ void insertAfterToken(SourceLocation loc, StringRef text);
void remove(SourceRange range);
void removeStmt(Stmt *S);
- void replace(SourceRange range, llvm::StringRef text);
+ void replace(SourceRange range, StringRef text);
void replace(SourceRange range, SourceRange replacementRange);
- void replaceStmt(Stmt *S, llvm::StringRef text);
- void replaceText(SourceLocation loc, llvm::StringRef text,
- llvm::StringRef replacementText);
+ void replaceStmt(Stmt *S, StringRef text);
+ void replaceText(SourceLocation loc, StringRef text,
+ StringRef replacementText);
void increaseIndentation(SourceRange range,
SourceLocation parentIndent);
@@ -151,15 +149,15 @@ private:
bool canInsertAfterToken(SourceLocation loc);
bool canRemoveRange(SourceRange range);
bool canReplaceRange(SourceRange range, SourceRange replacementRange);
- bool canReplaceText(SourceLocation loc, llvm::StringRef text);
+ bool canReplaceText(SourceLocation loc, StringRef text);
void commitInsert(SourceLocation loc, StringRef text);
void commitInsertAfterToken(SourceLocation loc, StringRef text);
void commitRemove(SourceRange range);
void commitRemoveStmt(Stmt *S);
void commitReplace(SourceRange range, SourceRange replacementRange);
- void commitReplaceText(SourceLocation loc, llvm::StringRef text,
- llvm::StringRef replacementText);
+ void commitReplaceText(SourceLocation loc, StringRef text,
+ StringRef replacementText);
void commitIncreaseIndentation(SourceRange range,SourceLocation parentIndent);
void commitClearDiagnostic(llvm::ArrayRef<unsigned> IDs, SourceRange range);
@@ -425,7 +423,7 @@ bool TransformActionsImpl::canReplaceText(SourceLocation loc, StringRef text) {
// Try to load the file buffer.
bool invalidTemp = false;
- llvm::StringRef file = SM.getBufferData(locInfo.first, &invalidTemp);
+ StringRef file = SM.getBufferData(locInfo.first, &invalidTemp);
if (invalidTemp)
return false;
@@ -621,12 +619,12 @@ void TransformActions::abortTransaction() {
}
-void TransformActions::insert(SourceLocation loc, llvm::StringRef text) {
+void TransformActions::insert(SourceLocation loc, StringRef text) {
static_cast<TransformActionsImpl*>(Impl)->insert(loc, text);
}
void TransformActions::insertAfterToken(SourceLocation loc,
- llvm::StringRef text) {
+ StringRef text) {
static_cast<TransformActionsImpl*>(Impl)->insertAfterToken(loc, text);
}
@@ -638,7 +636,7 @@ void TransformActions::removeStmt(Stmt *S) {
static_cast<TransformActionsImpl*>(Impl)->removeStmt(S);
}
-void TransformActions::replace(SourceRange range, llvm::StringRef text) {
+void TransformActions::replace(SourceRange range, StringRef text) {
static_cast<TransformActionsImpl*>(Impl)->replace(range, text);
}
@@ -647,12 +645,12 @@ void TransformActions::replace(SourceRange range,
static_cast<TransformActionsImpl*>(Impl)->replace(range, replacementRange);
}
-void TransformActions::replaceStmt(Stmt *S, llvm::StringRef text) {
+void TransformActions::replaceStmt(Stmt *S, StringRef text) {
static_cast<TransformActionsImpl*>(Impl)->replaceStmt(S, text);
}
-void TransformActions::replaceText(SourceLocation loc, llvm::StringRef text,
- llvm::StringRef replacementText) {
+void TransformActions::replaceText(SourceLocation loc, StringRef text,
+ StringRef replacementText) {
static_cast<TransformActionsImpl*>(Impl)->replaceText(loc, text,
replacementText);
}
@@ -672,7 +670,7 @@ void TransformActions::applyRewrites(RewriteReceiver &receiver) {
static_cast<TransformActionsImpl*>(Impl)->applyRewrites(receiver);
}
-void TransformActions::reportError(llvm::StringRef error, SourceLocation loc,
+void TransformActions::reportError(StringRef error, SourceLocation loc,
SourceRange range) {
assert(!static_cast<TransformActionsImpl*>(Impl)->isInTransaction() &&
"Errors should be emitted out of a transaction");
@@ -686,7 +684,7 @@ void TransformActions::reportError(llvm::StringRef error, SourceLocation loc,
ReportedErrors = true;
}
-void TransformActions::reportNote(llvm::StringRef note, SourceLocation loc,
+void TransformActions::reportNote(StringRef note, SourceLocation loc,
SourceRange range) {
assert(!static_cast<TransformActionsImpl*>(Impl)->isInTransaction() &&
"Errors should be emitted out of a transaction");
diff --git a/clang/lib/ARCMigrate/Transforms.cpp b/clang/lib/ARCMigrate/Transforms.cpp
index 22c34befe2f..42bda9c4430 100644
--- a/clang/lib/ARCMigrate/Transforms.cpp
+++ b/clang/lib/ARCMigrate/Transforms.cpp
@@ -23,7 +23,6 @@
using namespace clang;
using namespace arcmt;
using namespace trans;
-using llvm::StringRef;
//===----------------------------------------------------------------------===//
// Helpers.
@@ -105,7 +104,7 @@ SourceLocation trans::findLocationAfterSemi(SourceLocation loc,
// Try to load the file buffer.
bool invalidTemp = false;
- llvm::StringRef file = SM.getBufferData(locInfo.first, &invalidTemp);
+ StringRef file = SM.getBufferData(locInfo.first, &invalidTemp);
if (invalidTemp)
return SourceLocation();
OpenPOWER on IntegriCloud