diff options
author | Chris Lattner <sabre@nondot.org> | 2011-07-23 10:55:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-07-23 10:55:15 +0000 |
commit | 5f9e272e632e951b1efe824cd16acb4d96077930 (patch) | |
tree | 3268557d12b85d0c2e72de5329ec83d4fc0bca48 | |
parent | d47d3b0cfeb7e8564ff77f48130fe63282b6d127 (diff) |
remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
243 files changed, 2240 insertions, 2290 deletions
diff --git a/lib/ARCMigrate/ARCMT.cpp b/lib/ARCMigrate/ARCMT.cpp index 6b28d3d7dd..f2dba72e66 100644 --- a/lib/ARCMigrate/ARCMT.cpp +++ b/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/lib/ARCMigrate/ARCMTActions.cpp b/lib/ARCMigrate/ARCMTActions.cpp index e4761f692b..dea867af65 100644 --- a/lib/ARCMigrate/ARCMTActions.cpp +++ b/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/lib/ARCMigrate/FileRemapper.cpp b/lib/ARCMigrate/FileRemapper.cpp index db26c29a3d..55ba371060 100644 --- a/lib/ARCMigrate/FileRemapper.cpp +++ b/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/lib/ARCMigrate/PlistReporter.cpp b/lib/ARCMigrate/PlistReporter.cpp index 6abc392227..95ef14ac59 100644 --- a/lib/ARCMigrate/PlistReporter.cpp +++ b/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/lib/ARCMigrate/TransAPIUses.cpp b/lib/ARCMigrate/TransAPIUses.cpp index 296aa07000..228ca3e091 100644 --- a/lib/ARCMigrate/TransAPIUses.cpp +++ b/lib/ARCMigrate/TransAPIUses.cpp @@ -24,7 +24,6 @@ using namespace clang; using namespace arcmt; using namespace trans; -using llvm::StringRef; namespace { diff --git a/lib/ARCMigrate/TransARCAssign.cpp b/lib/ARCMigrate/TransARCAssign.cpp index 8c00df5daa..1f10196f9d 100644 --- a/lib/ARCMigrate/TransARCAssign.cpp +++ b/lib/ARCMigrate/TransARCAssign.cpp @@ -28,7 +28,6 @@ using namespace clang; using namespace arcmt; using namespace trans; -using llvm::StringRef; namespace { diff --git a/lib/ARCMigrate/TransAutoreleasePool.cpp b/lib/ARCMigrate/TransAutoreleasePool.cpp index 5b8485432c..b9c22b0308 100644 --- a/lib/ARCMigrate/TransAutoreleasePool.cpp +++ b/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/lib/ARCMigrate/TransBlockObjCVariable.cpp b/lib/ARCMigrate/TransBlockObjCVariable.cpp index 0e342b7a8f..505b4ef8a0 100644 --- a/lib/ARCMigrate/TransBlockObjCVariable.cpp +++ b/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/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp b/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp index d0bc332ff1..b896c4898a 100644 --- a/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp +++ b/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp @@ -26,7 +26,6 @@ using namespace clang; using namespace arcmt; using namespace trans; -using llvm::StringRef; namespace { diff --git a/lib/ARCMigrate/TransProperties.cpp b/lib/ARCMigrate/TransProperties.cpp index 872c95e1a4..365168e933 100644 --- a/lib/ARCMigrate/TransProperties.cpp +++ b/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/lib/ARCMigrate/TransRetainReleaseDealloc.cpp b/lib/ARCMigrate/TransRetainReleaseDealloc.cpp index ed6ed0adfd..4a5cdf8056 100644 --- a/lib/ARCMigrate/TransRetainReleaseDealloc.cpp +++ b/lib/ARCMigrate/TransRetainReleaseDealloc.cpp @@ -25,7 +25,6 @@ using namespace clang; using namespace arcmt; using namespace trans; -using llvm::StringRef; namespace { diff --git a/lib/ARCMigrate/TransUnbridgedCasts.cpp b/lib/ARCMigrate/TransUnbridgedCasts.cpp index 1cacd6d84e..74bad5e180 100644 --- a/lib/ARCMigrate/TransUnbridgedCasts.cpp +++ b/lib/ARCMigrate/TransUnbridgedCasts.cpp @@ -41,7 +41,6 @@ using namespace clang; using namespace arcmt; using namespace trans; -using llvm::StringRef; namespace { diff --git a/lib/ARCMigrate/TransUnusedInitDelegate.cpp b/lib/ARCMigrate/TransUnusedInitDelegate.cpp index 1019ab4ff1..e2aa6ff93c 100644 --- a/lib/ARCMigrate/TransUnusedInitDelegate.cpp +++ b/lib/ARCMigrate/TransUnusedInitDelegate.cpp @@ -27,7 +27,6 @@ using namespace clang; using namespace arcmt; using namespace trans; -using llvm::StringRef; namespace { diff --git a/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp b/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp index 07ccf70d4d..1dbe811149 100644 --- a/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp +++ b/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp @@ -19,7 +19,6 @@ using namespace clang; using namespace arcmt; using namespace trans; -using llvm::StringRef; namespace { diff --git a/lib/ARCMigrate/TransformActions.cpp b/lib/ARCMigrate/TransformActions.cpp index 5f3605d734..f521358c8e 100644 --- a/lib/ARCMigrate/TransformActions.cpp +++ b/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/lib/ARCMigrate/Transforms.cpp b/lib/ARCMigrate/Transforms.cpp index 22c34befe2..42bda9c443 100644 --- a/lib/ARCMigrate/Transforms.cpp +++ b/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(); diff --git a/lib/AST/APValue.cpp b/lib/AST/APValue.cpp index 86eec3b8bb..27d9234d76 100644 --- a/lib/AST/APValue.cpp +++ b/lib/AST/APValue.cpp @@ -91,7 +91,7 @@ static double GetApproxValue(const llvm::APFloat &F) { return V.convertToDouble(); } -void APValue::print(llvm::raw_ostream &OS) const { +void APValue::print(raw_ostream &OS) const { switch (getKind()) { default: assert(0 && "Unknown APValue kind!"); case Uninitialized: @@ -120,7 +120,7 @@ void APValue::print(llvm::raw_ostream &OS) const { } } -static void WriteShortAPValueToStream(llvm::raw_ostream& Out, +static void WriteShortAPValueToStream(raw_ostream& Out, const APValue& V) { switch (V.getKind()) { default: assert(0 && "Unknown APValue kind!"); diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 99a51cf7df..5463b7b7b0 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -104,7 +104,7 @@ ASTContext::getCanonicalTemplateTemplateParmDecl( // Build a canonical template parameter list. TemplateParameterList *Params = TTP->getTemplateParameters(); - llvm::SmallVector<NamedDecl *, 4> CanonParams; + SmallVector<NamedDecl *, 4> CanonParams; CanonParams.reserve(Params->size()); for (TemplateParameterList::const_iterator P = Params->begin(), PEnd = Params->end(); @@ -123,8 +123,8 @@ ASTContext::getCanonicalTemplateTemplateParmDecl( TypeSourceInfo *TInfo = getTrivialTypeSourceInfo(T); NonTypeTemplateParmDecl *Param; if (NTTP->isExpandedParameterPack()) { - llvm::SmallVector<QualType, 2> ExpandedTypes; - llvm::SmallVector<TypeSourceInfo *, 2> ExpandedTInfos; + SmallVector<QualType, 2> ExpandedTypes; + SmallVector<TypeSourceInfo *, 2> ExpandedTInfos; for (unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) { ExpandedTypes.push_back(getCanonicalType(NTTP->getExpansionType(I))); ExpandedTInfos.push_back( @@ -2013,7 +2013,7 @@ ASTContext::getFunctionType(QualType ResultTy, // The exception spec is not part of the canonical type. QualType Canonical; if (!isCanonical || getCanonicalCallConv(CallConv) != CallConv) { - llvm::SmallVector<QualType, 16> CanonicalArgs; + SmallVector<QualType, 16> CanonicalArgs; CanonicalArgs.reserve(NumArgs); for (unsigned i = 0; i != NumArgs; ++i) CanonicalArgs.push_back(getCanonicalParamType(ArgArray[i])); @@ -2309,7 +2309,7 @@ ASTContext::getTemplateSpecializationType(TemplateName Template, unsigned NumArgs = Args.size(); - llvm::SmallVector<TemplateArgument, 4> ArgVec; + SmallVector<TemplateArgument, 4> ArgVec; ArgVec.reserve(NumArgs); for (unsigned i = 0; i != NumArgs; ++i) ArgVec.push_back(Args[i].getArgument()); @@ -2376,7 +2376,7 @@ ASTContext::getCanonicalTemplateSpecializationType(TemplateName Template, // Build the canonical template specialization type. TemplateName CanonTemplate = getCanonicalTemplateName(Template); - llvm::SmallVector<TemplateArgument, 4> CanonArgs; + SmallVector<TemplateArgument, 4> CanonArgs; CanonArgs.reserve(NumArgs); for (unsigned I = 0; I != NumArgs; ++I) CanonArgs.push_back(getCanonicalTemplateArgument(Args[I])); @@ -2496,7 +2496,7 @@ ASTContext::getDependentTemplateSpecializationType( const IdentifierInfo *Name, const TemplateArgumentListInfo &Args) const { // TODO: avoid this copy - llvm::SmallVector<TemplateArgument, 16> ArgCopy; + SmallVector<TemplateArgument, 16> ArgCopy; for (unsigned I = 0, E = Args.size(); I != E; ++I) ArgCopy.push_back(Args[I].getArgument()); return getDependentTemplateSpecializationType(Keyword, NNS, Name, @@ -2530,7 +2530,7 @@ ASTContext::getDependentTemplateSpecializationType( if (Keyword == ETK_None) CanonKeyword = ETK_Typename; bool AnyNonCanonArgs = false; - llvm::SmallVector<TemplateArgument, 16> CanonArgs(NumArgs); + SmallVector<TemplateArgument, 16> CanonArgs(NumArgs); for (unsigned I = 0; I != NumArgs; ++I) { CanonArgs[I] = getCanonicalTemplateArgument(Args[I]); if (!CanonArgs[I].structurallyEquals(Args[I])) @@ -2634,7 +2634,7 @@ QualType ASTContext::getObjCObjectType(QualType BaseType, bool ProtocolsSorted = areSortedAndUniqued(Protocols, NumProtocols); if (!ProtocolsSorted || !BaseType.isCanonical()) { if (!ProtocolsSorted) { - llvm::SmallVector<ObjCProtocolDecl*, 8> Sorted(Protocols, + SmallVector<ObjCProtocolDecl*, 8> Sorted(Protocols, Protocols + NumProtocols); unsigned UniqueCount = NumProtocols; @@ -3824,7 +3824,7 @@ bool ASTContext::BlockRequiresCopying(QualType Ty) const { } QualType -ASTContext::BuildByRefType(llvm::StringRef DeclName, QualType Ty) const { +ASTContext::BuildByRefType(StringRef DeclName, QualType Ty) const { // type = struct __Block_byref_1_X { // void *__isa; // struct __Block_byref_1_X *__forwarding; @@ -3856,7 +3856,7 @@ ASTContext::BuildByRefType(llvm::StringRef DeclName, QualType Ty) const { Ty }; - llvm::StringRef FieldNames[] = { + StringRef FieldNames[] = { "__isa", "__forwarding", "__flags", @@ -4329,7 +4329,7 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S, // Another legacy compatibility encoding. Some ObjC qualifier and type // combinations need to be rearranged. // Rewrite "in const" from "nr" to "rn" - if (llvm::StringRef(S).endswith("nr")) + if (StringRef(S).endswith("nr")) S.replace(S.end()-2, S.end(), "rn"); } @@ -5248,7 +5248,7 @@ static void getIntersectionOfProtocols(ASTContext &Context, const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT, - llvm::SmallVectorImpl<ObjCProtocolDecl *> &IntersectionOfProtocols) { + SmallVectorImpl<ObjCProtocolDecl *> &IntersectionOfProtocols) { const ObjCObjectType* LHS = LHSOPT->getObjectType(); const ObjCObjectType* RHS = RHSOPT->getObjectType(); @@ -5304,7 +5304,7 @@ QualType ASTContext::areCommonBaseCompatible( do { LHS = cast<ObjCInterfaceType>(getObjCInterfaceType(LDecl)); if (canAssignObjCInterfaces(LHS, RHS)) { - llvm::SmallVector<ObjCProtocolDecl *, 8> Protocols; + SmallVector<ObjCProtocolDecl *, 8> Protocols; getIntersectionOfProtocols(*this, Lptr, Rptr, Protocols); QualType Result = QualType(LHS, 0); @@ -5567,7 +5567,7 @@ QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs, return QualType(); // Check argument compatibility - llvm::SmallVector<QualType, 10> types; + SmallVector<QualType, 10> types; for (unsigned i = 0; i < lproto_nargs; i++) { QualType largtype = lproto->getArgType(i).getUnqualifiedType(); QualType rargtype = rproto->getArgType(i).getUnqualifiedType(); @@ -6234,7 +6234,7 @@ QualType ASTContext::GetBuiltinType(unsigned Id, unsigned *IntegerConstantArgs) const { const char *TypeStr = BuiltinInfo.GetTypeString(Id); - llvm::SmallVector<QualType, 8> ArgTypes; + SmallVector<QualType, 8> ArgTypes; bool RequiresICE = false; Error = GE_None; diff --git a/lib/AST/ASTDiagnostic.cpp b/lib/AST/ASTDiagnostic.cpp index 7c91b5cb7a..c93bbe60ab 100644 --- a/lib/AST/ASTDiagnostic.cpp +++ b/lib/AST/ASTDiagnostic.cpp @@ -154,14 +154,14 @@ static std::string ConvertTypeToDiagnosticString(ASTContext &Context, QualType Ty, const Diagnostic::ArgumentValue *PrevArgs, unsigned NumPrevArgs, - llvm::SmallVectorImpl<intptr_t> &QualTypeVals) { + SmallVectorImpl<intptr_t> &QualTypeVals) { // FIXME: Playing with std::string is really slow. bool ForceAKA = false; QualType CanTy = Ty.getCanonicalType(); std::string S = Ty.getAsString(Context.PrintingPolicy); std::string CanS = CanTy.getAsString(Context.PrintingPolicy); - for (llvm::SmallVectorImpl<intptr_t>::iterator I = QualTypeVals.begin(), + for (SmallVectorImpl<intptr_t>::iterator I = QualTypeVals.begin(), E = QualTypeVals.end(); I != E; ++I) { QualType CompareTy = QualType::getFromOpaquePtr(reinterpret_cast<void*>(*I)); @@ -226,9 +226,9 @@ void clang::FormatASTNodeDiagnosticArgument( unsigned ArgLen, const Diagnostic::ArgumentValue *PrevArgs, unsigned NumPrevArgs, - llvm::SmallVectorImpl<char> &Output, + SmallVectorImpl<char> &Output, void *Cookie, - llvm::SmallVectorImpl<intptr_t> &QualTypeVals) { + SmallVectorImpl<intptr_t> &QualTypeVals) { ASTContext &Context = *static_cast<ASTContext*>(Cookie); std::string S; diff --git a/lib/AST/ASTImporter.cpp b/lib/AST/ASTImporter.cpp index d68d240346..2ea79912d1 100644 --- a/lib/AST/ASTImporter.cpp +++ b/lib/AST/ASTImporter.cpp @@ -92,7 +92,7 @@ namespace { TemplateArgument ImportTemplateArgument(const TemplateArgument &From); bool ImportTemplateArguments(const TemplateArgument *FromArgs, unsigned NumFromArgs, - llvm::SmallVectorImpl<TemplateArgument> &ToArgs); + SmallVectorImpl<TemplateArgument> &ToArgs); bool IsStructuralMatch(RecordDecl *FromRecord, RecordDecl *ToRecord); bool IsStructuralMatch(EnumDecl *FromEnum, EnumDecl *ToRecord); bool IsStructuralMatch(ClassTemplateDecl *From, ClassTemplateDecl *To); @@ -1518,7 +1518,7 @@ QualType ASTNodeImporter::VisitFunctionProtoType(const FunctionProtoType *T) { return QualType(); // Import argument types - llvm::SmallVector<QualType, 4> ArgTypes; + SmallVector<QualType, 4> ArgTypes; for (FunctionProtoType::arg_type_iterator A = T->arg_type_begin(), AEnd = T->arg_type_end(); A != AEnd; ++A) { @@ -1529,7 +1529,7 @@ QualType ASTNodeImporter::VisitFunctionProtoType(const FunctionProtoType *T) { } // Import exception types - llvm::SmallVector<QualType, 4> ExceptionTypes; + SmallVector<QualType, 4> ExceptionTypes; for (FunctionProtoType::exception_iterator E = T->exception_begin(), EEnd = T->exception_end(); E != EEnd; ++E) { @@ -1628,7 +1628,7 @@ QualType ASTNodeImporter::VisitTemplateSpecializationType( if (ToTemplate.isNull()) return QualType(); - llvm::SmallVector<TemplateArgument, 2> ToTemplateArgs; + SmallVector<TemplateArgument, 2> ToTemplateArgs; if (ImportTemplateArguments(T->getArgs(), T->getNumArgs(), ToTemplateArgs)) return QualType(); @@ -1677,7 +1677,7 @@ QualType ASTNodeImporter::VisitObjCObjectType(const ObjCObjectType *T) { if (ToBaseType.isNull()) return QualType(); - llvm::SmallVector<ObjCProtocolDecl *, 4> Protocols; + SmallVector<ObjCProtocolDecl *, 4> Protocols; for (ObjCObjectType::qual_iterator P = T->qual_begin(), PEnd = T->qual_end(); P != PEnd; ++P) { @@ -1788,7 +1788,7 @@ bool ASTNodeImporter::ImportDefinition(RecordDecl *From, RecordDecl *To, bool Fo if (CXXRecordDecl *ToCXX = dyn_cast<CXXRecordDecl>(To)) { CXXRecordDecl *FromCXX = cast<CXXRecordDecl>(From); - llvm::SmallVector<CXXBaseSpecifier *, 4> Bases; + SmallVector<CXXBaseSpecifier *, 4> Bases; for (CXXRecordDecl::base_class_iterator Base1 = FromCXX->bases_begin(), FromBaseEnd = FromCXX->bases_end(); @@ -1822,7 +1822,7 @@ bool ASTNodeImporter::ImportDefinition(RecordDecl *From, RecordDecl *To, bool Fo TemplateParameterList *ASTNodeImporter::ImportTemplateParameterList( TemplateParameterList *Params) { - llvm::SmallVector<NamedDecl *, 4> ToParams; + SmallVector<NamedDecl *, 4> ToParams; ToParams.reserve(Params->size()); for (TemplateParameterList::iterator P = Params->begin(), PEnd = Params->end(); @@ -1889,7 +1889,7 @@ ASTNodeImporter::ImportTemplateArgument(const TemplateArgument &From) { return TemplateArgument(); case TemplateArgument::Pack: { - llvm::SmallVector<TemplateArgument, 2> ToPack; + SmallVector<TemplateArgument, 2> ToPack; ToPack.reserve(From.pack_size()); if (ImportTemplateArguments(From.pack_begin(), From.pack_size(), ToPack)) return TemplateArgument(); @@ -1907,7 +1907,7 @@ ASTNodeImporter::ImportTemplateArgument(const TemplateArgument &From) { bool ASTNodeImporter::ImportTemplateArguments(const TemplateArgument *FromArgs, unsigned NumFromArgs, - llvm::SmallVectorImpl<TemplateArgument> &ToArgs) { + SmallVectorImpl<TemplateArgument> &ToArgs) { for (unsigned I = 0; I != NumFromArgs; ++I) { TemplateArgument To = ImportTemplateArgument(FromArgs[I]); if (To.isNull() && !FromArgs[I].isNull()) @@ -1966,7 +1966,7 @@ Decl *ASTNodeImporter::VisitNamespaceDecl(NamespaceDecl *D) { else MergeWithNamespace = cast<NamespaceDecl>(DC)->getAnonymousNamespace(); } else { - llvm::SmallVector<NamedDecl *, 4> ConflictingDecls; + SmallVector<NamedDecl *, 4> ConflictingDecls; for (DeclContext::lookup_result Lookup = DC->lookup(Name); Lookup.first != Lookup.second; ++Lookup.first) { @@ -2026,7 +2026,7 @@ Decl *ASTNodeImporter::VisitTypedefNameDecl(TypedefNameDecl *D, bool IsAlias) { // seen a typedef with the same name (that we can merge with) or any // other entity by that name (which name lookup could conflict with). if (!DC->isFunctionOrMethod()) { - llvm::SmallVector<NamedDecl *, 4> ConflictingDecls; + SmallVector<NamedDecl *, 4> ConflictingDecls; unsigned IDNS = Decl::IDNS_Ordinary; for (DeclContext::lookup_result Lookup = DC->lookup(Name); Lookup.first != Lookup.second; @@ -2106,7 +2106,7 @@ Decl *ASTNodeImporter::VisitEnumDecl(EnumDecl *D) { // We may already have an enum of the same name; try to find and match it. if (!DC->isFunctionOrMethod() && SearchName) { - llvm::SmallVector<NamedDecl *, 4> ConflictingDecls; + SmallVector<NamedDecl *, 4> ConflictingDecls; for (DeclContext::lookup_result Lookup = DC->lookup(Name); Lookup.first != Lookup.second; ++Lookup.first) { @@ -2208,7 +2208,7 @@ Decl *ASTNodeImporter::VisitRecordDecl(RecordDecl *D) { // We may already have a record of the same name; try to find and match it. RecordDecl *AdoptDecl = 0; if (!DC->isFunctionOrMethod() && SearchName) { - llvm::SmallVector<NamedDecl *, 4> ConflictingDecls; + SmallVector<NamedDecl *, 4> ConflictingDecls; for (DeclContext::lookup_result Lookup = DC->lookup(Name); Lookup.first != Lookup.second; ++Lookup.first) { @@ -2292,7 +2292,7 @@ Decl *ASTNodeImporter::VisitEnumConstantDecl(EnumConstantDecl *D) { // Determine whether there are any other declarations with the same name and // in the same context. if (!LexicalDC->isFunctionOrMethod()) { - llvm::SmallVector<NamedDecl *, 4> ConflictingDecls; + SmallVector<NamedDecl *, 4> ConflictingDecls; unsigned IDNS = Decl::IDNS_Ordinary; for (DeclContext::lookup_result Lookup = DC->lookup(Name); Lookup.first != Lookup.second; @@ -2338,7 +2338,7 @@ Decl *ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) { // Try to find a function in our own ("to") context with the same name, same // type, and in the same context as the function we're importing. if (!LexicalDC->isFunctionOrMethod()) { - llvm::SmallVector<NamedDecl *, 4> ConflictingDecls; + SmallVector<NamedDecl *, 4> ConflictingDecls; unsigned IDNS = Decl::IDNS_Ordinary; for (DeclContext::lookup_result Lookup = DC->lookup(Name); Lookup.first != Lookup.second; @@ -2393,7 +2393,7 @@ Decl *ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) { return 0; // Import the function parameters. - llvm::SmallVector<ParmVarDecl *, 8> Parameters; + SmallVector<ParmVarDecl *, 8> Parameters; for (FunctionDecl::param_iterator P = D->param_begin(), PEnd = D->param_end(); P != PEnd; ++P) { ParmVarDecl *ToP = cast_or_null<ParmVarDecl>(Importer.Import(*P)); @@ -2618,7 +2618,7 @@ Decl *ASTNodeImporter::VisitVarDecl(VarDecl *D) { // in the same context as the variable we're importing. if (D->isFileVarDecl()) { VarDecl *MergeWithVar = 0; - llvm::SmallVector<NamedDecl *, 4> ConflictingDecls; + SmallVector<NamedDecl *, 4> ConflictingDecls; unsigned IDNS = Decl::IDNS_Ordinary; for (DeclContext::lookup_result Lookup = DC->lookup(Name); Lookup.first != Lookup.second; @@ -2877,7 +2877,7 @@ Decl *ASTNodeImporter::VisitObjCMethodDecl(ObjCMethodDecl *D) { // deal with implicit parameters. // Import the parameters - llvm::SmallVector<ParmVarDecl *, 5> ToParams; + SmallVector<ParmVarDecl *, 5> ToParams; for (ObjCMethodDecl::param_iterator FromP = D->param_begin(), FromPEnd = D->param_end(); FromP != FromPEnd; @@ -2936,8 +2936,8 @@ Decl *ASTNodeImporter::VisitObjCCategoryDecl(ObjCCategoryDecl *D) { ToCategory->insertNextClassCategory(); // Import protocols - llvm::SmallVector<ObjCProtocolDecl *, 4> Protocols; - llvm::SmallVector<SourceLocation, 4> ProtocolLocs; + SmallVector<ObjCProtocolDecl *, 4> Protocols; + SmallVector<SourceLocation, 4> ProtocolLocs; ObjCCategoryDecl::protocol_loc_iterator FromProtoLoc = D->protocol_loc_begin(); for (ObjCCategoryDecl::protocol_iterator FromProto = D->protocol_begin(), @@ -3008,8 +3008,8 @@ Decl *ASTNodeImporter::VisitObjCProtocolDecl(ObjCProtocolDecl *D) { Importer.Imported(D, ToProto); // Import protocols - llvm::SmallVector<ObjCProtocolDecl *, 4> Protocols; - llvm::SmallVector<SourceLocation, 4> ProtocolLocs; + SmallVector<ObjCProtocolDecl *, 4> Protocols; + SmallVector<SourceLocation, 4> ProtocolLocs; ObjCProtocolDecl::protocol_loc_iterator FromProtoLoc = D->protocol_loc_begin(); for (ObjCProtocolDecl::protocol_iterator FromProto = D->protocol_begin(), @@ -3082,8 +3082,8 @@ Decl *ASTNodeImporter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) { } // Import protocols - llvm::SmallVector<ObjCProtocolDecl *, 4> Protocols; - llvm::SmallVector<SourceLocation, 4> ProtocolLocs; + SmallVector<ObjCProtocolDecl *, 4> Protocols; + SmallVector<SourceLocation, 4> ProtocolLocs; ObjCInterfaceDecl::protocol_loc_iterator FromProtoLoc = D->protocol_loc_begin(); @@ -3427,8 +3427,8 @@ ASTNodeImporter::VisitObjCForwardProtocolDecl(ObjCForwardProtocolDecl *D) { // Import the location of this declaration. SourceLocation Loc = Importer.Import(D->getLocation()); - llvm::SmallVector<ObjCProtocolDecl *, 4> Protocols; - llvm::SmallVector<SourceLocation, 4> Locations; + SmallVector<ObjCProtocolDecl *, 4> Protocols; + SmallVector<SourceLocation, 4> Locations; ObjCForwardProtocolDecl::protocol_loc_iterator FromProtoLoc = D->protocol_loc_begin(); for (ObjCForwardProtocolDecl::protocol_iterator FromProto @@ -3470,8 +3470,8 @@ Decl *ASTNodeImporter::VisitObjCClassDecl(ObjCClassDecl *D) { // Import the location of this declaration. SourceLocation Loc = Importer.Import(D->getLocation()); - llvm::SmallVector<ObjCInterfaceDecl *, 4> Interfaces; - llvm::SmallVector<SourceLocation, 4> Locations; + SmallVector<ObjCInterfaceDecl *, 4> Interfaces; + SmallVector<SourceLocation, 4> Locations; for (ObjCClassDecl::iterator From = D->begin(), FromEnd = D->end(); From != FromEnd; ++From) { ObjCInterfaceDecl *ToIface @@ -3591,7 +3591,7 @@ Decl *ASTNodeImporter::VisitClassTemplateDecl(ClassTemplateDecl *D) { // We may already have a template of the same name; try to find and match it. if (!DC->isFunctionOrMethod()) { - llvm::SmallVector<NamedDecl *, 4> ConflictingDecls; + SmallVector<NamedDecl *, 4> ConflictingDecls; for (DeclContext::lookup_result Lookup = DC->lookup(Name); Lookup.first != Lookup.second; ++Lookup.first) { @@ -3701,7 +3701,7 @@ Decl *ASTNodeImporter::VisitClassTemplateSpecializationDecl( SourceLocation IdLoc = Importer.Import(D->getLocation()); // Import template arguments. - llvm::SmallVector<TemplateArgument, 2> TemplateArgs; + SmallVector<TemplateArgument, 2> TemplateArgs; if (ImportTemplateArguments(D->getTemplateArgs().data(), D->getTemplateArgs().size(), TemplateArgs)) @@ -4042,7 +4042,7 @@ Decl *ASTImporter::Import(Decl *FromD) { } else if (TypedefNameDecl *FromTypedef = dyn_cast<TypedefNameDecl>(FromD)) { // When we've finished transforming a typedef, see whether it was the // typedef for an anonymous tag. - for (llvm::SmallVector<TagDecl *, 4>::iterator + for (SmallVector<TagDecl *, 4>::iterator FromTag = AnonTagsWithPendingTypedefs.begin(), FromTagEnd = AnonTagsWithPendingTypedefs.end(); FromTag != FromTagEnd; ++FromTag) { @@ -4384,7 +4384,7 @@ Selector ASTImporter::Import(Selector FromSel) { if (FromSel.isNull()) return Selector(); - llvm::SmallVector<IdentifierInfo *, 4> Idents; + SmallVector<IdentifierInfo *, 4> Idents; Idents.push_back(Import(FromSel.getIdentifierInfoForSlot(0))); for (unsigned I = 1, N = FromSel.getNumArgs(); I < N; ++I) Idents.push_back(Import(FromSel.getIdentifierInfoForSlot(I))); diff --git a/lib/AST/CXXInheritance.cpp b/lib/AST/CXXInheritance.cpp index 9ffe1f8656..f29bfd1319 100644 --- a/lib/AST/CXXInheritance.cpp +++ b/lib/AST/CXXInheritance.cpp @@ -119,7 +119,7 @@ bool CXXRecordDecl::isProvablyNotDerivedFrom(const CXXRecordDecl *Base) const { bool CXXRecordDecl::forallBases(ForallBasesCallback *BaseMatches, void *OpaqueData, bool AllowShortCircuit) const { - llvm::SmallVector<const CXXRecordDecl*, 8> Queue; + SmallVector<const CXXRecordDecl*, 8> Queue; const CXXRecordDecl *Record = this; bool AllMatches = true; @@ -425,7 +425,7 @@ FindNestedNameSpecifierMember(const CXXBaseSpecifier *Specifier, void OverridingMethods::add(unsigned OverriddenSubobject, UniqueVirtualMethod Overriding) { - llvm::SmallVector<UniqueVirtualMethod, 4> &SubobjectOverrides + SmallVector<UniqueVirtualMethod, 4> &SubobjectOverrides = Overrides[OverriddenSubobject]; if (std::find(SubobjectOverrides.begin(), SubobjectOverrides.end(), Overriding) == SubobjectOverrides.end()) @@ -556,7 +556,7 @@ void FinalOverriderCollector::Collect(const CXXRecordDecl *RD, // overrides. typedef std::pair<CXXMethodDecl::method_iterator, CXXMethodDecl::method_iterator> OverriddenMethods; - llvm::SmallVector<OverriddenMethods, 4> Stack; + SmallVector<OverriddenMethods, 4> Stack; Stack.push_back(std::make_pair(CanonM->begin_overridden_methods(), CanonM->end_overridden_methods())); while (!Stack.empty()) { @@ -623,11 +623,11 @@ CXXRecordDecl::getFinalOverriders(CXXFinalOverriderMap &FinalOverriders) const { SOEnd = OM->second.end(); SO != SOEnd; ++SO) { - llvm::SmallVector<UniqueVirtualMethod, 4> &Overriding = SO->second; + SmallVector<UniqueVirtualMethod, 4> &Overriding = SO->second; if (Overriding.size() < 2) continue; - for (llvm::SmallVector<UniqueVirtualMethod, 4>::iterator + for (SmallVector<UniqueVirtualMethod, 4>::iterator Pos = Overriding.begin(), PosEnd = Overriding.end(); Pos != PosEnd; /* increment in loop */) { @@ -642,7 +642,7 @@ CXXRecordDecl::getFinalOverriders(CXXFinalOverriderMap &FinalOverriders) const { // in a base class subobject that hides the virtual base class // subobject. bool Hidden = false; - for (llvm::SmallVector<UniqueVirtualMethod, 4>::iterator + for (SmallVector<UniqueVirtualMethod, 4>::iterator OP = Overriding.begin(), OPEnd = Overriding.end(); OP != OPEnd && !Hidden; ++OP) { diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index b7884e04cb..ed8171d3ef 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -818,7 +818,7 @@ std::string NamedDecl::getQualifiedNameAsString(const PrintingPolicy &P) const { if (Ctx->isFunctionOrMethod()) return getNameAsString(); - typedef llvm::SmallVector<const DeclContext *, 8> ContextsTy; + typedef SmallVector<const DeclContext *, 8> ContextsTy; ContextsTy Contexts; // Collect contexts. @@ -2387,7 +2387,7 @@ void RecordDecl::LoadFieldsFromExternalStorage() const { // Notify that we have a RecordDecl doing some initialization. ExternalASTSource::Deserializing TheFields(Source); - llvm::SmallVector<Decl*, 64> Decls; + SmallVector<Decl*, 64> Decls; LoadedFieldsFromExternalStorage = true; switch (Source->FindExternalLexicalDeclsBy<FieldDecl>(this, Decls)) { case ELR_Success: diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index b2806f092c..27d05baca2 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -148,7 +148,7 @@ bool Decl::isDefinedOutsideFunctionOrMethod() const { // PrettyStackTraceDecl Implementation //===----------------------------------------------------------------------===// -void PrettyStackTraceDecl::print(llvm::raw_ostream &OS) const { +void PrettyStackTraceDecl::print(raw_ostream &OS) const { SourceLocation TheLoc = Loc; if (TheLoc.isInvalid() && TheDecl) TheLoc = TheDecl->getLocation(); @@ -265,8 +265,8 @@ bool Decl::isReferenced() const { static AvailabilityResult CheckAvailability(ASTContext &Context, const AvailabilityAttr *A, std::string *Message) { - llvm::StringRef TargetPlatform = Context.Target.getPlatformName(); - llvm::StringRef PrettyPlatformName + StringRef TargetPlatform = Context.Target.getPlatformName(); + StringRef PrettyPlatformName = AvailabilityAttr::getPrettyPlatformName(TargetPlatform); if (PrettyPlatformName.empty()) PrettyPlatformName = TargetPlatform; @@ -812,7 +812,7 @@ DeclContext *DeclContext::getNextContext() { } std::pair<Decl *, Decl *> -DeclContext::BuildDeclChain(const llvm::SmallVectorImpl<Decl*> &Decls) { +DeclContext::BuildDeclChain(const SmallVectorImpl<Decl*> &Decls) { // Build up a chain of declarations via the Decl::NextDeclInContext field. Decl *FirstNewDecl = 0; Decl *PrevDecl = 0; @@ -840,7 +840,7 @@ DeclContext::LoadLexicalDeclsFromExternalStorage() const { ExternalASTSource::Deserializing ADeclContext(Source); // Load the external declarations, if any. - llvm::SmallVector<Decl*, 64> Decls; + SmallVector<Decl*, 64> Decls; ExternalLexicalStorage = false; switch (Source->FindExternalLexicalDecls(this, Decls)) { case ELR_Success: @@ -890,7 +890,7 @@ ExternalASTSource::SetNoExternalVisibleDeclsForName(const DeclContext *DC, DeclContext::lookup_result ExternalASTSource::SetExternalVisibleDeclsForName(const DeclContext *DC, DeclarationName Name, - llvm::SmallVectorImpl<NamedDecl*> &Decls) { + SmallVectorImpl<NamedDecl*> &Decls) { ASTContext &Context = DC->getParentASTContext();; StoredDeclsMap *Map; @@ -910,7 +910,7 @@ ExternalASTSource::SetExternalVisibleDeclsForName(const DeclContext *DC, void ExternalASTSource::MaterializeVisibleDeclsForName(const DeclContext *DC, DeclarationName Name, - llvm::SmallVectorImpl<NamedDecl*> &Decls) { + SmallVectorImpl<NamedDecl*> &Decls) { assert(DC->LookupPtr); StoredDeclsMap &Map = *DC->LookupPtr; diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp index 4b59bf37d7..aaa75dcad7 100644 --- a/lib/AST/DeclCXX.cpp +++ b/lib/AST/DeclCXX.cpp @@ -89,7 +89,7 @@ CXXRecordDecl::setBases(CXXBaseSpecifier const * const *Bases, llvm::SmallPtrSet<CanQualType, 8> SeenVBaseTypes; // The virtual bases of this class. - llvm::SmallVector<const CXXBaseSpecifier *, 8> VBases; + SmallVector<const CXXBaseSpecifier *, 8> VBases; data().Bases = new(C) CXXBaseSpecifier [NumBases]; data().NumBases = NumBases; @@ -287,7 +287,7 @@ bool CXXRecordDecl::isTriviallyCopyable() const { /// (if there is one). static CXXMethodDecl * GetBestOverloadCandidateSimple( - const llvm::SmallVectorImpl<std::pair<CXXMethodDecl *, Qualifiers> > &Cands) { + const SmallVectorImpl<std::pair<CXXMethodDecl *, Qualifiers> > &Cands) { if (Cands.empty()) return 0; if (Cands.size() == 1) @@ -313,7 +313,7 @@ CXXConstructorDecl *CXXRecordDecl::getCopyConstructor(unsigned TypeQuals) const{ = Context.DeclarationNames.getCXXConstructorName( Context.getCanonicalType(ClassType)); unsigned FoundTQs; - llvm::SmallVector<std::pair<CXXMethodDecl *, Qualifiers>, 4> Found; + SmallVector<std::pair<CXXMethodDecl *, Qualifiers>, 4> Found; DeclContext::lookup_const_iterator Con, ConEnd; for (llvm::tie(Con, ConEnd) = this->lookup(ConstructorName); Con != ConEnd; ++Con) { @@ -349,7 +349,7 @@ CXXMethodDecl *CXXRecordDecl::getCopyAssignmentOperator(bool ArgIsConst) const { QualType Class = Context.getTypeDeclType(const_cast<CXXRecordDecl *>(this)); DeclarationName Name = Context.DeclarationNames.getCXXOperatorName(OO_Equal); - llvm::SmallVector<std::pair<CXXMethodDecl *, Qualifiers>, 4> Found; + SmallVector<std::pair<CXXMethodDecl *, Qualifiers>, 4> Found; DeclContext::lookup_const_iterator Op, OpEnd; for (llvm::tie(Op, OpEnd) = this->lookup(Name); Op != OpEnd; ++Op) { // C++ [class.copy]p9: diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index f0a16db644..8d5d011978 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -185,7 +185,7 @@ void ObjCInterfaceDecl::mergeClassExtensionProtocolList( // Check for duplicate protocol in class's protocol list. // This is O(n*m). But it is extremely rare and number of protocols in // class or its extension are very few. - llvm::SmallVector<ObjCProtocolDecl*, 8> ProtocolRefs; + SmallVector<ObjCProtocolDecl*, 8> ProtocolRefs; for (unsigned i = 0; i < ExtNum; i++) { bool protocolExists = false; ObjCProtocolDecl *ProtoInExtension = ExtList[i]; @@ -997,7 +997,7 @@ FindPropertyImplDecl(IdentifierInfo *Id) const { return 0; } -llvm::raw_ostream &clang::operator<<(llvm::raw_ostream &OS, +raw_ostream &clang::operator<<(raw_ostream &OS, const ObjCCategoryImplDecl *CID) { OS << CID->getName(); return OS; @@ -1028,7 +1028,7 @@ void ObjCImplementationDecl::setIvarInitializers(ASTContext &C, } } -llvm::raw_ostream &clang::operator<<(llvm::raw_ostream &OS, +raw_ostream &clang::operator<<(raw_ostream &OS, const ObjCImplementationDecl *ID) { OS << ID->getName(); return OS; diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp index 19554a3baa..08112cb7f8 100644 --- a/lib/AST/DeclPrinter.cpp +++ b/lib/AST/DeclPrinter.cpp @@ -24,19 +24,19 @@ using namespace clang; namespace { class DeclPrinter : public DeclVisitor<DeclPrinter> { - llvm::raw_ostream &Out; + raw_ostream &Out; ASTContext &Context; PrintingPolicy Policy; unsigned Indentation; - llvm::raw_ostream& Indent() { return Indent(Indentation); } - llvm::raw_ostream& Indent(unsigned Indentation); - void ProcessDeclGroup(llvm::SmallVectorImpl<Decl*>& Decls); + raw_ostream& Indent() { return Indent(Indentation); } + raw_ostream& Indent(unsigned Indentation); + void ProcessDeclGroup(SmallVectorImpl<Decl*>& Decls); void Print(AccessSpecifier AS); public: - DeclPrinter(llvm::raw_ostream &Out, ASTContext &Context, + DeclPrinter(raw_ostream &Out, ASTContext &Context, const PrintingPolicy &Policy, unsigned Indentation = 0) : Out(Out), Context(Context), Policy(Policy), Indentation(Indentation) { } @@ -80,11 +80,11 @@ namespace { }; } -void Decl::print(llvm::raw_ostream &Out, unsigned Indentation) const { +void Decl::print(raw_ostream &Out, unsigned Indentation) const { print(Out, getASTContext().PrintingPolicy, Indentation); } -void Decl::print(llvm::raw_ostream &Out, const PrintingPolicy &Policy, +void Decl::print(raw_ostream &Out, const PrintingPolicy &Policy, unsigned Indentation) const { DeclPrinter Printer(Out, getASTContext(), Policy, Indentation); Printer.Visit(const_cast<Decl*>(this)); @@ -119,7 +119,7 @@ static QualType getDeclType(Decl* D) { } void Decl::printGroup(Decl** Begin, unsigned NumDecls, - llvm::raw_ostream &Out, const PrintingPolicy &Policy, + raw_ostream &Out, const PrintingPolicy &Policy, unsigned Indentation) { if (NumDecls == 1) { (*Begin)->print(Out, Policy, Indentation); @@ -167,13 +167,13 @@ void Decl::dump() const { print(llvm::errs()); } -llvm::raw_ostream& DeclPrinter::Indent(unsigned Indentation) { +raw_ostream& DeclPrinter::Indent(unsigned Indentation) { for (unsigned i = 0; i != Indentation; ++i) Out << " "; return Out; } -void DeclPrinter::ProcessDeclGroup(llvm::SmallVectorImpl<Decl*>& Decls) { +void DeclPrinter::ProcessDeclGroup(SmallVectorImpl<Decl*>& Decls) { this->Indent(); Decl::printGroup(Decls.data(), Decls.size(), Out, Policy, Indentation); Out << ";\n"; @@ -198,7 +198,7 @@ void DeclPrinter::VisitDeclContext(DeclContext *DC, bool Indent) { if (Indent) Indentation += Policy.Indentation; - llvm::SmallVector<Decl*, 2> Decls; + SmallVector<Decl*, 2> Decls; for (DeclContext::decl_iterator D = DC->decls_begin(), DEnd = DC->decls_end(); D != DEnd; ++D) { diff --git a/lib/AST/DeclTemplate.cpp b/lib/AST/DeclTemplate.cpp index bc375d0ad2..7ed2ce851b 100644 --- a/lib/AST/DeclTemplate.cpp +++ b/lib/AST/DeclTemplate.cpp @@ -348,7 +348,7 @@ void ClassTemplateDecl::AddPartialSpecialization( } void ClassTemplateDecl::getPartialSpecializations( - llvm::SmallVectorImpl<ClassTemplatePartialSpecializationDecl *> &PS) { + SmallVectorImpl<ClassTemplatePartialSpecializationDecl *> &PS) { llvm::FoldingSet<ClassTemplatePartialSpecializationDecl> &PartialSpecs = getPartialSpecializations(); PS.clear(); @@ -406,7 +406,7 @@ ClassTemplateDecl::getInjectedClassNameSpecialization() { // pack. ASTContext &Context = getASTContext(); TemplateParameterList *Params = getTemplateParameters(); - llvm::SmallVector<TemplateArgument, 16> TemplateArgs; + SmallVector<TemplateArgument, 16> TemplateArgs; TemplateArgs.resize(Params->size()); GenerateInjectedTemplateArgs(getASTContext(), Params, TemplateArgs.data()); CommonPtr->InjectedClassNameType diff --git a/lib/AST/DeclarationName.cpp b/lib/AST/DeclarationName.cpp index 72c0e9da7f..a3ba94195f 100644 --- a/lib/AST/DeclarationName.cpp +++ b/lib/AST/DeclarationName.cpp @@ -209,7 +209,7 @@ std::string DeclarationName::getAsString() const { return OS.str(); } -void DeclarationName::printName(llvm::raw_ostream &OS) const { +void DeclarationName::printName(raw_ostream &OS) const { switch (getNameKind()) { case Identifier: if (const IdentifierInfo *II = getAsIdentifierInfo()) @@ -562,7 +562,7 @@ std::string DeclarationNameInfo::getAsString() const { return OS.str(); } -void DeclarationNameInfo::printName(llvm::raw_ostream &OS) const { +void DeclarationNameInfo::printName(raw_ostream &OS) const { switch (Name.getNameKind()) { case DeclarationName::Identifier: case DeclarationName::ObjCZeroArgSelector: diff --git a/lib/AST/DumpXML.cpp b/lib/AST/DumpXML.cpp index dfe0119f59..dd0147c5a3 100644 --- a/lib/AST/DumpXML.cpp +++ b/lib/AST/DumpXML.cpp @@ -53,9 +53,9 @@ enum NodeState { }; struct Node { - llvm::StringRef Name; + StringRef Name; NodeState State; - Node(llvm::StringRef name) : Name(name), State(NS_Attrs) {} + Node(StringRef name) : Name(name), State(NS_Attrs) {} bool isDoneWithAttrs() const { return State != NS_Attrs; } }; @@ -159,7 +159,7 @@ template <class Impl> struct XMLTypeVisitor { #undef DISPATCH }; -static llvm::StringRef getTypeKindName(Type *T) { +static StringRef getTypeKindName(Type *T) { switch (T->getTypeClass()) { #define TYPE(DERIVED, BASE) case Type::DERIVED: return #DERIVED "Type"; #define ABSTRACT_TYPE(DERIVED, BASE) @@ -172,11 +172,11 @@ static llvm::StringRef getTypeKindName(Type *T) { struct XMLDumper : public XMLDeclVisitor<XMLDumper>, public XMLTypeVisitor<XMLDumper> { - llvm::raw_ostream &out; + raw_ostream &out; ASTContext &Context; - llvm::SmallVector<Node, 16> Stack; + SmallVector<Node, 16> Stack; unsigned Indent; - explicit XMLDumper(llvm::raw_ostream &OS, ASTContext &context) + explicit XMLDumper(raw_ostream &OS, ASTContext &context) : out(OS), Context(context), Indent(0) {} void indent() { @@ -185,7 +185,7 @@ struct XMLDumper : public XMLDeclVisitor<XMLDumper>, } /// Push a new node on the stack. - void push(llvm::StringRef name) { + void push(StringRef name) { if (!Stack.empty()) { assert(Stack.back().isDoneWithAttrs()); if (Stack.back().State == NS_LazyChildren) { @@ -200,7 +200,7 @@ struct XMLDumper : public XMLDeclVisitor<XMLDumper>, } /// Set the given attribute to the given value. - void set(llvm::StringRef attr, llvm::StringRef value) { + void set(StringRef attr, StringRef value) { assert(!Stack.empty() && !Stack.back().isDoneWithAttrs()); out << ' ' << attr << '=' << '"' << value << '"'; // TODO: quotation } @@ -226,7 +226,7 @@ struct XMLDumper : public XMLDeclVisitor<XMLDumper>, //---- General utilities -------------------------------------------// - void setPointer(llvm::StringRef prop, const void *p) { + void setPointer(StringRef prop, const void *p) { llvm::SmallString<10> buffer; llvm::raw_svector_ostream os(buffer); os << p; @@ -238,11 +238,11 @@ struct XMLDumper : public XMLDeclVisitor<XMLDumper>, setPointer("ptr", p); } - void setInteger(llvm::StringRef prop, const llvm::APSInt &v) { + void setInteger(StringRef prop, const llvm::APSInt &v) { set(prop, v.toString(10)); } - void setInteger(llvm::StringRef prop, unsigned n) { + void setInteger(StringRef prop, unsigned n) { llvm::SmallString<10> buffer; llvm::raw_svector_ostream os(buffer); os << n; @@ -250,7 +250,7 @@ struct XMLDumper : public XMLDeclVisitor<XMLDumper>, set(prop, buffer); } - void setFlag(llvm::StringRef prop, bool flag) { + void setFlag(StringRef prop, bool flag) { if (flag) set(prop, "true"); } @@ -268,7 +268,7 @@ struct XMLDumper : public XMLDeclVisitor<XMLDumper>, class TemporaryContainer { XMLDumper &Dumper; public: - TemporaryContainer(XMLDumper &dumper, llvm::StringRef name) + TemporaryContainer(XMLDumper &dumper, StringRef name) : Dumper(dumper) { Dumper.push(name); Dumper.completeAttrs(); @@ -303,7 +303,7 @@ struct XMLDumper : public XMLDeclVisitor<XMLDumper>, completeAttrs(); pop(); } - void visitDeclRef(llvm::StringRef Name, Decl *D) { + void visitDeclRef(StringRef Name, Decl *D) { TemporaryContainer C(*this, Name); if (D) visitDeclRef(D); } @@ -423,7 +423,7 @@ struct XMLDumper : public XMLDeclVisitor<XMLDumper>, // LinkageSpecDecl void visitLinkageSpecDeclAttrs(LinkageSpecDecl *D) { - llvm::StringRef lang = ""; + StringRef lang = ""; switch (D->getLanguage()) { case LinkageSpecDecl::lang_c: lang = "C"; break; case LinkageSpecDecl::lang_cxx: lang = "C++"; break; @@ -860,7 +860,7 @@ struct XMLDumper : public XMLDeclVisitor<XMLDumper>, } // ObjCIvarDecl - void setAccessControl(llvm::StringRef prop, ObjCIvarDecl::AccessControl AC) { + void setAccessControl(StringRef prop, ObjCIvarDecl::AccessControl AC) { switch (AC) { case ObjCIvarDecl::None: return set(prop, "none"); case ObjCIvarDecl::Private: return set(prop, "private"); @@ -1031,13 +1031,13 @@ void Decl::dumpXML() const { dumpXML(llvm::errs()); } -void Decl::dumpXML(llvm::raw_ostream &out) const { +void Decl::dumpXML(raw_ostream &out) const { XMLDumper(out, getASTContext()).dispatch(const_cast<Decl*>(this)); } #else /* ifndef NDEBUG */ void Decl::dumpXML() const {} -void Decl::dumpXML(llvm::raw_ostream &out) const {} +void Decl::dumpXML(raw_ostream &out) const {} #endif diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 4611ae3699..58fb32d278 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -532,7 +532,7 @@ double FloatingLiteral::getValueAsApproximateDouble() const { return V.convertToDouble(); } -StringLiteral *StringLiteral::Create(ASTContext &C, llvm::StringRef Str, +StringLiteral *StringLiteral::Create(ASTContext &C, StringRef Str, bool Wide, bool Pascal, QualType Ty, const SourceLocation *Loc, @@ -570,7 +570,7 @@ StringLiteral *StringLiteral::CreateEmpty(ASTContext &C, unsigned NumStrs) { return SL; } -void StringLiteral::setString(ASTContext &C, llvm::StringRef Str) { +void StringLiteral::setString(ASTContext &C, StringRef Str) { char *AStrData = new (C, 1) char[Str.size()]; memcpy(AStrData, Str.data(), Str.size()); StrData = AStrData; @@ -604,7 +604,7 @@ getLocationOfByte(unsigned ByteNo, const SourceManager &SM, // Re-lex the token to get its length and original spelling. std::pair<FileID, unsigned> LocInfo =SM.getDecomposedLoc(StrTokSpellingLoc); bool Invalid = false; - llvm::StringRef Buffer = SM.getBufferData(LocInfo.first, &Invalid); + StringRef Buffer = SM.getBufferData(LocInfo.first, &Invalid); if (Invalid) return StrTokSpellingLoc; @@ -2397,7 +2397,7 @@ bool Expr::isConstantInitializer(ASTContext &Ctx, bool IsForRef) const { break; case MaterializeTemporaryExprClass: - return llvm::cast<MaterializeTemporaryExpr>(this)->GetTemporaryExpr() + return cast<MaterializeTemporaryExpr>(this)->GetTemporaryExpr() ->isConstantInitializer(Ctx, false); } return isEvaluatable(Ctx); @@ -2576,7 +2576,7 @@ unsigned ExtVectorElementExpr::getNumElements() const { bool ExtVectorElementExpr::containsDuplicateElements() const { // FIXME: Refactor this code to an accessor on the AST node which returns the // "type" of component access, and share with code below and in Sema. - llvm::StringRef Comp = Accessor->getName(); + StringRef Comp = Accessor->getName(); // Halving swizzles do not contain duplicate elements. if (Comp == "hi" || Comp == "lo" || Comp == "even" || Comp == "odd") @@ -2587,7 +2587,7 @@ bool ExtVectorElementExpr::containsDuplicateElements() const { Comp = Comp.substr(1); for (unsigned i = 0, e = Comp.size(); i != e; ++i) - if (Comp.substr(i + 1).find(Comp[i]) != llvm::StringRef::npos) + if (Comp.substr(i + 1).find(Comp[i]) != StringRef::npos) return true; return false; @@ -2595,8 +2595,8 @@ bool ExtVectorElementExpr::containsDuplicateElements() const { /// getEncodedElementAccess - We encode the fields as a llvm ConstantArray. void ExtVectorElementExpr::getEncodedElementAccess( - llvm::SmallVectorImpl<unsigned> &Elts) const { - llvm::StringRef Comp = Accessor->getName(); + SmallVectorImpl<unsigned> &Elts) const { + StringRef Comp = Accessor->getName(); if (Comp[0] == 's' || Comp[0] == 'S') Comp = Comp.substr(1); @@ -2830,7 +2830,7 @@ ObjCInterfaceDecl *ObjCMessageExpr::getReceiverInterface() const { return 0; } -llvm::StringRef ObjCBridgedCastExpr::getBridgeKindName() const { +StringRef ObjCBridgedCastExpr::getBridgeKindName() const { switch (getBridgeKind()) { case OBC_Bridge: return "__bridge"; diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 786155af28..fdcff0a4da 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -812,7 +812,7 @@ APValue VectorExprEvaluator::VisitCastExpr(const CastExpr* E) { } // Splat and create vector APValue. - llvm::SmallVector<APValue, 4> Elts(NElts, Result); + SmallVector<APValue, 4> Elts(NElts, Result); return APValue(&Elts[0], Elts.size()); } case CK_BitCast: { @@ -829,7 +829,7 @@ APValue VectorExprEvaluator::VisitCastExpr(const CastExpr* E) { assert((EltTy->isIntegerType() || EltTy->isRealFloatingType()) && "Vectors must be composed of ints or floats"); - llvm::SmallVector<APValue, 4> Elts; + SmallVector<APValue, 4> Elts; for (unsigned i = 0; i != NElts; ++i) { APSInt Tmp = Init.extOrTrunc(EltWidth); @@ -862,7 +862,7 @@ VectorExprEvaluator::VisitInitListExpr(const InitListExpr *E) { unsigned NumElements = VT->getNumElements(); QualType EltTy = VT->getElementType(); - llvm::SmallVector<APValue, 4> Elements; + SmallVector<APValue, 4> Elements; // If a vector is initialized with a single element, that value // becomes every element of the vector, not just the first. @@ -926,7 +926,7 @@ VectorExprEvaluator::GetZeroVector(QualType T) { ZeroElement = APValue(APFloat::getZero(Info.Ctx.getFloatTypeSemantics(EltTy))); - llvm::SmallVector<APValue, 4> Elements(VT->getNumElements(), ZeroElement); + SmallVector<APValue, 4> Elements(VT->getNumElements(), ZeroElement); return APValue(&Elements[0], Elements.size()); } @@ -1300,9 +1300,9 @@ bool IntExprEvaluator::VisitCallExpr(const CallExpr *E) { = dyn_cast<StringLiteral>(E->getArg(0)->IgnoreParenImpCasts())) { // The string literal may have embedded null characters. Find the first // one and truncate there. - llvm::StringRef Str = S->getString(); - llvm::StringRef::size_type Pos = Str.find(0); - if (Pos != llvm::StringRef::npos) + StringRef Str = S->getString(); + StringRef::size_type Pos = Str.find(0); + if (Pos != StringRef::npos) Str = Str.substr(0, Pos); return Success(Str.size(), E); diff --git a/lib/AST/ExternalASTSource.cpp b/lib/AST/ExternalASTSource.cpp index b96d65a729..4d66bec5d1 100644 --- a/lib/AST/ExternalASTSource.cpp +++ b/lib/AST/ExternalASTSource.cpp @@ -54,7 +54,7 @@ void ExternalASTSource::MaterializeVisibleDecls(const DeclContext *DC) { } ExternalLoadResult ExternalASTSource::FindExternalLexicalDecls(const DeclContext *DC, bool (*isKindWeWant)(Decl::Kind), - llvm::SmallVectorImpl<Decl*> &Result) { + SmallVectorImpl<Decl*> &Result) { return ELR_AlreadyLoaded; } diff --git a/lib/AST/InheritViz.cpp b/lib/AST/InheritViz.cpp index c47a9dadba..b70520f44d 100644 --- a/lib/AST/InheritViz.cpp +++ b/lib/AST/InheritViz.cpp @@ -33,12 +33,12 @@ namespace clang { /// vs. non-virtual bases. class InheritanceHierarchyWriter { ASTContext& Context; - llvm::raw_ostream &Out; + raw_ostream &Out; std::map<QualType, int, QualTypeOrdering> DirectBaseCount; std::set<QualType, QualTypeOrdering> KnownVirtualBases; public: - InheritanceHierarchyWriter(ASTContext& Context, llvm::raw_ostream& Out) + InheritanceHierarchyWriter(ASTContext& Context, raw_ostream& Out) : Context(Context), Out(Out) { } void WriteGraph(QualType Type) { @@ -55,7 +55,7 @@ protected: /// WriteNodeReference - Write out a reference to the given node, /// using a unique identifier for each direct base and for the /// (only) virtual base. - llvm::raw_ostream& WriteNodeReference(QualType Type, bool FromVirtual); + raw_ostream& WriteNodeReference(QualType Type, bool FromVirtual); }; void InheritanceHierarchyWriter::WriteNode(QualType Type, bool FromVirtual) { @@ -120,7 +120,7 @@ void InheritanceHierarchyWriter::WriteNode(QualType Type, bool FromVirtual) { /// WriteNodeReference - Write out a reference to the given node, /// using a unique identifier for each direct base and for the /// (only) virtual base. -llvm::raw_ostream& +raw_ostream& InheritanceHierarchyWriter::WriteNodeReference(QualType Type, bool FromVirtual) { QualType CanonType = Context.getCanonicalType(Type); diff --git a/lib/AST/ItaniumMangle.cpp b/lib/AST/ItaniumMangle.cpp index ec9863b298..2bfd0a12be 100644 --- a/lib/AST/ItaniumMangle.cpp +++ b/lib/AST/ItaniumMangle.cpp @@ -92,30 +92,30 @@ public: /// @{ bool shouldMangleDeclName(const NamedDecl *D); - void mangleName(const NamedDecl *D, llvm::raw_ostream &); + void mangleName(const NamedDecl *D, raw_ostream &); void mangleThunk(const CXXMethodDecl *MD, const ThunkInfo &Thunk, - llvm::raw_ostream &); + raw_ostream &); void mangleCXXDtorThunk(const CXXDestructorDecl *DD, CXXDtorType Type, const ThisAdjustment &ThisAdjustment, - llvm::raw_ostream &); + raw_ostream &); void mangleReferenceTemporary(const VarDecl *D, - llvm::raw_ostream &); + raw_ostream &); void mangleCXXVTable(const CXXRecordDecl *RD, - llvm::raw_ostream &); + raw_ostream &); void mangleCXXVTT(const CXXRecordDecl *RD, - llvm::raw_ostream &); + raw_ostream &); void mangleCXXCtorVTable(const CXXRecordDecl *RD, int64_t Offset, const CXXRecordDecl *Type, - llvm::raw_ostream &); - void mangleCXXRTTI(QualType T, llvm::raw_ostream &); - void mangleCXXRTTIName(QualType T, llvm::raw_ostream &); + raw_ostream &); + void mangleCXXRTTI(QualType T, raw_ostream &); + void mangleCXXRTTIName(QualType T, raw_ostream &); void mangleCXXCtor(const CXXConstructorDecl *D, CXXCtorType Type, - llvm::raw_ostream &); + raw_ostream &); void mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type, - llvm::raw_ostream &); + raw_ostream &); - void mangleItaniumGuardVariable(const VarDecl *D, llvm::raw_ostream &); + void mangleItaniumGuardVariable(const VarDecl *D, raw_ostream &); void mangleInitDiscriminator() { Discriminator = 0; @@ -136,7 +136,7 @@ public: /// CXXNameMangler - Manage the mangling of a single name. class CXXNameMangler { ItaniumMangleContext &Context; - llvm::raw_ostream &Out; + raw_ostream &Out; /// The "structor" is the top-level declaration being mangled, if /// that's not a template specialization; otherwise it's the pattern @@ -191,7 +191,7 @@ class CXXNameMangler { ASTContext &getASTContext() const { return Context.getASTContext(); } public: - CXXNameMangler(ItaniumMangleContext &C, llvm::raw_ostream &Out_, + CXXNameMangler(ItaniumMangleContext &C, raw_ostream &Out_, const NamedDecl *D = 0) : Context(C), Out(Out_), Structor(getStructor(D)), StructorType(0), SeqID(0) { @@ -199,11 +199,11 @@ public: assert(!D || (!isa<CXXDestructorDecl>(D) && !isa<CXXConstructorDecl>(D))); } - CXXNameMangler(ItaniumMangleContext &C, llvm::raw_ostream &Out_, + CXXNameMangler(ItaniumMangleContext &C, raw_ostream &Out_, const CXXConstructorDecl *D, CXXCtorType Type) : Context(C), Out(Out_), Structor(getStructor(D)), StructorType(Type), SeqID(0) { } - CXXNameMangler(ItaniumMangleContext &C, llvm::raw_ostream &Out_, + CXXNameMangler(ItaniumMangleContext &C, raw_ostream &Out_, const CXXDestructorDecl *D, CXXDtorType Type) : Context(C), Out(Out_), Structor(getStructor(D)), StructorType(Type), SeqID(0) { } @@ -219,9 +219,9 @@ public: free(result); } #endif - llvm::raw_ostream &getStream() { return Out; } + raw_ostream &getStream() { return Out; } - void mangle(const NamedDecl *D, llvm::StringRef Prefix = "_Z"); + void mangle(const NamedDecl *D, StringRef Prefix = "_Z"); void mangleCallOffset(int64_t NonVirtual, int64_t Virtual); void mangleNumber(const llvm::APSInt &I); void mangleNumber(int64_t Number); @@ -385,7 +385,7 @@ bool ItaniumMangleContext::shouldMangleDeclName(const NamedDecl *D) { return true; } -void CXXNameMangler::mangle(const NamedDecl *D, llvm::StringRef Prefix) { +void CXXNameMangler::mangle(const NamedDecl *D, StringRef Prefix) { // Any decl can be declared with __asm("foo") on it, and this takes precedence // over all other naming in the .o file. if (const AsmLabelAttr *ALA = D->getAttr<AsmLabelAttr>()) { @@ -397,7 +397,7 @@ void CXXNameMangler::mangle(const NamedDecl *D, llvm::StringRef Prefix) { // llvm mangler on ELF is a nop, so we can just avoid adding the \01 // marker. We also avoid adding the marker if this is an alias for an // LLVM intrinsic. - llvm::StringRef UserLabelPrefix = + StringRef UserLabelPrefix = getASTContext().Target.getUserLabelPrefix(); if (!UserLabelPrefix.empty() && !ALA->getLabel().startswith("llvm.")) Out << '\01'; // LLVM IR Marker for __asm("foo") @@ -1538,7 +1538,7 @@ void CXXNameMangler::mangleQualifiers(Qualifiers Quals) { Out << 'U' << ASString.size() << ASString; } - llvm::StringRef LifetimeName; + StringRef LifetimeName; switch (Quals.getObjCLifetime()) { // Objective-C ARC Extension: // @@ -2526,7 +2526,7 @@ recurse: case Expr::ObjCBridgedCastExprClass: { // Mangle ownership casts as a vendor extended operator __bridge, // __bridge_transfer, or __bridge_retain. - llvm::StringRef Kind = cast<ObjCBridgedCastExpr>(E)->getBridgeKindName(); + StringRef Kind = cast<ObjCBridgedCastExpr>(E)->getBridgeKindName(); Out << "v1U" << Kind.size() << Kind; } // Fall through to mangle the cast itself. @@ -3021,7 +3021,7 @@ bool CXXNameMangler::mangleSubstitution(uintptr_t Ptr) { } Out << 'S' - << llvm::StringRef(BufferPtr, llvm::array_endof(Buffer)-BufferPtr) + << StringRef(BufferPtr, llvm::array_endof(Buffer)-BufferPtr) << '_'; } @@ -3196,7 +3196,7 @@ void CXXNameMangler::addSubstitution(uintptr_t Ptr) { /// emit the identifier of the declaration (\c D->getIdentifier()) as its /// name. void ItaniumMangleContext::mangleName(const NamedDecl *D, - llvm::raw_ostream &Out) { + raw_ostream &Out) { assert((isa<FunctionDecl>(D) || isa<VarDecl>(D)) && "Invalid mangleName() call, argument is not a variable or function!"); assert(!isa<CXXConstructorDecl>(D) && !isa<CXXDestructorDecl>(D) && @@ -3212,21 +3212,21 @@ void ItaniumMangleContext::mangleName(const NamedDecl *D, void ItaniumMangleContext::mangleCXXCtor(const CXXConstructorDecl *D, CXXCtorType Type, - llvm::raw_ostream &Out) { + raw_ostream &Out) { CXXNameMangler Mangler(*this, Out, D, Type); Mangler.mangle(D); } void ItaniumMangleContext::mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type, - llvm::raw_ostream &Out) { + raw_ostream &Out) { CXXNameMangler Mangler(*this, Out, D, Type); Mangler.mangle(D); } void ItaniumMangleContext::mangleThunk(const CXXMethodDecl *MD, const ThunkInfo &Thunk, - llvm::raw_ostream &Out) { + raw_ostream &Out) { // <special-name> ::= T <call-offset> <base encoding> // # base is the nominal target function of thunk // <special-name> ::= Tc <call-offset> <call-offset> <base encoding> @@ -3256,7 +3256,7 @@ void ItaniumMangleContext::mangleCXXDtorThunk(const CXXDestructorDecl *DD, CXXDtorType Type, const ThisAdjustment &ThisAdjustment, - llvm::raw_ostream &Out) { + raw_ostream &Out) { // <special-name> ::= T <call-offset> <base encoding> // # base is the nominal target function of thunk CXXNameMangler Mangler(*this, Out, DD, Type); @@ -3272,7 +3272,7 @@ ItaniumMangleContext::mangleCXXDtorThunk(const CXXDestructorDecl *DD, /// mangleGuardVariable - Returns the mangled name for a guard variable /// for the passed in VarDecl. void ItaniumMangleContext::mangleItaniumGuardVariable(const VarDecl *D, - llvm::raw_ostream &Out) { + raw_ostream &Out) { // <special-name> ::= GV <object name> # Guard variable for one-time // # initialization CXXNameMangler Mangler(*this, Out); @@ -3281,7 +3281,7 @@ void ItaniumMangleContext::mangleItaniumGuardVariable(const VarDecl *D, } void ItaniumMangleContext::mangleReferenceTemporary(const VarDecl *D, - llvm::raw_ostream &Out) { + raw_ostream &Out) { // We match the GCC mangling here. // <special-name> ::= GR <object name> CXXNameMangler Mangler(*this, Out); @@ -3290,7 +3290,7 @@ void ItaniumMangleContext::mangleReferenceTemporary(const VarDecl *D, } void ItaniumMangleContext::mangleCXXVTable(const CXXRecordDecl *RD, - llvm::raw_ostream &Out) { + raw_ostream &Out) { // <special-name> ::= TV <type> # virtual table CXXNameMangler Mangler(*this, Out); Mangler.getStream() << "_ZTV"; @@ -3298,7 +3298,7 @@ void ItaniumMangleContext::mangleCXXVTable(const CXXRecordDecl *RD, } void ItaniumMangleContext::mangleCXXVTT(const CXXRecordDecl *RD, - llvm::raw_ostream &Out) { + raw_ostream &Out) { // <special-name> ::= TT <type> # VTT structure CXXNameMangler Mangler(*this, Out); Mangler.getStream() << "_ZTT"; @@ -3308,7 +3308,7 @@ void ItaniumMangleContext::mangleCXXVTT(const CXXRecordDecl *RD, void ItaniumMangleContext::mangleCXXCtorVTable(const CXXRecordDecl *RD, int64_t Offset, const CXXRecordDecl *Type, - llvm::raw_ostream &Out) { + raw_ostream &Out) { // <special-name> ::= TC <type> <offset number> _ <base type> CXXNameMangler Mangler(*this, Out); Mangler.getStream() << "_ZTC"; @@ -3319,7 +3319,7 @@ void ItaniumMangleContext::mangleCXXCtorVTable(const CXXRecordDecl *RD, } void ItaniumMangleContext::mangleCXXRTTI(QualType Ty, - llvm::raw_ostream &Out) { + raw_ostream &Out) { // <special-name> ::= TI <type> # typeinfo structure assert(!Ty.hasQualifiers() && "RTTI info cannot have top-level qualifiers"); CXXNameMangler Mangler(*this, Out); @@ -3328,7 +3328,7 @@ void ItaniumMangleContext::mangleCXXRTTI(QualType Ty, } void ItaniumMangleContext::mangleCXXRTTIName(QualType Ty, - llvm::raw_ostream &Out) { + raw_ostream &Out) { // <special-name> ::= TS <type> # typeinfo name (null terminated byte string) CXXNameMangler Mangler(*this, Out); Mangler.getStream() << "_ZTS"; diff --git a/lib/AST/Mangle.cpp b/lib/AST/Mangle.cpp index c3f3b11cac..5cb8f47519 100644 --- a/lib/AST/Mangle.cpp +++ b/lib/AST/Mangle.cpp @@ -37,9 +37,9 @@ using namespace clang; namespace { static void mangleFunctionBlock(MangleContext &Context, - llvm::StringRef Outer, + StringRef Outer, const BlockDecl *BD, - llvm::raw_ostream &Out) { + raw_ostream &Out) { Out << "__" << Outer << "_block_invoke_" << Context.getBlockId(BD, true); } @@ -60,13 +60,13 @@ static void checkMangleDC(const DeclContext *DC, const BlockDecl *BD) { } void MangleContext::mangleGlobalBlock(const BlockDecl *BD, - llvm::raw_ostream &Out) { + raw_ostream &Out) { Out << "__block_global_" << getBlockId(BD, false); } void MangleContext::mangleCtorBlock(const CXXConstructorDecl *CD, CXXCtorType CT, const BlockDecl *BD, - llvm::raw_ostream &ResStream) { + raw_ostream &ResStream) { checkMangleDC(CD, BD); llvm::SmallString<64> Buffer; llvm::raw_svector_ostream Out(Buffer); @@ -77,7 +77,7 @@ void MangleContext::mangleCtorBlock(const CXXConstructorDecl *CD, void MangleContext::mangleDtorBlock(const CXXDestructorDecl *DD, CXXDtorType DT, const BlockDecl *BD, - llvm::raw_ostream &ResStream) { + raw_ostream &ResStream) { checkMangleDC(DD, BD); llvm::SmallString<64> Buffer; llvm::raw_svector_ostream Out(Buffer); @@ -87,7 +87,7 @@ void MangleContext::mangleDtorBlock(const CXXDestructorDecl *DD, } void MangleContext::mangleBlock(const DeclContext *DC, const BlockDecl *BD, - llvm::raw_ostream &Out) { + raw_ostream &Out) { assert(!isa<CXXConstructorDecl>(DC) && !isa<CXXDestructorDecl>(DC)); checkMangleDC(DC, BD); @@ -113,7 +113,7 @@ void MangleContext::mangleBlock(const DeclContext *DC, const BlockDecl *BD, } void MangleContext::mangleObjCMethodName(const ObjCMethodDecl *MD, - llvm::raw_ostream &Out) { + raw_ostream &Out) { llvm::SmallString<64> Name; llvm::raw_svector_ostream OS(Name); @@ -129,7 +129,7 @@ void MangleContext::mangleObjCMethodName(const ObjCMethodDecl *MD, } void MangleContext::mangleBlock(const BlockDecl *BD, - llvm::raw_ostream &Out) { + raw_ostream &Out) { const DeclContext *DC = BD->getDeclContext(); while (isa<BlockDecl>(DC) || isa<EnumDecl>(DC)) DC = DC->getParent(); diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp index 4f920f9aac..14a1d6662d 100644 --- a/lib/AST/MicrosoftMangle.cpp +++ b/lib/AST/MicrosoftMangle.cpp @@ -29,15 +29,15 @@ namespace { /// Microsoft Visual C++ ABI. class MicrosoftCXXNameMangler { MangleContext &Context; - llvm::raw_ostream &Out; + raw_ostream &Out; ASTContext &getASTContext() const { return Context.getASTContext(); } public: - MicrosoftCXXNameMangler(MangleContext &C, llvm::raw_ostream &Out_) + MicrosoftCXXNameMangler(MangleContext &C, raw_ostream &Out_) : Context(C), Out(Out_) { } - void mangle(const NamedDecl *D, llvm::StringRef Prefix = "?"); + void mangle(const NamedDecl *D, StringRef Prefix = "?"); void mangleName(const NamedDecl *ND); void mangleFunctionEncoding(const FunctionDecl *FD); void mangleVariableEncoding(const VarDecl *VD); @@ -80,28 +80,28 @@ public: MicrosoftMangleContext(ASTContext &Context, Diagnostic &Diags) : MangleContext(Context, Diags) { } virtual bool shouldMangleDeclName(const NamedDecl *D); - virtual void mangleName(const NamedDecl *D, llvm::raw_ostream &Out); + virtual void mangleName(const NamedDecl *D, raw_ostream &Out); virtual void mangleThunk(const CXXMethodDecl *MD, const ThunkInfo &Thunk, - llvm::raw_ostream &); + raw_ostream &); virtual void mangleCXXDtorThunk(const CXXDestructorDecl *DD, CXXDtorType Type, const ThisAdjustment &ThisAdjustment, - llvm::raw_ostream &); + raw_ostream &); virtual void mangleCXXVTable(const CXXRecordDecl *RD, - llvm::raw_ostream &); + raw_ostream &); virtual void mangleCXXVTT(const CXXRecordDecl *RD, - llvm::raw_ostream &); + raw_ostream &); virtual void mangleCXXCtorVTable(const CXXRecordDecl *RD, int64_t Offset, const CXXRecordDecl *Type, - llvm::raw_ostream &); - virtual void mangleCXXRTTI(QualType T, llvm::raw_ostream &); - virtual void mangleCXXRTTIName(QualType T, llvm::raw_ostream &); + raw_ostream &); + virtual void mangleCXXRTTI(QualType T, raw_ostream &); + virtual void mangleCXXRTTIName(QualType T, raw_ostream &); virtual void mangleCXXCtor(const CXXConstructorDecl *D, CXXCtorType Type, - llvm::raw_ostream &); + raw_ostream &); virtual void mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type, - llvm::raw_ostream &); + raw_ostream &); virtual void mangleReferenceTemporary(const clang::VarDecl *, - llvm::raw_ostream &); + raw_ostream &); }; } @@ -154,7 +154,7 @@ bool MicrosoftMangleContext::shouldMangleDeclName(const NamedDecl *D) { } void MicrosoftCXXNameMangler::mangle(const NamedDecl *D, - llvm::StringRef Prefix) { + StringRef Prefix) { // MSVC doesn't mangle C++ names the same way it mangles extern "C" names. // Therefore it's really important that we don't decorate the // name with leading underscores or leading/trailing at signs. So, emit a @@ -954,7 +954,7 @@ void MicrosoftCXXNameMangler::mangleType(const IncompleteArrayType *T) { mangleType(static_cast<const ArrayType *>(T), false); } void MicrosoftCXXNameMangler::mangleExtraDimensions(QualType ElementTy) { - llvm::SmallVector<llvm::APInt, 3> Dimensions; + SmallVector<llvm::APInt, 3> Dimensions; for (;;) { if (ElementTy->isConstantArrayType()) { const ConstantArrayType *CAT = @@ -1122,7 +1122,7 @@ void MicrosoftCXXNameMangler::mangleType(const AutoType *T) { } void MicrosoftMangleContext::mangleName(const NamedDecl *D, - llvm::raw_ostream &Out) { + raw_ostream &Out) { assert((isa<FunctionDecl>(D) || isa<VarDecl>(D)) && "Invalid mangleName() call, argument is not a variable or function!"); assert(!isa<CXXConstructorDecl>(D) && !isa<CXXDestructorDecl>(D) && @@ -1137,49 +1137,49 @@ void MicrosoftMangleContext::mangleName(const NamedDecl *D, } void MicrosoftMangleContext::mangleThunk(const CXXMethodDecl *MD, const ThunkInfo &Thunk, - llvm::raw_ostream &) { + raw_ostream &) { assert(false && "Can't yet mangle thunks!"); } void MicrosoftMangleContext::mangleCXXDtorThunk(const CXXDestructorDecl *DD, CXXDtorType Type, const ThisAdjustment &, - llvm::raw_ostream &) { + raw_ostream &) { assert(false && "Can't yet mangle destructor thunks!"); } void MicrosoftMangleContext::mangleCXXVTable(const CXXRecordDecl *RD, - llvm::raw_ostream &) { + raw_ostream &) { assert(false && "Can't yet mangle virtual tables!"); } void MicrosoftMangleContext::mangleCXXVTT(const CXXRecordDecl *RD, - llvm::raw_ostream &) { + raw_ostream &) { llvm_unreachable("The MS C++ ABI does not have virtual table tables!"); } void MicrosoftMangleContext::mangleCXXCtorVTable(const CXXRecordDecl *RD, int64_t Offset, const CXXRecordDecl *Type, - llvm::raw_ostream &) { + raw_ostream &) { llvm_unreachable("The MS C++ ABI does not have constructor vtables!"); } void MicrosoftMangleContext::mangleCXXRTTI(QualType T, - llvm::raw_ostream &) { + raw_ostream &) { assert(false && "Can't yet mangle RTTI!"); } void MicrosoftMangleContext::mangleCXXRTTIName(QualType T, - llvm::raw_ostream &) { + raw_ostream &) { assert(false && "Can't yet mangle RTTI names!"); } void MicrosoftMangleContext::mangleCXXCtor(const CXXConstructorDecl *D, CXXCtorType Type, - llvm::raw_ostream &) { + raw_ostream &) { assert(false && "Can't yet mangle constructors!"); } void MicrosoftMangleContext::mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type, - llvm::raw_ostream &) { + raw_ostream &) { assert(false && "Can't yet mangle destructors!"); } void MicrosoftMangleContext::mangleReferenceTemporary(const clang::VarDecl *, - llvm::raw_ostream &) { + raw_ostream &) { assert(false && "Can't yet mangle reference temporaries!"); } diff --git a/lib/AST/NestedNameSpecifier.cpp b/lib/AST/NestedNameSpecifier.cpp index f6d4f2513c..1ff2e7177b 100644 --- a/lib/AST/NestedNameSpecifier.cpp +++ b/lib/AST/NestedNameSpecifier.cpp @@ -218,7 +218,7 @@ bool NestedNameSpecifier::containsUnexpandedParameterPack() const { /// \brief Print this nested name specifier to the given output /// stream. void -NestedNameSpecifier::print(llvm::raw_ostream &OS, +NestedNameSpecifier::print(raw_ostream &OS, const PrintingPolicy &Policy) const { if (getPrefix()) getPrefix()->print(OS, Policy); @@ -569,7 +569,7 @@ void NestedNameSpecifierLocBuilder::MakeTrivial(ASTContext &Context, // Construct bogus (but well-formed) source information for the // nested-name-specifier. BufferSize = 0; - llvm::SmallVector<NestedNameSpecifier *, 4> Stack; + SmallVector<NestedNameSpecifier *, 4> Stack; for (NestedNameSpecifier *NNS = Qualifier; NNS; NNS = NNS->getPrefix()) Stack.push_back(NNS); while (!Stack.empty()) { diff --git a/lib/AST/RecordLayoutBuilder.cpp b/lib/AST/RecordLayoutBuilder.cpp index c064d124b4..bb5b33406f 100644 --- a/lib/AST/RecordLayoutBuilder.cpp +++ b/lib/AST/RecordLayoutBuilder.cpp @@ -44,7 +44,7 @@ struct BaseSubobjectInfo { bool IsVirtual; /// Bases - Information about the base subobjects. - llvm::SmallVector<BaseSubobjectInfo*, 4> Bases; + SmallVector<BaseSubobjectInfo*, 4> Bases; /// PrimaryVirtualBaseInfo - Holds the base info for the primary virtual base /// of this base info (if one exists). @@ -64,7 +64,7 @@ class EmptySubobjectMap { const CXXRecordDecl *Class; /// EmptyClassOffsets - A map from offsets to empty record decls. - typedef llvm::SmallVector<const CXXRecordDecl *, 1> ClassVectorTy; + typedef SmallVector<const CXXRecordDecl *, 1> ClassVectorTy; typedef llvm::DenseMap<CharUnits, ClassVectorTy> EmptyClassOffsetsMapTy; EmptyClassOffsetsMapTy EmptyClassOffsets; @@ -556,7 +556,7 @@ protected: /// \brief The alignment if attribute packed is not used. CharUnits UnpackedAlignment; - llvm::SmallVector<uint64_t, 16> FieldOffsets; + SmallVector<uint64_t, 16> FieldOffsets; /// Packed - Whether the record is packed or not. unsigned Packed : 1; @@ -1956,13 +1956,13 @@ ASTContext::getObjCLayout(const ObjCInterfaceDecl *D, return *NewEntry; } -static void PrintOffset(llvm::raw_ostream &OS, +static void PrintOffset(raw_ostream &OS, CharUnits Offset, unsigned IndentLevel) { OS << llvm::format("%4d | ", Offset.getQuantity()); OS.indent(IndentLevel * 2); } -static void DumpCXXRecordLayout(llvm::raw_ostream &OS, +static void DumpCXXRecordLayout(raw_ostream &OS, const CXXRecordDecl *RD, const ASTContext &C, CharUnits Offset, unsigned IndentLevel, @@ -2052,7 +2052,7 @@ static void DumpCXXRecordLayout(llvm::raw_ostream &OS, } void ASTContext::DumpRecordLayout(const RecordDecl *RD, - llvm::raw_ostream &OS) const { + raw_ostream &OS) const { const ASTRecordLayout &Info = getASTRecordLayout(RD); if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD)) diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp index fd6f21d43b..6e4d52bf47 100644 --- a/lib/AST/Stmt.cpp +++ b/lib/AST/Stmt.cpp @@ -214,7 +214,7 @@ Expr *AsmStmt::getOutputExpr(unsigned i) { /// getOutputConstraint - Return the constraint string for the specified /// output operand. All output constraints are known to be non-empty (either /// '=' or '+'). -llvm::StringRef AsmStmt::getOutputConstraint(unsigned i) const { +StringRef AsmStmt::getOutputConstraint(unsigned i) const { return getOutputConstraintLiteral(i)->getString(); } @@ -238,7 +238,7 @@ void AsmStmt::setInputExpr(unsigned i, Expr *E) { /// getInputConstraint - Return the specified input constraint. Unlike output /// constraints, these can be empty. -llvm::StringRef AsmStmt::getInputConstraint(unsigned i) const { +StringRef AsmStmt::getInputConstraint(unsigned i) const { return getInputConstraintLiteral(i)->getString(); } @@ -277,7 +277,7 @@ void AsmStmt::setOutputsAndInputsAndClobbers(ASTContext &C, /// getNamedOperand - Given a symbolic operand reference like %[foo], /// translate this into a numeric value needed to reference the same operand. /// This returns -1 if the operand name is invalid. -int AsmStmt::getNamedOperand(llvm::StringRef SymbolicName) const { +int AsmStmt::getNamedOperand(StringRef SymbolicName) const { unsigned NumPlusOperands = 0; // Check if this is an output operand. @@ -297,9 +297,9 @@ int AsmStmt::getNamedOperand(llvm::StringRef SymbolicName) const { /// AnalyzeAsmString - Analyze the asm string of the current asm, decomposing /// it into pieces. If the asm string is erroneous, emit errors and return /// true, otherwise return false. -unsigned AsmStmt::AnalyzeAsmString(llvm::SmallVectorImpl<AsmStringPiece>&Pieces, +unsigned AsmStmt::AnalyzeAsmString(SmallVectorImpl<AsmStringPiece>&Pieces, ASTContext &C, unsigned &DiagOffs) const { - llvm::StringRef Str = getAsmString()->getString(); + StringRef Str = getAsmString()->getString(); const char *StrStart = Str.begin(); const char *StrEnd = Str.end(); const char *CurPtr = StrStart; @@ -416,7 +416,7 @@ unsigned AsmStmt::AnalyzeAsmString(llvm::SmallVectorImpl<AsmStringPiece>&Pieces, if (NameEnd == CurPtr) return diag::err_asm_empty_symbolic_operand_name; - llvm::StringRef SymbolicName(CurPtr, NameEnd - CurPtr); + StringRef SymbolicName(CurPtr, NameEnd - CurPtr); int N = getNamedOperand(SymbolicName); if (N == -1) { diff --git a/lib/AST/StmtDumper.cpp b/lib/AST/StmtDumper.cpp index fb024f33ab..7218af570f 100644 --- a/lib/AST/StmtDumper.cpp +++ b/lib/AST/StmtDumper.cpp @@ -27,7 +27,7 @@ using namespace clang; namespace { class StmtDumper : public StmtVisitor<StmtDumper> { SourceManager *SM; - llvm::raw_ostream &OS; + raw_ostream &OS; unsigned IndentLevel; /// MaxDepth - When doing a normal dump (not dumpAll) we only want to dump @@ -41,7 +41,7 @@ namespace { unsigned LastLocLine; public: - StmtDumper(SourceManager *sm, llvm::raw_ostream &os, unsigned maxDepth) + StmtDumper(SourceManager *sm, raw_ostream &os, unsigned maxDepth) : SM(sm), OS(os), IndentLevel(0-1), MaxDepth(maxDepth) { LastLocFilename = ""; LastLocLine = ~0U; @@ -333,7 +333,7 @@ void StmtDumper::VisitExpr(Expr *Node) { DumpExpr(Node); } -static void DumpBasePath(llvm::raw_ostream &OS, CastExpr *Node) { +static void DumpBasePath(raw_ostream &OS, CastExpr *Node) { if (Node->path_empty()) return; @@ -674,7 +674,7 @@ void Stmt::dump(SourceManager &SM) const { dump(llvm::errs(), SM); } -void Stmt::dump(llvm::raw_ostream &OS, SourceManager &SM) const { +void Stmt::dump(raw_ostream &OS, SourceManager &SM) const { StmtDumper P(&SM, OS, 4); P.DumpSubTree(const_cast<Stmt*>(this)); OS << "\n"; diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp index f705a84c7c..8fcad14ec2 100644 --- a/lib/AST/StmtPrinter.cpp +++ b/lib/AST/StmtPrinter.cpp @@ -28,14 +28,14 @@ using namespace clang; namespace { class StmtPrinter : public StmtVisitor<StmtPrinter> { - llvm::raw_ostream &OS; + raw_ostream &OS; ASTContext &Context; unsigned IndentLevel; clang::PrinterHelper* Helper; PrintingPolicy Policy; public: - StmtPrinter(llvm::raw_ostream &os, ASTContext &C, PrinterHelper* helper, + StmtPrinter(raw_ostream &os, ASTContext &C, PrinterHelper* helper, const PrintingPolicy &Policy, unsigned Indentation = 0) : OS(os), Context(C), IndentLevel(Indentation), Helper(helper), @@ -76,7 +76,7 @@ namespace { OS << "<null expr>"; } - llvm::raw_ostream &Indent(int Delta = 0) { + raw_ostream &Indent(int Delta = 0) { for (int i = 0, e = IndentLevel+Delta; i < e; ++i) OS << " "; return OS; @@ -124,7 +124,7 @@ void StmtPrinter::PrintRawDecl(Decl *D) { void StmtPrinter::PrintRawDeclStmt(DeclStmt *S) { DeclStmt::decl_iterator Begin = S->decl_begin(), End = S->decl_end(); - llvm::SmallVector<Decl*, 2> Decls; + SmallVector<Decl*, 2> Decls; for ( ; Begin != End; ++Begin) Decls.push_back(*Begin); @@ -676,8 +676,8 @@ void StmtPrinter::VisitStringLiteral(StringLiteral *Str) { OS << '"'; // FIXME: this doesn't print wstrings right. - llvm::StringRef StrData = Str->getString(); - for (llvm::StringRef::iterator I = StrData.begin(), E = StrData.end(); + StringRef StrData = Str->getString(); + for (StringRef::iterator I = StrData.begin(), E = StrData.end(); I != E; ++I) { unsigned char Char = *I; @@ -1541,7 +1541,7 @@ void Stmt::dumpPretty(ASTContext& Context) const { PrintingPolicy(Context.getLangOptions())); } -void Stmt::printPretty(llvm::raw_ostream &OS, ASTContext& Context, +void Stmt::printPretty(raw_ostream &OS, ASTContext& Context, PrinterHelper* Helper, const PrintingPolicy &Policy, unsigned Indentation) const { diff --git a/lib/AST/TemplateBase.cpp b/lib/AST/TemplateBase.cpp index 56c6e7bc47..d565a47733 100644 --- a/lib/AST/TemplateBase.cpp +++ b/lib/AST/TemplateBase.cpp @@ -33,7 +33,7 @@ using namespace clang; /// /// \param Out the raw_ostream instance to use for printing. static void printIntegral(const TemplateArgument &TemplArg, - llvm::raw_ostream &Out) { + raw_ostream &Out) { const ::clang::Type *T = TemplArg.getIntegralType().getTypePtr(); const llvm::APSInt *Val = TemplArg.getAsIntegral(); @@ -309,7 +309,7 @@ TemplateArgument TemplateArgument::getPackExpansionPattern() const { } void TemplateArgument::print(const PrintingPolicy &Policy, - llvm::raw_ostream &Out) const { + raw_ostream &Out) const { switch (getKind()) { case Null: Out << "<no value>"; diff --git a/lib/AST/TemplateName.cpp b/lib/AST/TemplateName.cpp index 1f7b19aae4..7cfd1cdbe0 100644 --- a/lib/AST/TemplateName.cpp +++ b/lib/AST/TemplateName.cpp @@ -125,7 +125,7 @@ bool TemplateName::containsUnexpandedParameterPack() const { } void -TemplateName::print(llvm::raw_ostream &OS, const PrintingPolicy &Policy, +TemplateName::print(raw_ostream &OS, const PrintingPolicy &Policy, bool SuppressNNS) const { if (TemplateDecl *Template = Storage.dyn_cast<TemplateDecl *>()) OS << Template; diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index 08971eb034..7cd3be2fb4 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -1481,7 +1481,7 @@ QualType QualType::getNonLValueExprType(ASTContext &Context) const { return *this; } -llvm::StringRef FunctionType::getNameForCallConv(CallingConv CC) { +StringRef FunctionType::getNameForCallConv(CallingConv CC) { switch (CC) { case CC_Default: llvm_unreachable("no name for default cc"); diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index 2a13450b4d..be6ffee668 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -1333,7 +1333,7 @@ CFGBlock *CFGBuilder::VisitDeclStmt(DeclStmt *DS) { CFGBlock *B = 0; // FIXME: Add a reverse iterator for DeclStmt to avoid this extra copy. - typedef llvm::SmallVector<Decl*,10> BufTy; + typedef SmallVector<Decl*,10> BufTy; BufTy Buf(DS->decl_begin(), DS->decl_end()); for (BufTy::reverse_iterator I = Buf.rbegin(), E = Buf.rend(); I != E; ++I) { @@ -2776,7 +2776,7 @@ CFGBlock *CFGBuilder::VisitChildrenForTemporaryDtors(Stmt *E) { // When visiting children for destructors we want to visit them in reverse // order. Because there's no reverse iterator for children must to reverse // them in helper vector. - typedef llvm::SmallVector<Stmt *, 4> ChildrenVect; + typedef SmallVector<Stmt *, 4> ChildrenVect; ChildrenVect ChildrenRev; for (Stmt::child_range I = E->children(); I; ++I) { if (*I) ChildrenRev.push_back(*I); @@ -3225,7 +3225,7 @@ public: void setBlockID(signed i) { currentBlock = i; } void setStmtID(unsigned i) { currentStmt = i; } - virtual bool handledStmt(Stmt* S, llvm::raw_ostream& OS) { + virtual bool handledStmt(Stmt* S, raw_ostream& OS) { StmtMapTy::iterator I = StmtMap.find(S); if (I == StmtMap.end()) @@ -3240,7 +3240,7 @@ public: return true; } - bool handleDecl(const Decl* D, llvm::raw_ostream& OS) { + bool handleDecl(const Decl* D, raw_ostream& OS) { DeclMapTy::iterator I = DeclMap.find(D); if (I == DeclMap.end()) @@ -3262,11 +3262,11 @@ namespace { class CFGBlockTerminatorPrint : public StmtVisitor<CFGBlockTerminatorPrint,void> { - llvm::raw_ostream& OS; + raw_ostream& OS; StmtPrinterHelper* Helper; PrintingPolicy Policy; public: - CFGBlockTerminatorPrint(llvm::raw_ostream& os, StmtPrinterHelper* helper, + CFGBlockTerminatorPrint(raw_ostream& os, StmtPrinterHelper* helper, const PrintingPolicy &Policy) : OS(os), Helper(helper), Policy(Policy) {} @@ -3356,7 +3356,7 @@ public: }; } // end anonymous namespace -static void print_elem(llvm::raw_ostream &OS, StmtPrinterHelper* Helper, +static void print_elem(raw_ostream &OS, StmtPrinterHelper* Helper, const CFGElement &E) { if (const CFGStmt *CS = E.getAs<CFGStmt>()) { Stmt *S = CS->getStmt(); @@ -3447,7 +3447,7 @@ static void print_elem(llvm::raw_ostream &OS, StmtPrinterHelper* Helper, } } -static void print_block(llvm::raw_ostream& OS, const CFG* cfg, +static void print_block(raw_ostream& OS, const CFG* cfg, const CFGBlock& B, StmtPrinterHelper* Helper, bool print_edges) { @@ -3573,7 +3573,7 @@ static void print_block(llvm::raw_ostream& OS, const CFG* cfg, void CFG::dump(const LangOptions &LO) const { print(llvm::errs(), LO); } /// print - A simple pretty printer of a CFG that outputs to an ostream. -void CFG::print(llvm::raw_ostream &OS, const LangOptions &LO) const { +void CFG::print(raw_ostream &OS, const LangOptions &LO) const { StmtPrinterHelper Helper(this, LO); // Print the entry block. @@ -3600,14 +3600,14 @@ void CFGBlock::dump(const CFG* cfg, const LangOptions &LO) const { /// print - A simple pretty printer of a CFGBlock that outputs to an ostream. /// Generally this will only be called from CFG::print. -void CFGBlock::print(llvm::raw_ostream& OS, const CFG* cfg, +void CFGBlock::print(raw_ostream& OS, const CFG* cfg, const LangOptions &LO) const { StmtPrinterHelper Helper(cfg, LO); print_block(OS, cfg, *this, &Helper, true); } /// printTerminator - A simple pretty printer of the terminator of a CFGBlock. -void CFGBlock::printTerminator(llvm::raw_ostream &OS, +void CFGBlock::printTerminator(raw_ostream &OS, const LangOptions &LO) const { CFGBlockTerminatorPrint TPrinter(OS, NULL, PrintingPolicy(LO)); TPrinter.Visit(const_cast<Stmt*>(getTerminator().getStmt())); diff --git a/lib/Analysis/CFGReachabilityAnalysis.cpp b/lib/Analysis/CFGReachabilityAnalysis.cpp index 65cd089857..e77e72fa9f 100644 --- a/lib/Analysis/CFGReachabilityAnalysis.cpp +++ b/lib/Analysis/CFGReachabilityAnalysis.cpp @@ -40,7 +40,7 @@ bool CFGReverseBlockReachabilityAnalysis::isReachable(const CFGBlock *Src, // Maps reachability to a common node by walking the predecessors of the // destination node. void CFGReverseBlockReachabilityAnalysis::mapReachability(const CFGBlock *Dst) { - llvm::SmallVector<const CFGBlock *, 11> worklist; + SmallVector<const CFGBlock *, 11> worklist; llvm::BitVector visited(analyzed.size()); ReachableSet &DstReachability = reachable[Dst->getBlockID()]; diff --git a/lib/Analysis/CocoaConventions.cpp b/lib/Analysis/CocoaConventions.cpp index 90f7092f90..176701a3ef 100644 --- a/lib/Analysis/CocoaConventions.cpp +++ b/lib/Analysis/CocoaConventions.cpp @@ -17,12 +17,9 @@ #include "clang/AST/DeclObjC.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/ErrorHandling.h" - using namespace clang; using namespace ento; -using llvm::StringRef; - // The "fundamental rule" for naming conventions of methods: // (url broken into two lines) // http://developer.apple.com/documentation/Cocoa/Conceptual/ @@ -63,11 +60,11 @@ cocoa::NamingConvention cocoa::deriveNamingConvention(Selector S, return NoConvention; } -bool cocoa::isRefType(QualType RetTy, llvm::StringRef Prefix, - llvm::StringRef Name) { +bool cocoa::isRefType(QualType RetTy, StringRef Prefix, + StringRef Name) { // Recursively walk the typedef stack, allowing typedefs of reference types. while (const TypedefType *TD = dyn_cast<TypedefType>(RetTy.getTypePtr())) { - llvm::StringRef TDName = TD->getDecl()->getIdentifier()->getName(); + StringRef TDName = TD->getDecl()->getIdentifier()->getName(); if (TDName.startswith(Prefix) && TDName.endswith("Ref")) return true; @@ -127,10 +124,10 @@ bool cocoa::isCocoaObjectRef(QualType Ty) { return false; } -bool coreFoundation::followsCreateRule(llvm::StringRef functionName) { - llvm::StringRef::iterator it = functionName.begin(); - llvm::StringRef::iterator start = it; - llvm::StringRef::iterator endI = functionName.end(); +bool coreFoundation::followsCreateRule(StringRef functionName) { + StringRef::iterator it = functionName.begin(); + StringRef::iterator start = it; + StringRef::iterator endI = functionName.end(); while (true) { // Scan for the start of 'create' or 'copy'. @@ -149,7 +146,7 @@ bool coreFoundation::followsCreateRule(llvm::StringRef functionName) { // Scan for *lowercase* 'reate' or 'opy', followed by no lowercase // character. - llvm::StringRef suffix = functionName.substr(it - start); + StringRef suffix = functionName.substr(it - start); if (suffix.startswith("reate")) { it += 5; } diff --git a/lib/Analysis/FormatString.cpp b/lib/Analysis/FormatString.cpp index 5f3cd4c615..3550a5415c 100644 --- a/lib/Analysis/FormatString.cpp +++ b/lib/Analysis/FormatString.cpp @@ -379,7 +379,7 @@ analyze_format_string::LengthModifier::toString() const { // Methods on OptionalAmount. //===----------------------------------------------------------------------===// -void OptionalAmount::toString(llvm::raw_ostream &os) const { +void OptionalAmount::toString(raw_ostream &os) const { switch (hs) { case Invalid: case NotSpecified: diff --git a/lib/Analysis/LiveVariables.cpp b/lib/Analysis/LiveVariables.cpp index 7b36f85ab6..b7ae141781 100644 --- a/lib/Analysis/LiveVariables.cpp +++ b/lib/Analysis/LiveVariables.cpp @@ -43,7 +43,7 @@ class RegisterDecls LiveVariables::AnalysisDataTy& AD; - typedef llvm::SmallVector<VarDecl*, 20> AlwaysLiveTy; + typedef SmallVector<VarDecl*, 20> AlwaysLiveTy; AlwaysLiveTy AlwaysLive; diff --git a/lib/Analysis/PrintfFormatString.cpp b/lib/Analysis/PrintfFormatString.cpp index 00b0b279e4..8b23a071d9 100644 --- a/lib/Analysis/PrintfFormatString.cpp +++ b/lib/Analysis/PrintfFormatString.cpp @@ -469,7 +469,7 @@ bool PrintfSpecifier::fixType(QualType QT) { return true; } -void PrintfSpecifier::toString(llvm::raw_ostream &os) const { +void PrintfSpecifier::toString(raw_ostream &os) const { // Whilst some features have no defined order, we are using the order // appearing in the C99 standard (ISO/IEC 9899:1999 (E) 7.19.6.1) os << "%"; diff --git a/lib/Analysis/ReachableCode.cpp b/lib/Analysis/ReachableCode.cpp index c5b17fc77b..12dfac56fd 100644 --- a/lib/Analysis/ReachableCode.cpp +++ b/lib/Analysis/ReachableCode.cpp @@ -125,7 +125,7 @@ static SourceLocation MarkLiveTop(const CFGBlock *Start, SourceManager &SM) { // Prep work worklist. - llvm::SmallVector<const CFGBlock*, 32> WL; + SmallVector<const CFGBlock*, 32> WL; WL.push_back(Start); SourceRange R1, R2; @@ -197,7 +197,7 @@ namespace clang { namespace reachable_code { unsigned ScanReachableFromBlock(const CFGBlock &Start, llvm::BitVector &Reachable) { unsigned count = 0; - llvm::SmallVector<const CFGBlock*, 32> WL; + SmallVector<const CFGBlock*, 32> WL; // Prep work queue Reachable.set(Start.getBlockID()); @@ -242,7 +242,7 @@ void FindUnreachableCode(AnalysisContext &AC, Callback &CB) { SourceRange R1, R2; - llvm::SmallVector<ErrLoc, 24> lines; + SmallVector<ErrLoc, 24> lines; bool AddEHEdges = AC.getAddEHEdges(); // First, give warnings for blocks with no predecessors, as they @@ -287,7 +287,7 @@ void FindUnreachableCode(AnalysisContext &AC, Callback &CB) { llvm::array_pod_sort(lines.begin(), lines.end(), LineCmp); - for (llvm::SmallVectorImpl<ErrLoc>::iterator I=lines.begin(), E=lines.end(); + for (SmallVectorImpl<ErrLoc>::iterator I=lines.begin(), E=lines.end(); I != E; ++I) if (I->Loc.isValid()) CB.HandleUnreachable(I->Loc, I->R1, I->R2); diff --git a/lib/Analysis/UninitializedValues.cpp b/lib/Analysis/UninitializedValues.cpp index 4301ca1293..7df2dc27b8 100644 --- a/lib/Analysis/UninitializedValues.cpp +++ b/lib/Analysis/UninitializedValues.cpp @@ -178,7 +178,7 @@ static BinaryOperator *getLogicalOperatorInChain(const CFGBlock *block) { if (!cstmt) return 0; - BinaryOperator *b = llvm::dyn_cast_or_null<BinaryOperator>(cstmt->getStmt()); + BinaryOperator *b = dyn_cast_or_null<BinaryOperator>(cstmt->getStmt()); if (!b || !b->isLogicalOp()) return 0; @@ -283,7 +283,7 @@ ValueVector::reference CFGBlockValues::operator[](const VarDecl *vd) { namespace { class DataflowWorklist { - llvm::SmallVector<const CFGBlock *, 20> worklist; + SmallVector<const CFGBlock *, 20> worklist; llvm::BitVector enqueuedBlocks; public: DataflowWorklist(const CFG &cfg) : enqueuedBlocks(cfg.getNumBlockIDs()) {} diff --git a/lib/Basic/Builtins.cpp b/lib/Basic/Builtins.cpp index 7df24a03b0..57b771ab5b 100644 --- a/lib/Basic/Builtins.cpp +++ b/lib/Basic/Builtins.cpp @@ -59,7 +59,7 @@ void Builtin::Context::InitializeBuiltins(IdentifierTable &Table, } void -Builtin::Context::GetBuiltinNames(llvm::SmallVectorImpl<const char *> &Names, +Builtin::Context::GetBuiltinNames(SmallVectorImpl<const char *> &Names, bool NoBuiltins) { // Final all target-independent names for (unsigned i = Builtin::NotBuiltin+1; i != Builtin::FirstTSBuiltin; ++i) diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp index c12651a3f9..48dad6f2e0 100644 --- a/lib/Basic/Diagnostic.cpp +++ b/lib/Basic/Diagnostic.cpp @@ -25,9 +25,9 @@ static void DummyArgToStringFn(Diagnostic::ArgumentKind AK, intptr_t QT, const char *Argument, unsigned ArgLen, const Diagnostic::ArgumentValue *PrevArgs, unsigned NumPrevArgs, - llvm::SmallVectorImpl<char> &Output, + SmallVectorImpl<char> &Output, void *Cookie, - llvm::SmallVectorImpl<intptr_t> &QualTypeVals) { + SmallVectorImpl<intptr_t> &QualTypeVals) { const char *Str = "<can't format argument>"; Output.append(Str, Str+strlen(Str)); } @@ -112,8 +112,8 @@ void Diagnostic::Reset() { PushDiagStatePoint(&DiagStates.back(), SourceLocation()); } -void Diagnostic::SetDelayedDiagnostic(unsigned DiagID, llvm::StringRef Arg1, - llvm::StringRef Arg2) { +void Diagnostic::SetDelayedDiagnostic(unsigned DiagID, StringRef Arg1, + StringRef Arg2) { if (DelayedDiagID) return; @@ -339,7 +339,7 @@ static const char *ScanFormat(const char *I, const char *E, char Target) { /// This is very useful for certain classes of variant diagnostics. static void HandleSelectModifier(const DiagnosticInfo &DInfo, unsigned ValNo, const char *Argument, unsigned ArgumentLen, - llvm::SmallVectorImpl<char> &OutStr) { + SmallVectorImpl<char> &OutStr) { const char *ArgumentEnd = Argument+ArgumentLen; // Skip over 'ValNo' |'s. @@ -362,7 +362,7 @@ static void HandleSelectModifier(const DiagnosticInfo &DInfo, unsigned ValNo, /// letter 's' to the string if the value is not 1. This is used in cases like /// this: "you idiot, you have %4 parameter%s4!". static void HandleIntegerSModifier(unsigned ValNo, - llvm::SmallVectorImpl<char> &OutStr) { + SmallVectorImpl<char> &OutStr) { if (ValNo != 1) OutStr.push_back('s'); } @@ -372,7 +372,7 @@ static void HandleIntegerSModifier(unsigned ValNo, /// to the first ordinal. Currently this is hard-coded to use the /// English form. static void HandleOrdinalModifier(unsigned ValNo, - llvm::SmallVectorImpl<char> &OutStr) { + SmallVectorImpl<char> &OutStr) { assert(ValNo != 0 && "ValNo must be strictly positive!"); llvm::raw_svector_ostream Out(OutStr); @@ -497,7 +497,7 @@ static bool EvalPluralExpr(unsigned ValNo, const char *Start, const char *End) { /// {1:form0|%100=[10,20]:form2|%10=[2,4]:form1|:form2} static void HandlePluralModifier(const DiagnosticInfo &DInfo, unsigned ValNo, const char *Argument, unsigned ArgumentLen, - llvm::SmallVectorImpl<char> &OutStr) { + SmallVectorImpl<char> &OutStr) { const char *ArgumentEnd = Argument + ArgumentLen; while (1) { assert(Argument < ArgumentEnd && "Plural expression didn't match."); @@ -524,13 +524,13 @@ static void HandlePluralModifier(const DiagnosticInfo &DInfo, unsigned ValNo, /// formal arguments into the %0 slots. The result is appended onto the Str /// array. void DiagnosticInfo:: -FormatDiagnostic(llvm::SmallVectorImpl<char> &OutStr) const { +FormatDiagnostic(SmallVectorImpl<char> &OutStr) const { if (!StoredDiagMessage.empty()) { OutStr.append(StoredDiagMessage.begin(), StoredDiagMessage.end()); return; } - llvm::StringRef Diag = + StringRef Diag = getDiags()->getDiagnosticIDs()->getDescription(getID()); FormatDiagnostic(Diag.begin(), Diag.end(), OutStr); @@ -538,17 +538,17 @@ FormatDiagnostic(llvm::SmallVectorImpl<char> &OutStr) const { void DiagnosticInfo:: FormatDiagnostic(const char *DiagStr, const char *DiagEnd, - llvm::SmallVectorImpl<char> &OutStr) const { + SmallVectorImpl<char> &OutStr) const { /// FormattedArgs - Keep track of all of the arguments formatted by /// ConvertArgToString and pass them into subsequent calls to /// ConvertArgToString, allowing the implementation to avoid redundancies in /// obvious cases. - llvm::SmallVector<Diagnostic::ArgumentValue, 8> FormattedArgs; + SmallVector<Diagnostic::ArgumentValue, 8> FormattedArgs; /// QualTypeVals - Pass a vector of arrays so that QualType names can be /// compared to see if more information is needed to be printed. - llvm::SmallVector<intptr_t, 2> QualTypeVals; + SmallVector<intptr_t, 2> QualTypeVals; for (unsigned i = 0, e = getNumArgs(); i < e; ++i) if (getArgKind(i) == Diagnostic::ak_qualtype) QualTypeVals.push_back(getRawArg(i)); @@ -702,7 +702,7 @@ FormatDiagnostic(const char *DiagStr, const char *DiagEnd, StoredDiagnostic::StoredDiagnostic() { } StoredDiagnostic::StoredDiagnostic(Diagnostic::Level Level, unsigned ID, - llvm::StringRef Message) + StringRef Message) : ID(ID), Level(Level), Loc(), Message(Message) { } StoredDiagnostic::StoredDiagnostic(Diagnostic::Level Level, @@ -727,7 +727,7 @@ StoredDiagnostic::StoredDiagnostic(Diagnostic::Level Level, } StoredDiagnostic::StoredDiagnostic(Diagnostic::Level Level, unsigned ID, - llvm::StringRef Message, FullSourceLoc Loc, + StringRef Message, FullSourceLoc Loc, llvm::ArrayRef<CharSourceRange> Ranges, llvm::ArrayRef<FixItHint> Fixits) : ID(ID), Level(Level), Loc(Loc), Message(Message) diff --git a/lib/Basic/DiagnosticIDs.cpp b/lib/Basic/DiagnosticIDs.cpp index 147ba7e99e..19f627e804 100644 --- a/lib/Basic/DiagnosticIDs.cpp +++ b/lib/Basic/DiagnosticIDs.cpp @@ -61,21 +61,21 @@ struct StaticDiagInfoRec { const char *BriefExplanationStr; const char *FullExplanationStr; - llvm::StringRef getName() const { - return llvm::StringRef(NameStr, NameLen); + StringRef getName() const { + return StringRef(NameStr, NameLen); } - llvm::StringRef getOptionGroup() const { - return llvm::StringRef(OptionGroupStr, OptionGroupLen); + StringRef getOptionGroup() const { + return StringRef(OptionGroupStr, OptionGroupLen); } - llvm::StringRef getDescription() const { - return llvm::StringRef(DescriptionStr, DescriptionLen); + StringRef getDescription() const { + return StringRef(DescriptionStr, DescriptionLen); } - llvm::StringRef getBriefExplanation() const { - return llvm::StringRef(BriefExplanationStr, BriefExplanationLen); + StringRef getBriefExplanation() const { + return StringRef(BriefExplanationStr, BriefExplanationLen); } - llvm::StringRef getFullExplanation() const { - return llvm::StringRef(FullExplanationStr, FullExplanationLen); + StringRef getFullExplanation() const { + return StringRef(FullExplanationStr, FullExplanationLen); } bool operator<(const StaticDiagInfoRec &RHS) const { @@ -88,8 +88,8 @@ struct StaticDiagNameIndexRec { unsigned short DiagID; uint8_t NameLen; - llvm::StringRef getName() const { - return llvm::StringRef(NameStr, NameLen); + StringRef getName() const { + return StringRef(NameStr, NameLen); } bool operator<(const StaticDiagNameIndexRec &RHS) const { @@ -186,10 +186,10 @@ static unsigned GetDefaultDiagMapping(unsigned DiagID) { /// getWarningOptionForDiag - Return the lowest-level warning option that /// enables the specified diagnostic. If there is no -Wfoo flag that controls /// the diagnostic, this returns null. -llvm::StringRef DiagnosticIDs::getWarningOptionForDiag(unsigned DiagID) { +StringRef DiagnosticIDs::getWarningOptionForDiag(unsigned DiagID) { if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID)) return Info->getOptionGroup(); - return llvm::StringRef(); + return StringRef(); } /// getCategoryNumberForDiag - Return the category number that a specified @@ -206,8 +206,8 @@ namespace { const char *NameStr; uint8_t NameLen; - llvm::StringRef getName() const { - return llvm::StringRef(NameStr, NameLen); + StringRef getName() const { + return StringRef(NameStr, NameLen); } }; } @@ -228,9 +228,9 @@ unsigned DiagnosticIDs::getNumberOfCategories() { /// getCategoryNameFromID - Given a category ID, return the name of the /// category, an empty string if CategoryID is zero, or null if CategoryID is /// invalid. -llvm::StringRef DiagnosticIDs::getCategoryNameFromID(unsigned CategoryID) { +StringRef DiagnosticIDs::getCategoryNameFromID(unsigned CategoryID) { if (CategoryID >= getNumberOfCategories()) - return llvm::StringRef(); + return StringRef(); return CategoryNameTable[CategoryID].getName(); } @@ -256,14 +256,14 @@ DiagnosticIDs::getDiagnosticSFINAEResponse(unsigned DiagID) { } /// getName - Given a diagnostic ID, return its name -llvm::StringRef DiagnosticIDs::getName(unsigned DiagID) { +StringRef DiagnosticIDs::getName(unsigned DiagID) { if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID)) return Info->getName(); - return llvm::StringRef(); + return StringRef(); } /// getIdFromName - Given a diagnostic name, return its ID, or 0 -unsigned DiagnosticIDs::getIdFromName(llvm::StringRef Name) { +unsigned DiagnosticIDs::getIdFromName(StringRef Name) { const StaticDiagNameIndexRec *StaticDiagNameIndexEnd = StaticDiagNameIndex + StaticDiagNameIndexSize; @@ -282,18 +282,18 @@ unsigned DiagnosticIDs::getIdFromName(llvm::StringRef Name) { /// getBriefExplanation - Given a diagnostic ID, return a brief explanation /// of the issue -llvm::StringRef DiagnosticIDs::getBriefExplanation(unsigned DiagID) { +StringRef DiagnosticIDs::getBriefExplanation(unsigned DiagID) { if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID)) return Info->getBriefExplanation(); - return llvm::StringRef(); + return StringRef(); } /// getFullExplanation - Given a diagnostic ID, return a full explanation /// of the issue -llvm::StringRef DiagnosticIDs::getFullExplanation(unsigned DiagID) { +StringRef DiagnosticIDs::getFullExplanation(unsigned DiagID) { if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID)) return Info->getFullExplanation(); - return llvm::StringRef(); + return StringRef(); } /// getBuiltinDiagClass - Return the class field of the diagnostic. @@ -318,7 +318,7 @@ namespace clang { /// getDescription - Return the description of the specified custom /// diagnostic. - llvm::StringRef getDescription(unsigned DiagID) const { + StringRef getDescription(unsigned DiagID) const { assert(this && DiagID-DIAG_UPPER_LIMIT < DiagInfo.size() && "Invalid diagnosic ID"); return DiagInfo[DiagID-DIAG_UPPER_LIMIT].second; @@ -331,7 +331,7 @@ namespace clang { return DiagInfo[DiagID-DIAG_UPPER_LIMIT].first; } - unsigned getOrCreateDiagID(DiagnosticIDs::Level L, llvm::StringRef Message, + unsigned getOrCreateDiagID(DiagnosticIDs::Level L, StringRef Message, DiagnosticIDs &Diags) { DiagDesc D(L, Message); // Check to see if it already exists. @@ -366,7 +366,7 @@ DiagnosticIDs::~DiagnosticIDs() { /// getCustomDiagID - Return an ID for a diagnostic with the specified message /// and level. If this is the first request for this diagnosic, it is /// registered and created, otherwise the existing ID is returned. -unsigned DiagnosticIDs::getCustomDiagID(Level L, llvm::StringRef Message) { +unsigned DiagnosticIDs::getCustomDiagID(Level L, StringRef Message) { if (CustomDiagInfo == 0) CustomDiagInfo = new diag::CustomDiagInfo(); return CustomDiagInfo->getOrCreateDiagID(L, Message, *this); @@ -406,7 +406,7 @@ bool DiagnosticIDs::isBuiltinExtensionDiag(unsigned DiagID, /// getDescription - Given a diagnostic ID, return a description of the /// issue. -llvm::StringRef DiagnosticIDs::getDescription(unsigned DiagID) const { +StringRef DiagnosticIDs::getDescription(unsigned DiagID) const { if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID)) return Info->getDescription(); return CustomDiagInfo->getDescription(DiagID); @@ -556,8 +556,8 @@ namespace { const short *Members; const short *SubGroups; - llvm::StringRef getName() const { - return llvm::StringRef(NameStr, NameLen); + StringRef getName() const { + return StringRef(NameStr, NameLen); } }; } @@ -598,7 +598,7 @@ static void MapGroupMembers(const WarningOption *Group, diag::Mapping Mapping, /// setDiagnosticGroupMapping - Change an entire diagnostic group (e.g. /// "unknown-pragmas" to have the specified mapping. This returns true and /// ignores the request if "Group" was unknown, false otherwise. -bool DiagnosticIDs::setDiagnosticGroupMapping(llvm::StringRef Group, +bool DiagnosticIDs::setDiagnosticGroupMapping(StringRef Group, diag::Mapping Map, SourceLocation Loc, Diagnostic &Diag) const { diff --git a/lib/Basic/FileManager.cpp b/lib/Basic/FileManager.cpp index f747c534c0..4ac8e4da1d 100644 --- a/lib/Basic/FileManager.cpp +++ b/lib/Basic/FileManager.cpp @@ -217,14 +217,14 @@ void FileManager::removeStatCache(FileSystemStatCache *statCache) { /// \brief Retrieve the directory that the given file name resides in. /// Filename can point to either a real file or a virtual file. static const DirectoryEntry *getDirectoryFromFile(FileManager &FileMgr, - llvm::StringRef Filename) { + StringRef Filename) { if (Filename.empty()) return NULL; if (llvm::sys::path::is_separator(Filename[Filename.size() - 1])) return NULL; // If Filename is a directory. - llvm::StringRef DirName = llvm::sys::path::parent_path(Filename); + StringRef DirName = llvm::sys::path::parent_path(Filename); // Use the current directory if file has no path component. if (DirName.empty()) DirName = "."; @@ -234,8 +234,8 @@ static const DirectoryEntry *getDirectoryFromFile(FileManager &FileMgr, /// Add all ancestors of the given path (pointing to either a file or /// a directory) as virtual directories. -void FileManager::addAncestorsAsVirtualDirs(llvm::StringRef Path) { - llvm::StringRef DirName = llvm::sys::path::parent_path(Path); +void FileManager::addAncestorsAsVirtualDirs(StringRef Path) { + StringRef DirName = llvm::sys::path::parent_path(Path); if (DirName.empty()) return; @@ -263,7 +263,7 @@ void FileManager::addAncestorsAsVirtualDirs(llvm::StringRef Path) { /// (real or virtual). This returns NULL if the directory doesn't /// exist. /// -const DirectoryEntry *FileManager::getDirectory(llvm::StringRef DirName) { +const DirectoryEntry *FileManager::getDirectory(StringRef DirName) { ++NumDirLookups; llvm::StringMapEntry<DirectoryEntry *> &NamedDirEnt = SeenDirEntries.GetOrCreateValue(DirName); @@ -309,7 +309,7 @@ const DirectoryEntry *FileManager::getDirectory(llvm::StringRef DirName) { /// getFile - Lookup, cache, and verify the specified file (real or /// virtual). This returns NULL if the file doesn't exist. /// -const FileEntry *FileManager::getFile(llvm::StringRef Filename, bool openFile) { +const FileEntry *FileManager::getFile(StringRef Filename, bool openFile) { ++NumFileLookups; // See if there is already an entry in the map. @@ -381,7 +381,7 @@ const FileEntry *FileManager::getFile(llvm::StringRef Filename, bool openFile) { } const FileEntry * -FileManager::getVirtualFile(llvm::StringRef Filename, off_t Size, +FileManager::getVirtualFile(StringRef Filename, off_t Size, time_t ModificationTime) { ++NumFileLookups; @@ -451,8 +451,8 @@ FileManager::getVirtualFile(llvm::StringRef Filename, off_t Size, return UFE; } -void FileManager::FixupRelativePath(llvm::SmallVectorImpl<char> &path) const { - llvm::StringRef pathRef(path.data(), path.size()); +void FileManager::FixupRelativePath(SmallVectorImpl<char> &path) const { + StringRef pathRef(path.data(), path.size()); if (FileSystemOpts.WorkingDir.empty() || llvm::sys::path::is_absolute(pathRef)) @@ -499,7 +499,7 @@ getBufferForFile(const FileEntry *Entry, std::string *ErrorStr) { } llvm::MemoryBuffer *FileManager:: -getBufferForFile(llvm::StringRef Filename, std::string *ErrorStr) { +getBufferForFile(StringRef Filename, std::string *ErrorStr) { llvm::OwningPtr<llvm::MemoryBuffer> Result; llvm::error_code ec; if (FileSystemOpts.WorkingDir.empty()) { @@ -537,7 +537,7 @@ bool FileManager::getStatValue(const char *Path, struct stat &StatBuf, StatCache.get()); } -bool FileManager::getNoncachedStatValue(llvm::StringRef Path, +bool FileManager::getNoncachedStatValue(StringRef Path, struct stat &StatBuf) { llvm::SmallString<128> FilePath(Path); FixupRelativePath(FilePath); @@ -546,7 +546,7 @@ bool FileManager::getNoncachedStatValue(llvm::StringRef Path, } void FileManager::GetUniqueIDMapping( - llvm::SmallVectorImpl<const FileEntry *> &UIDToFiles) const { + SmallVectorImpl<const FileEntry *> &UIDToFiles) const { UIDToFiles.clear(); UIDToFiles.resize(NextFileUID); @@ -558,7 +558,7 @@ void FileManager::GetUniqueIDMapping( UIDToFiles[FE->getValue()->getUID()] = FE->getValue(); // Map virtual file entries - for (llvm::SmallVector<FileEntry*, 4>::const_iterator + for (SmallVector<FileEntry*, 4>::const_iterator VFE = VirtualFileEntries.begin(), VFEEnd = VirtualFileEntries.end(); VFE != VFEEnd; ++VFE) if (*VFE && *VFE != NON_EXISTENT_FILE) diff --git a/lib/Basic/IdentifierTable.cpp b/lib/Basic/IdentifierTable.cpp index 188e2d46f5..edf2e99a51 100644 --- a/lib/Basic/IdentifierTable.cpp +++ b/lib/Basic/IdentifierTable.cpp @@ -55,7 +55,7 @@ namespace { class EmptyLookupIterator : public IdentifierIterator { public: - virtual llvm::StringRef Next() { return llvm::StringRef(); } + virtual StringRef Next() { return StringRef(); } }; } @@ -106,7 +106,7 @@ namespace { /// enabled in the specified langauge, set to 1 if it is an extension /// in the specified language, and set to 0 if disabled in the /// specified language. -static void AddKeyword(llvm::StringRef Keyword, +static void AddKeyword(StringRef Keyword, tok::TokenKind TokenCode, unsigned Flags, const LangOptions &LangOpts, IdentifierTable &Table) { unsigned AddResult = 0; @@ -133,7 +133,7 @@ static void AddKeyword(llvm::StringRef Keyword, /// AddCXXOperatorKeyword - Register a C++ operator keyword alternative /// representations. -static void AddCXXOperatorKeyword(llvm::StringRef Keyword, +static void AddCXXOperatorKeyword(StringRef Keyword, tok::TokenKind TokenCode, IdentifierTable &Table) { IdentifierInfo &Info = Table.get(Keyword, TokenCode); @@ -142,7 +142,7 @@ static void AddCXXOperatorKeyword(llvm::StringRef Keyword, /// AddObjCKeyword - Register an Objective-C @keyword like "class" "selector" or /// "property". -static void AddObjCKeyword(llvm::StringRef Name, +static void AddObjCKeyword(StringRef Name, tok::ObjCKeywordKind ObjCID, IdentifierTable &Table) { Table.get(Name).setObjCKeywordID(ObjCID); @@ -153,20 +153,20 @@ static void AddObjCKeyword(llvm::StringRef Name, void IdentifierTable::AddKeywords(const LangOptions &LangOpts) { // Add keywords and tokens for the current language. #define KEYWORD(NAME, FLAGS) \ - AddKeyword(llvm::StringRef(#NAME), tok::kw_ ## NAME, \ + AddKeyword(StringRef(#NAME), tok::kw_ ## NAME, \ FLAGS, LangOpts, *this); #define ALIAS(NAME, TOK, FLAGS) \ - AddKeyword(llvm::StringRef(NAME), tok::kw_ ## TOK, \ + AddKeyword(StringRef(NAME), tok::kw_ ## TOK, \ FLAGS, LangOpts, *this); #define CXX_KEYWORD_OPERATOR(NAME, ALIAS) \ if (LangOpts.CXXOperatorNames) \ - AddCXXOperatorKeyword(llvm::StringRef(#NAME), tok::ALIAS, *this); + AddCXXOperatorKeyword(StringRef(#NAME), tok::ALIAS, *this); #define OBJC1_AT_KEYWORD(NAME) \ if (LangOpts.ObjC1) \ - AddObjCKeyword(llvm::StringRef(#NAME), tok::objc_##NAME, *this); + AddObjCKeyword(StringRef(#NAME), tok::objc_##NAME, *this); #define OBJC2_AT_KEYWORD(NAME) \ if (LangOpts.ObjC2) \ - AddObjCKeyword(llvm::StringRef(#NAME), tok::objc_##NAME, *this); + AddObjCKeyword(StringRef(#NAME), tok::objc_##NAME, *this); #define TESTING_KEYWORD(NAME, FLAGS) #include "clang/Basic/TokenKinds.def" @@ -336,9 +336,9 @@ IdentifierInfo *Selector::getIdentifierInfoForSlot(unsigned argIndex) const { return SI->getIdentifierInfoForSlot(argIndex); } -llvm::StringRef Selector::getNameForSlot(unsigned int argIndex) const { +StringRef Selector::getNameForSlot(unsigned int argIndex) const { IdentifierInfo *II = getIdentifierInfoForSlot(argIndex); - return II? II->getName() : llvm::StringRef(); + return II? II->getName() : StringRef(); } std::string MultiKeywordSelector::getName() const { @@ -377,7 +377,7 @@ std::string Selector::getAsString() const { /// Interpreting the given string using the normal CamelCase /// conventions, determine whether the given string starts with the /// given "word", which is assumed to end in a lowercase letter. -static bool startsWithWord(llvm::StringRef name, llvm::StringRef word) { +static bool startsWithWord(StringRef name, StringRef word) { if (name.size() < word.size()) return false; return ((name.size() == word.size() || !islower(name[word.size()])) @@ -388,7 +388,7 @@ ObjCMethodFamily Selector::getMethodFamilyImpl(Selector sel) { IdentifierInfo *first = sel.getIdentifierInfoForSlot(0); if (!first) return OMF_None; - llvm::StringRef name = first->getName(); + StringRef name = first->getName(); if (sel.isUnarySelector()) { if (name == "autorelease") return OMF_autorelease; if (name == "dealloc") return OMF_dealloc; diff --git a/lib/Basic/SourceLocation.cpp b/lib/Basic/SourceLocation.cpp index 5062d43f58..cf89edb935 100644 --- a/lib/Basic/SourceLocation.cpp +++ b/lib/Basic/SourceLocation.cpp @@ -23,7 +23,7 @@ using namespace clang; // PrettyStackTraceLoc //===----------------------------------------------------------------------===// -void PrettyStackTraceLoc::print(llvm::raw_ostream &OS) const { +void PrettyStackTraceLoc::print(raw_ostream &OS) const { if (Loc.isValid()) { Loc.print(OS, SM); OS << ": "; @@ -35,7 +35,7 @@ void PrettyStackTraceLoc::print(llvm::raw_ostream &OS) const { // SourceLocation //===----------------------------------------------------------------------===// -void SourceLocation::print(llvm::raw_ostream &OS, const SourceManager &SM)const{ +void SourceLocation::print(raw_ostream &OS, const SourceManager &SM)const{ if (!isValid()) { OS << "<invalid loc>"; return; @@ -125,7 +125,7 @@ const llvm::MemoryBuffer* FullSourceLoc::getBuffer(bool *Invalid) const { return SrcMgr->getBuffer(SrcMgr->getFileID(*this), Invalid); } -llvm::StringRef FullSourceLoc::getBufferData(bool *Invalid) const { +StringRef FullSourceLoc::getBufferData(bool *Invalid) const { return getBuffer(Invalid)->getBuffer(); } diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp index ee13f621b5..cbac7ffa31 100644 --- a/lib/Basic/SourceManager.cpp +++ b/lib/Basic/SourceManager.cpp @@ -105,7 +105,7 @@ const llvm::MemoryBuffer *ContentCache::getBuffer(Diagnostic &Diag, // that we are in an inconsistent situation and error out as quickly as // possible. if (!Buffer.getPointer()) { - const llvm::StringRef FillStr("<<<MISSING SOURCE FILE>>>\n"); + const StringRef FillStr("<<<MISSING SOURCE FILE>>>\n"); Buffer.setPointer(MemoryBuffer::getNewMemBuffer(ContentsEntry->getSize(), "<invalid>")); char *Ptr = const_cast<char*>(Buffer.getPointer()->getBufferStart()); @@ -143,7 +143,7 @@ const llvm::MemoryBuffer *ContentCache::getBuffer(Diagnostic &Diag, // If the buffer is valid, check to see if it has a UTF Byte Order Mark // (BOM). We only support UTF-8 with and without a BOM right now. See // http://en.wikipedia.org/wiki/Byte_order_mark for more information. - llvm::StringRef BufStr = Buffer.getPointer()->getBuffer(); + StringRef BufStr = Buffer.getPointer()->getBuffer(); const char *InvalidBOM = llvm::StringSwitch<const char *>(BufStr) .StartsWith("\xFE\xFF", "UTF-16 (BE)") .StartsWith("\xFF\xFE", "UTF-16 (LE)") @@ -169,7 +169,7 @@ const llvm::MemoryBuffer *ContentCache::getBuffer(Diagnostic &Diag, return Buffer.getPointer(); } -unsigned LineTableInfo::getLineTableFilenameID(llvm::StringRef Name) { +unsigned LineTableInfo::getLineTableFilenameID(StringRef Name) { // Look up the filename in the string table, returning the pre-existing value // if it exists. llvm::StringMapEntry<unsigned> &Entry = @@ -277,7 +277,7 @@ void LineTableInfo::AddEntry(int FID, /// getLineTableFilenameID - Return the uniqued ID for the specified filename. /// -unsigned SourceManager::getLineTableFilenameID(llvm::StringRef Name) { +unsigned SourceManager::getLineTableFilenameID(StringRef Name) { if (LineTable == 0) LineTable = new LineTableInfo(); return LineTable->getLineTableFilenameID(Name); @@ -588,7 +588,7 @@ void SourceManager::overrideFileContents(const FileEntry *SourceFile, OverriddenFiles[SourceFile] = NewFile; } -llvm::StringRef SourceManager::getBufferData(FileID FID, bool *Invalid) const { +StringRef SourceManager::getBufferData(FileID FID, bool *Invalid) const { bool MyInvalid = false; const SLocEntry &SLoc = getSLocEntry(FID, &MyInvalid); if (!SLoc.isFile() || MyInvalid) { @@ -986,7 +986,7 @@ static void ComputeLineNumbers(Diagnostic &Diag, ContentCache *FI, // Find the file offsets of all of the *physical* source lines. This does // not look at trigraphs, escaped newlines, or anything else tricky. - llvm::SmallVector<unsigned, 256> LineOffsets; + SmallVector<unsigned, 256> LineOffsets; // Line #1 starts at char 0. LineOffsets.push_back(0); @@ -1316,7 +1316,7 @@ SourceLocation SourceManager::getLocation(const FileEntry *SourceFile, // First, check the main file ID, since it is common to look for a // location in the main file. llvm::Optional<ino_t> SourceFileInode; - llvm::Optional<llvm::StringRef> SourceFileName; + llvm::Optional<StringRef> SourceFileName; if (!MainFileID.isInvalid()) { bool Invalid = false; const SLocEntry &MainSLoc = getSLocEntry(MainFileID, &Invalid); diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp index 30a9bdb317..7ea51467c1 100644 --- a/lib/Basic/TargetInfo.cpp +++ b/lib/Basic/TargetInfo.cpp @@ -174,7 +174,7 @@ void TargetInfo::setForcedLangOptions(LangOptions &Opts) { //===----------------------------------------------------------------------===// -static llvm::StringRef removeGCCRegisterPrefix(llvm::StringRef Name) { +static StringRef removeGCCRegisterPrefix(StringRef Name) { if (Name[0] == '%' || Name[0] == '#') Name = Name.substr(1); @@ -184,7 +184,7 @@ static llvm::StringRef removeGCCRegisterPrefix(llvm::StringRef Name) { /// isValidClobber - Returns whether the passed in string is /// a valid clobber in an inline asm statement. This is used by /// Sema. -bool TargetInfo::isValidClobber(llvm::StringRef Name) const { +bool TargetInfo::isValidClobber(StringRef Name) const { return (isValidGCCRegisterName(Name) || Name == "memory" || Name == "cc"); } @@ -192,7 +192,7 @@ bool TargetInfo::isValidClobber(llvm::StringRef Name) const { /// isValidGCCRegisterName - Returns whether the passed in string /// is a valid register name according to GCC. This is used by Sema for /// inline asm statements. -bool TargetInfo::isValidGCCRegisterName(llvm::StringRef Name) const { +bool TargetInfo::isValidGCCRegisterName(StringRef Name) const { if (Name.empty()) return false; @@ -248,8 +248,8 @@ bool TargetInfo::isValidGCCRegisterName(llvm::StringRef Name) const { return false; } -llvm::StringRef -TargetInfo::getNormalizedGCCRegisterName(llvm::StringRef Name) const { +StringRef +TargetInfo::getNormalizedGCCRegisterName(StringRef Name) const { assert(isValidGCCRegisterName(Name) && "Invalid register passed in"); // Get rid of any register prefix. diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 0414d196d4..3aebc41d71 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -37,7 +37,7 @@ using namespace clang; /// DefineStd - Define a macro name and standard variants. For example if /// MacroName is "unix", then this will define "__unix", "__unix__", and "unix" /// when in GNU mode. -static void DefineStd(MacroBuilder &Builder, llvm::StringRef MacroName, +static void DefineStd(MacroBuilder &Builder, StringRef MacroName, const LangOptions &Opts) { assert(MacroName[0] != '_' && "Identifier should be in the user's namespace"); @@ -77,7 +77,7 @@ public: static void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts, const llvm::Triple &Triple, - llvm::StringRef &PlatformName, + StringRef &PlatformName, VersionTuple &PlatformMinVersion) { Builder.defineMacro("__APPLE_CC__", "5621"); Builder.defineMacro("__APPLE__"); @@ -202,9 +202,9 @@ public: this->MCountName = "\01mcount"; } - virtual std::string isValidSectionSpecifier(llvm::StringRef SR) const { + virtual std::string isValidSectionSpecifier(StringRef SR) const { // Let MCSectionMachO validate this. - llvm::StringRef Segment, Section; + StringRef Segment, Section; unsigned TAA, StubSize; bool HasTAA; return llvm::MCSectionMachO::ParseSectionSpecifier(SR, Segment, Section, @@ -247,7 +247,7 @@ protected: // FreeBSD defines; list based off of gcc output // FIXME: Move version number handling to llvm::Triple. - llvm::StringRef Release = Triple.getOSName().substr(strlen("freebsd"), 1); + StringRef Release = Triple.getOSName().substr(strlen("freebsd"), 1); Builder.defineMacro("__FreeBSD__", Release); Builder.defineMacro("__FreeBSD_cc_version", Release + "00001"); @@ -503,7 +503,7 @@ protected: Builder.defineMacro("_MT"); if (Opts.MSCVersion != 0) - Builder.defineMacro("_MSC_VER", llvm::Twine(Opts.MSCVersion)); + Builder.defineMacro("_MSC_VER", Twine(Opts.MSCVersion)); if (Opts.Microsoft) { Builder.defineMacro("_MSC_EXTENSIONS"); @@ -1429,13 +1429,13 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts, case SSSE3: case SSE3: case SSE2: - Builder.defineMacro("_M_IX86_FP", llvm::Twine(2)); + Builder.defineMacro("_M_IX86_FP", Twine(2)); break; case SSE1: - Builder.defineMacro("_M_IX86_FP", llvm::Twine(1)); + Builder.defineMacro("_M_IX86_FP", Twine(1)); break; default: - Builder.defineMacro("_M_IX86_FP", llvm::Twine(0)); + Builder.defineMacro("_M_IX86_FP", Twine(0)); } } @@ -1706,7 +1706,7 @@ protected: // RTEMS defines; list based off of gcc output // FIXME: Move version number handling to llvm::Triple. - llvm::StringRef Release = Triple.getOSName().substr(strlen("rtems"), 1); + StringRef Release = Triple.getOSName().substr(strlen("rtems"), 1); Builder.defineMacro("__rtems__"); Builder.defineMacro("__ELF__"); @@ -2035,7 +2035,7 @@ public: Features.erase(it); } - static const char *getCPUDefineSuffix(llvm::StringRef Name) { + static const char *getCPUDefineSuffix(StringRef Name) { return llvm::StringSwitch<const char*>(Name) .Cases("arm8", "arm810", "4") .Cases("strongarm", "strongarm110", "strongarm1100", "strongarm1110", "4") @@ -2074,7 +2074,7 @@ public: Builder.defineMacro("__LITTLE_ENDIAN__"); Builder.defineMacro("__REGISTER_PREFIX__", ""); - llvm::StringRef CPUArch = getCPUDefineSuffix(CPU); + StringRef CPUArch = getCPUDefineSuffix(CPU); Builder.defineMacro("__ARM_ARCH_" + CPUArch + "__"); // Subtarget options. diff --git a/lib/Basic/Version.cpp b/lib/Basic/Version.cpp index 86d4aa5dfb..10b9364587 100644 --- a/lib/Basic/Version.cpp +++ b/lib/Basic/Version.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "clang/Basic/Version.h" +#include "clang/Basic/LLVM.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Config/config.h" #include <cstring> @@ -24,14 +25,14 @@ std::string getClangRepositoryPath() { return CLANG_REPOSITORY_STRING; #else #ifdef SVN_REPOSITORY - llvm::StringRef URL(SVN_REPOSITORY); + StringRef URL(SVN_REPOSITORY); #else - llvm::StringRef URL(""); + StringRef URL(""); #endif // If the SVN_REPOSITORY is empty, try to use the SVN keyword. This helps us // pick up a tag in an SVN export, for example. - static llvm::StringRef SVNRepository("$URL$"); + static StringRef SVNRepository("$URL$"); if (URL.empty()) { URL = SVNRepository.slice(SVNRepository.find(':'), SVNRepository.find("/lib/Basic")); @@ -42,7 +43,7 @@ std::string getClangRepositoryPath() { // Trim path prefix off, assuming path came from standard cfe path. size_t Start = URL.find("cfe/"); - if (Start != llvm::StringRef::npos) + if (Start != StringRef::npos) URL = URL.substr(Start + 4); return URL; diff --git a/lib/Basic/VersionTuple.cpp b/lib/Basic/VersionTuple.cpp index d5cf126ff4..77aad39cbf 100644 --- a/lib/Basic/VersionTuple.cpp +++ b/lib/Basic/VersionTuple.cpp @@ -25,7 +25,7 @@ std::string VersionTuple::getAsString() const { return Result; } -llvm::raw_ostream& clang::operator<<(llvm::raw_ostream &Out, +raw_ostream& clang::operator<<(raw_ostream &Out, const VersionTuple &V) { Out << V.getMajor(); if (llvm::Optional<unsigned> Minor = V.getMinor()) diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp index 9544cb4eb7..8edf2eda06 100644 --- a/lib/CodeGen/CGBlocks.cpp +++ b/lib/CodeGen/CGBlocks.cpp @@ -62,7 +62,7 @@ static llvm::Constant *buildBlockDescriptor(CodeGenModule &CGM, llvm::Type *ulong = CGM.getTypes().ConvertType(C.UnsignedLongTy); llvm::Type *i8p = CGM.getTypes().ConvertType(C.VoidPtrTy); - llvm::SmallVector<llvm::Constant*, 6> elements; + SmallVector<llvm::Constant*, 6> elements; // reserved elements.push_back(llvm::ConstantInt::get(ulong, 0)); @@ -243,7 +243,7 @@ static CharUnits getLowBit(CharUnits v) { } static void initializeForBlockHeader(CodeGenModule &CGM, CGBlockInfo &info, - llvm::SmallVectorImpl<llvm::Type*> &elementTypes) { + SmallVectorImpl<llvm::Type*> &elementTypes) { ASTContext &C = CGM.getContext(); // The header is basically a 'struct { void *; int; int; void *; void *; }'. @@ -280,7 +280,7 @@ static void computeBlockInfo(CodeGenModule &CGM, CGBlockInfo &info) { ASTContext &C = CGM.getContext(); const BlockDecl *block = info.getBlockDecl(); - llvm::SmallVector<llvm::Type*, 8> elementTypes; + SmallVector<llvm::Type*, 8> elementTypes; initializeForBlockHeader(CGM, info, elementTypes); if (!block->hasCaptures()) { @@ -291,7 +291,7 @@ static void computeBlockInfo(CodeGenModule &CGM, CGBlockInfo &info) { } // Collect the layout chunks. - llvm::SmallVector<BlockLayoutChunk, 16> layout; + SmallVector<BlockLayoutChunk, 16> layout; layout.reserve(block->capturesCXXThis() + (block->capture_end() - block->capture_begin())); @@ -422,7 +422,7 @@ static void computeBlockInfo(CodeGenModule &CGM, CGBlockInfo &info) { // which has 7 bytes of padding, as opposed to the naive solution // which might have less (?). if (endAlign < maxFieldAlign) { - llvm::SmallVectorImpl<BlockLayoutChunk>::iterator + SmallVectorImpl<BlockLayoutChunk>::iterator li = layout.begin() + 1, le = layout.end(); // Look for something that the header end is already @@ -433,7 +433,7 @@ static void computeBlockInfo(CodeGenModule &CGM, CGBlockInfo &info) { // If we found something that's naturally aligned for the end of // the header, keep adding things... if (li != le) { - llvm::SmallVectorImpl<BlockLayoutChunk>::iterator first = li; + SmallVectorImpl<BlockLayoutChunk>::iterator first = li; for (; li != le; ++li) { assert(endAlign >= li->Alignment); @@ -468,7 +468,7 @@ static void computeBlockInfo(CodeGenModule &CGM, CGBlockInfo &info) { // Slam everything else on now. This works because they have // strictly decreasing alignment and we expect that size is always a // multiple of alignment. - for (llvm::SmallVectorImpl<BlockLayoutChunk>::iterator + for (SmallVectorImpl<BlockLayoutChunk>::iterator li = layout.begin(), le = layout.end(); li != le; ++li) { assert(endAlign >= li->Alignment); li->setIndex(info, elementTypes.size()); @@ -1665,7 +1665,7 @@ llvm::Type *CodeGenFunction::BuildByRefType(const VarDecl *D) { QualType Ty = D->getType(); - llvm::SmallVector<llvm::Type *, 8> types; + SmallVector<llvm::Type *, 8> types; llvm::StructType *ByRefType = llvm::StructType::createNamed(getLLVMContext(), diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index dedac9da0a..5c49d5945c 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -1193,12 +1193,12 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID, const FunctionDecl *FD = E->getDirectCallee(); // Oddly people write this call without args on occasion and gcc accepts // it - it's also marked as varargs in the description file. - llvm::SmallVector<Value*, 2> Ops; + SmallVector<Value*, 2> Ops; for (unsigned i = 0; i < E->getNumArgs(); i++) Ops.push_back(EmitScalarExpr(E->getArg(i))); llvm::Type *Ty = CGM.getTypes().ConvertType(FD->getType()); llvm::FunctionType *FTy = cast<llvm::FunctionType>(Ty); - llvm::StringRef Name = FD->getName(); + StringRef Name = FD->getName(); return Builder.CreateCall(CGM.CreateRuntimeFunction(FTy, Name), Ops); } @@ -1236,7 +1236,7 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID, return Builder.CreateCall3(F, Arg0, Arg1, StPtr, "strexd"); } - llvm::SmallVector<Value*, 4> Ops; + SmallVector<Value*, 4> Ops; for (unsigned i = 0, e = E->getNumArgs() - 1; i != e; i++) Ops.push_back(EmitScalarExpr(E->getArg(i))); @@ -1918,7 +1918,7 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID, } llvm::Value *CodeGenFunction:: -BuildVector(const llvm::SmallVectorImpl<llvm::Value*> &Ops) { +BuildVector(const SmallVectorImpl<llvm::Value*> &Ops) { assert((Ops.size() & (Ops.size() - 1)) == 0 && "Not a power-of-two sized vector!"); bool AllConstants = true; @@ -1946,7 +1946,7 @@ BuildVector(const llvm::SmallVectorImpl<llvm::Value*> &Ops) { Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, const CallExpr *E) { - llvm::SmallVector<Value*, 4> Ops; + SmallVector<Value*, 4> Ops; // Find out if any arguments are required to be integer constant expressions. unsigned ICEArguments = 0; @@ -2141,7 +2141,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, // If palignr is shifting the pair of input vectors less than 9 bytes, // emit a shuffle instruction. if (shiftVal <= 8) { - llvm::SmallVector<llvm::Constant*, 8> Indices; + SmallVector<llvm::Constant*, 8> Indices; for (unsigned i = 0; i != 8; ++i) Indices.push_back(llvm::ConstantInt::get(Int32Ty, shiftVal + i)); @@ -2172,7 +2172,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, // If palignr is shifting the pair of input vectors less than 17 bytes, // emit a shuffle instruction. if (shiftVal <= 16) { - llvm::SmallVector<llvm::Constant*, 16> Indices; + SmallVector<llvm::Constant*, 16> Indices; for (unsigned i = 0; i != 16; ++i) Indices.push_back(llvm::ConstantInt::get(Int32Ty, shiftVal + i)); @@ -2349,7 +2349,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID, const CallExpr *E) { - llvm::SmallVector<Value*, 4> Ops; + SmallVector<Value*, 4> Ops; for (unsigned i = 0, e = E->getNumArgs(); i != e; i++) Ops.push_back(EmitScalarExpr(E->getArg(i))); diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index f841b25009..f7f8a1271c 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -154,7 +154,7 @@ bool CodeGenModule::TryEmitDefinitionAsAlias(GlobalDecl AliasDecl, new llvm::GlobalAlias(AliasType, Linkage, "", Aliasee, &getModule()); // Switch any previous uses to the alias. - llvm::StringRef MangledName = getMangledName(AliasDecl); + StringRef MangledName = getMangledName(AliasDecl); llvm::GlobalValue *Entry = GetGlobalValue(MangledName); if (Entry) { assert(Entry->isDeclaration() && "definition already exists for alias"); @@ -214,7 +214,7 @@ CodeGenModule::GetAddrOfCXXConstructor(const CXXConstructorDecl *ctor, const CGFunctionInfo *fnInfo) { GlobalDecl GD(ctor, ctorType); - llvm::StringRef name = getMangledName(GD); + StringRef name = getMangledName(GD); if (llvm::GlobalValue *existing = GetGlobalValue(name)) return existing; @@ -282,7 +282,7 @@ CodeGenModule::GetAddrOfCXXDestructor(const CXXDestructorDecl *dtor, const CGFunctionInfo *fnInfo) { GlobalDecl GD(dtor, dtorType); - llvm::StringRef name = getMangledName(GD); + StringRef name = getMangledName(GD); if (llvm::GlobalValue *existing = GetGlobalValue(name)) return existing; diff --git a/lib/CodeGen/CGCXXABI.cpp b/lib/CodeGen/CGCXXABI.cpp index ff7213df1f..8106507e0d 100644 --- a/lib/CodeGen/CGCXXABI.cpp +++ b/lib/CodeGen/CGCXXABI.cpp @@ -20,7 +20,7 @@ using namespace CodeGen; CGCXXABI::~CGCXXABI() { } static void ErrorUnsupportedABI(CodeGenFunction &CGF, - llvm::StringRef S) { + StringRef S) { Diagnostic &Diags = CGF.CGM.getDiags(); unsigned DiagID = Diags.getCustomDiagID(Diagnostic::Error, "cannot yet compile %1 in this ABI"); diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index e3b93a3f45..d13fd017cd 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -69,14 +69,14 @@ static CanQualType GetReturnType(QualType RetTy) { const CGFunctionInfo & CodeGenTypes::getFunctionInfo(CanQual<FunctionNoProtoType> FTNP) { return getFunctionInfo(FTNP->getResultType().getUnqualifiedType(), - llvm::SmallVector<CanQualType, 16>(), + SmallVector<CanQualType, 16>(), FTNP->getExtInfo()); } /// \param Args - contains any initial parameters besides those /// in the formal type static const CGFunctionInfo &getFunctionInfo(CodeGenTypes &CGT, - llvm::SmallVectorImpl<CanQualType> &ArgTys, + SmallVectorImpl<CanQualType> &ArgTys, CanQual<FunctionProtoType> FTP) { // FIXME: Kill copy. for (unsigned i = 0, e = FTP->getNumArgs(); i != e; ++i) @@ -87,7 +87,7 @@ static const CGFunctionInfo &getFunctionInfo(CodeGenTypes &CGT, const CGFunctionInfo & CodeGenTypes::getFunctionInfo(CanQual<FunctionProtoType> FTP) { - llvm::SmallVector<CanQualType, 16> ArgTys; + SmallVector<CanQualType, 16> ArgTys; return ::getFunctionInfo(*this, ArgTys, FTP); } @@ -113,7 +113,7 @@ static CallingConv getCallingConventionForDecl(const Decl *D) { const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const CXXRecordDecl *RD, const FunctionProtoType *FTP) { - llvm::SmallVector<CanQualType, 16> ArgTys; + SmallVector<CanQualType, 16> ArgTys; // Add the 'this' pointer. ArgTys.push_back(GetThisType(Context, RD)); @@ -123,7 +123,7 @@ const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const CXXRecordDecl *RD, } const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const CXXMethodDecl *MD) { - llvm::SmallVector<CanQualType, 16> ArgTys; + SmallVector<CanQualType, 16> ArgTys; assert(!isa<CXXConstructorDecl>(MD) && "wrong method for contructors!"); assert(!isa<CXXDestructorDecl>(MD) && "wrong method for destructors!"); @@ -137,7 +137,7 @@ const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const CXXMethodDecl *MD) { const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const CXXConstructorDecl *D, CXXCtorType Type) { - llvm::SmallVector<CanQualType, 16> ArgTys; + SmallVector<CanQualType, 16> ArgTys; ArgTys.push_back(GetThisType(Context, D->getParent())); CanQualType ResTy = Context.VoidTy; @@ -154,7 +154,7 @@ const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const CXXConstructorDecl *D, const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const CXXDestructorDecl *D, CXXDtorType Type) { - llvm::SmallVector<CanQualType, 2> ArgTys; + SmallVector<CanQualType, 2> ArgTys; ArgTys.push_back(GetThisType(Context, D->getParent())); CanQualType ResTy = Context.VoidTy; @@ -180,7 +180,7 @@ const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const FunctionDecl *FD) { } const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const ObjCMethodDecl *MD) { - llvm::SmallVector<CanQualType, 16> ArgTys; + SmallVector<CanQualType, 16> ArgTys; ArgTys.push_back(Context.getCanonicalParamType(MD->getSelfDecl()->getType())); ArgTys.push_back(Context.getCanonicalParamType(Context.getObjCSelType())); // FIXME: Kill copy? @@ -216,7 +216,7 @@ const CGFunctionInfo &CodeGenTypes::getFunctionInfo(QualType ResTy, const CallArgList &Args, const FunctionType::ExtInfo &Info) { // FIXME: Kill copy. - llvm::SmallVector<CanQualType, 16> ArgTys; + SmallVector<CanQualType, 16> ArgTys; for (CallArgList::const_iterator i = Args.begin(), e = Args.end(); i != e; ++i) ArgTys.push_back(Context.getCanonicalParamType(i->Ty)); @@ -227,7 +227,7 @@ const CGFunctionInfo &CodeGenTypes::getFunctionInfo(QualType ResTy, const FunctionArgList &Args, const FunctionType::ExtInfo &Info) { // FIXME: Kill copy. - llvm::SmallVector<CanQualType, 16> ArgTys; + SmallVector<CanQualType, 16> ArgTys; for (FunctionArgList::const_iterator i = Args.begin(), e = Args.end(); i != e; ++i) ArgTys.push_back(Context.getCanonicalParamType((*i)->getType())); @@ -235,15 +235,15 @@ const CGFunctionInfo &CodeGenTypes::getFunctionInfo(QualType ResTy, } const CGFunctionInfo &CodeGenTypes::getNullaryFunctionInfo() { - llvm::SmallVector<CanQualType, 1> args; + SmallVector<CanQualType, 1> args; return getFunctionInfo(getContext().VoidTy, args, FunctionType::ExtInfo()); } const CGFunctionInfo &CodeGenTypes::getFunctionInfo(CanQualType ResTy, - const llvm::SmallVectorImpl<CanQualType> &ArgTys, + const SmallVectorImpl<CanQualType> &ArgTys, const FunctionType::ExtInfo &Info) { #ifndef NDEBUG - for (llvm::SmallVectorImpl<CanQualType>::const_iterator + for (SmallVectorImpl<CanQualType>::const_iterator I = ArgTys.begin(), E = ArgTys.end(); I != E; ++I) assert(I->isCanonicalAsParam()); #endif @@ -312,7 +312,7 @@ CGFunctionInfo::CGFunctionInfo(unsigned _CallingConvention, /***/ void CodeGenTypes::GetExpandedTypes(QualType type, - llvm::SmallVectorImpl<llvm::Type*> &expandedTypes) { + SmallVectorImpl<llvm::Type*> &expandedTypes) { const RecordType *RT = type->getAsStructureType(); assert(RT && "Can only expand structure types."); const RecordDecl *RD = RT->getDecl(); @@ -614,7 +614,7 @@ CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI, bool isVariadic) { bool Inserted = FunctionsBeingProcessed.insert(&FI); (void)Inserted; assert(Inserted && "Recursively being processed?"); - llvm::SmallVector<llvm::Type*, 8> argTypes; + SmallVector<llvm::Type*, 8> argTypes; llvm::Type *resultType = 0; const ABIArgInfo &retAI = FI.getReturnInfo(); @@ -824,7 +824,7 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI, continue; case ABIArgInfo::Expand: { - llvm::SmallVector<llvm::Type*, 8> types; + SmallVector<llvm::Type*, 8> types; // FIXME: This is rather inefficient. Do we ever actually need to do // anything here? The result should be just reconstructed on the other // side, so extension should be a non-issue. @@ -995,7 +995,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI, for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { assert(AI != Fn->arg_end() && "Argument mismatch!"); - AI->setName(Arg->getName() + ".coerce" + llvm::Twine(i)); + AI->setName(Arg->getName() + ".coerce" + Twine(i)); llvm::Value *EltPtr = Builder.CreateConstGEP2_32(Ptr, 0, i); Builder.CreateStore(AI++, EltPtr); } @@ -1029,7 +1029,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI, // Name the arguments used in expansion and increment AI. unsigned Index = 0; for (; AI != End; ++AI, ++Index) - AI->setName(Arg->getName() + "." + llvm::Twine(Index)); + AI->setName(Arg->getName() + "." + Twine(Index)); continue; } @@ -1063,7 +1063,7 @@ static llvm::Value *tryEmitFusedAutoreleaseOfResult(CodeGenFunction &CGF, // result is in a BasicBlock and is therefore an Instruction. llvm::Instruction *generator = cast<llvm::Instruction>(result); - llvm::SmallVector<llvm::Instruction*,4> insnsToKill; + SmallVector<llvm::Instruction*,4> insnsToKill; // Look for: // %generator = bitcast %type1* %generator2 to %type2* @@ -1116,7 +1116,7 @@ static llvm::Value *tryEmitFusedAutoreleaseOfResult(CodeGenFunction &CGF, } // Delete all the unnecessary instructions, from latest to earliest. - for (llvm::SmallVectorImpl<llvm::Instruction*>::iterator + for (SmallVectorImpl<llvm::Instruction*>::iterator i = insnsToKill.begin(), e = insnsToKill.end(); i != e; ++i) (*i)->eraseFromParent(); @@ -1432,7 +1432,7 @@ void CodeGenFunction::EmitCallArg(CallArgList &args, const Expr *E, llvm::CallSite CodeGenFunction::EmitCallOrInvoke(llvm::Value *Callee, llvm::ArrayRef<llvm::Value *> Args, - const llvm::Twine &Name) { + const Twine &Name) { llvm::BasicBlock *InvokeDest = getInvokeDest(); if (!InvokeDest) return Builder.CreateCall(Callee, Args, Name); @@ -1446,7 +1446,7 @@ CodeGenFunction::EmitCallOrInvoke(llvm::Value *Callee, llvm::CallSite CodeGenFunction::EmitCallOrInvoke(llvm::Value *Callee, - const llvm::Twine &Name) { + const Twine &Name) { return EmitCallOrInvoke(Callee, llvm::ArrayRef<llvm::Value *>(), Name); } @@ -1460,7 +1460,7 @@ static void checkArgMatches(llvm::Value *Elt, unsigned &ArgNo, } void CodeGenFunction::ExpandTypeToArgs(QualType Ty, RValue RV, - llvm::SmallVector<llvm::Value*,16> &Args, + SmallVector<llvm::Value*,16> &Args, llvm::FunctionType *IRFuncTy) { const RecordType *RT = Ty->getAsStructureType(); assert(RT && "Can only expand structure types."); @@ -1503,7 +1503,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, const Decl *TargetDecl, llvm::Instruction **callOrInvoke) { // FIXME: We no longer need the types from CallArgs; lift up and simplify. - llvm::SmallVector<llvm::Value*, 16> Args; + SmallVector<llvm::Value*, 16> Args; // Handle struct-return functions by passing a pointer to the // location that we would like to return into. diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp index d2b104eec0..2d32b83b12 100644 --- a/lib/CodeGen/CGClass.cpp +++ b/lib/CodeGen/CGClass.cpp @@ -729,7 +729,7 @@ void CodeGenFunction::EmitCtorPrologue(const CXXConstructorDecl *CD, const CXXRecordDecl *ClassDecl = CD->getParent(); - llvm::SmallVector<CXXCtorInitializer *, 8> MemberInitializers; + SmallVector<CXXCtorInitializer *, 8> MemberInitializers; for (CXXConstructorDecl::init_const_iterator B = CD->init_begin(), E = CD->init_end(); @@ -1018,7 +1018,7 @@ void CodeGenFunction::EnterDtorCleanups(const CXXDestructorDecl *DD, } // Destroy direct fields. - llvm::SmallVector<const FieldDecl *, 16> FieldDecls; + SmallVector<const FieldDecl *, 16> FieldDecls; for (CXXRecordDecl::field_iterator I = ClassDecl->field_begin(), E = ClassDecl->field_end(); I != E; ++I) { const FieldDecl *field = *I; diff --git a/lib/CodeGen/CGCleanup.cpp b/lib/CodeGen/CGCleanup.cpp index 564b662638..10f716aa95 100644 --- a/lib/CodeGen/CGCleanup.cpp +++ b/lib/CodeGen/CGCleanup.cpp @@ -583,7 +583,7 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) { // Copy the cleanup emission data out. Note that SmallVector // guarantees maximal alignment for its buffer regardless of its // type parameter. - llvm::SmallVector<char, 8*sizeof(void*)> CleanupBuffer; + SmallVector<char, 8*sizeof(void*)> CleanupBuffer; CleanupBuffer.reserve(Scope.getCleanupSize()); memcpy(CleanupBuffer.data(), Scope.getCleanupBuffer(), Scope.getCleanupSize()); @@ -595,7 +595,7 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) { // ahead and do the setup for the EH cleanup while the scope is still // alive. llvm::BasicBlock *EHEntry = 0; - llvm::SmallVector<llvm::Instruction*, 2> EHInstsToAppend; + SmallVector<llvm::Instruction*, 2> EHInstsToAppend; if (RequiresEHCleanup) { EHEntry = CreateEHEntry(*this, Scope); @@ -716,7 +716,7 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) { } llvm::BasicBlock *FallthroughDest = 0; - llvm::SmallVector<llvm::Instruction*, 2> InstsToAppend; + SmallVector<llvm::Instruction*, 2> InstsToAppend; // If there's exactly one branch-after and no other threads, // we can route it without a switch. diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 3c9b3eb78f..9cfb71e825 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -81,7 +81,7 @@ llvm::DIDescriptor CGDebugInfo::getContextDescriptor(const Decl *Context) { /// getFunctionName - Get function name for the given FunctionDecl. If the /// name is constructred on demand (e.g. C++ destructor) then the name /// is stored on the side. -llvm::StringRef CGDebugInfo::getFunctionName(const FunctionDecl *FD) { +StringRef CGDebugInfo::getFunctionName(const FunctionDecl *FD) { assert (FD && "Invalid FunctionDecl!"); IdentifierInfo *FII = FD->getIdentifier(); if (FII) @@ -93,10 +93,10 @@ llvm::StringRef CGDebugInfo::getFunctionName(const FunctionDecl *FD) { // Copy this name on the side and use its reference. char *StrPtr = DebugInfoNames.Allocate<char>(NS.length()); memcpy(StrPtr, NS.data(), NS.length()); - return llvm::StringRef(StrPtr, NS.length()); + return StringRef(StrPtr, NS.length()); } -llvm::StringRef CGDebugInfo::getObjCMethodName(const ObjCMethodDecl *OMD) { +StringRef CGDebugInfo::getObjCMethodName(const ObjCMethodDecl *OMD) { llvm::SmallString<256> MethodName; llvm::raw_svector_ostream OS(MethodName); OS << (OMD->isInstanceMethod() ? '-' : '+') << '['; @@ -116,22 +116,22 @@ llvm::StringRef CGDebugInfo::getObjCMethodName(const ObjCMethodDecl *OMD) { char *StrPtr = DebugInfoNames.Allocate<char>(OS.tell()); memcpy(StrPtr, MethodName.begin(), OS.tell()); - return llvm::StringRef(StrPtr, OS.tell()); + return StringRef(StrPtr, OS.tell()); } /// getSelectorName - Return selector name. This is used for debugging /// info. -llvm::StringRef CGDebugInfo::getSelectorName(Selector S) { +StringRef CGDebugInfo::getSelectorName(Selector S) { llvm::SmallString<256> SName; llvm::raw_svector_ostream OS(SName); OS << S.getAsString(); char *StrPtr = DebugInfoNames.Allocate<char>(OS.tell()); memcpy(StrPtr, SName.begin(), OS.tell()); - return llvm::StringRef(StrPtr, OS.tell()); + return StringRef(StrPtr, OS.tell()); } /// getClassName - Get class name including template argument list. -llvm::StringRef +StringRef CGDebugInfo::getClassName(RecordDecl *RD) { ClassTemplateSpecializationDecl *Spec = dyn_cast<ClassTemplateSpecializationDecl>(RD); @@ -160,7 +160,7 @@ CGDebugInfo::getClassName(RecordDecl *RD) { // Copy this name on the side and use its reference. char *StrPtr = DebugInfoNames.Allocate<char>(Buffer.length()); memcpy(StrPtr, Buffer.data(), Buffer.length()); - return llvm::StringRef(StrPtr, Buffer.length()); + return StringRef(StrPtr, Buffer.length()); } /// getOrCreateFile - Get the file debug info descriptor for the input location. @@ -172,7 +172,7 @@ llvm::DIFile CGDebugInfo::getOrCreateFile(SourceLocation Loc) { SourceManager &SM = CGM.getContext().getSourceManager(); PresumedLoc PLoc = SM.getPresumedLoc(Loc); - if (PLoc.isInvalid() || llvm::StringRef(PLoc.getFilename()).empty()) + if (PLoc.isInvalid() || StringRef(PLoc.getFilename()).empty()) // If the location is not valid then use main input file. return DBuilder.createFile(TheCU.getFilename(), TheCU.getDirectory()); @@ -217,14 +217,14 @@ unsigned CGDebugInfo::getColumnNumber(SourceLocation Loc) { return PLoc.isValid()? PLoc.getColumn() : 0; } -llvm::StringRef CGDebugInfo::getCurrentDirname() { +StringRef CGDebugInfo::getCurrentDirname() { if (!CWDName.empty()) return CWDName; char *CompDirnamePtr = NULL; llvm::sys::Path CWD = llvm::sys::Path::GetCurrentDirectory(); CompDirnamePtr = DebugInfoNames.Allocate<char>(CWD.size()); memcpy(CompDirnamePtr, CWD.c_str(), CWD.size()); - return CWDName = llvm::StringRef(CompDirnamePtr, CWD.size()); + return CWDName = StringRef(CompDirnamePtr, CWD.size()); } /// CreateCompileUnit - Create new compile unit. @@ -250,7 +250,7 @@ void CGDebugInfo::CreateCompileUnit() { // Save filename string. char *FilenamePtr = DebugInfoNames.Allocate<char>(MainFileName.length()); memcpy(FilenamePtr, MainFileName.c_str(), MainFileName.length()); - llvm::StringRef Filename(FilenamePtr, MainFileName.length()); + StringRef Filename(FilenamePtr, MainFileName.length()); unsigned LangTag; const LangOptions &LO = CGM.getLangOptions(); @@ -312,7 +312,7 @@ llvm::DIType CGDebugInfo::CreateType(const BuiltinType *BT) { llvm::DIType ISATy = DBuilder.createPointerType(OCTy, Size); - llvm::SmallVector<llvm::Value *, 16> EltTys; + SmallVector<llvm::Value *, 16> EltTys; llvm::DIType FieldTy = DBuilder.createMemberType(getOrCreateMainFile(), "isa", getOrCreateMainFile(), 0, Size, @@ -489,7 +489,7 @@ llvm::DIType CGDebugInfo::CreateType(const BlockPointerType *Ty, if (BlockLiteralGenericSet) return BlockLiteralGeneric; - llvm::SmallVector<llvm::Value *, 8> EltTys; + SmallVector<llvm::Value *, 8> EltTys; llvm::DIType FieldTy; QualType FType; uint64_t FieldSize, FieldOffset; @@ -567,7 +567,7 @@ llvm::DIType CGDebugInfo::CreateType(const TypedefType *Ty, llvm::DIType CGDebugInfo::CreateType(const FunctionType *Ty, llvm::DIFile Unit) { - llvm::SmallVector<llvm::Value *, 16> EltTys; + SmallVector<llvm::Value *, 16> EltTys; // Add the result type at least. EltTys.push_back(getOrCreateType(Ty->getResultType(), Unit)); @@ -587,7 +587,7 @@ llvm::DIType CGDebugInfo::CreateType(const FunctionType *Ty, return DbgTy; } -llvm::DIType CGDebugInfo::createFieldType(llvm::StringRef name, +llvm::DIType CGDebugInfo::createFieldType(StringRef name, QualType type, Expr *bitWidth, SourceLocation loc, @@ -624,7 +624,7 @@ llvm::DIType CGDebugInfo::createFieldType(llvm::StringRef name, /// record fields. This is used while creating debug info entry for a Record. void CGDebugInfo:: CollectRecordFields(const RecordDecl *record, llvm::DIFile tunit, - llvm::SmallVectorImpl<llvm::Value *> &elements, + SmallVectorImpl<llvm::Value *> &elements, llvm::DIType RecordTy) { unsigned fieldNo = 0; const FieldDecl *LastFD = 0; @@ -644,7 +644,7 @@ CollectRecordFields(const RecordDecl *record, llvm::DIFile tunit, LastFD = field; } - llvm::StringRef name = field->getName(); + StringRef name = field->getName(); QualType type = field->getType(); // Ignore unnamed fields unless they're anonymous structs/unions. @@ -678,7 +678,7 @@ CGDebugInfo::getOrCreateMethodType(const CXXMethodDecl *Method, llvm::DIArray Args = llvm::DICompositeType(FnTy).getTypeArray(); assert (Args.getNumElements() && "Invalid number of arguments!"); - llvm::SmallVector<llvm::Value *, 16> Elts; + SmallVector<llvm::Value *, 16> Elts; // First element is always return type. For 'void' functions it is NULL. Elts.push_back(Args.getElement(0)); @@ -723,12 +723,12 @@ CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method, bool IsCtorOrDtor = isa<CXXConstructorDecl>(Method) || isa<CXXDestructorDecl>(Method); - llvm::StringRef MethodName = getFunctionName(Method); + StringRef MethodName = getFunctionName(Method); llvm::DIType MethodTy = getOrCreateMethodType(Method, Unit); // Since a single ctor/dtor corresponds to multiple functions, it doesn't // make sense to give a single ctor/dtor a linkage name. - llvm::StringRef MethodLinkageName; + StringRef MethodLinkageName; if (!IsCtorOrDtor && !isFunctionLocalClass(Method->getParent())) MethodLinkageName = CGM.getMangledName(Method); @@ -791,7 +791,7 @@ CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method, /// a Record. void CGDebugInfo:: CollectCXXMemberFunctions(const CXXRecordDecl *RD, llvm::DIFile Unit, - llvm::SmallVectorImpl<llvm::Value *> &EltTys, + SmallVectorImpl<llvm::Value *> &EltTys, llvm::DIType RecordTy) { for(CXXRecordDecl::method_iterator I = RD->method_begin(), E = RD->method_end(); I != E; ++I) { @@ -809,7 +809,7 @@ CollectCXXMemberFunctions(const CXXRecordDecl *RD, llvm::DIFile Unit, /// a Record. void CGDebugInfo:: CollectCXXFriends(const CXXRecordDecl *RD, llvm::DIFile Unit, - llvm::SmallVectorImpl<llvm::Value *> &EltTys, + SmallVectorImpl<llvm::Value *> &EltTys, llvm::DIType RecordTy) { for (CXXRecordDecl::friend_iterator BI = RD->friend_begin(), @@ -826,7 +826,7 @@ CollectCXXFriends(const CXXRecordDecl *RD, llvm::DIFile Unit, /// a Record. void CGDebugInfo:: CollectCXXBases(const CXXRecordDecl *RD, llvm::DIFile Unit, - llvm::SmallVectorImpl<llvm::Value *> &EltTys, + SmallVectorImpl<llvm::Value *> &EltTys, llvm::DIType RecordTy) { const ASTRecordLayout &RL = CGM.getContext().getASTRecordLayout(RD); @@ -868,7 +868,7 @@ llvm::DIArray CGDebugInfo:: CollectTemplateParams(const TemplateParameterList *TPList, const TemplateArgumentList &TAList, llvm::DIFile Unit) { - llvm::SmallVector<llvm::Value *, 16> TemplateParams; + SmallVector<llvm::Value *, 16> TemplateParams; for (unsigned i = 0, e = TAList.size(); i != e; ++i) { const TemplateArgument &TA = TAList[i]; const NamedDecl *ND = TPList->getParam(i); @@ -936,14 +936,14 @@ llvm::DIType CGDebugInfo::getOrCreateVTablePtrType(llvm::DIFile Unit) { } /// getVTableName - Get vtable name for the given Class. -llvm::StringRef CGDebugInfo::getVTableName(const CXXRecordDecl *RD) { +StringRef CGDebugInfo::getVTableName(const CXXRecordDecl *RD) { // Otherwise construct gdb compatible name name. std::string Name = "_vptr$" + RD->getNameAsString(); // Copy this name on the side and use its reference. char *StrPtr = DebugInfoNames.Allocate<char>(Name.length()); memcpy(StrPtr, Name.data(), Name.length()); - return llvm::StringRef(StrPtr, Name.length()); + return StringRef(StrPtr, Name.length()); } @@ -951,7 +951,7 @@ llvm::StringRef CGDebugInfo::getVTableName(const CXXRecordDecl *RD) { /// debug info entry in EltTys vector. void CGDebugInfo:: CollectVTableInfo(const CXXRecordDecl *RD, llvm::DIFile Unit, - llvm::SmallVectorImpl<llvm::Value *> &EltTys) { + SmallVectorImpl<llvm::Value *> &EltTys) { const ASTRecordLayout &RL = CGM.getContext().getASTRecordLayout(RD); // If there is a primary base then it will hold vtable info. @@ -1020,7 +1020,7 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty) { RegionMap[Ty->getDecl()] = llvm::WeakVH(FwdDecl); // Convert all the elements. - llvm::SmallVector<llvm::Value *, 16> EltTys; + SmallVector<llvm::Value *, 16> EltTys; const CXXRecordDecl *CXXDecl = dyn_cast<CXXRecordDecl>(RD); if (CXXDecl) { @@ -1040,7 +1040,7 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty) { // Create the descriptor for static variable. llvm::DIFile VUnit = getOrCreateFile(V->getLocation()); - llvm::StringRef VName = V->getName(); + StringRef VName = V->getName(); llvm::DIType VTy = getOrCreateType(V->getType(), VUnit); // Do not use DIGlobalVariable for enums. if (VTy.getTag() != llvm::dwarf::DW_TAG_enumeration_type) { @@ -1070,7 +1070,7 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty) { llvm::DIDescriptor RDContext = getContextDescriptor(cast<Decl>(RD->getDeclContext())); - llvm::StringRef RDName = RD->getName(); + StringRef RDName = RD->getName(); uint64_t Size = CGM.getContext().getTypeSize(Ty); uint64_t Align = CGM.getContext().getTypeAlign(Ty); llvm::DIArray Elements = DBuilder.getOrCreateArray(EltTys); @@ -1162,7 +1162,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, RegionMap[Ty->getDecl()] = llvm::WeakVH(FwdDecl); // Convert all the elements. - llvm::SmallVector<llvm::Value *, 16> EltTys; + SmallVector<llvm::Value *, 16> EltTys; ObjCInterfaceDecl *SClass = ID->getSuperClass(); if (SClass) { @@ -1185,7 +1185,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, if (!FieldTy.isValid()) return llvm::DIType(); - llvm::StringRef FieldName = Field->getName(); + StringRef FieldName = Field->getName(); // Ignore unnamed fields. if (FieldName.empty()) @@ -1217,9 +1217,9 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, else if (Field->getAccessControl() == ObjCIvarDecl::Private) Flags = llvm::DIDescriptor::FlagPrivate; - llvm::StringRef PropertyName; - llvm::StringRef PropertyGetter; - llvm::StringRef PropertySetter; + StringRef PropertyName; + StringRef PropertyGetter; + StringRef PropertySetter; unsigned PropertyAttributes = 0; if (ObjCPropertyDecl *PD = ID->FindPropertyVisibleInPrimaryClass(Field->getIdentifier())) { @@ -1322,7 +1322,7 @@ llvm::DIType CGDebugInfo::CreateType(const ArrayType *Ty, // Add the dimensions of the array. FIXME: This loses CV qualifiers from // interior arrays, do we care? Why aren't nested arrays represented the // obvious/recursive way? - llvm::SmallVector<llvm::Value *, 8> Subscripts; + SmallVector<llvm::Value *, 8> Subscripts; QualType EltTy(Ty, 0); if (Ty->isIncompleteArrayType()) EltTy = Ty->getElementType(); @@ -1395,7 +1395,7 @@ llvm::DIType CGDebugInfo::CreateType(const MemberPointerType *Ty, llvm::DIArray Elements = DBuilder.getOrCreateArray(ElementTypes); - return DBuilder.createStructType(U, llvm::StringRef("test"), + return DBuilder.createStructType(U, StringRef("test"), U, 0, FieldOffset, 0, 0, Elements); } @@ -1403,7 +1403,7 @@ llvm::DIType CGDebugInfo::CreateType(const MemberPointerType *Ty, /// CreateEnumType - get enumeration type. llvm::DIType CGDebugInfo::CreateEnumType(const EnumDecl *ED) { llvm::DIFile Unit = getOrCreateFile(ED->getLocation()); - llvm::SmallVector<llvm::Value *, 16> Enumerators; + SmallVector<llvm::Value *, 16> Enumerators; // Create DIEnumerator elements for each enumerator. for (EnumDecl::enumerator_iterator @@ -1582,7 +1582,7 @@ llvm::DIType CGDebugInfo::CreateTypeNode(QualType Ty, /// CreateMemberType - Create new member and increase Offset by FType's size. llvm::DIType CGDebugInfo::CreateMemberType(llvm::DIFile Unit, QualType FType, - llvm::StringRef Name, + StringRef Name, uint64_t *Offset) { llvm::DIType FieldTy = CGDebugInfo::getOrCreateType(FType, Unit); uint64_t FieldSize = CGM.getContext().getTypeSize(FType); @@ -1633,7 +1633,7 @@ llvm::DIType CGDebugInfo::getOrCreateFunctionType(const Decl * D, QualType FnTyp return getOrCreateMethodType(Method, F); else if (const ObjCMethodDecl *OMethod = dyn_cast<ObjCMethodDecl>(D)) { // Add "self" and "_cmd" - llvm::SmallVector<llvm::Value *, 16> Elts; + SmallVector<llvm::Value *, 16> Elts; // First element is always return type. For 'void' functions it is NULL. Elts.push_back(getOrCreateType(OMethod->getResultType(), F)); @@ -1658,8 +1658,8 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType, llvm::Function *Fn, CGBuilderTy &Builder) { - llvm::StringRef Name; - llvm::StringRef LinkageName; + StringRef Name; + StringRef LinkageName; FnBeginRegionCount.push_back(RegionStack.size()); @@ -1687,7 +1687,7 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType, if (!Fn->hasInternalLinkage()) LinkageName = CGM.getMangledName(GD); if (LinkageName == Name) - LinkageName = llvm::StringRef(); + LinkageName = StringRef(); if (FD->hasPrototype()) Flags |= llvm::DIDescriptor::FlagPrototyped; if (const NamespaceDecl *NSDecl = @@ -1847,7 +1847,7 @@ void CGDebugInfo::EmitFunctionEnd(CGBuilderTy &Builder) { llvm::DIType CGDebugInfo::EmitTypeForVarWithBlocksAttr(const ValueDecl *VD, uint64_t *XOffset) { - llvm::SmallVector<llvm::Value *, 5> EltTys; + SmallVector<llvm::Value *, 5> EltTys; QualType FType; uint64_t FieldSize, FieldOffset; unsigned FieldAlign; @@ -1951,11 +1951,11 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag, Flags |= llvm::DIDescriptor::FlagArtificial; llvm::MDNode *Scope = RegionStack.back(); - llvm::StringRef Name = VD->getName(); + StringRef Name = VD->getName(); if (!Name.empty()) { if (VD->hasAttr<BlocksAttr>()) { CharUnits offset = CharUnits::fromQuantity(32); - llvm::SmallVector<llvm::Value *, 9> addr; + SmallVector<llvm::Value *, 9> addr; llvm::Type *Int64Ty = llvm::Type::getInt64Ty(CGM.getLLVMContext()); addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIBuilder::OpPlus)); // offset of __forwarding field @@ -2006,7 +2006,7 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag, I != E; ++I) { FieldDecl *Field = *I; llvm::DIType FieldTy = getOrCreateType(Field->getType(), Unit); - llvm::StringRef FieldName = Field->getName(); + StringRef FieldName = Field->getName(); // Ignore unnamed fields. Do not ignore unnamed records. if (FieldName.empty() && !isa<RecordType>(Field->getType())) @@ -2063,7 +2063,7 @@ void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable( target.getStructLayout(blockInfo.StructureType) ->getElementOffset(blockInfo.getCapture(VD).getIndex())); - llvm::SmallVector<llvm::Value *, 9> addr; + SmallVector<llvm::Value *, 9> addr; llvm::Type *Int64Ty = llvm::Type::getInt64Ty(CGM.getLLVMContext()); addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIBuilder::OpPlus)); addr.push_back(llvm::ConstantInt::get(Int64Ty, offset.getQuantity())); @@ -2129,7 +2129,7 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block, const llvm::StructLayout *blockLayout = CGM.getTargetData().getStructLayout(block.StructureType); - llvm::SmallVector<llvm::Value*, 16> fields; + SmallVector<llvm::Value*, 16> fields; fields.push_back(createFieldType("__isa", C.VoidPtrTy, 0, loc, AS_public, blockLayout->getElementOffsetInBits(0), tunit, tunit)); @@ -2152,7 +2152,7 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block, // We want to sort the captures by offset, not because DWARF // requires this, but because we're paranoid about debuggers. - llvm::SmallVector<BlockLayoutChunk, 8> chunks; + SmallVector<BlockLayoutChunk, 8> chunks; // 'this' capture. if (blockDecl->capturesCXXThis()) { @@ -2185,7 +2185,7 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block, // Sort by offset. llvm::array_pod_sort(chunks.begin(), chunks.end()); - for (llvm::SmallVectorImpl<BlockLayoutChunk>::iterator + for (SmallVectorImpl<BlockLayoutChunk>::iterator i = chunks.begin(), e = chunks.end(); i != e; ++i) { uint64_t offsetInBits = i->OffsetInBits; const BlockDecl::Capture *capture = i->Capture; @@ -2202,7 +2202,7 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block, } const VarDecl *variable = capture->getVariable(); - llvm::StringRef name = variable->getName(); + StringRef name = variable->getName(); llvm::DIType fieldType; if (capture->isByRef()) { @@ -2238,7 +2238,7 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block, // Get overall information about the block. unsigned flags = llvm::DIDescriptor::FlagArtificial; llvm::MDNode *scope = RegionStack.back(); - llvm::StringRef name = ".block_descriptor"; + StringRef name = ".block_descriptor"; // Create the descriptor for the parameter. llvm::DIVariable debugVar = @@ -2275,13 +2275,13 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var, T = CGM.getContext().getConstantArrayType(ET, ConstVal, ArrayType::Normal, 0); } - llvm::StringRef DeclName = D->getName(); - llvm::StringRef LinkageName; + StringRef DeclName = D->getName(); + StringRef LinkageName; if (D->getDeclContext() && !isa<FunctionDecl>(D->getDeclContext()) && !isa<ObjCMethodDecl>(D->getDeclContext())) LinkageName = Var->getName(); if (LinkageName == DeclName) - LinkageName = llvm::StringRef(); + LinkageName = StringRef(); llvm::DIDescriptor DContext = getContextDescriptor(dyn_cast<Decl>(D->getDeclContext())); DBuilder.createStaticVariable(DContext, DeclName, LinkageName, @@ -2296,7 +2296,7 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var, llvm::DIFile Unit = getOrCreateFile(ID->getLocation()); unsigned LineNo = getLineNumber(ID->getLocation()); - llvm::StringRef Name = ID->getName(); + StringRef Name = ID->getName(); QualType T = CGM.getContext().getObjCInterfaceType(ID); if (T->isIncompleteArrayType()) { @@ -2321,7 +2321,7 @@ void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD, llvm::Constant *Init) { // Create the descriptor for the variable. llvm::DIFile Unit = getOrCreateFile(VD->getLocation()); - llvm::StringRef Name = VD->getName(); + StringRef Name = VD->getName(); llvm::DIType Ty = getOrCreateType(VD->getType(), Unit); if (const EnumConstantDecl *ECD = dyn_cast<EnumConstantDecl>(VD)) { if (const EnumDecl *ED = dyn_cast<EnumDecl>(ECD->getDeclContext())) diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp index b9e4e7dffd..9b22c7f956 100644 --- a/lib/CodeGen/CGDecl.cpp +++ b/lib/CodeGen/CGDecl.cpp @@ -139,7 +139,7 @@ static std::string GetStaticDeclName(CodeGenFunction &CGF, const VarDecl &D, const char *Separator) { CodeGenModule &CGM = CGF.CGM; if (CGF.getContext().getLangOptions().CPlusPlus) { - llvm::StringRef Name = CGM.getMangledName(&D); + StringRef Name = CGM.getMangledName(&D); return Name.str(); } @@ -156,7 +156,7 @@ static std::string GetStaticDeclName(CodeGenFunction &CGF, const VarDecl &D, else assert(0 && "Unknown context for block static var decl"); } else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(CGF.CurFuncDecl)) { - llvm::StringRef Name = CGM.getMangledName(FD); + StringRef Name = CGM.getMangledName(FD); ContextName = Name.str(); } else if (isa<ObjCMethodDecl>(CGF.CurFuncDecl)) ContextName = CGF.CurFn->getName(); @@ -1267,7 +1267,7 @@ static void emitPartialArrayDestroy(CodeGenFunction &CGF, if (arrayDepth) { llvm::Value *zero = llvm::ConstantInt::get(CGF.SizeTy, arrayDepth+1); - llvm::SmallVector<llvm::Value*,4> gepIndices(arrayDepth, zero); + SmallVector<llvm::Value*,4> gepIndices(arrayDepth, zero); begin = CGF.Builder.CreateInBoundsGEP(begin, gepIndices, "pad.arraybegin"); end = CGF.Builder.CreateInBoundsGEP(end, gepIndices, "pad.arrayend"); } diff --git a/lib/CodeGen/CGDeclCXX.cpp b/lib/CodeGen/CGDeclCXX.cpp index 1df8768d53..f9f5e86bef 100644 --- a/lib/CodeGen/CGDeclCXX.cpp +++ b/lib/CodeGen/CGDeclCXX.cpp @@ -168,7 +168,7 @@ void CodeGenFunction::EmitCXXGuardedInit(const VarDecl &D, static llvm::Function * CreateGlobalInitOrDestructFunction(CodeGenModule &CGM, llvm::FunctionType *FTy, - llvm::StringRef Name) { + StringRef Name) { llvm::Function *Fn = llvm::Function::Create(FTy, llvm::GlobalValue::InternalLinkage, Name, &CGM.getModule()); @@ -234,7 +234,7 @@ CodeGenModule::EmitCXXGlobalInitFunc() { CreateGlobalInitOrDestructFunction(*this, FTy, "_GLOBAL__I_a"); if (!PrioritizedCXXGlobalInits.empty()) { - llvm::SmallVector<llvm::Constant*, 8> LocalCXXGlobalInits; + SmallVector<llvm::Constant*, 8> LocalCXXGlobalInits; llvm::array_pod_sort(PrioritizedCXXGlobalInits.begin(), PrioritizedCXXGlobalInits.end()); for (unsigned i = 0; i < PrioritizedCXXGlobalInits.size(); i++) { diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp index 5ce9c35581..fd2684c51e 100644 --- a/lib/CodeGen/CGException.cpp +++ b/lib/CodeGen/CGException.cpp @@ -131,7 +131,7 @@ static llvm::Constant *getTerminateFn(CodeGenFunction &CGF) { llvm::FunctionType *FTy = llvm::FunctionType::get(CGF.VoidTy, /*IsVarArgs=*/false); - llvm::StringRef name; + StringRef name; // In C++, use std::terminate(). if (CGF.getLangOptions().CPlusPlus) @@ -145,7 +145,7 @@ static llvm::Constant *getTerminateFn(CodeGenFunction &CGF) { } static llvm::Constant *getCatchallRethrowFn(CodeGenFunction &CGF, - llvm::StringRef Name) { + StringRef Name) { llvm::Type *ArgTys[] = { CGF.Int8PtrTy }; llvm::FunctionType *FTy = llvm::FunctionType::get(CGF.VoidTy, ArgTys, /*IsVarArgs=*/false); @@ -665,7 +665,7 @@ llvm::BasicBlock *CodeGenFunction::EmitLandingPad() { Builder.CreateStore(Exn, getExceptionSlot()); // Build the selector arguments. - llvm::SmallVector<llvm::Value*, 8> EHSelector; + SmallVector<llvm::Value*, 8> EHSelector; EHSelector.push_back(Exn); EHSelector.push_back(getOpaquePersonalityFn(CGM, Personality)); @@ -674,7 +674,7 @@ llvm::BasicBlock *CodeGenFunction::EmitLandingPad() { UnwindDest CatchAll; bool HasEHCleanup = false; bool HasEHFilter = false; - llvm::SmallVector<llvm::Value*, 8> EHFilters; + SmallVector<llvm::Value*, 8> EHFilters; for (EHScopeStack::iterator I = EHStack.begin(), E = EHStack.end(); I != E; ++I) { @@ -1153,7 +1153,7 @@ void CodeGenFunction::ExitCXXTryStmt(const CXXTryStmt &S, bool IsFnTryBlock) { // Copy the handler blocks off before we pop the EH stack. Emitting // the handlers might scribble on this memory. - llvm::SmallVector<EHCatchScope::Handler, 8> Handlers(NumHandlers); + SmallVector<EHCatchScope::Handler, 8> Handlers(NumHandlers); memcpy(Handlers.data(), CatchScope.begin(), NumHandlers * sizeof(EHCatchScope::Handler)); EHStack.popCatch(); @@ -1464,7 +1464,7 @@ CodeGenFunction::UnwindDest CodeGenFunction::getRethrowDest() { // This can always be a call because we necessarily didn't find // anything on the EH stack which needs our help. - llvm::StringRef RethrowName = Personality.getCatchallRethrowFnName(); + StringRef RethrowName = Personality.getCatchallRethrowFnName(); if (!RethrowName.empty()) { Builder.CreateCall(getCatchallRethrowFn(*this, RethrowName), Builder.CreateLoad(getExceptionSlot())) diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index c030e2bf0b..7fcd404713 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -45,7 +45,7 @@ llvm::Value *CodeGenFunction::EmitCastToVoidPtr(llvm::Value *value) { /// CreateTempAlloca - This creates a alloca and inserts it into the entry /// block. llvm::AllocaInst *CodeGenFunction::CreateTempAlloca(llvm::Type *Ty, - const llvm::Twine &Name) { + const Twine &Name) { if (!Builder.isNamePreserving()) return new llvm::AllocaInst(Ty, 0, "", AllocaInsertPt); return new llvm::AllocaInst(Ty, 0, Name, AllocaInsertPt); @@ -59,7 +59,7 @@ void CodeGenFunction::InitTempAlloca(llvm::AllocaInst *Var, } llvm::AllocaInst *CodeGenFunction::CreateIRTemp(QualType Ty, - const llvm::Twine &Name) { + const Twine &Name) { llvm::AllocaInst *Alloc = CreateTempAlloca(ConvertType(Ty), Name); // FIXME: Should we prefer the preferred type alignment here? CharUnits Align = getContext().getTypeAlignInChars(Ty); @@ -68,7 +68,7 @@ llvm::AllocaInst *CodeGenFunction::CreateIRTemp(QualType Ty, } llvm::AllocaInst *CodeGenFunction::CreateMemTemp(QualType Ty, - const llvm::Twine &Name) { + const Twine &Name) { llvm::AllocaInst *Alloc = CreateTempAlloca(ConvertTypeForMem(Ty), Name); // FIXME: Should we prefer the preferred type alignment here? CharUnits Align = getContext().getTypeAlignInChars(Ty); @@ -310,7 +310,7 @@ EmitExprForReferenceBinding(CodeGenFunction &CGF, const Expr *E, return ReferenceTemporary; } - llvm::SmallVector<SubobjectAdjustment, 2> Adjustments; + SmallVector<SubobjectAdjustment, 2> Adjustments; while (true) { E = E->IgnoreParens(); @@ -921,7 +921,7 @@ RValue CodeGenFunction::EmitLoadOfExtVectorElementLValue(LValue LV) { // Always use shuffle vector to try to retain the original program structure unsigned NumResultElts = ExprVT->getNumElements(); - llvm::SmallVector<llvm::Constant*, 4> Mask; + SmallVector<llvm::Constant*, 4> Mask; for (unsigned i = 0; i != NumResultElts; ++i) { unsigned InIdx = getAccessedFieldNo(i, Elts); Mask.push_back(llvm::ConstantInt::get(Int32Ty, InIdx)); @@ -1147,7 +1147,7 @@ void CodeGenFunction::EmitStoreThroughExtVectorComponentLValue(RValue Src, // Use shuffle vector is the src and destination are the same number of // elements and restore the vector mask since it is on the side it will be // stored. - llvm::SmallVector<llvm::Constant*, 4> Mask(NumDstElts); + SmallVector<llvm::Constant*, 4> Mask(NumDstElts); for (unsigned i = 0; i != NumSrcElts; ++i) { unsigned InIdx = getAccessedFieldNo(i, Elts); Mask[InIdx] = llvm::ConstantInt::get(Int32Ty, i); @@ -1162,7 +1162,7 @@ void CodeGenFunction::EmitStoreThroughExtVectorComponentLValue(RValue Src, // into the destination. // FIXME: since we're shuffling with undef, can we just use the indices // into that? This could be simpler. - llvm::SmallVector<llvm::Constant*, 4> ExtMask; + SmallVector<llvm::Constant*, 4> ExtMask; unsigned i; for (i = 0; i != NumSrcElts; ++i) ExtMask.push_back(llvm::ConstantInt::get(Int32Ty, i)); @@ -1174,7 +1174,7 @@ void CodeGenFunction::EmitStoreThroughExtVectorComponentLValue(RValue Src, llvm::UndefValue::get(SrcVal->getType()), ExtMaskV, "tmp"); // build identity - llvm::SmallVector<llvm::Constant*, 4> Mask; + SmallVector<llvm::Constant*, 4> Mask; for (unsigned i = 0; i != NumDstElts; ++i) Mask.push_back(llvm::ConstantInt::get(Int32Ty, i)); @@ -1290,7 +1290,7 @@ static void setObjCGCLValueClass(const ASTContext &Ctx, const Expr *E, static llvm::Value * EmitBitCastOfLValueToProperType(CodeGenFunction &CGF, llvm::Value *V, llvm::Type *IRType, - llvm::StringRef Name = llvm::StringRef()) { + StringRef Name = StringRef()) { unsigned AS = cast<llvm::PointerType>(V->getType())->getAddressSpace(); return CGF.Builder.CreateBitCast(V, IRType->getPointerTo(AS), Name); } @@ -1486,7 +1486,7 @@ LValue CodeGenFunction::EmitPredefinedLValue(const PredefinedExpr *E) { break; } - llvm::StringRef FnName = CurFn->getName(); + StringRef FnName = CurFn->getName(); if (FnName.startswith("\01")) FnName = FnName.substr(1); GlobalVarName += FnName; @@ -1681,8 +1681,8 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E) { static llvm::Constant *GenerateConstantVector(llvm::LLVMContext &VMContext, - llvm::SmallVector<unsigned, 4> &Elts) { - llvm::SmallVector<llvm::Constant*, 4> CElts; + SmallVector<unsigned, 4> &Elts) { + SmallVector<llvm::Constant*, 4> CElts; llvm::Type *Int32Ty = llvm::Type::getInt32Ty(VMContext); for (unsigned i = 0, e = Elts.size(); i != e; ++i) @@ -1725,7 +1725,7 @@ EmitExtVectorElementExpr(const ExtVectorElementExpr *E) { E->getType().withCVRQualifiers(Base.getQuals().getCVRQualifiers()); // Encode the element access list into a vector of unsigned indices. - llvm::SmallVector<unsigned, 4> Indices; + SmallVector<unsigned, 4> Indices; E->getEncodedElementAccess(Indices); if (Base.isSimple()) { @@ -1735,7 +1735,7 @@ EmitExtVectorElementExpr(const ExtVectorElementExpr *E) { assert(Base.isExtVectorElt() && "Can only subscript lvalue vec elts here!"); llvm::Constant *BaseElts = Base.getExtVectorElts(); - llvm::SmallVector<llvm::Constant *, 4> CElts; + SmallVector<llvm::Constant *, 4> CElts; for (unsigned i = 0, e = Indices.size(); i != e; ++i) { if (isa<llvm::ConstantAggregateZero>(BaseElts)) diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 2579614809..245640bfcf 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -839,7 +839,7 @@ void AggExprEmitter::VisitInitListExpr(InitListExpr *E) { // We'll need to enter cleanup scopes in case any of the member // initializers throw an exception. - llvm::SmallVector<EHScopeStack::stable_iterator, 16> cleanups; + SmallVector<EHScopeStack::stable_iterator, 16> cleanups; // Here we iterate over the fields; this makes it simpler to both // default-initialize fields and skip over unnamed fields. diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp index 9a0eafeae8..7967c822b3 100644 --- a/lib/CodeGen/CGExprCXX.cpp +++ b/lib/CodeGen/CGExprCXX.cpp @@ -1406,7 +1406,7 @@ void CodeGenFunction::EmitCXXDeleteExpr(const CXXDeleteExpr *E) { QualType DeleteTy = Arg->getType()->getAs<PointerType>()->getPointeeType(); if (DeleteTy->isConstantArrayType()) { llvm::Value *Zero = Builder.getInt32(0); - llvm::SmallVector<llvm::Value*,8> GEP; + SmallVector<llvm::Value*,8> GEP; GEP.push_back(Zero); // point at the outermost array diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index b900e1f9c6..006cf5bf99 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -1030,7 +1030,7 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E, return llvm::ConstantStruct::get(STy, Complex); } case APValue::Vector: { - llvm::SmallVector<llvm::Constant *, 4> Inits; + SmallVector<llvm::Constant *, 4> Inits; unsigned NumElts = Result.Val.getVectorLength(); if (Context.getLangOptions().AltiVec && diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 3eebbaa9a8..524d79e131 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -595,7 +595,7 @@ Value *ScalarExprEmitter::EmitScalarConversion(Value *Src, QualType SrcType, UnV = Builder.CreateInsertElement(UnV, Elt, Idx, "tmp"); // Splat the element across to all elements - llvm::SmallVector<llvm::Constant*, 16> Args; + SmallVector<llvm::Constant*, 16> Args; unsigned NumElements = cast<llvm::VectorType>(DstTy)->getNumElements(); for (unsigned i = 0; i != NumElements; ++i) Args.push_back(Builder.getInt32(0)); @@ -693,7 +693,7 @@ Value *ScalarExprEmitter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) { Mask = CGF.EmitScalarExpr(E->getExpr(2)); // Shuffle LHS & RHS into one input vector. - llvm::SmallVector<llvm::Constant*, 32> concat; + SmallVector<llvm::Constant*, 32> concat; for (unsigned i = 0; i != LHSElts; ++i) { concat.push_back(Builder.getInt32(2*i)); concat.push_back(Builder.getInt32(2*i+1)); @@ -721,7 +721,7 @@ Value *ScalarExprEmitter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) { (1 << llvm::Log2_32(LHSElts))-1); // Mask off the high bits of each shuffle index. - llvm::SmallVector<llvm::Constant *, 32> MaskV; + SmallVector<llvm::Constant *, 32> MaskV; for (unsigned i = 0, e = MTy->getNumElements(); i != e; ++i) MaskV.push_back(EltMask); @@ -761,7 +761,7 @@ Value *ScalarExprEmitter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) { // Handle vec3 special since the index will be off by one for the RHS. llvm::VectorType *VTy = cast<llvm::VectorType>(V1->getType()); - llvm::SmallVector<llvm::Constant*, 32> indices; + SmallVector<llvm::Constant*, 32> indices; for (unsigned i = 2; i < E->getNumSubExprs(); i++) { unsigned Idx = E->getShuffleMaskIdx(CGF.getContext(), i-2); if (VTy->getNumElements() == 3 && Idx > 3) @@ -851,7 +851,7 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) { for (unsigned i = 0; i != NumInitElements; ++i) { Expr *IE = E->getInit(i); Value *Init = Visit(IE); - llvm::SmallVector<llvm::Constant*, 16> Args; + SmallVector<llvm::Constant*, 16> Args; llvm::VectorType *VVT = dyn_cast<llvm::VectorType>(Init->getType()); @@ -1174,7 +1174,7 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { UnV = Builder.CreateInsertElement(UnV, Elt, Idx, "tmp"); // Splat the element across to all elements - llvm::SmallVector<llvm::Constant*, 16> Args; + SmallVector<llvm::Constant*, 16> Args; unsigned NumElements = cast<llvm::VectorType>(DstTy)->getNumElements(); llvm::Constant *Zero = Builder.getInt32(0); for (unsigned i = 0; i < NumElements; i++) @@ -2610,7 +2610,7 @@ Value *ScalarExprEmitter::VisitAsTypeExpr(AsTypeExpr *E) { llvm::Value *UnV = llvm::UndefValue::get(Src->getType()); - llvm::SmallVector<llvm::Constant*, 3> Args; + SmallVector<llvm::Constant*, 3> Args; Args.push_back(Builder.getInt32(0)); Args.push_back(Builder.getInt32(1)); Args.push_back(Builder.getInt32(2)); diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp index 8e3532659d..c817115cbe 100644 --- a/lib/CodeGen/CGObjC.cpp +++ b/lib/CodeGen/CGObjC.cpp @@ -810,7 +810,7 @@ void CodeGenFunction::GenerateObjCCtorDtorMethod(ObjCImplementationDecl *IMP, // Suppress the final autorelease in ARC. AutoreleaseResult = false; - llvm::SmallVector<CXXCtorInitializer *, 8> IvarInitializers; + SmallVector<CXXCtorInitializer *, 8> IvarInitializers; for (ObjCImplementationDecl::init_const_iterator B = IMP->init_begin(), E = IMP->init_end(); B != E; ++B) { CXXCtorInitializer *IvarInit = (*B); @@ -1329,7 +1329,7 @@ llvm::Value *CodeGenFunction::EmitObjCExtendObjectLifetime(QualType type, static llvm::Constant *createARCRuntimeFunction(CodeGenModule &CGM, llvm::FunctionType *type, - llvm::StringRef fnName) { + StringRef fnName) { llvm::Constant *fn = CGM.CreateRuntimeFunction(type, fnName); // In -fobjc-no-arc-runtime, emit weak references to the runtime @@ -1347,7 +1347,7 @@ static llvm::Constant *createARCRuntimeFunction(CodeGenModule &CGM, static llvm::Value *emitARCValueOperation(CodeGenFunction &CGF, llvm::Value *value, llvm::Constant *&fn, - llvm::StringRef fnName) { + StringRef fnName) { if (isa<llvm::ConstantPointerNull>(value)) return value; if (!fn) { @@ -1374,7 +1374,7 @@ static llvm::Value *emitARCValueOperation(CodeGenFunction &CGF, static llvm::Value *emitARCLoadOperation(CodeGenFunction &CGF, llvm::Value *addr, llvm::Constant *&fn, - llvm::StringRef fnName) { + StringRef fnName) { if (!fn) { std::vector<llvm::Type*> args(1, CGF.Int8PtrPtrTy); llvm::FunctionType *fnType = @@ -1405,7 +1405,7 @@ static llvm::Value *emitARCStoreOperation(CodeGenFunction &CGF, llvm::Value *addr, llvm::Value *value, llvm::Constant *&fn, - llvm::StringRef fnName, + StringRef fnName, bool ignored) { assert(cast<llvm::PointerType>(addr->getType())->getElementType() == value->getType()); @@ -1439,7 +1439,7 @@ static void emitARCCopyOperation(CodeGenFunction &CGF, llvm::Value *dst, llvm::Value *src, llvm::Constant *&fn, - llvm::StringRef fnName) { + StringRef fnName) { assert(dst->getType() == src->getType()); if (!fn) { @@ -1494,7 +1494,7 @@ CodeGenFunction::EmitARCRetainAutoreleasedReturnValue(llvm::Value *value) { llvm::InlineAsm *&marker = CGM.getARCEntrypoints().retainAutoreleasedReturnValueMarker; if (!marker) { - llvm::StringRef assembly + StringRef assembly = CGM.getTargetCodeGenInfo() .getARCRetainAutoreleasedReturnValueMarker(); @@ -1555,7 +1555,7 @@ void CodeGenFunction::EmitARCRelease(llvm::Value *value, bool precise) { call->setDoesNotThrow(); if (!precise) { - llvm::SmallVector<llvm::Value*,1> args; + SmallVector<llvm::Value*,1> args; call->setMetadata("clang.imprecise_release", llvm::MDNode::get(Builder.getContext(), args)); } diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp index af36fb54c4..ba38bfa706 100644 --- a/lib/CodeGen/CGObjCGNU.cpp +++ b/lib/CodeGen/CGObjCGNU.cpp @@ -36,12 +36,11 @@ #include "llvm/Support/Compiler.h" #include "llvm/Target/TargetData.h" -#include <stdarg.h> +#include <cstdarg> using namespace clang; using namespace CodeGen; -using llvm::dyn_cast; namespace { @@ -193,7 +192,7 @@ protected: /// first argument. llvm::GlobalVariable *MakeGlobal(llvm::StructType *Ty, std::vector<llvm::Constant*> &V, - llvm::StringRef Name="", + StringRef Name="", llvm::GlobalValue::LinkageTypes linkage =llvm::GlobalValue::InternalLinkage) { llvm::Constant *C = llvm::ConstantStruct::get(Ty, V); @@ -205,7 +204,7 @@ protected: /// element type. llvm::GlobalVariable *MakeGlobal(llvm::ArrayType *Ty, std::vector<llvm::Constant*> &V, - llvm::StringRef Name="", + StringRef Name="", llvm::GlobalValue::LinkageTypes linkage =llvm::GlobalValue::InternalLinkage) { llvm::Constant *C = llvm::ConstantArray::get(Ty, V); @@ -216,7 +215,7 @@ protected: /// element type and the size of the initialiser. llvm::GlobalVariable *MakeGlobalArray(llvm::Type *Ty, std::vector<llvm::Constant*> &V, - llvm::StringRef Name="", + StringRef Name="", llvm::GlobalValue::LinkageTypes linkage =llvm::GlobalValue::InternalLinkage) { llvm::ArrayType *ArrayTy = llvm::ArrayType::get(Ty, V.size()); @@ -268,7 +267,7 @@ private: /// Type of the selector map. This is roughly equivalent to the structure /// used in the GNUstep runtime, which maintains a list of all of the valid /// types for a selector in a table. - typedef llvm::DenseMap<Selector, llvm::SmallVector<TypedSelector, 2> > + typedef llvm::DenseMap<Selector, SmallVector<TypedSelector, 2> > SelectorMap; /// A map from selectors to selector types. This allows us to emit all /// selectors of the same name and type together. @@ -332,18 +331,18 @@ private: /// metadata. This is used purely for introspection in the fragile ABI. In /// the non-fragile ABI, it's used for instance variable fixup. llvm::Constant *GenerateIvarList( - const llvm::SmallVectorImpl<llvm::Constant *> &IvarNames, - const llvm::SmallVectorImpl<llvm::Constant *> &IvarTypes, - const llvm::SmallVectorImpl<llvm::Constant *> &IvarOffsets); + const SmallVectorImpl<llvm::Constant *> &IvarNames, + const SmallVectorImpl<llvm::Constant *> &IvarTypes, + const SmallVectorImpl<llvm::Constant *> &IvarOffsets); /// Generates a method list structure. This is a structure containing a size /// and an array of structures containing method metadata. /// /// This structure is used by both classes and categories, and contains a next /// pointer allowing them to be chained together in a linked list. - llvm::Constant *GenerateMethodList(const llvm::StringRef &ClassName, - const llvm::StringRef &CategoryName, - const llvm::SmallVectorImpl<Selector> &MethodSels, - const llvm::SmallVectorImpl<llvm::Constant *> &MethodTypes, + llvm::Constant *GenerateMethodList(const StringRef &ClassName, + const StringRef &CategoryName, + const SmallVectorImpl<Selector> &MethodSels, + const SmallVectorImpl<llvm::Constant *> &MethodTypes, bool isClassMethodList); /// Emits an empty protocol. This is used for @protocol() where no protocol /// is found. The runtime will (hopefully) fix up the pointer to refer to the @@ -352,12 +351,12 @@ private: /// Generates a list of property metadata structures. This follows the same /// pattern as method and instance variable metadata lists. llvm::Constant *GeneratePropertyList(const ObjCImplementationDecl *OID, - llvm::SmallVectorImpl<Selector> &InstanceMethodSels, - llvm::SmallVectorImpl<llvm::Constant*> &InstanceMethodTypes); + SmallVectorImpl<Selector> &InstanceMethodSels, + SmallVectorImpl<llvm::Constant*> &InstanceMethodTypes); /// Generates a list of referenced protocols. Classes, categories, and /// protocols all use this structure. llvm::Constant *GenerateProtocolList( - const llvm::SmallVectorImpl<std::string> &Protocols); + const SmallVectorImpl<std::string> &Protocols); /// To ensure that all protocols are seen by the runtime, we add a category on /// a class defined in the runtime, declaring no methods, but adopting the /// protocols. This is a horribly ugly hack, but it allows us to collect all @@ -380,8 +379,8 @@ private: /// Generates a method list. This is used by protocols to define the required /// and optional methods. llvm::Constant *GenerateProtocolMethodList( - const llvm::SmallVectorImpl<llvm::Constant *> &MethodNames, - const llvm::SmallVectorImpl<llvm::Constant *> &MethodTypes); + const SmallVectorImpl<llvm::Constant *> &MethodNames, + const SmallVectorImpl<llvm::Constant *> &MethodTypes); /// Returns a selector with the specified type encoding. An empty string is /// used to return an untyped selector (with the types field set to NULL). llvm::Value *GetSelector(CGBuilderTy &Builder, Selector Sel, @@ -650,13 +649,13 @@ void CGObjCGNU::EmitClassRef(const std::string &className) { llvm::GlobalValue::WeakAnyLinkage, ClassSymbol, symbolRef); } -static std::string SymbolNameForMethod(const llvm::StringRef &ClassName, - const llvm::StringRef &CategoryName, const Selector MethodName, +static std::string SymbolNameForMethod(const StringRef &ClassName, + const StringRef &CategoryName, const Selector MethodName, bool isClassMethod) { std::string MethodNameColonStripped = MethodName.getAsString(); std::replace(MethodNameColonStripped.begin(), MethodNameColonStripped.end(), ':', '_'); - return (llvm::Twine(isClassMethod ? "_c_" : "_i_") + ClassName + "_" + + return (Twine(isClassMethod ? "_c_" : "_i_") + ClassName + "_" + CategoryName + "_" + MethodNameColonStripped).str(); } @@ -813,11 +812,11 @@ llvm::Value *CGObjCGNU::EmitNSAutoreleasePoolClassRef(CGBuilderTy &Builder) { llvm::Value *CGObjCGNU::GetSelector(CGBuilderTy &Builder, Selector Sel, const std::string &TypeEncoding, bool lval) { - llvm::SmallVector<TypedSelector, 2> &Types = SelectorTable[Sel]; + SmallVector<TypedSelector, 2> &Types = SelectorTable[Sel]; llvm::GlobalAlias *SelValue = 0; - for (llvm::SmallVectorImpl<TypedSelector>::iterator i = Types.begin(), + for (SmallVectorImpl<TypedSelector>::iterator i = Types.begin(), e = Types.end() ; i!=e ; i++) { if (i->first == TypeEncoding) { SelValue = i->second; @@ -1201,10 +1200,10 @@ CGObjCGNU::GenerateMessageSend(CodeGenFunction &CGF, /// Generates a MethodList. Used in construction of a objc_class and /// objc_category structures. -llvm::Constant *CGObjCGNU::GenerateMethodList(const llvm::StringRef &ClassName, - const llvm::StringRef &CategoryName, - const llvm::SmallVectorImpl<Selector> &MethodSels, - const llvm::SmallVectorImpl<llvm::Constant *> &MethodTypes, +llvm::Constant *CGObjCGNU::GenerateMethodList(const StringRef &ClassName, + const StringRef &CategoryName, + const SmallVectorImpl<Selector> &MethodSels, + const SmallVectorImpl<llvm::Constant *> &MethodTypes, bool isClassMethodList) { if (MethodSels.empty()) return NULLPtr; @@ -1261,9 +1260,9 @@ llvm::Constant *CGObjCGNU::GenerateMethodList(const llvm::StringRef &ClassName, /// Generates an IvarList. Used in construction of a objc_class. llvm::Constant *CGObjCGNU::GenerateIvarList( - const llvm::SmallVectorImpl<llvm::Constant *> &IvarNames, - const llvm::SmallVectorImpl<llvm::Constant *> &IvarTypes, - const llvm::SmallVectorImpl<llvm::Constant *> &IvarOffsets) { + const SmallVectorImpl<llvm::Constant *> &IvarNames, + const SmallVectorImpl<llvm::Constant *> &IvarTypes, + const SmallVectorImpl<llvm::Constant *> &IvarOffsets) { if (IvarNames.size() == 0) return NULLPtr; // Get the method structure type. @@ -1374,8 +1373,8 @@ llvm::Constant *CGObjCGNU::GenerateClassStructure( } llvm::Constant *CGObjCGNU::GenerateProtocolMethodList( - const llvm::SmallVectorImpl<llvm::Constant *> &MethodNames, - const llvm::SmallVectorImpl<llvm::Constant *> &MethodTypes) { + const SmallVectorImpl<llvm::Constant *> &MethodNames, + const SmallVectorImpl<llvm::Constant *> &MethodTypes) { // Get the method structure type. llvm::StructType *ObjCMethodDescTy = llvm::StructType::get( PtrToInt8Ty, // Really a selector, but the runtime does the casting for us. @@ -1403,7 +1402,7 @@ llvm::Constant *CGObjCGNU::GenerateProtocolMethodList( // Create the protocol list structure used in classes, categories and so on llvm::Constant *CGObjCGNU::GenerateProtocolList( - const llvm::SmallVectorImpl<std::string> &Protocols) { + const SmallVectorImpl<std::string> &Protocols) { llvm::ArrayType *ProtocolArrayTy = llvm::ArrayType::get(PtrToInt8Ty, Protocols.size()); llvm::StructType *ProtocolListTy = llvm::StructType::get( @@ -1445,8 +1444,8 @@ llvm::Value *CGObjCGNU::GenerateProtocolRef(CGBuilderTy &Builder, llvm::Constant *CGObjCGNU::GenerateEmptyProtocol( const std::string &ProtocolName) { - llvm::SmallVector<std::string, 0> EmptyStringVector; - llvm::SmallVector<llvm::Constant*, 0> EmptyConstantVector; + SmallVector<std::string, 0> EmptyStringVector; + SmallVector<llvm::Constant*, 0> EmptyConstantVector; llvm::Constant *ProtocolList = GenerateProtocolList(EmptyStringVector); llvm::Constant *MethodList = @@ -1479,14 +1478,14 @@ llvm::Constant *CGObjCGNU::GenerateEmptyProtocol( void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) { ASTContext &Context = CGM.getContext(); std::string ProtocolName = PD->getNameAsString(); - llvm::SmallVector<std::string, 16> Protocols; + SmallVector<std::string, 16> Protocols; for (ObjCProtocolDecl::protocol_iterator PI = PD->protocol_begin(), E = PD->protocol_end(); PI != E; ++PI) Protocols.push_back((*PI)->getNameAsString()); - llvm::SmallVector<llvm::Constant*, 16> InstanceMethodNames; - llvm::SmallVector<llvm::Constant*, 16> InstanceMethodTypes; - llvm::SmallVector<llvm::Constant*, 16> OptionalInstanceMethodNames; - llvm::SmallVector<llvm::Constant*, 16> OptionalInstanceMethodTypes; + SmallVector<llvm::Constant*, 16> InstanceMethodNames; + SmallVector<llvm::Constant*, 16> InstanceMethodTypes; + SmallVector<llvm::Constant*, 16> OptionalInstanceMethodNames; + SmallVector<llvm::Constant*, 16> OptionalInstanceMethodTypes; for (ObjCProtocolDecl::instmeth_iterator iter = PD->instmeth_begin(), E = PD->instmeth_end(); iter != E; iter++) { std::string TypeStr; @@ -1502,10 +1501,10 @@ void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) { } } // Collect information about class methods: - llvm::SmallVector<llvm::Constant*, 16> ClassMethodNames; - llvm::SmallVector<llvm::Constant*, 16> ClassMethodTypes; - llvm::SmallVector<llvm::Constant*, 16> OptionalClassMethodNames; - llvm::SmallVector<llvm::Constant*, 16> OptionalClassMethodTypes; + SmallVector<llvm::Constant*, 16> ClassMethodNames; + SmallVector<llvm::Constant*, 16> ClassMethodTypes; + SmallVector<llvm::Constant*, 16> OptionalClassMethodNames; + SmallVector<llvm::Constant*, 16> OptionalClassMethodTypes; for (ObjCProtocolDecl::classmeth_iterator iter = PD->classmeth_begin(), endIter = PD->classmeth_end(); iter != endIter ; iter++) { @@ -1642,8 +1641,8 @@ void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) { } void CGObjCGNU::GenerateProtocolHolderCategory(void) { // Collect information about instance methods - llvm::SmallVector<Selector, 1> MethodSels; - llvm::SmallVector<llvm::Constant*, 1> MethodTypes; + SmallVector<Selector, 1> MethodSels; + SmallVector<llvm::Constant*, 1> MethodTypes; std::vector<llvm::Constant*> Elements; const std::string ClassName = "__ObjC_Protocol_Holder_Ugly_Hack"; @@ -1690,8 +1689,8 @@ void CGObjCGNU::GenerateCategory(const ObjCCategoryImplDecl *OCD) { std::string ClassName = OCD->getClassInterface()->getNameAsString(); std::string CategoryName = OCD->getNameAsString(); // Collect information about instance methods - llvm::SmallVector<Selector, 16> InstanceMethodSels; - llvm::SmallVector<llvm::Constant*, 16> InstanceMethodTypes; + SmallVector<Selector, 16> InstanceMethodSels; + SmallVector<llvm::Constant*, 16> InstanceMethodTypes; for (ObjCCategoryImplDecl::instmeth_iterator iter = OCD->instmeth_begin(), endIter = OCD->instmeth_end(); iter != endIter ; iter++) { @@ -1702,8 +1701,8 @@ void CGObjCGNU::GenerateCategory(const ObjCCategoryImplDecl *OCD) { } // Collect information about class methods - llvm::SmallVector<Selector, 16> ClassMethodSels; - llvm::SmallVector<llvm::Constant*, 16> ClassMethodTypes; + SmallVector<Selector, 16> ClassMethodSels; + SmallVector<llvm::Constant*, 16> ClassMethodTypes; for (ObjCCategoryImplDecl::classmeth_iterator iter = OCD->classmeth_begin(), endIter = OCD->classmeth_end(); iter != endIter ; iter++) { @@ -1714,7 +1713,7 @@ void CGObjCGNU::GenerateCategory(const ObjCCategoryImplDecl *OCD) { } // Collect the names of referenced protocols - llvm::SmallVector<std::string, 16> Protocols; + SmallVector<std::string, 16> Protocols; const ObjCCategoryDecl *CatDecl = OCD->getCategoryDecl(); const ObjCList<ObjCProtocolDecl> &Protos = CatDecl->getReferencedProtocols(); for (ObjCList<ObjCProtocolDecl>::iterator I = Protos.begin(), @@ -1741,8 +1740,8 @@ void CGObjCGNU::GenerateCategory(const ObjCCategoryImplDecl *OCD) { } llvm::Constant *CGObjCGNU::GeneratePropertyList(const ObjCImplementationDecl *OID, - llvm::SmallVectorImpl<Selector> &InstanceMethodSels, - llvm::SmallVectorImpl<llvm::Constant*> &InstanceMethodTypes) { + SmallVectorImpl<Selector> &InstanceMethodSels, + SmallVectorImpl<llvm::Constant*> &InstanceMethodTypes) { ASTContext &Context = CGM.getContext(); // // Property metadata: name, attributes, isSynthesized, setter name, setter @@ -1845,9 +1844,9 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { Context.getASTObjCImplementationLayout(OID).getSize().getQuantity(); // Collect information about instance variables. - llvm::SmallVector<llvm::Constant*, 16> IvarNames; - llvm::SmallVector<llvm::Constant*, 16> IvarTypes; - llvm::SmallVector<llvm::Constant*, 16> IvarOffsets; + SmallVector<llvm::Constant*, 16> IvarNames; + SmallVector<llvm::Constant*, 16> IvarTypes; + SmallVector<llvm::Constant*, 16> IvarOffsets; std::vector<llvm::Constant*> IvarOffsetValues; @@ -1898,8 +1897,8 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { // Collect information about instance methods - llvm::SmallVector<Selector, 16> InstanceMethodSels; - llvm::SmallVector<llvm::Constant*, 16> InstanceMethodTypes; + SmallVector<Selector, 16> InstanceMethodSels; + SmallVector<llvm::Constant*, 16> InstanceMethodTypes; for (ObjCImplementationDecl::instmeth_iterator iter = OID->instmeth_begin(), endIter = OID->instmeth_end(); iter != endIter ; iter++) { @@ -1914,8 +1913,8 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { // Collect information about class methods - llvm::SmallVector<Selector, 16> ClassMethodSels; - llvm::SmallVector<llvm::Constant*, 16> ClassMethodTypes; + SmallVector<Selector, 16> ClassMethodSels; + SmallVector<llvm::Constant*, 16> ClassMethodTypes; for (ObjCImplementationDecl::classmeth_iterator iter = OID->classmeth_begin(), endIter = OID->classmeth_end(); iter != endIter ; iter++) { @@ -1925,7 +1924,7 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { ClassMethodTypes.push_back(MakeConstantString(TypeStr)); } // Collect the names of referenced protocols - llvm::SmallVector<std::string, 16> Protocols; + SmallVector<std::string, 16> Protocols; const ObjCList<ObjCProtocolDecl> &Protos =ClassDecl->getReferencedProtocols(); for (ObjCList<ObjCProtocolDecl>::iterator I = Protos.begin(), E = Protos.end(); I != E; ++I) @@ -1941,7 +1940,7 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { SuperClass = llvm::ConstantPointerNull::get(PtrToInt8Ty); } // Empty vector used to construct empty method lists - llvm::SmallVector<llvm::Constant*, 1> empty; + SmallVector<llvm::Constant*, 1> empty; // Generate the method and instance variable lists llvm::Constant *MethodList = GenerateMethodList(ClassName, "", InstanceMethodSels, InstanceMethodTypes, false); @@ -2046,7 +2045,7 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() { ConstantStrings.size() + 1); ConstantStrings.push_back(NULLPtr); - llvm::StringRef StringClass = CGM.getLangOptions().ObjCConstantStringClass; + StringRef StringClass = CGM.getLangOptions().ObjCConstantStringClass; if (StringClass.empty()) StringClass = "NXConstantString"; @@ -2085,8 +2084,8 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() { std::string SelNameStr = iter->first.getAsString(); llvm::Constant *SelName = ExportUniqueString(SelNameStr, ".objc_sel_name"); - llvm::SmallVectorImpl<TypedSelector> &Types = iter->second; - for (llvm::SmallVectorImpl<TypedSelector>::iterator i = Types.begin(), + SmallVectorImpl<TypedSelector> &Types = iter->second; + for (SmallVectorImpl<TypedSelector>::iterator i = Types.begin(), e = Types.end() ; i!=e ; i++) { llvm::Constant *SelectorTypeEncoding = NULLPtr; @@ -2216,8 +2215,8 @@ llvm::Function *CGObjCGNU::GenerateMethod(const ObjCMethodDecl *OMD, const ObjCContainerDecl *CD) { const ObjCCategoryImplDecl *OCD = dyn_cast<ObjCCategoryImplDecl>(OMD->getDeclContext()); - llvm::StringRef CategoryName = OCD ? OCD->getName() : ""; - llvm::StringRef ClassName = CD->getName(); + StringRef CategoryName = OCD ? OCD->getName() : ""; + StringRef ClassName = CD->getName(); Selector MethodName = OMD->getSelector(); bool isClassMethod = !OMD->isInstanceMethod(); diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index 67e3e9d43b..5c56e81adb 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -205,7 +205,7 @@ public: CodeGen::CodeGenTypes &Types = CGM.getTypes(); ASTContext &Ctx = CGM.getContext(); // id objc_getProperty (id, SEL, ptrdiff_t, bool) - llvm::SmallVector<CanQualType,4> Params; + SmallVector<CanQualType,4> Params; CanQualType IdType = Ctx.getCanonicalParamType(Ctx.getObjCIdType()); CanQualType SelType = Ctx.getCanonicalParamType(Ctx.getObjCSelType()); Params.push_back(IdType); @@ -223,7 +223,7 @@ public: CodeGen::CodeGenTypes &Types = CGM.getTypes(); ASTContext &Ctx = CGM.getContext(); // void objc_setProperty (id, SEL, ptrdiff_t, id, bool, bool) - llvm::SmallVector<CanQualType,6> Params; + SmallVector<CanQualType,6> Params; CanQualType IdType = Ctx.getCanonicalParamType(Ctx.getObjCIdType()); CanQualType SelType = Ctx.getCanonicalParamType(Ctx.getObjCSelType()); Params.push_back(IdType); @@ -244,7 +244,7 @@ public: CodeGen::CodeGenTypes &Types = CGM.getTypes(); ASTContext &Ctx = CGM.getContext(); // void objc_copyStruct (void *, const void *, size_t, bool, bool) - llvm::SmallVector<CanQualType,5> Params; + SmallVector<CanQualType,5> Params; Params.push_back(Ctx.VoidPtrTy); Params.push_back(Ctx.VoidPtrTy); Params.push_back(Ctx.LongTy); @@ -261,7 +261,7 @@ public: CodeGen::CodeGenTypes &Types = CGM.getTypes(); ASTContext &Ctx = CGM.getContext(); // void objc_enumerationMutation (id) - llvm::SmallVector<CanQualType,1> Params; + SmallVector<CanQualType,1> Params; Params.push_back(Ctx.getCanonicalParamType(Ctx.getObjCIdType())); llvm::FunctionType *FTy = Types.GetFunctionType(Types.getFunctionInfo(Ctx.VoidTy, Params, @@ -669,8 +669,8 @@ protected: unsigned ObjCABI; // gc ivar layout bitmap calculation helper caches. - llvm::SmallVector<GC_IVAR, 16> SkipIvars; - llvm::SmallVector<GC_IVAR, 16> IvarsInfo; + SmallVector<GC_IVAR, 16> SkipIvars; + SmallVector<GC_IVAR, 16> IvarsInfo; /// LazySymbols - Symbols to generate a lazy reference for. See /// DefinedSymbols and FinishModule(). @@ -733,7 +733,7 @@ protected: /// \param[out] NameOut - The return value. void GetNameForMethod(const ObjCMethodDecl *OMD, const ObjCContainerDecl *CD, - llvm::SmallVectorImpl<char> &NameOut); + SmallVectorImpl<char> &NameOut); /// GetMethodVarName - Return a unique constant for the given /// selector's name. The return value has type char *. @@ -786,7 +786,7 @@ protected: /// EmitPropertyList - Emit the given property list. The return /// value has type PropertyListPtrTy. - llvm::Constant *EmitPropertyList(llvm::Twine Name, + llvm::Constant *EmitPropertyList(Twine Name, const Decl *Container, const ObjCContainerDecl *OCD, const ObjCCommonTypesHelper &ObjCTypes); @@ -817,7 +817,7 @@ protected: /// \param Align - The alignment for the variable, or 0. /// \param AddToUsed - Whether the variable should be added to /// "llvm.used". - llvm::GlobalVariable *CreateMetadataVar(llvm::Twine Name, + llvm::GlobalVariable *CreateMetadataVar(Twine Name, llvm::Constant *Init, const char *Section, unsigned Align, @@ -923,7 +923,7 @@ private: /// EmitMethodList - Emit the method list for the given /// implementation. The return value has type MethodListPtrTy. - llvm::Constant *EmitMethodList(llvm::Twine Name, + llvm::Constant *EmitMethodList(Twine Name, const char *Section, const ConstantVector &Methods); @@ -938,7 +938,7 @@ private: /// - begin, end: The method list to output. /// /// The return value has type MethodDescriptionListPtrTy. - llvm::Constant *EmitMethodDescList(llvm::Twine Name, + llvm::Constant *EmitMethodDescList(Twine Name, const char *Section, const ConstantVector &Methods); @@ -964,7 +964,7 @@ private: /// EmitProtocolList - Generate the list of referenced /// protocols. The return value has type ProtocolListPtrTy. - llvm::Constant *EmitProtocolList(llvm::Twine Name, + llvm::Constant *EmitProtocolList(Twine Name, ObjCProtocolDecl::protocol_iterator begin, ObjCProtocolDecl::protocol_iterator end); @@ -1117,7 +1117,7 @@ private: /// EmitMethodList - Emit the method list for the given /// implementation. The return value has type MethodListnfABITy. - llvm::Constant *EmitMethodList(llvm::Twine Name, + llvm::Constant *EmitMethodList(Twine Name, const char *Section, const ConstantVector &Methods); /// EmitIvarList - Emit the ivar list for the given @@ -1144,7 +1144,7 @@ private: /// EmitProtocolList - Generate the list of referenced /// protocols. The return value has type ProtocolListPtrTy. - llvm::Constant *EmitProtocolList(llvm::Twine Name, + llvm::Constant *EmitProtocolList(Twine Name, ObjCProtocolDecl::protocol_iterator begin, ObjCProtocolDecl::protocol_iterator end); @@ -1878,7 +1878,7 @@ CGObjCMac::EmitProtocolExtension(const ObjCProtocolDecl *PD, }; */ llvm::Constant * -CGObjCMac::EmitProtocolList(llvm::Twine Name, +CGObjCMac::EmitProtocolList(Twine Name, ObjCProtocolDecl::protocol_iterator begin, ObjCProtocolDecl::protocol_iterator end) { std::vector<llvm::Constant*> ProtocolRefs; @@ -1942,7 +1942,7 @@ void CGObjCCommonMac::PushProtocolProperties(llvm::SmallPtrSet<const IdentifierI struct _objc_property[prop_count]; }; */ -llvm::Constant *CGObjCCommonMac::EmitPropertyList(llvm::Twine Name, +llvm::Constant *CGObjCCommonMac::EmitPropertyList(Twine Name, const Decl *Container, const ObjCContainerDecl *OCD, const ObjCCommonTypesHelper &ObjCTypes) { @@ -2014,7 +2014,7 @@ CGObjCMac::GetMethodDescriptionConstant(const ObjCMethodDecl *MD) { Desc); } -llvm::Constant *CGObjCMac::EmitMethodDescList(llvm::Twine Name, +llvm::Constant *CGObjCMac::EmitMethodDescList(Twine Name, const char *Section, const ConstantVector &Methods) { // Return null for empty list. @@ -2475,7 +2475,7 @@ llvm::Constant *CGObjCMac::GetMethodConstant(const ObjCMethodDecl *MD) { return llvm::ConstantStruct::get(ObjCTypes.MethodTy, Method); } -llvm::Constant *CGObjCMac::EmitMethodList(llvm::Twine Name, +llvm::Constant *CGObjCMac::EmitMethodList(Twine Name, const char *Section, const ConstantVector &Methods) { // Return null for empty list. @@ -2513,7 +2513,7 @@ llvm::Function *CGObjCCommonMac::GenerateMethod(const ObjCMethodDecl *OMD, } llvm::GlobalVariable * -CGObjCCommonMac::CreateMetadataVar(llvm::Twine Name, +CGObjCCommonMac::CreateMetadataVar(Twine Name, llvm::Constant *Init, const char *Section, unsigned Align, @@ -2626,7 +2626,7 @@ namespace { class FragileHazards { CodeGenFunction &CGF; - llvm::SmallVector<llvm::Value*, 20> Locals; + SmallVector<llvm::Value*, 20> Locals; llvm::DenseSet<llvm::BasicBlock*> BlocksBeforeTry; llvm::InlineAsm *ReadHazard; @@ -2765,7 +2765,7 @@ void FragileHazards::collectLocals() { } llvm::FunctionType *FragileHazards::GetAsmFnType() { - llvm::SmallVector<llvm::Type *, 16> tys(Locals.size()); + SmallVector<llvm::Type *, 16> tys(Locals.size()); for (unsigned i = 0, e = Locals.size(); i != e; ++i) tys[i] = Locals[i]->getType(); return llvm::FunctionType::get(CGF.VoidTy, tys, false); @@ -3756,7 +3756,7 @@ llvm::Constant *CGObjCCommonMac::BuildIvarLayoutBitmap(std::string& BitMap) { llvm::Type *PtrTy = llvm::Type::getInt8PtrTy(VMContext); // Build the string of skip/scan nibbles - llvm::SmallVector<SKIP_SCAN, 32> SkipScanIvars; + SmallVector<SKIP_SCAN, 32> SkipScanIvars; unsigned int WordSize = CGM.getTypes().getTargetData().getTypeAllocSize(PtrTy); if (IvarsInfo[0].ivar_bytepos == 0) { @@ -4034,7 +4034,7 @@ CGObjCCommonMac::GetPropertyTypeString(const ObjCPropertyDecl *PD, void CGObjCCommonMac::GetNameForMethod(const ObjCMethodDecl *D, const ObjCContainerDecl *CD, - llvm::SmallVectorImpl<char> &Name) { + SmallVectorImpl<char> &Name) { llvm::raw_svector_ostream OS(Name); assert (CD && "Missing container decl in GetNameForMethod"); OS << '\01' << (D->isInstanceMethod() ? '-' : '+') @@ -5165,7 +5165,7 @@ llvm::Constant *CGObjCNonFragileABIMac::GetMethodConstant( /// struct _objc_method method_list[method_count]; /// } /// -llvm::Constant *CGObjCNonFragileABIMac::EmitMethodList(llvm::Twine Name, +llvm::Constant *CGObjCNonFragileABIMac::EmitMethodList(Twine Name, const char *Section, const ConstantVector &Methods) { // Return null for empty list. @@ -5458,7 +5458,7 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol( /// @endcode /// llvm::Constant * -CGObjCNonFragileABIMac::EmitProtocolList(llvm::Twine Name, +CGObjCNonFragileABIMac::EmitProtocolList(Twine Name, ObjCProtocolDecl::protocol_iterator begin, ObjCProtocolDecl::protocol_iterator end) { std::vector<llvm::Constant*> ProtocolRefs; diff --git a/lib/CodeGen/CGObjCRuntime.cpp b/lib/CodeGen/CGObjCRuntime.cpp index bc739c8411..c2978039b1 100644 --- a/lib/CodeGen/CGObjCRuntime.cpp +++ b/lib/CodeGen/CGObjCRuntime.cpp @@ -177,7 +177,7 @@ void CGObjCRuntime::EmitTryCatchStmt(CodeGenFunction &CGF, FinallyInfo.enter(CGF, Finally->getFinallyBody(), beginCatchFn, endCatchFn, exceptionRethrowFn); - llvm::SmallVector<CatchHandler, 8> Handlers; + SmallVector<CatchHandler, 8> Handlers; // Enter the catch, if there is one. if (S.getNumCatchStmts()) { diff --git a/lib/CodeGen/CGRTTI.cpp b/lib/CodeGen/CGRTTI.cpp index 1ef9a17a2c..0b9484b700 100644 --- a/lib/CodeGen/CGRTTI.cpp +++ b/lib/CodeGen/CGRTTI.cpp @@ -29,7 +29,7 @@ class RTTIBuilder { llvm::Type *Int8PtrTy; /// Fields - The fields of the RTTI descriptor currently being built. - llvm::SmallVector<llvm::Constant *, 16> Fields; + SmallVector<llvm::Constant *, 16> Fields; /// GetAddrOfTypeName - Returns the mangled type name of the given type. llvm::GlobalVariable * @@ -120,7 +120,7 @@ RTTIBuilder::GetAddrOfTypeName(QualType Ty, llvm::raw_svector_ostream Out(OutName); CGM.getCXXABI().getMangleContext().mangleCXXRTTIName(Ty, Out); Out.flush(); - llvm::StringRef Name = OutName.str(); + StringRef Name = OutName.str(); // We know that the mangled name of the type starts at index 4 of the // mangled name of the typename, so we can just index into it in order to @@ -141,7 +141,7 @@ llvm::Constant *RTTIBuilder::GetAddrOfExternalRTTIDescriptor(QualType Ty) { llvm::raw_svector_ostream Out(OutName); CGM.getCXXABI().getMangleContext().mangleCXXRTTI(Ty, Out); Out.flush(); - llvm::StringRef Name = OutName.str(); + StringRef Name = OutName.str(); // Look for an existing global. llvm::GlobalVariable *GV = CGM.getModule().getNamedGlobal(Name); @@ -533,7 +533,7 @@ maybeUpdateRTTILinkage(CodeGenModule &CGM, llvm::GlobalVariable *GV, llvm::raw_svector_ostream Out(OutName); CGM.getCXXABI().getMangleContext().mangleCXXRTTIName(Ty, Out); Out.flush(); - llvm::StringRef Name = OutName.str(); + StringRef Name = OutName.str(); llvm::GlobalVariable *TypeNameGV = CGM.getModule().getNamedGlobal(Name); @@ -553,7 +553,7 @@ llvm::Constant *RTTIBuilder::BuildTypeInfo(QualType Ty, bool Force) { llvm::raw_svector_ostream Out(OutName); CGM.getCXXABI().getMangleContext().mangleCXXRTTI(Ty, Out); Out.flush(); - llvm::StringRef Name = OutName.str(); + StringRef Name = OutName.str(); llvm::GlobalVariable *OldGV = CGM.getModule().getNamedGlobal(Name); if (OldGV && !OldGV->isDeclaration()) { diff --git a/lib/CodeGen/CGRecordLayoutBuilder.cpp b/lib/CodeGen/CGRecordLayoutBuilder.cpp index df65ba88a3..f3b84071a1 100644 --- a/lib/CodeGen/CGRecordLayoutBuilder.cpp +++ b/lib/CodeGen/CGRecordLayoutBuilder.cpp @@ -35,7 +35,7 @@ class CGRecordLayoutBuilder { public: /// FieldTypes - Holds the LLVM types that the struct is created from. /// - llvm::SmallVector<llvm::Type *, 16> FieldTypes; + SmallVector<llvm::Type *, 16> FieldTypes; /// BaseSubobjectType - Holds the LLVM type for the non-virtual part /// of the struct. For example, consider: @@ -1037,7 +1037,7 @@ CGRecordLayout *CodeGenTypes::ComputeRecordLayout(const RecordDecl *D, return RL; } -void CGRecordLayout::print(llvm::raw_ostream &OS) const { +void CGRecordLayout::print(raw_ostream &OS) const { OS << "<CGRecordLayout\n"; OS << " LLVMType:" << *CompleteObjectType << "\n"; if (BaseSubobjectType) @@ -1071,7 +1071,7 @@ void CGRecordLayout::dump() const { print(llvm::errs()); } -void CGBitFieldInfo::print(llvm::raw_ostream &OS) const { +void CGBitFieldInfo::print(raw_ostream &OS) const { OS << "<CGBitFieldInfo"; OS << " Size:" << Size; OS << " IsSigned:" << IsSigned << "\n"; diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index d56c4bbe01..60db07d388 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -961,7 +961,7 @@ enum CSFC_Result { CSFC_Failure, CSFC_FallThrough, CSFC_Success }; static CSFC_Result CollectStatementsForCase(const Stmt *S, const SwitchCase *Case, bool &FoundCase, - llvm::SmallVectorImpl<const Stmt*> &ResultStmts) { + SmallVectorImpl<const Stmt*> &ResultStmts) { // If this is a null statement, just succeed. if (S == 0) return Case ? CSFC_Success : CSFC_FallThrough; @@ -1086,7 +1086,7 @@ static CSFC_Result CollectStatementsForCase(const Stmt *S, /// for more details. static bool FindCaseStatementsForValue(const SwitchStmt &S, const llvm::APInt &ConstantCondValue, - llvm::SmallVectorImpl<const Stmt*> &ResultStmts, + SmallVectorImpl<const Stmt*> &ResultStmts, ASTContext &C) { // First step, find the switch case that is being branched to. We can do this // efficiently by scanning the SwitchCase list. @@ -1147,7 +1147,7 @@ void CodeGenFunction::EmitSwitchStmt(const SwitchStmt &S) { // emit the live case statement (if any) of the switch. llvm::APInt ConstantCondValue; if (ConstantFoldsToSimpleInteger(S.getCond(), ConstantCondValue)) { - llvm::SmallVector<const Stmt*, 4> CaseStmts; + SmallVector<const Stmt*, 4> CaseStmts; if (FindCaseStatementsForValue(S, ConstantCondValue, CaseStmts, getContext())) { RunCleanupsScope ExecutedScope(*this); @@ -1219,7 +1219,7 @@ void CodeGenFunction::EmitSwitchStmt(const SwitchStmt &S) { static std::string SimplifyConstraint(const char *Constraint, const TargetInfo &Target, - llvm::SmallVectorImpl<TargetInfo::ConstraintInfo> *OutCons=0) { + SmallVectorImpl<TargetInfo::ConstraintInfo> *OutCons=0) { std::string Result; while (*Constraint) { @@ -1276,7 +1276,7 @@ AddVariableConstraints(const std::string &Constraint, const Expr &AsmExpr, AsmLabelAttr *Attr = Variable->getAttr<AsmLabelAttr>(); if (!Attr) return Constraint; - llvm::StringRef Register = Attr->getLabel(); + StringRef Register = Attr->getLabel(); assert(Target.isValidGCCRegisterName(Register)); // We're using validateOutputConstraint here because we only care if // this is a register constraint. @@ -1341,11 +1341,11 @@ llvm::Value* CodeGenFunction::EmitAsmInput(const AsmStmt &S, /// asm. static llvm::MDNode *getAsmSrcLocInfo(const StringLiteral *Str, CodeGenFunction &CGF) { - llvm::SmallVector<llvm::Value *, 8> Locs; + SmallVector<llvm::Value *, 8> Locs; // Add the location of the first line to the MDNode. Locs.push_back(llvm::ConstantInt::get(CGF.Int32Ty, Str->getLocStart().getRawEncoding())); - llvm::StringRef StrVal = Str->getString(); + StringRef StrVal = Str->getString(); if (!StrVal.empty()) { const SourceManager &SM = CGF.CGM.getContext().getSourceManager(); const LangOptions &LangOpts = CGF.CGM.getLangOptions(); @@ -1367,7 +1367,7 @@ static llvm::MDNode *getAsmSrcLocInfo(const StringLiteral *Str, void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { // Analyze the asm string to decompose it into its pieces. We know that Sema // has already done this, so it is guaranteed to be successful. - llvm::SmallVector<AsmStmt::AsmStringPiece, 4> Pieces; + SmallVector<AsmStmt::AsmStringPiece, 4> Pieces; unsigned DiagOffs; S.AnalyzeAsmString(Pieces, getContext(), DiagOffs); @@ -1384,8 +1384,8 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { } // Get all the output and input constraints together. - llvm::SmallVector<TargetInfo::ConstraintInfo, 4> OutputConstraintInfos; - llvm::SmallVector<TargetInfo::ConstraintInfo, 4> InputConstraintInfos; + SmallVector<TargetInfo::ConstraintInfo, 4> OutputConstraintInfos; + SmallVector<TargetInfo::ConstraintInfo, 4> InputConstraintInfos; for (unsigned i = 0, e = S.getNumOutputs(); i != e; i++) { TargetInfo::ConstraintInfo Info(S.getOutputConstraint(i), @@ -1556,7 +1556,7 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { // Clobbers for (unsigned i = 0, e = S.getNumClobbers(); i != e; i++) { - llvm::StringRef Clobber = S.getClobber(i)->getString(); + StringRef Clobber = S.getClobber(i)->getString(); if (Clobber != "memory" && Clobber != "cc") Clobber = Target.getNormalizedGCCRegisterName(Clobber); diff --git a/lib/CodeGen/CGVTT.cpp b/lib/CodeGen/CGVTT.cpp index 49d0938e53..c8a65fd1c1 100644 --- a/lib/CodeGen/CGVTT.cpp +++ b/lib/CodeGen/CGVTT.cpp @@ -30,7 +30,7 @@ class VTTBuilder { /// vtable. const CXXRecordDecl *MostDerivedClass; - typedef llvm::SmallVector<llvm::Constant *, 64> VTTComponentsVectorTy; + typedef SmallVector<llvm::Constant *, 64> VTTComponentsVectorTy; /// VTTComponents - The VTT components. VTTComponentsVectorTy VTTComponents; @@ -408,7 +408,7 @@ llvm::GlobalVariable *CodeGenVTables::GetAddrOfVTT(const CXXRecordDecl *RD) { llvm::raw_svector_ostream Out(OutName); CGM.getCXXABI().getMangleContext().mangleCXXVTT(RD, Out); Out.flush(); - llvm::StringRef Name = OutName.str(); + StringRef Name = OutName.str(); ComputeVTableRelatedInformation(RD, /*VTableRequired=*/true); diff --git a/lib/CodeGen/CGVTables.cpp b/lib/CodeGen/CGVTables.cpp index 1e5c56f7fc..b71145fbed 100644 --- a/lib/CodeGen/CGVTables.cpp +++ b/lib/CodeGen/CGVTables.cpp @@ -122,7 +122,7 @@ private: /// dump - dump the final overriders for a base subobject, and all its direct /// and indirect base subobjects. - void dump(llvm::raw_ostream &Out, BaseSubobject Base, + void dump(raw_ostream &Out, BaseSubobject Base, VisitedVirtualBasesSetTy& VisitedVirtualBases); public: @@ -380,7 +380,7 @@ FinalOverriders::ComputeBaseOffsets(BaseSubobject Base, bool IsVirtual, } } -void FinalOverriders::dump(llvm::raw_ostream &Out, BaseSubobject Base, +void FinalOverriders::dump(raw_ostream &Out, BaseSubobject Base, VisitedVirtualBasesSetTy &VisitedVirtualBases) { const CXXRecordDecl *RD = Base.getBase(); const ASTRecordLayout &Layout = Context.getASTRecordLayout(RD); @@ -616,7 +616,7 @@ struct VCallOffsetMap { /// Offsets - Keeps track of methods and their offsets. // FIXME: This should be a real map and not a vector. - llvm::SmallVector<MethodAndOffsetPairTy, 16> Offsets; + SmallVector<MethodAndOffsetPairTy, 16> Offsets; /// MethodsCanShareVCallOffset - Returns whether two virtual member functions /// can share the same vcall offset. @@ -724,7 +724,7 @@ private: ASTContext &Context; /// Components - vcall and vbase offset components - typedef llvm::SmallVector<VTableComponent, 64> VTableComponentVectorTy; + typedef SmallVector<VTableComponent, 64> VTableComponentVectorTy; VTableComponentVectorTy Components; /// VisitedVirtualBases - Visited virtual bases. @@ -999,7 +999,7 @@ private: VBaseOffsetOffsetsMapTy VBaseOffsetOffsets; /// Components - The components of the vtable being built. - llvm::SmallVector<VTableComponent, 64> Components; + SmallVector<VTableComponent, 64> Components; /// AddressPoints - Address points for the vtable being built. AddressPointsMapTy AddressPoints; @@ -1042,7 +1042,7 @@ private: /// built. VTableThunksMapTy VTableThunks; - typedef llvm::SmallVector<ThunkInfo, 1> ThunkInfoVectorTy; + typedef SmallVector<ThunkInfo, 1> ThunkInfoVectorTy; typedef llvm::DenseMap<const CXXMethodDecl *, ThunkInfoVectorTy> ThunksMapTy; /// Thunks - A map that contains all the thunks needed for all methods in the @@ -1214,14 +1214,14 @@ public: } /// dumpLayout - Dump the vtable layout. - void dumpLayout(llvm::raw_ostream&); + void dumpLayout(raw_ostream&); }; void VTableBuilder::AddThunk(const CXXMethodDecl *MD, const ThunkInfo &Thunk) { assert(!isBuildingConstructorVTable() && "Can't add thunks for construction vtable"); - llvm::SmallVector<ThunkInfo, 1> &ThunksVector = Thunks[MD]; + SmallVector<ThunkInfo, 1> &ThunksVector = Thunks[MD]; // Check if we have this thunk already. if (std::find(ThunksVector.begin(), ThunksVector.end(), Thunk) != @@ -1981,7 +1981,7 @@ VTableBuilder::LayoutVTablesForVirtualBases(const CXXRecordDecl *RD, } /// dumpLayout - Dump the vtable layout. -void VTableBuilder::dumpLayout(llvm::raw_ostream& Out) { +void VTableBuilder::dumpLayout(raw_ostream& Out) { if (isBuildingConstructorVTable()) { Out << "Construction vtable for ('"; @@ -2881,7 +2881,7 @@ void CodeGenVTables::EmitThunk(GlobalDecl GD, const ThunkInfo &Thunk, "Shouldn't replace non-declaration"); // Remove the name from the old thunk function and get a new thunk. - OldThunkFn->setName(llvm::StringRef()); + OldThunkFn->setName(StringRef()); Entry = CGM.GetAddrOfThunk(GD, Thunk); // If needed, replace the old thunk with a bitcast. @@ -3064,7 +3064,7 @@ CodeGenVTables::CreateVTableInitializer(const CXXRecordDecl *RD, const uint64_t *Components, unsigned NumComponents, const VTableThunksTy &VTableThunks) { - llvm::SmallVector<llvm::Constant *, 64> Inits; + SmallVector<llvm::Constant *, 64> Inits; llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGM.getLLVMContext()); @@ -3174,7 +3174,7 @@ llvm::GlobalVariable *CodeGenVTables::GetAddrOfVTable(const CXXRecordDecl *RD) { llvm::raw_svector_ostream Out(OutName); CGM.getCXXABI().getMangleContext().mangleCXXVTable(RD, Out); Out.flush(); - llvm::StringRef Name = OutName.str(); + StringRef Name = OutName.str(); ComputeVTableRelatedInformation(RD, /*VTableRequired=*/true); @@ -3244,7 +3244,7 @@ CodeGenVTables::GenerateConstructionVTable(const CXXRecordDecl *RD, mangleCXXCtorVTable(RD, Base.getBaseOffset().getQuantity(), Base.getBase(), Out); Out.flush(); - llvm::StringRef Name = OutName.str(); + StringRef Name = OutName.str(); llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGM.getLLVMContext()); llvm::ArrayType *ArrayType = diff --git a/lib/CodeGen/CodeGenAction.cpp b/lib/CodeGen/CodeGenAction.cpp index 263e01e4f1..fc1bd5ee2f 100644 --- a/lib/CodeGen/CodeGenAction.cpp +++ b/lib/CodeGen/CodeGenAction.cpp @@ -35,7 +35,7 @@ namespace clang { const CodeGenOptions &CodeGenOpts; const TargetOptions &TargetOpts; const LangOptions &LangOpts; - llvm::raw_ostream *AsmOutStream; + raw_ostream *AsmOutStream; ASTContext *Context; Timer LLVMIRGeneration; @@ -50,7 +50,7 @@ namespace clang { const TargetOptions &targetopts, const LangOptions &langopts, bool TimePasses, - const std::string &infile, llvm::raw_ostream *OS, + const std::string &infile, raw_ostream *OS, LLVMContext &C) : Diags(_Diags), Action(action), @@ -199,7 +199,7 @@ void BackendConsumer::InlineAsmDiagHandler2(const llvm::SMDiagnostic &D, // we re-format the SMDiagnostic in terms of a clang diagnostic. // Strip "error: " off the start of the message string. - llvm::StringRef Message = D.getMessage(); + StringRef Message = D.getMessage(); if (Message.startswith("error: ")) Message = Message.substr(7); @@ -259,7 +259,7 @@ llvm::LLVMContext *CodeGenAction::takeLLVMContext() { } static raw_ostream *GetOutputStream(CompilerInstance &CI, - llvm::StringRef InFile, + StringRef InFile, BackendAction Action) { switch (Action) { case Backend_EmitAssembly: @@ -280,9 +280,9 @@ static raw_ostream *GetOutputStream(CompilerInstance &CI, } ASTConsumer *CodeGenAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { BackendAction BA = static_cast<BackendAction>(Act); - llvm::OwningPtr<llvm::raw_ostream> OS(GetOutputStream(CI, InFile, BA)); + llvm::OwningPtr<raw_ostream> OS(GetOutputStream(CI, InFile, BA)); if (BA != Backend_EmitNothing && !OS) return 0; @@ -326,7 +326,7 @@ void CodeGenAction::ExecuteAction() { // Get a custom diagnostic for the error. We strip off a leading // diagnostic code if there is one. - llvm::StringRef Msg = Err.getMessage(); + StringRef Msg = Err.getMessage(); if (Msg.startswith("error: ")) Msg = Msg.substr(7); unsigned DiagID = CI.getDiagnostics().getCustomDiagID(Diagnostic::Error, diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 173994aa85..bdad01344a 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -740,7 +740,7 @@ CodeGenFunction::EmitNullInitialization(llvm::Value *DestPtr, QualType Ty) { new llvm::GlobalVariable(CGM.getModule(), NullConstant->getType(), /*isConstant=*/true, llvm::GlobalVariable::PrivateLinkage, - NullConstant, llvm::Twine()); + NullConstant, Twine()); llvm::Value *SrcPtr = Builder.CreateBitCast(NullVariable, Builder.getInt8PtrTy()); @@ -818,7 +818,7 @@ llvm::Value *CodeGenFunction::emitArrayLength(const ArrayType *origArrayType, // We have some number of constant-length arrays, so addr should // have LLVM type [M x [N x [...]]]*. Build a GEP that walks // down to the first element of addr. - llvm::SmallVector<llvm::Value*, 8> gepIndices; + SmallVector<llvm::Value*, 8> gepIndices; // GEP down to the array type. llvm::ConstantInt *zero = Builder.getInt32(0); diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index fd7128ed03..d22c0efef1 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -166,7 +166,7 @@ bool CodeGenModule::isTargetDarwin() const { return getContext().Target.getTriple().isOSDarwin(); } -void CodeGenModule::Error(SourceLocation loc, llvm::StringRef error) { +void CodeGenModule::Error(SourceLocation loc, StringRef error) { unsigned diagID = getDiags().getCustomDiagID(Diagnostic::Error, error); getDiags().Report(Context.getFullLoc(loc), diagID); } @@ -281,10 +281,10 @@ void CodeGenModule::setTypeVisibility(llvm::GlobalValue *GV, GV->setUnnamedAddr(true); } -llvm::StringRef CodeGenModule::getMangledName(GlobalDecl GD) { +StringRef CodeGenModule::getMangledName(GlobalDecl GD) { const NamedDecl *ND = cast<NamedDecl>(GD.getDecl()); - llvm::StringRef &Str = MangledDeclNames[GD.getCanonicalDecl()]; + StringRef &Str = MangledDeclNames[GD.getCanonicalDecl()]; if (!Str.empty()) return Str; @@ -313,7 +313,7 @@ llvm::StringRef CodeGenModule::getMangledName(GlobalDecl GD) { char *Name = MangledNamesAllocator.Allocate<char>(Length); std::copy(Buffer.begin(), Buffer.end(), Name); - Str = llvm::StringRef(Name, Length); + Str = StringRef(Name, Length); return Str; } @@ -333,7 +333,7 @@ void CodeGenModule::getBlockMangledName(GlobalDecl GD, MangleBuffer &Buffer, MangleCtx.mangleBlock(cast<DeclContext>(D), BD, Out); } -llvm::GlobalValue *CodeGenModule::GetGlobalValue(llvm::StringRef Name) { +llvm::GlobalValue *CodeGenModule::GetGlobalValue(StringRef Name) { return getModule().getNamedValue(Name); } @@ -618,7 +618,7 @@ void CodeGenModule::EmitDeferred() { // ignore these cases. // // TODO: That said, looking this up multiple times is very wasteful. - llvm::StringRef Name = getMangledName(D); + StringRef Name = getMangledName(D); llvm::GlobalValue *CGRef = GetGlobalValue(Name); assert(CGRef && "Deferred decl wasn't referenced?"); @@ -731,7 +731,7 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) { // Ignore declarations, they will be emitted on their first use. if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(Global)) { if (FD->getIdentifier()) { - llvm::StringRef Name = FD->getName(); + StringRef Name = FD->getName(); if (Name == "_Block_object_assign") { BlockObjectAssignDecl = FD; } else if (Name == "_Block_object_dispose") { @@ -747,7 +747,7 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) { const FunctionDecl *InlineDefinition = 0; FD->getBody(InlineDefinition); - llvm::StringRef MangledName = getMangledName(GD); + StringRef MangledName = getMangledName(GD); llvm::StringMap<GlobalDecl>::iterator DDI = DeferredDecls.find(MangledName); if (DDI != DeferredDecls.end()) @@ -760,7 +760,7 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) { assert(VD->isFileVarDecl() && "Cannot emit local var decl as global."); if (VD->getIdentifier()) { - llvm::StringRef Name = VD->getName(); + StringRef Name = VD->getName(); if (Name == "_NSConcreteGlobalBlock") { NSConcreteGlobalBlockDecl = VD; } else if (Name == "_NSConcreteStackBlock") { @@ -791,7 +791,7 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) { // If the value has already been used, add it directly to the // DeferredDeclsToEmit list. - llvm::StringRef MangledName = getMangledName(GD); + StringRef MangledName = getMangledName(GD); if (GetGlobalValue(MangledName)) DeferredDeclsToEmit.push_back(GD); else { @@ -851,7 +851,7 @@ void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD) { /// If D is non-null, it specifies a decl that correspond to this. This is used /// to set the attributes on the function when it is first created. llvm::Constant * -CodeGenModule::GetOrCreateLLVMFunction(llvm::StringRef MangledName, +CodeGenModule::GetOrCreateLLVMFunction(StringRef MangledName, llvm::Type *Ty, GlobalDecl D, bool ForVTable, llvm::Attributes ExtraAttrs) { @@ -954,7 +954,7 @@ llvm::Constant *CodeGenModule::GetAddrOfFunction(GlobalDecl GD, if (!Ty) Ty = getTypes().ConvertType(cast<ValueDecl>(GD.getDecl())->getType()); - llvm::StringRef MangledName = getMangledName(GD); + StringRef MangledName = getMangledName(GD); return GetOrCreateLLVMFunction(MangledName, Ty, GD, ForVTable); } @@ -962,7 +962,7 @@ llvm::Constant *CodeGenModule::GetAddrOfFunction(GlobalDecl GD, /// type and name. llvm::Constant * CodeGenModule::CreateRuntimeFunction(llvm::FunctionType *FTy, - llvm::StringRef Name, + StringRef Name, llvm::Attributes ExtraAttrs) { return GetOrCreateLLVMFunction(Name, FTy, GlobalDecl(), /*ForVTable=*/false, ExtraAttrs); @@ -992,7 +992,7 @@ static bool DeclIsConstantGlobal(ASTContext &Context, const VarDecl *D, /// If D is non-null, it specifies a decl that correspond to this. This is used /// to set the attributes on the global when it is first created. llvm::Constant * -CodeGenModule::GetOrCreateLLVMGlobal(llvm::StringRef MangledName, +CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName, llvm::PointerType *Ty, const VarDecl *D, bool UnnamedAddr) { @@ -1062,7 +1062,7 @@ CodeGenModule::GetOrCreateLLVMGlobal(llvm::StringRef MangledName, llvm::GlobalVariable * -CodeGenModule::CreateOrReplaceCXXRuntimeVariable(llvm::StringRef Name, +CodeGenModule::CreateOrReplaceCXXRuntimeVariable(StringRef Name, llvm::Type *Ty, llvm::GlobalValue::LinkageTypes Linkage) { llvm::GlobalVariable *GV = getModule().getNamedGlobal(Name); @@ -1114,7 +1114,7 @@ llvm::Constant *CodeGenModule::GetAddrOfGlobalVar(const VarDecl *D, llvm::PointerType *PTy = llvm::PointerType::get(Ty, getContext().getTargetAddressSpace(ASTTy)); - llvm::StringRef MangledName = getMangledName(D); + StringRef MangledName = getMangledName(D); return GetOrCreateLLVMGlobal(MangledName, PTy, D); } @@ -1122,7 +1122,7 @@ llvm::Constant *CodeGenModule::GetAddrOfGlobalVar(const VarDecl *D, /// specified type and name. llvm::Constant * CodeGenModule::CreateRuntimeVariable(llvm::Type *Ty, - llvm::StringRef Name) { + StringRef Name) { return GetOrCreateLLVMGlobal(Name, llvm::PointerType::getUnqual(Ty), 0, true); } @@ -1134,7 +1134,7 @@ void CodeGenModule::EmitTentativeDefinition(const VarDecl *D) { // If we have not seen a reference to this variable yet, place it // into the deferred declarations table to be emitted if needed // later. - llvm::StringRef MangledName = getMangledName(D); + StringRef MangledName = getMangledName(D); if (!GetGlobalValue(MangledName)) { DeferredDecls[MangledName] = D; return; @@ -1295,7 +1295,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) { getContext().getTargetAddressSpace(ASTTy)) { // Move the old entry aside so that we'll create a new one. - Entry->setName(llvm::StringRef()); + Entry->setName(StringRef()); // Make a new global with the correct type, this is now guaranteed to work. GV = cast<llvm::GlobalVariable>(GetAddrOfGlobalVar(D, InitType)); @@ -1391,7 +1391,7 @@ static void ReplaceUsesOfNonProtoTypeWithRealFunction(llvm::GlobalValue *Old, if (OldFn == 0) return; llvm::Type *NewRetTy = NewFn->getReturnType(); - llvm::SmallVector<llvm::Value*, 4> ArgList; + SmallVector<llvm::Value*, 4> ArgList; for (llvm::Value::use_iterator UI = OldFn->use_begin(), E = OldFn->use_end(); UI != E; ) { @@ -1480,7 +1480,7 @@ void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD) { // (e.g. "int f()") and then a definition of a different type // (e.g. "int f(int x)"). Move the old function aside so that it // doesn't interfere with GetAddrOfFunction. - OldFn->setName(llvm::StringRef()); + OldFn->setName(StringRef()); llvm::Function *NewFn = cast<llvm::Function>(GetAddrOfFunction(GD, Ty)); // If this is an implementation of a function without a prototype, try to @@ -1530,7 +1530,7 @@ void CodeGenModule::EmitAliasDefinition(GlobalDecl GD) { const AliasAttr *AA = D->getAttr<AliasAttr>(); assert(AA && "Not an alias?"); - llvm::StringRef MangledName = getMangledName(GD); + StringRef MangledName = getMangledName(GD); // If there is a definition in the module, then it wins over the alias. // This is dubious, but allow it to be safe. Just ignore the alias. @@ -1604,7 +1604,7 @@ llvm::Value *CodeGenModule::getBuiltinLibFunction(const FunctionDecl *FD, "isn't a lib fn"); // Get the name, skip over the __builtin_ prefix (if necessary). - llvm::StringRef Name; + StringRef Name; GlobalDecl D(FD); // If the builtin has been declared explicitly with an assembler label, @@ -1636,7 +1636,7 @@ GetConstantCFStringEntry(llvm::StringMap<llvm::Constant*> &Map, bool TargetIsLSB, bool &IsUTF16, unsigned &StringLength) { - llvm::StringRef String = Literal->getString(); + StringRef String = Literal->getString(); unsigned NumBytes = String.size(); // Check for simple case. @@ -1646,7 +1646,7 @@ GetConstantCFStringEntry(llvm::StringMap<llvm::Constant*> &Map, } // Otherwise, convert the UTF8 literals into a byte string. - llvm::SmallVector<UTF16, 128> ToBuf(NumBytes); + SmallVector<UTF16, 128> ToBuf(NumBytes); const UTF8 *FromPtr = (UTF8 *)String.data(); UTF16 *ToPtr = &ToBuf[0]; @@ -1678,7 +1678,7 @@ GetConstantCFStringEntry(llvm::StringMap<llvm::Constant*> &Map, AsBytes.push_back(0); IsUTF16 = true; - return Map.GetOrCreateValue(llvm::StringRef(AsBytes.data(), AsBytes.size())); + return Map.GetOrCreateValue(StringRef(AsBytes.data(), AsBytes.size())); } static llvm::StringMapEntry<llvm::Constant*> & @@ -1686,7 +1686,7 @@ GetConstantStringEntry(llvm::StringMap<llvm::Constant*> &Map, const StringLiteral *Literal, unsigned &StringLength) { - llvm::StringRef String = Literal->getString(); + StringRef String = Literal->getString(); StringLength = String.size(); return Map.GetOrCreateValue(String); } @@ -1913,7 +1913,7 @@ CodeGenModule::GetAddrOfConstantStringFromObjCEncode(const ObjCEncodeExpr *E) { /// GenerateWritableString -- Creates storage for a string literal. -static llvm::Constant *GenerateStringLiteral(llvm::StringRef str, +static llvm::Constant *GenerateStringLiteral(StringRef str, bool constant, CodeGenModule &CGM, const char *GlobalName) { @@ -1939,7 +1939,7 @@ static llvm::Constant *GenerateStringLiteral(llvm::StringRef str, /// Feature.WriteableStrings. /// /// The result has pointer to array type. -llvm::Constant *CodeGenModule::GetAddrOfConstantString(llvm::StringRef Str, +llvm::Constant *CodeGenModule::GetAddrOfConstantString(StringRef Str, const char *GlobalName) { bool IsConstant = !Features.WritableStrings; @@ -1968,7 +1968,7 @@ llvm::Constant *CodeGenModule::GetAddrOfConstantString(llvm::StringRef Str, /// character. The result has pointer to array type. llvm::Constant *CodeGenModule::GetAddrOfConstantCString(const std::string &Str, const char *GlobalName){ - llvm::StringRef StrWithNull(Str.c_str(), Str.size() + 1); + StringRef StrWithNull(Str.c_str(), Str.size() + 1); return GetAddrOfConstantString(StrWithNull, GlobalName); } @@ -2181,7 +2181,7 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { case Decl::FileScopeAsm: { FileScopeAsmDecl *AD = cast<FileScopeAsmDecl>(D); - llvm::StringRef AsmString = AD->getAsmString()->getString(); + StringRef AsmString = AD->getAsmString()->getString(); const std::string &S = getModule().getModuleInlineAsm(); if (S.empty()) @@ -2234,7 +2234,7 @@ void CodeGenModule::EmitDeclMetadata() { llvm::NamedMDNode *GlobalMetadata = 0; // StaticLocalDeclMap - for (llvm::DenseMap<GlobalDecl,llvm::StringRef>::iterator + for (llvm::DenseMap<GlobalDecl,StringRef>::iterator I = MangledDeclNames.begin(), E = MangledDeclNames.end(); I != E; ++I) { llvm::GlobalValue *Addr = getModule().getNamedValue(I->second); diff --git a/lib/CodeGen/CodeGenTBAA.cpp b/lib/CodeGen/CodeGenTBAA.cpp index 8d206cf3a1..887c1eabb0 100644 --- a/lib/CodeGen/CodeGenTBAA.cpp +++ b/lib/CodeGen/CodeGenTBAA.cpp @@ -58,7 +58,7 @@ llvm::MDNode *CodeGenTBAA::getChar() { /// getTBAAInfoForNamedType - Create a TBAA tree node with the given string /// as its identifier, and the given Parent node as its tree parent. -llvm::MDNode *CodeGenTBAA::getTBAAInfoForNamedType(llvm::StringRef NameStr, +llvm::MDNode *CodeGenTBAA::getTBAAInfoForNamedType(StringRef NameStr, llvm::MDNode *Parent, bool Readonly) { // Currently there is only one flag defined - the readonly flag. diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp index 87b3da5000..856b1f9dc2 100644 --- a/lib/CodeGen/CodeGenTypes.cpp +++ b/lib/CodeGen/CodeGenTypes.cpp @@ -47,7 +47,7 @@ CodeGenTypes::~CodeGenTypes() { void CodeGenTypes::addRecordTypeName(const RecordDecl *RD, llvm::StructType *Ty, - llvm::StringRef suffix) { + StringRef suffix) { llvm::SmallString<256> TypeName; llvm::raw_svector_ostream OS(TypeName); OS << RD->getKindName() << '.'; diff --git a/lib/CodeGen/ItaniumCXXABI.cpp b/lib/CodeGen/ItaniumCXXABI.cpp index 2832168eb3..db891db22b 100644 --- a/lib/CodeGen/ItaniumCXXABI.cpp +++ b/lib/CodeGen/ItaniumCXXABI.cpp @@ -96,12 +96,12 @@ public: void BuildConstructorSignature(const CXXConstructorDecl *Ctor, CXXCtorType T, CanQualType &ResTy, - llvm::SmallVectorImpl<CanQualType> &ArgTys); + SmallVectorImpl<CanQualType> &ArgTys); void BuildDestructorSignature(const CXXDestructorDecl *Dtor, CXXDtorType T, CanQualType &ResTy, - llvm::SmallVectorImpl<CanQualType> &ArgTys); + SmallVectorImpl<CanQualType> &ArgTys); void BuildInstanceFunctionParams(CodeGenFunction &CGF, QualType &ResTy, @@ -131,12 +131,12 @@ public: void BuildConstructorSignature(const CXXConstructorDecl *Ctor, CXXCtorType T, CanQualType &ResTy, - llvm::SmallVectorImpl<CanQualType> &ArgTys); + SmallVectorImpl<CanQualType> &ArgTys); void BuildDestructorSignature(const CXXDestructorDecl *Dtor, CXXDtorType T, CanQualType &ResTy, - llvm::SmallVectorImpl<CanQualType> &ArgTys); + SmallVectorImpl<CanQualType> &ArgTys); void BuildInstanceFunctionParams(CodeGenFunction &CGF, QualType &ResTy, @@ -678,7 +678,7 @@ bool ItaniumCXXABI::isZeroInitializable(const MemberPointerType *MPT) { void ItaniumCXXABI::BuildConstructorSignature(const CXXConstructorDecl *Ctor, CXXCtorType Type, CanQualType &ResTy, - llvm::SmallVectorImpl<CanQualType> &ArgTys) { + SmallVectorImpl<CanQualType> &ArgTys) { ASTContext &Context = getContext(); // 'this' is already there. @@ -692,7 +692,7 @@ void ItaniumCXXABI::BuildConstructorSignature(const CXXConstructorDecl *Ctor, void ARMCXXABI::BuildConstructorSignature(const CXXConstructorDecl *Ctor, CXXCtorType Type, CanQualType &ResTy, - llvm::SmallVectorImpl<CanQualType> &ArgTys) { + SmallVectorImpl<CanQualType> &ArgTys) { ItaniumCXXABI::BuildConstructorSignature(Ctor, Type, ResTy, ArgTys); ResTy = ArgTys[0]; } @@ -702,7 +702,7 @@ void ARMCXXABI::BuildConstructorSignature(const CXXConstructorDecl *Ctor, void ItaniumCXXABI::BuildDestructorSignature(const CXXDestructorDecl *Dtor, CXXDtorType Type, CanQualType &ResTy, - llvm::SmallVectorImpl<CanQualType> &ArgTys) { + SmallVectorImpl<CanQualType> &ArgTys) { ASTContext &Context = getContext(); // 'this' is already there. @@ -717,7 +717,7 @@ void ItaniumCXXABI::BuildDestructorSignature(const CXXDestructorDecl *Dtor, void ARMCXXABI::BuildDestructorSignature(const CXXDestructorDecl *Dtor, CXXDtorType Type, CanQualType &ResTy, - llvm::SmallVectorImpl<CanQualType> &ArgTys) { + SmallVectorImpl<CanQualType> &ArgTys) { ItaniumCXXABI::BuildDestructorSignature(Dtor, Type, ResTy, ArgTys); if (Type != Dtor_Deleting) diff --git a/lib/CodeGen/MicrosoftCXXABI.cpp b/lib/CodeGen/MicrosoftCXXABI.cpp index 747e5e3222..e200e79617 100644 --- a/lib/CodeGen/MicrosoftCXXABI.cpp +++ b/lib/CodeGen/MicrosoftCXXABI.cpp @@ -31,7 +31,7 @@ public: void BuildConstructorSignature(const CXXConstructorDecl *Ctor, CXXCtorType Type, CanQualType &ResTy, - llvm::SmallVectorImpl<CanQualType> &ArgTys) { + SmallVectorImpl<CanQualType> &ArgTys) { // 'this' is already in place // TODO: 'for base' flag } @@ -39,7 +39,7 @@ public: void BuildDestructorSignature(const CXXDestructorDecl *Ctor, CXXDtorType Type, CanQualType &ResTy, - llvm::SmallVectorImpl<CanQualType> &ArgTys) { + SmallVectorImpl<CanQualType> &ArgTys) { // 'this' is already in place // TODO: 'for base' flag } diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index 58efe179e4..ea0cec3d91 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -57,7 +57,7 @@ const llvm::TargetData &ABIInfo::getTargetData() const { void ABIArgInfo::dump() const { - llvm::raw_ostream &OS = llvm::errs(); + raw_ostream &OS = llvm::errs(); OS << "(ABIArgInfo Kind="; switch (TheKind) { case Direct: @@ -357,7 +357,7 @@ bool UseX86_MMXType(llvm::Type *IRType) { } static llvm::Type* X86AdjustInlineAsmType(CodeGen::CodeGenFunction &CGF, - llvm::StringRef Constraint, + StringRef Constraint, llvm::Type* Ty) { if ((Constraint == "y" || Constraint == "&y") && Ty->isVectorTy()) return llvm::Type::getX86_MMXTy(CGF.getLLVMContext()); @@ -428,7 +428,7 @@ public: llvm::Value *Address) const; llvm::Type* adjustInlineAsmType(CodeGen::CodeGenFunction &CGF, - llvm::StringRef Constraint, + StringRef Constraint, llvm::Type* Ty) const { return X86AdjustInlineAsmType(CGF, Constraint, Ty); } @@ -943,7 +943,7 @@ public: } llvm::Type* adjustInlineAsmType(CodeGen::CodeGenFunction &CGF, - llvm::StringRef Constraint, + StringRef Constraint, llvm::Type* Ty) const { return X86AdjustInlineAsmType(CGF, Constraint, Ty); } @@ -2321,7 +2321,7 @@ public: return 13; } - llvm::StringRef getARCRetainAutoreleasedReturnValueMarker() const { + StringRef getARCRetainAutoreleasedReturnValueMarker() const { return "mov\tr7, r7\t\t@ marker for objc_retainAutoreleaseReturnValue"; } @@ -2354,7 +2354,7 @@ void ARMABIInfo::computeInfo(CGFunctionInfo &FI) const { // Calling convention as default by an ABI. llvm::CallingConv::ID DefaultCC; - llvm::StringRef Env = getContext().Target.getTriple().getEnvironmentName(); + StringRef Env = getContext().Target.getTriple().getEnvironmentName(); if (Env == "gnueabi" || Env == "eabi") DefaultCC = llvm::CallingConv::ARM_AAPCS; else @@ -2652,7 +2652,7 @@ void PTXABIInfo::computeInfo(CGFunctionInfo &FI) const { // Calling convention as default by an ABI. llvm::CallingConv::ID DefaultCC; - llvm::StringRef Env = getContext().Target.getTriple().getEnvironmentName(); + StringRef Env = getContext().Target.getTriple().getEnvironmentName(); if (Env == "device") DefaultCC = llvm::CallingConv::PTX_Device; else @@ -2891,7 +2891,7 @@ void MSP430TargetCodeGenInfo::SetTargetAttributes(const Decl *D, // Step 3: Emit ISR vector alias. unsigned Num = attr->getNumber() + 0xffe0; new llvm::GlobalAlias(GV->getType(), llvm::Function::ExternalLinkage, - "vector_" + llvm::Twine::utohexstr(Num), + "vector_" + Twine::utohexstr(Num), GV, &M.getModule()); } } diff --git a/lib/Driver/ArgList.cpp b/lib/Driver/ArgList.cpp index b8af9cc47e..86da885a40 100644 --- a/lib/Driver/ArgList.cpp +++ b/lib/Driver/ArgList.cpp @@ -117,8 +117,8 @@ bool ArgList::hasFlag(OptSpecifier Pos, OptSpecifier Neg, bool Default) const { return Default; } -llvm::StringRef ArgList::getLastArgValue(OptSpecifier Id, - llvm::StringRef Default) const { +StringRef ArgList::getLastArgValue(OptSpecifier Id, + StringRef Default) const { if (Arg *A = getLastArg(Id)) return A->getValue(*this); return Default; @@ -129,7 +129,7 @@ int ArgList::getLastArgIntValue(OptSpecifier Id, int Default, int Res = Default; if (Arg *A = getLastArg(Id)) { - if (llvm::StringRef(A->getValue(*this)).getAsInteger(10, Res)) + if (StringRef(A->getValue(*this)).getAsInteger(10, Res)) Diags.Report(diag::err_drv_invalid_int_value) << A->getAsString(*this) << A->getValue(*this); } @@ -138,7 +138,7 @@ int ArgList::getLastArgIntValue(OptSpecifier Id, int Default, } std::vector<std::string> ArgList::getAllArgValues(OptSpecifier Id) const { - llvm::SmallVector<const char *, 16> Values; + SmallVector<const char *, 16> Values; AddAllArgValues(Values, Id); return std::vector<std::string>(Values.begin(), Values.end()); } @@ -177,7 +177,7 @@ void ArgList::AddAllArgsTranslated(ArgStringList &Output, OptSpecifier Id0, (*it)->claim(); if (Joined) { - Output.push_back(MakeArgString(llvm::StringRef(Translation) + + Output.push_back(MakeArgString(StringRef(Translation) + (*it)->getValue(*this, 0))); } else { Output.push_back(Translation); @@ -192,16 +192,16 @@ void ArgList::ClaimAllArgs(OptSpecifier Id0) const { (*it)->claim(); } -const char *ArgList::MakeArgString(const llvm::Twine &T) const { +const char *ArgList::MakeArgString(const Twine &T) const { llvm::SmallString<256> Str; T.toVector(Str); return MakeArgString(Str.str()); } const char *ArgList::GetOrMakeJoinedArgString(unsigned Index, - llvm::StringRef LHS, - llvm::StringRef RHS) const { - llvm::StringRef Cur = getArgString(Index); + StringRef LHS, + StringRef RHS) const { + StringRef Cur = getArgString(Index); if (Cur.size() == LHS.size() + RHS.size() && Cur.startswith(LHS) && Cur.endswith(RHS)) return Cur.data(); @@ -223,7 +223,7 @@ InputArgList::~InputArgList() { delete *it; } -unsigned InputArgList::MakeIndex(llvm::StringRef String0) const { +unsigned InputArgList::MakeIndex(StringRef String0) const { unsigned Index = ArgStrings.size(); // Tuck away so we have a reliable const char *. @@ -233,8 +233,8 @@ unsigned InputArgList::MakeIndex(llvm::StringRef String0) const { return Index; } -unsigned InputArgList::MakeIndex(llvm::StringRef String0, - llvm::StringRef String1) const { +unsigned InputArgList::MakeIndex(StringRef String0, + StringRef String1) const { unsigned Index0 = MakeIndex(String0); unsigned Index1 = MakeIndex(String1); assert(Index0 + 1 == Index1 && "Unexpected non-consecutive indices!"); @@ -242,7 +242,7 @@ unsigned InputArgList::MakeIndex(llvm::StringRef String0, return Index0; } -const char *InputArgList::MakeArgString(llvm::StringRef Str) const { +const char *InputArgList::MakeArgString(StringRef Str) const { return getArgString(MakeIndex(Str)); } @@ -259,7 +259,7 @@ DerivedArgList::~DerivedArgList() { delete *it; } -const char *DerivedArgList::MakeArgString(llvm::StringRef Str) const { +const char *DerivedArgList::MakeArgString(StringRef Str) const { return BaseArgs.MakeArgString(Str); } @@ -270,7 +270,7 @@ Arg *DerivedArgList::MakeFlagArg(const Arg *BaseArg, const Option *Opt) const { } Arg *DerivedArgList::MakePositionalArg(const Arg *BaseArg, const Option *Opt, - llvm::StringRef Value) const { + StringRef Value) const { unsigned Index = BaseArgs.MakeIndex(Value); Arg *A = new Arg(Opt, Index, BaseArgs.getArgString(Index), BaseArg); SynthesizedArgs.push_back(A); @@ -278,7 +278,7 @@ Arg *DerivedArgList::MakePositionalArg(const Arg *BaseArg, const Option *Opt, } Arg *DerivedArgList::MakeSeparateArg(const Arg *BaseArg, const Option *Opt, - llvm::StringRef Value) const { + StringRef Value) const { unsigned Index = BaseArgs.MakeIndex(Opt->getName(), Value); Arg *A = new Arg(Opt, Index, BaseArgs.getArgString(Index + 1), BaseArg); SynthesizedArgs.push_back(A); @@ -286,7 +286,7 @@ Arg *DerivedArgList::MakeSeparateArg(const Arg *BaseArg, const Option *Opt, } Arg *DerivedArgList::MakeJoinedArg(const Arg *BaseArg, const Option *Opt, - llvm::StringRef Value) const { + StringRef Value) const { unsigned Index = BaseArgs.MakeIndex(Opt->getName().str() + Value.str()); Arg *A = new Arg(Opt, Index, BaseArgs.getArgString(Index) + Opt->getName().size(), diff --git a/lib/Driver/Compilation.cpp b/lib/Driver/Compilation.cpp index 2657faa0d3..df07f783b2 100644 --- a/lib/Driver/Compilation.cpp +++ b/lib/Driver/Compilation.cpp @@ -60,7 +60,7 @@ const DerivedArgList &Compilation::getArgsForToolChain(const ToolChain *TC, return *Entry; } -void Compilation::PrintJob(llvm::raw_ostream &OS, const Job &J, +void Compilation::PrintJob(raw_ostream &OS, const Job &J, const char *Terminator, bool Quote) const { if (const Command *C = dyn_cast<Command>(&J)) { OS << " \"" << C->getExecutable() << '"'; @@ -137,7 +137,7 @@ int Compilation::ExecuteCommand(const Command &C, if (getDriver().CCCEcho || getDriver().CCPrintOptions || getArgs().hasArg(options::OPT_v)) { - llvm::raw_ostream *OS = &llvm::errs(); + raw_ostream *OS = &llvm::errs(); // Follow gcc implementation of CC_PRINT_OPTIONS; we could also cache the // output stream. diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 789f6f7ae9..7a0bb6aa79 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -46,9 +46,9 @@ using namespace clang::driver; using namespace clang; -Driver::Driver(llvm::StringRef ClangExecutable, - llvm::StringRef DefaultHostTriple, - llvm::StringRef DefaultImageName, +Driver::Driver(StringRef ClangExecutable, + StringRef DefaultHostTriple, + StringRef DefaultImageName, bool IsProduction, bool CXXIsProduction, Diagnostic &Diags) : Opts(createDriverOptTable()), Diags(Diags), @@ -82,7 +82,7 @@ Driver::Driver(llvm::StringRef ClangExecutable, Dir = llvm::sys::path::parent_path(ClangExecutable); // Compute the path to the resource directory. - llvm::StringRef ClangResourceDir(CLANG_RESOURCE_DIR); + StringRef ClangResourceDir(CLANG_RESOURCE_DIR); llvm::SmallString<128> P(Dir); if (ClangResourceDir != "") llvm::sys::path::append(P, ClangResourceDir); @@ -142,7 +142,7 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const { // Add the remaining values as Xlinker arguments. for (unsigned i = 0, e = A->getNumValues(); i != e; ++i) - if (llvm::StringRef(A->getValue(Args, i)) != "--no-demangle") + if (StringRef(A->getValue(Args, i)) != "--no-demangle") DAL->AddSeparateArg(A, Opts->getOption(options::OPT_Xlinker), A->getValue(Args, i)); @@ -154,10 +154,10 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const { // care to encourage this usage model. if (A->getOption().matches(options::OPT_Wp_COMMA) && A->getNumValues() == 2 && - (A->getValue(Args, 0) == llvm::StringRef("-MD") || - A->getValue(Args, 0) == llvm::StringRef("-MMD"))) { + (A->getValue(Args, 0) == StringRef("-MD") || + A->getValue(Args, 0) == StringRef("-MMD"))) { // Rewrite to -MD/-MMD along with -MF. - if (A->getValue(Args, 0) == llvm::StringRef("-MD")) + if (A->getValue(Args, 0) == StringRef("-MD")) DAL->AddFlagArg(A, Opts->getOption(options::OPT_MD)); else DAL->AddFlagArg(A, Opts->getOption(options::OPT_MMD)); @@ -168,7 +168,7 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const { // Rewrite reserved library names. if (A->getOption().matches(options::OPT_l)) { - llvm::StringRef Value = A->getValue(Args); + StringRef Value = A->getValue(Args); // Rewrite unless -nostdlib is present. if (!HasNostdlib && Value == "stdc++") { @@ -242,11 +242,11 @@ Compilation *Driver::BuildCompilation(llvm::ArrayRef<const char *> ArgList) { CCCUseClang = !Args->hasArg(options::OPT_ccc_no_clang); CCCUseClangCPP = !Args->hasArg(options::OPT_ccc_no_clang_cpp); if (const Arg *A = Args->getLastArg(options::OPT_ccc_clang_archs)) { - llvm::StringRef Cur = A->getValue(*Args); + StringRef Cur = A->getValue(*Args); CCCClangArchs.clear(); while (!Cur.empty()) { - std::pair<llvm::StringRef, llvm::StringRef> Split = Cur.split(','); + std::pair<StringRef, StringRef> Split = Cur.split(','); if (!Split.first.empty()) { llvm::Triple::ArchType Arch = @@ -382,7 +382,7 @@ void Driver::PrintHelp(bool ShowHidden) const { ShowHidden); } -void Driver::PrintVersion(const Compilation &C, llvm::raw_ostream &OS) const { +void Driver::PrintVersion(const Compilation &C, raw_ostream &OS) const { // FIXME: The following handlers should use a callback mechanism, we don't // know what the client would like to do. OS << getClangFullVersion() << '\n'; @@ -397,7 +397,7 @@ void Driver::PrintVersion(const Compilation &C, llvm::raw_ostream &OS) const { /// PrintDiagnosticCategories - Implement the --print-diagnostic-categories /// option. -static void PrintDiagnosticCategories(llvm::raw_ostream &OS) { +static void PrintDiagnosticCategories(raw_ostream &OS) { // Skip the empty category. for (unsigned i = 1, max = DiagnosticIDs::getNumberOfCategories(); i != max; ++i) @@ -599,7 +599,7 @@ void Driver::BuildUniversalActions(const ToolChain &TC, // Collect the list of architectures. Duplicates are allowed, but should only // be handled once (in the order seen). llvm::StringSet<> ArchNames; - llvm::SmallVector<const char *, 4> Archs; + SmallVector<const char *, 4> Archs; for (ArgList::const_iterator it = Args.begin(), ie = Args.end(); it != ie; ++it) { Arg *A = *it; @@ -699,7 +699,7 @@ void Driver::BuildActions(const ToolChain &TC, const DerivedArgList &Args, types::ID InputType = types::TY_Nothing; Arg *InputTypeArg = 0; - llvm::SmallVector<std::pair<types::ID, const Arg*>, 16> Inputs; + SmallVector<std::pair<types::ID, const Arg*>, 16> Inputs; for (ArgList::const_iterator it = Args.begin(), ie = Args.end(); it != ie; ++it) { Arg *A = *it; @@ -1236,7 +1236,7 @@ const char *Driver::GetNamedOutputPath(Compilation &C, } llvm::SmallString<128> BasePath(BaseInput); - llvm::StringRef BaseName; + StringRef BaseName; // Dsymutil actions should use the full path. if (isa<DsymutilJobAction>(JA)) diff --git a/lib/Driver/OptTable.cpp b/lib/Driver/OptTable.cpp index 0252b3e5ca..780ea564db 100644 --- a/lib/Driver/OptTable.cpp +++ b/lib/Driver/OptTable.cpp @@ -13,10 +13,10 @@ #include "clang/Driver/Option.h" #include "llvm/Support/raw_ostream.h" #include <algorithm> -#include <cassert> #include <map> using namespace clang::driver; using namespace clang::driver::options; +using namespace clang; // Ordering on Info. The ordering is *almost* lexicographic, with two // exceptions. First, '\0' comes at the end of the alphabet instead of @@ -291,7 +291,7 @@ static std::string getOptionHelpName(const OptTable &Opts, OptSpecifier Id) { return Name; } -static void PrintHelpOptionList(llvm::raw_ostream &OS, llvm::StringRef Title, +static void PrintHelpOptionList(raw_ostream &OS, StringRef Title, std::vector<std::pair<std::string, const char*> > &OptionHelp) { OS << Title << ":\n"; @@ -342,7 +342,7 @@ static const char *getOptionHelpGroup(const OptTable &Opts, OptSpecifier Id) { return getOptionHelpGroup(Opts, GroupID); } -void OptTable::PrintHelp(llvm::raw_ostream &OS, const char *Name, +void OptTable::PrintHelp(raw_ostream &OS, const char *Name, const char *Title, bool ShowHidden) const { OS << "OVERVIEW: " << Title << "\n"; OS << '\n'; diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp index 74b65918f3..d83fd9af25 100644 --- a/lib/Driver/ToolChain.cpp +++ b/lib/Driver/ToolChain.cpp @@ -18,11 +18,11 @@ #include "clang/Driver/ObjCRuntime.h" #include "clang/Driver/Options.h" #include "llvm/Support/ErrorHandling.h" - using namespace clang::driver; +using namespace clang; -ToolChain::ToolChain(const HostInfo &_Host, const llvm::Triple &_Triple) - : Host(_Host), Triple(_Triple) { +ToolChain::ToolChain(const HostInfo &H, const llvm::Triple &T) + : Host(H), Triple(T) { } ToolChain::~ToolChain() { @@ -79,7 +79,7 @@ static const char *getARMTargetCPU(const ArgList &Args, if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) return A->getValue(Args); - llvm::StringRef MArch; + StringRef MArch; if (Arg *A = Args.getLastArg(options::OPT_march_EQ)) { // Otherwise, if we have -march= choose the base CPU for that arch. MArch = A->getValue(Args); @@ -134,7 +134,7 @@ static const char *getARMTargetCPU(const ArgList &Args, // // FIXME: This is redundant with -mcpu, why does LLVM use this. // FIXME: tblgen this, or kill it! -static const char *getLLVMArchSuffixForARM(llvm::StringRef CPU) { +static const char *getLLVMArchSuffixForARM(StringRef CPU) { if (CPU == "arm7tdmi" || CPU == "arm7tdmi-s" || CPU == "arm710t" || CPU == "arm720t" || CPU == "arm9" || CPU == "arm9tdmi" || CPU == "arm920" || CPU == "arm920t" || CPU == "arm922t" || @@ -182,7 +182,7 @@ std::string ToolChain::ComputeLLVMTriple(const ArgList &Args) const { // Thumb2 is the default for V7 on Darwin. // // FIXME: Thumb should just be another -target-feaure, not in the triple. - llvm::StringRef Suffix = + StringRef Suffix = getLLVMArchSuffixForARM(getARMTargetCPU(Args, Triple)); bool ThumbDefault = (Suffix == "v7" && getTriple().getOS() == llvm::Triple::Darwin); @@ -201,7 +201,7 @@ std::string ToolChain::ComputeEffectiveClangTriple(const ArgList &Args) const { if (Arg *A = Args.getLastArg(options::OPT_mmacosx_version_min_EQ, options::OPT_miphoneos_version_min_EQ, options::OPT_mios_simulator_version_min_EQ)) - getDriver().Diag(clang::diag::err_drv_clang_unsupported) + getDriver().Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args); return ComputeLLVMTriple(Args); @@ -209,12 +209,12 @@ std::string ToolChain::ComputeEffectiveClangTriple(const ArgList &Args) const { ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{ if (Arg *A = Args.getLastArg(options::OPT_stdlib_EQ)) { - llvm::StringRef Value = A->getValue(Args); + StringRef Value = A->getValue(Args); if (Value == "libc++") return ToolChain::CST_Libcxx; if (Value == "libstdc++") return ToolChain::CST_Libstdcxx; - getDriver().Diag(clang::diag::err_drv_invalid_stdlib_name) + getDriver().Diag(diag::err_drv_invalid_stdlib_name) << A->getAsString(Args); } diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 8b5b2ec9b0..5ed4b7f4d3 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -41,6 +41,7 @@ using namespace clang::driver; using namespace clang::driver::toolchains; +using namespace clang; /// Darwin - Darwin tool chain for i386 and x86_64. @@ -54,7 +55,7 @@ Darwin::Darwin(const HostInfo &Host, const llvm::Triple& Triple) if (!Driver::GetReleaseVersion(&OSName.c_str()[6], DarwinVersion[0], DarwinVersion[1], DarwinVersion[2], HadExtra)) - getDriver().Diag(clang::diag::err_drv_invalid_darwin_version) << OSName; + getDriver().Diag(diag::err_drv_invalid_darwin_version) << OSName; llvm::raw_string_ostream(MacosxVersionMin) << "10." << std::max(0, (int)DarwinVersion[0] - 4) << '.' @@ -109,7 +110,7 @@ void Darwin::configureObjCRuntime(ObjCRuntime &runtime) const { } // FIXME: Can we tablegen this? -static const char *GetArmArchForMArch(llvm::StringRef Value) { +static const char *GetArmArchForMArch(StringRef Value) { if (Value == "armv6k") return "armv6"; @@ -131,7 +132,7 @@ static const char *GetArmArchForMArch(llvm::StringRef Value) { } // FIXME: Can we tablegen this? -static const char *GetArmArchForMCpu(llvm::StringRef Value) { +static const char *GetArmArchForMCpu(StringRef Value) { if (Value == "arm10tdmi" || Value == "arm1020t" || Value == "arm9e" || Value == "arm946e-s" || Value == "arm966e-s" || Value == "arm968e-s" || Value == "arm10e" || @@ -153,7 +154,7 @@ static const char *GetArmArchForMCpu(llvm::StringRef Value) { return 0; } -llvm::StringRef Darwin::getDarwinArchName(const ArgList &Args) const { +StringRef Darwin::getDarwinArchName(const ArgList &Args) const { switch (getTriple().getArch()) { default: return getArchName(); @@ -328,7 +329,7 @@ void DarwinClang::AddLinkSearchPathArgs(const ArgList &Args, case llvm::Triple::arm: case llvm::Triple::thumb: { std::string Triple = ComputeLLVMTriple(Args); - llvm::StringRef TripleStr = Triple; + StringRef TripleStr = Triple; if (TripleStr.startswith("armv5") || TripleStr.startswith("thumbv5")) ArchSpecificDir = "v5"; else if (TripleStr.startswith("armv6") || TripleStr.startswith("thumbv6")) @@ -408,7 +409,7 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args, // cares. This is useful in situations where someone wants to statically link // something like libstdc++, and needs its runtime support routines. if (const Arg *A = Args.getLastArg(options::OPT_static_libgcc)) { - getDriver().Diag(clang::diag::err_drv_unsupported_opt) + getDriver().Diag(diag::err_drv_unsupported_opt) << A->getAsString(Args); return; } @@ -452,7 +453,7 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args, } } -static inline llvm::StringRef SimulatorVersionDefineName() { +static inline StringRef SimulatorVersionDefineName() { return "__IPHONE_OS_VERSION_MIN_REQUIRED"; } @@ -461,11 +462,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; @@ -496,7 +497,7 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { if (!iOSVersion) { for (arg_iterator it = Args.filtered_begin(options::OPT_D), ie = Args.filtered_end(); it != ie; ++it) { - llvm::StringRef define = (*it)->getValue(Args); + StringRef define = (*it)->getValue(Args); if (define.startswith(SimulatorVersionDefineName())) { unsigned Major, Minor, Micro; if (GetVersionFromSimulatorDefine(define, Major, Minor, Micro) && @@ -510,12 +511,12 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { } if (OSXVersion && (iOSVersion || iOSSimVersion)) { - getDriver().Diag(clang::diag::err_drv_argument_not_allowed_with) + getDriver().Diag(diag::err_drv_argument_not_allowed_with) << OSXVersion->getAsString(Args) << (iOSVersion ? iOSVersion : iOSSimVersion)->getAsString(Args); iOSVersion = iOSSimVersion = 0; } else if (iOSVersion && iOSSimVersion) { - getDriver().Diag(clang::diag::err_drv_argument_not_allowed_with) + getDriver().Diag(diag::err_drv_argument_not_allowed_with) << iOSVersion->getAsString(Args) << iOSSimVersion->getAsString(Args); iOSSimVersion = 0; @@ -540,7 +541,7 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { // Do not allow conflicts with the iOS simulator target. if (iOSSimTarget && (OSXTarget || iOSTarget)) { - getDriver().Diag(clang::diag::err_drv_conflicting_deployment_targets) + getDriver().Diag(diag::err_drv_conflicting_deployment_targets) << "IOS_SIMULATOR_DEPLOYMENT_TARGET" << (OSXTarget ? "MACOSX_DEPLOYMENT_TARGET" : "IPHONEOS_DEPLOYMENT_TARGET"); @@ -580,7 +581,7 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { // Reject invalid architecture combinations. if (iOSSimVersion && (getTriple().getArch() != llvm::Triple::x86 && getTriple().getArch() != llvm::Triple::x86_64)) { - getDriver().Diag(clang::diag::err_drv_invalid_arch_for_deployment_target) + getDriver().Diag(diag::err_drv_invalid_arch_for_deployment_target) << getTriple().getArchName() << iOSSimVersion->getAsString(Args); } @@ -592,7 +593,7 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { if (!Driver::GetReleaseVersion(OSXVersion->getValue(Args), Major, Minor, Micro, HadExtra) || HadExtra || Major != 10 || Minor >= 100 || Micro >= 100) - getDriver().Diag(clang::diag::err_drv_invalid_version_number) + getDriver().Diag(diag::err_drv_invalid_version_number) << OSXVersion->getAsString(Args); } else { const Arg *Version = iOSVersion ? iOSVersion : iOSSimVersion; @@ -600,7 +601,7 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { if (!Driver::GetReleaseVersion(Version->getValue(Args), Major, Minor, Micro, HadExtra) || HadExtra || Major >= 10 || Minor >= 100 || Micro >= 100) - getDriver().Diag(clang::diag::err_drv_invalid_version_number) + getDriver().Diag(diag::err_drv_invalid_version_number) << Version->getAsString(Args); } @@ -704,7 +705,7 @@ DerivedArgList *Darwin::TranslateArgs(const DerivedArgList &Args, // triple arch, or the arch being bound. // // FIXME: Canonicalize name. - llvm::StringRef XarchArch = A->getValue(Args, 0); + StringRef XarchArch = A->getValue(Args, 0); if (!(XarchArch == getArchName() || (BoundArch && XarchArch == BoundArch))) continue; @@ -723,11 +724,11 @@ DerivedArgList *Darwin::TranslateArgs(const DerivedArgList &Args, // use isDriverOption() as an approximation, although things // like -O4 are going to slip through. if (!XarchArg || Index > Prev + 1) { - getDriver().Diag(clang::diag::err_drv_invalid_Xarch_argument_with_args) + getDriver().Diag(diag::err_drv_invalid_Xarch_argument_with_args) << A->getAsString(Args); continue; } else if (XarchArg->getOption().isDriverOption()) { - getDriver().Diag(clang::diag::err_drv_invalid_Xarch_argument_isdriver) + getDriver().Diag(diag::err_drv_invalid_Xarch_argument_isdriver) << A->getAsString(Args); continue; } @@ -830,7 +831,7 @@ DerivedArgList *Darwin::TranslateArgs(const DerivedArgList &Args, // Add the arch options based on the particular spelling of -arch, to match // how the driver driver works. if (BoundArch) { - llvm::StringRef Name = BoundArch; + StringRef Name = BoundArch; const Option *MCpu = Opts.getOption(options::OPT_mcpu_EQ); const Option *MArch = Opts.getOption(options::OPT_march_EQ); @@ -1370,8 +1371,8 @@ static bool HasMultilib(llvm::Triple::ArchType Arch, enum LinuxDistro Distro) { static LinuxDistro DetectLinuxDistro(llvm::Triple::ArchType Arch) { llvm::OwningPtr<llvm::MemoryBuffer> File; if (!llvm::MemoryBuffer::getFile("/etc/lsb-release", File)) { - llvm::StringRef Data = File.get()->getBuffer(); - llvm::SmallVector<llvm::StringRef, 8> Lines; + StringRef Data = File.get()->getBuffer(); + SmallVector<StringRef, 8> Lines; Data.split(Lines, "\n"); for (unsigned int i = 0, s = Lines.size(); i < s; ++ i) { if (Lines[i] == "DISTRIB_CODENAME=hardy") @@ -1395,7 +1396,7 @@ static LinuxDistro DetectLinuxDistro(llvm::Triple::ArchType Arch) { } if (!llvm::MemoryBuffer::getFile("/etc/redhat-release", File)) { - llvm::StringRef Data = File.get()->getBuffer(); + StringRef Data = File.get()->getBuffer(); if (Data.startswith("Fedora release 15")) return Fedora15; else if (Data.startswith("Fedora release 14")) @@ -1403,24 +1404,24 @@ static LinuxDistro DetectLinuxDistro(llvm::Triple::ArchType Arch) { else if (Data.startswith("Fedora release 13")) return Fedora13; else if (Data.startswith("Fedora release") && - Data.find("Rawhide") != llvm::StringRef::npos) + Data.find("Rawhide") != StringRef::npos) return FedoraRawhide; else if (Data.startswith("Red Hat Enterprise Linux") && - Data.find("release 6") != llvm::StringRef::npos) + Data.find("release 6") != StringRef::npos) return RHEL6; else if ((Data.startswith("Red Hat Enterprise Linux") || Data.startswith("CentOS")) && - Data.find("release 5") != llvm::StringRef::npos) + Data.find("release 5") != StringRef::npos) return RHEL5; else if ((Data.startswith("Red Hat Enterprise Linux") || Data.startswith("CentOS")) && - Data.find("release 4") != llvm::StringRef::npos) + Data.find("release 4") != StringRef::npos) return RHEL4; return UnknownDistro; } if (!llvm::MemoryBuffer::getFile("/etc/debian_version", File)) { - llvm::StringRef Data = File.get()->getBuffer(); + StringRef Data = File.get()->getBuffer(); if (Data[0] == '5') return DebianLenny; else if (Data.startswith("squeeze/sid")) @@ -1431,7 +1432,7 @@ static LinuxDistro DetectLinuxDistro(llvm::Triple::ArchType Arch) { } if (!llvm::MemoryBuffer::getFile("/etc/SuSE-release", File)) { - llvm::StringRef Data = File.get()->getBuffer(); + StringRef Data = File.get()->getBuffer(); if (Data.startswith("openSUSE 11.3")) return OpenSuse11_3; else if (Data.startswith("openSUSE 11.4")) @@ -1466,7 +1467,7 @@ static std::string findGCCBaseLibDir(const std::string &GccTriple) { // This is of the form /foo/bar/include/c++/4.5.2/ if (CxxIncludeRoot.back() == '/') llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the / - llvm::StringRef Version = llvm::sys::path::filename(CxxIncludeRoot); + StringRef Version = llvm::sys::path::filename(CxxIncludeRoot); llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the version llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the c++ llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the include diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 2fb865e020..31413c7cf9 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -45,6 +45,7 @@ using namespace clang::driver; using namespace clang::driver::tools; +using namespace clang; /// FindTargetProgramPath - Return path of the target specific version of /// ProgName. If it doesn't exist, return path of ProgName itself. @@ -63,7 +64,7 @@ static std::string FindTargetProgramPath(const ToolChain &TheToolChain, static void CheckPreprocessingOptions(const Driver &D, const ArgList &Args) { if (Arg *A = Args.getLastArg(options::OPT_C, options::OPT_CC)) if (!Args.hasArg(options::OPT_E) && !D.CCCIsCPP) - D.Diag(clang::diag::err_drv_argument_only_allowed_with) + D.Diag(diag::err_drv_argument_only_allowed_with) << A->getAsString(Args) << "-E"; } @@ -74,14 +75,14 @@ static void CheckCodeGenerationOptions(const Driver &D, const ArgList &Args) { if (Args.hasArg(options::OPT_static)) if (const Arg *A = Args.getLastArg(options::OPT_dynamic, options::OPT_mdynamic_no_pic)) - D.Diag(clang::diag::err_drv_argument_not_allowed_with) + D.Diag(diag::err_drv_argument_not_allowed_with) << A->getAsString(Args) << "-static"; } // Quote target names for inclusion in GNU Make dependency files. // Only the characters '$', '#', ' ', '\t' are quoted. -static void QuoteTarget(llvm::StringRef Target, - llvm::SmallVectorImpl<char> &Res) { +static void QuoteTarget(StringRef Target, + SmallVectorImpl<char> &Res) { for (unsigned i = 0, e = Target.size(); i != e; ++i) { switch (Target[i]) { case ' ': @@ -126,7 +127,7 @@ static void AddLinkerInputs(const ToolChain &TC, II.getType() == types::TY_LTO_IR || II.getType() == types::TY_LLVM_BC || II.getType() == types::TY_LTO_BC) - D.Diag(clang::diag::err_drv_no_linker_llvm_support) + D.Diag(diag::err_drv_no_linker_llvm_support) << TC.getTripleString(); } @@ -168,15 +169,15 @@ static void addProfileRT(const ToolChain &TC, const ArgList &Args, // the link line. We cannot do the same thing because unlike gcov there is a // libprofile_rt.so. We used to use the -l:libprofile_rt.a syntax, but that is // not supported by old linkers. - llvm::Twine ProfileRT = - llvm::Twine(TC.getDriver().Dir) + "/../lib/" + "libprofile_rt.a"; + Twine ProfileRT = + Twine(TC.getDriver().Dir) + "/../lib/" + "libprofile_rt.a"; if (Triple.getOS() == llvm::Triple::Darwin) { // On Darwin, if the static library doesn't exist try the dylib. bool Exists; if (llvm::sys::fs::exists(ProfileRT.str(), Exists) || !Exists) ProfileRT = - llvm::Twine(TC.getDriver().Dir) + "/../lib/" + "libprofile_rt.dylib"; + Twine(TC.getDriver().Dir) + "/../lib/" + "libprofile_rt.dylib"; } CmdArgs.push_back(Args.MakeArgString(ProfileRT)); @@ -245,7 +246,7 @@ void Clang::AddPreprocessingOptions(const Driver &D, if (Args.hasArg(options::OPT_MG)) { if (!A || A->getOption().matches(options::OPT_MD) || A->getOption().matches(options::OPT_MMD)) - D.Diag(clang::diag::err_drv_mg_requires_m_or_mm); + D.Diag(diag::err_drv_mg_requires_m_or_mm); CmdArgs.push_back("-MG"); } @@ -328,7 +329,7 @@ void Clang::AddPreprocessingOptions(const Driver &D, continue; } else { // Ignore the PCH if not first on command line and emit warning. - D.Diag(clang::diag::warn_drv_pch_not_first_include) + D.Diag(diag::warn_drv_pch_not_first_include) << P.str() << A->getAsString(Args); } } @@ -363,7 +364,7 @@ void Clang::AddPreprocessingOptions(const Driver &D, // -I- is a deprecated GCC feature, reject it. if (Arg *A = Args.getLastArg(options::OPT_I_)) - D.Diag(clang::diag::err_drv_I_dash_not_supported) << A->getAsString(Args); + D.Diag(diag::err_drv_I_dash_not_supported) << A->getAsString(Args); // If we have a --sysroot, and don't have an explicit -isysroot flag, add an // -isysroot to the CC1 invocation. @@ -386,7 +387,7 @@ static const char *getARMTargetCPU(const ArgList &Args, if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) return A->getValue(Args); - llvm::StringRef MArch; + StringRef MArch; if (Arg *A = Args.getLastArg(options::OPT_march_EQ)) { // Otherwise, if we have -march= choose the base CPU for that arch. MArch = A->getValue(Args); @@ -441,7 +442,7 @@ static const char *getARMTargetCPU(const ArgList &Args, // // FIXME: This is redundant with -mcpu, why does LLVM use this. // FIXME: tblgen this, or kill it! -static const char *getLLVMArchSuffixForARM(llvm::StringRef CPU) { +static const char *getLLVMArchSuffixForARM(StringRef CPU) { if (CPU == "arm7tdmi" || CPU == "arm7tdmi-s" || CPU == "arm710t" || CPU == "arm720t" || CPU == "arm9" || CPU == "arm9tdmi" || CPU == "arm920" || CPU == "arm920t" || CPU == "arm922t" || @@ -528,7 +529,7 @@ void Clang::AddARMTargetArgs(const ArgList &Args, // Select the float ABI as determined by -msoft-float, -mhard-float, and // -mfloat-abi=. - llvm::StringRef FloatABI; + StringRef FloatABI; if (Arg *A = Args.getLastArg(options::OPT_msoft_float, options::OPT_mhard_float, options::OPT_mfloat_abi_EQ)) { @@ -539,7 +540,7 @@ void Clang::AddARMTargetArgs(const ArgList &Args, else { FloatABI = A->getValue(Args); if (FloatABI != "soft" && FloatABI != "softfp" && FloatABI != "hard") { - D.Diag(clang::diag::err_drv_invalid_mfloat_abi) + D.Diag(diag::err_drv_invalid_mfloat_abi) << A->getAsString(Args); FloatABI = "soft"; } @@ -554,7 +555,7 @@ void Clang::AddARMTargetArgs(const ArgList &Args, // Darwin defaults to "softfp" for v6 and v7. // // FIXME: Factor out an ARM class so we can cache the arch somewhere. - llvm::StringRef ArchName = + StringRef ArchName = getLLVMArchSuffixForARM(getARMTargetCPU(Args, Triple)); if (ArchName.startswith("v6") || ArchName.startswith("v7")) FloatABI = "softfp"; @@ -583,7 +584,7 @@ void Clang::AddARMTargetArgs(const ArgList &Args, default: // Assume "soft", but warn the user we are guessing. FloatABI = "soft"; - D.Diag(clang::diag::warn_drv_assuming_mfloat_abi_is) << "soft"; + D.Diag(diag::warn_drv_assuming_mfloat_abi_is) << "soft"; break; } } @@ -630,7 +631,7 @@ void Clang::AddARMTargetArgs(const ArgList &Args, // FIXME: Centralize feature selection, defaulting shouldn't be also in the // frontend target. if (const Arg *A = Args.getLastArg(options::OPT_mfpu_EQ)) { - llvm::StringRef FPU = A->getValue(Args); + StringRef FPU = A->getValue(Args); // Set the target features based on the FPU. if (FPU == "fpa" || FPU == "fpe2" || FPU == "fpe3" || FPU == "maverick") { @@ -651,7 +652,7 @@ void Clang::AddARMTargetArgs(const ArgList &Args, CmdArgs.push_back("-target-feature"); CmdArgs.push_back("+neon"); } else - D.Diag(clang::diag::err_drv_clang_unsupported) << A->getAsString(Args); + D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args); } // Setting -msoft-float effectively disables NEON because of the GCC @@ -693,7 +694,7 @@ void Clang::AddMIPSTargetArgs(const ArgList &Args, CmdArgs.push_back(ABIName); if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) { - llvm::StringRef MArch = A->getValue(Args); + StringRef MArch = A->getValue(Args); CmdArgs.push_back("-target-cpu"); if ((MArch == "r2000") || (MArch == "r3000")) @@ -705,7 +706,7 @@ void Clang::AddMIPSTargetArgs(const ArgList &Args, } // Select the float ABI as determined by -msoft-float, -mhard-float, and - llvm::StringRef FloatABI; + StringRef FloatABI; if (Arg *A = Args.getLastArg(options::OPT_msoft_float, options::OPT_mhard_float)) { if (A->getOption().matches(options::OPT_msoft_float)) @@ -718,7 +719,7 @@ void Clang::AddMIPSTargetArgs(const ArgList &Args, if (FloatABI.empty()) { // Assume "soft", but warn the user we are guessing. FloatABI = "soft"; - D.Diag(clang::diag::warn_drv_assuming_mfloat_abi_is) << "soft"; + D.Diag(diag::warn_drv_assuming_mfloat_abi_is) << "soft"; } if (FloatABI == "soft") { @@ -737,13 +738,13 @@ void Clang::AddSparcTargetArgs(const ArgList &Args, const Driver &D = getToolChain().getDriver(); if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) { - llvm::StringRef MArch = A->getValue(Args); + StringRef MArch = A->getValue(Args); CmdArgs.push_back("-target-cpu"); CmdArgs.push_back(MArch.str().c_str()); } // Select the float ABI as determined by -msoft-float, -mhard-float, and - llvm::StringRef FloatABI; + StringRef FloatABI; if (Arg *A = Args.getLastArg(options::OPT_msoft_float, options::OPT_mhard_float)) { if (A->getOption().matches(options::OPT_msoft_float)) @@ -758,7 +759,7 @@ void Clang::AddSparcTargetArgs(const ArgList &Args, default: // Assume "soft", but warn the user we are guessing. FloatABI = "soft"; - D.Diag(clang::diag::warn_drv_assuming_mfloat_abi_is) << "soft"; + D.Diag(diag::warn_drv_assuming_mfloat_abi_is) << "soft"; break; } } @@ -792,7 +793,7 @@ void Clang::AddX86TargetArgs(const ArgList &Args, const char *CPUName = 0; if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) { - if (llvm::StringRef(A->getValue(Args)) == "native") { + if (StringRef(A->getValue(Args)) == "native") { // FIXME: Reject attempts to use -march=native unless the target matches // the host. // @@ -856,7 +857,7 @@ void Clang::AddX86TargetArgs(const ArgList &Args, std::vector<const char*> Features; for (arg_iterator it = Args.filtered_begin(options::OPT_m_x86_Features_Group), ie = Args.filtered_end(); it != ie; ++it) { - llvm::StringRef Name = (*it)->getOption().getName(); + StringRef Name = (*it)->getOption().getName(); (*it)->claim(); // Skip over "-m". @@ -999,7 +1000,7 @@ static bool ShouldDisableCFI(const ArgList &Args, /// \brief Check whether the given input tree contains any compilation actions. static bool ContainsCompileAction(const Action *A) { - if (llvm::isa<CompileJobAction>(A)) + if (isa<CompileJobAction>(A)) return true; for (Action::const_iterator it = A->begin(), ie = A->end(); it != ie; ++it) @@ -1079,7 +1080,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, A->claim(); for (unsigned i = 0, e = A->getNumValues(); i != e; ++i) { - llvm::StringRef Value = A->getValue(Args, i); + StringRef Value = A->getValue(Args, i); if (Value == "-force_cpusubtype_ALL") { // Do nothing, this is the default and we don't support anything else. @@ -1091,7 +1092,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } else if (Value == "--noexecstack") { CmdArgs.push_back("-mnoexecstack"); } else { - D.Diag(clang::diag::err_drv_unsupported_option_argument) + D.Diag(diag::err_drv_unsupported_option_argument) << A->getOption().getName() << Value; } } @@ -1217,7 +1218,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, else Model = getToolChain().GetDefaultRelocationModel(); } - if (llvm::StringRef(Model) != "pic") { + if (StringRef(Model) != "pic") { CmdArgs.push_back("-mrelocation-model"); CmdArgs.push_back(Model); } @@ -1362,14 +1363,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, if (!Args.hasArg(options::OPT_fallow_unsupported)) { Arg *Unsupported; if ((Unsupported = Args.getLastArg(options::OPT_iframework))) - D.Diag(clang::diag::err_drv_clang_unsupported) + D.Diag(diag::err_drv_clang_unsupported) << Unsupported->getOption().getName(); if (types::isCXX(InputType) && getToolChain().getTriple().getOS() == llvm::Triple::Darwin && getToolChain().getTriple().getArch() == llvm::Triple::x86) { if ((Unsupported = Args.getLastArg(options::OPT_fapple_kext))) - D.Diag(clang::diag::err_drv_clang_unsupported_opt_cxx_darwin_i386) + D.Diag(diag::err_drv_clang_unsupported_opt_cxx_darwin_i386) << Unsupported->getOption().getName(); } } @@ -1593,7 +1594,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // If -fmessage-length=N was not specified, determine whether this is a // terminal and, if so, implicitly define -fmessage-length appropriately. unsigned N = llvm::sys::Process::StandardErrColumns(); - CmdArgs.push_back(Args.MakeArgString(llvm::Twine(N))); + CmdArgs.push_back(Args.MakeArgString(Twine(N))); } if (const Arg *A = Args.getLastArg(options::OPT_fvisibility_EQ)) { @@ -1638,7 +1639,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // Forward -ftrap_function= options to the backend. if (Arg *A = Args.getLastArg(options::OPT_ftrap_function_EQ)) { - llvm::StringRef FuncName = A->getValue(Args); + StringRef FuncName = A->getValue(Args); CmdArgs.push_back("-backend-option"); CmdArgs.push_back(Args.MakeArgString("-trap-func=" + FuncName)); } @@ -1672,7 +1673,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, StackProtectorLevel = getToolChain().GetDefaultStackProtectorLevel(); if (StackProtectorLevel) { CmdArgs.push_back("-stack-protector"); - CmdArgs.push_back(Args.MakeArgString(llvm::Twine(StackProtectorLevel))); + CmdArgs.push_back(Args.MakeArgString(Twine(StackProtectorLevel))); } // Translate -mstackrealign @@ -1756,7 +1757,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, if (Args.hasFlag(options::OPT_fms_extensions, options::OPT_fno_ms_extensions, getToolChain().getTriple().getOS() == llvm::Triple::Win32) || Args.hasArg(options::OPT_fmsc_version)) { - llvm::StringRef msc_ver = Args.getLastArgValue(options::OPT_fmsc_version); + StringRef msc_ver = Args.getLastArgValue(options::OPT_fmsc_version); if (msc_ver.empty()) CmdArgs.push_back("-fmsc-version=1300"); else @@ -1815,14 +1816,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, objcABIVersion = 1; // If -fobjc-abi-version= is present, use that to set the version. if (Arg *A = Args.getLastArg(options::OPT_fobjc_abi_version_EQ)) { - if (llvm::StringRef(A->getValue(Args)) == "1") + if (StringRef(A->getValue(Args)) == "1") objcABIVersion = 1; - else if (llvm::StringRef(A->getValue(Args)) == "2") + else if (StringRef(A->getValue(Args)) == "2") objcABIVersion = 2; - else if (llvm::StringRef(A->getValue(Args)) == "3") + else if (StringRef(A->getValue(Args)) == "3") objcABIVersion = 3; else - D.Diag(clang::diag::err_drv_clang_unsupported) << A->getAsString(Args); + D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args); } else { // Otherwise, determine if we are using the non-fragile ABI. if (Args.hasFlag(options::OPT_fobjc_nonfragile_abi, @@ -1837,12 +1838,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, if (Arg *A = Args.getLastArg( options::OPT_fobjc_nonfragile_abi_version_EQ)) { - if (llvm::StringRef(A->getValue(Args)) == "1") + if (StringRef(A->getValue(Args)) == "1") NonFragileABIVersion = 1; - else if (llvm::StringRef(A->getValue(Args)) == "2") + else if (StringRef(A->getValue(Args)) == "2") NonFragileABIVersion = 2; else - D.Diag(clang::diag::err_drv_clang_unsupported) + D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args); } @@ -1907,13 +1908,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, GCArg = Args.getLastArg(options::OPT_fobjc_gc); if (GCArg) { if (ARC) { - D.Diag(clang::diag::err_drv_objc_gc_arr) + D.Diag(diag::err_drv_objc_gc_arr) << GCArg->getAsString(Args); } else if (getToolChain().SupportsObjCGC()) { GCArg->render(Args, CmdArgs); } else { // FIXME: We should move this to a hard error. - D.Diag(clang::diag::warn_drv_objc_gc_unsupported) + D.Diag(diag::warn_drv_objc_gc_unsupported) << GCArg->getAsString(Args); } } @@ -1969,13 +1970,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // -funsigned-bitfields. if (!Args.hasFlag(options::OPT_fsigned_bitfields, options::OPT_funsigned_bitfields)) - D.Diag(clang::diag::warn_drv_clang_unsupported) + D.Diag(diag::warn_drv_clang_unsupported) << Args.getLastArg(options::OPT_funsigned_bitfields)->getAsString(Args); // -fsigned-bitfields is default, and clang doesn't support -fno-for-scope. if (!Args.hasFlag(options::OPT_ffor_scope, options::OPT_fno_for_scope)) - D.Diag(clang::diag::err_drv_clang_unsupported) + D.Diag(diag::err_drv_clang_unsupported) << Args.getLastArg(options::OPT_fno_for_scope)->getAsString(Args); // -fcaret-diagnostics is default. @@ -2063,7 +2064,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, if (Arg *A = Args.getLastArg(options::OPT_funit_at_a_time, options::OPT_fno_unit_at_a_time)) { if (A->getOption().matches(options::OPT_fno_unit_at_a_time)) - D.Diag(clang::diag::warn_drv_clang_unsupported) << A->getAsString(Args); + D.Diag(diag::warn_drv_clang_unsupported) << A->getAsString(Args); } // Default to -fno-builtin-str{cat,cpy} on Darwin for ARM. @@ -2086,7 +2087,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, if (isa<PreprocessJobAction>(JA)) CmdArgs.push_back("-traditional-cpp"); else - D.Diag(clang::diag::err_drv_clang_unsupported) << A->getAsString(Args); + D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args); } Args.AddLastArg(CmdArgs, options::OPT_dM); @@ -2101,7 +2102,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // We translate this by hand to the -cc1 argument, since nightly test uses // it and developers have been trained to spell it with -mllvm. - if (llvm::StringRef((*it)->getValue(Args, 0)) == "-disable-llvm-optzns") + if (StringRef((*it)->getValue(Args, 0)) == "-disable-llvm-optzns") CmdArgs.push_back("-disable-llvm-optzns"); else (*it)->render(Args, CmdArgs); @@ -2153,7 +2154,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, if (Arg *A = Args.getLastArg(options::OPT_pg)) if (Args.hasArg(options::OPT_fomit_frame_pointer)) - D.Diag(clang::diag::err_drv_argument_not_allowed_with) + D.Diag(diag::err_drv_argument_not_allowed_with) << "-fomit-frame-pointer" << A->getAsString(Args); // Claim some arguments which clang supports automatically. @@ -2306,10 +2307,10 @@ void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA, // Don't try to pass LLVM or AST inputs to a generic gcc. if (II.getType() == types::TY_LLVM_IR || II.getType() == types::TY_LTO_IR || II.getType() == types::TY_LLVM_BC || II.getType() == types::TY_LTO_BC) - D.Diag(clang::diag::err_drv_no_linker_llvm_support) + D.Diag(diag::err_drv_no_linker_llvm_support) << getToolChain().getTripleString(); else if (II.getType() == types::TY_AST) - D.Diag(clang::diag::err_drv_no_ast_support) + D.Diag(diag::err_drv_no_ast_support) << getToolChain().getTripleString(); if (types::canTypeBeUserSpecified(II.getType())) { @@ -2372,7 +2373,7 @@ void gcc::Compile::RenderExtraToolArgs(const JobAction &JA, CmdArgs.push_back("-c"); else { if (JA.getType() != types::TY_PP_Asm) - D.Diag(clang::diag::err_drv_invalid_gcc_output_type) + D.Diag(diag::err_drv_invalid_gcc_output_type) << getTypeName(JA.getType()); CmdArgs.push_back("-S"); @@ -2478,7 +2479,7 @@ void darwin::CC1::AddCC1OptionsArgs(const ArgList &Args, ArgStringList &CmdArgs, if (Arg *A = Args.getLastArg(options::OPT_pg)) if (Args.hasArg(options::OPT_fomit_frame_pointer)) - D.Diag(clang::diag::err_drv_argument_not_allowed_with) + D.Diag(diag::err_drv_argument_not_allowed_with) << A->getAsString(Args) << "-fomit-frame-pointer"; AddCC1Args(Args, CmdArgs); @@ -2769,7 +2770,7 @@ void darwin::Compile::ConstructJob(Compilation &C, const JobAction &JA, types::ID InputType = Inputs[0].getType(); const Arg *A; if ((A = Args.getLastArg(options::OPT_traditional))) - D.Diag(clang::diag::err_drv_argument_only_allowed_with) + D.Diag(diag::err_drv_argument_only_allowed_with) << A->getAsString(Args) << "-E"; if (JA.getType() == types::TY_LLVM_IR || @@ -2779,11 +2780,11 @@ void darwin::Compile::ConstructJob(Compilation &C, const JobAction &JA, JA.getType() == types::TY_LTO_BC) CmdArgs.push_back("-emit-llvm-bc"); else if (Output.getType() == types::TY_AST) - D.Diag(clang::diag::err_drv_no_ast_support) + D.Diag(diag::err_drv_no_ast_support) << getToolChain().getTripleString(); else if (JA.getType() != types::TY_PP_Asm && JA.getType() != types::TY_PCH) - D.Diag(clang::diag::err_drv_invalid_gcc_output_type) + D.Diag(diag::err_drv_invalid_gcc_output_type) << getTypeName(JA.getType()); ArgStringList OutputArgs; @@ -2817,7 +2818,7 @@ void darwin::Compile::ConstructJob(Compilation &C, const JobAction &JA, // Reject AST inputs. if (II.getType() == types::TY_AST) { - D.Diag(clang::diag::err_drv_no_ast_support) + D.Diag(diag::err_drv_no_ast_support) << getToolChain().getTripleString(); return; } @@ -2911,7 +2912,7 @@ void darwin::Assemble::ConstructJob(Compilation &C, const JobAction &JA, void darwin::DarwinTool::AddDarwinArch(const ArgList &Args, ArgStringList &CmdArgs) const { - llvm::StringRef ArchName = getDarwinToolChain().getDarwinArchName(Args); + StringRef ArchName = getDarwinToolChain().getDarwinArchName(Args); // Derived from darwin_arch spec. CmdArgs.push_back("-arch"); @@ -2934,7 +2935,7 @@ void darwin::Link::AddLinkArgs(Compilation &C, if (!Driver::GetReleaseVersion(A->getValue(Args), Version[0], Version[1], Version[2], HadExtra) || HadExtra) - D.Diag(clang::diag::err_drv_invalid_version_number) + D.Diag(diag::err_drv_invalid_version_number) << A->getAsString(Args); } @@ -2958,7 +2959,7 @@ void darwin::Link::AddLinkArgs(Compilation &C, ie = Args.filtered_end(); it != ie; ++it) { const Arg *A = *it; for (unsigned i = 0, e = A->getNumValues(); i != e; ++i) - if (llvm::StringRef(A->getValue(Args, i)) == "-kext") + if (StringRef(A->getValue(Args, i)) == "-kext") UsesLdClassic = true; } } @@ -2999,7 +3000,7 @@ void darwin::Link::AddLinkArgs(Compilation &C, if ((A = Args.getLastArg(options::OPT_compatibility__version)) || (A = Args.getLastArg(options::OPT_current__version)) || (A = Args.getLastArg(options::OPT_install__name))) - D.Diag(clang::diag::err_drv_argument_only_allowed_with) + D.Diag(diag::err_drv_argument_only_allowed_with) << A->getAsString(Args) << "-dynamiclib"; Args.AddLastArg(CmdArgs, options::OPT_force__flat__namespace); @@ -3015,7 +3016,7 @@ void darwin::Link::AddLinkArgs(Compilation &C, (A = Args.getLastArg(options::OPT_force__flat__namespace)) || (A = Args.getLastArg(options::OPT_keep__private__externs)) || (A = Args.getLastArg(options::OPT_private__bundle))) - D.Diag(clang::diag::err_drv_argument_not_allowed_with) + D.Diag(diag::err_drv_argument_not_allowed_with) << A->getAsString(Args) << "-dynamiclib"; Args.AddAllArgsTranslated(CmdArgs, options::OPT_compatibility__version, @@ -3062,9 +3063,9 @@ void darwin::Link::AddLinkArgs(Compilation &C, CmdArgs.push_back("-iphoneos_version_min"); else CmdArgs.push_back("-macosx_version_min"); - CmdArgs.push_back(Args.MakeArgString(llvm::Twine(TargetVersion[0]) + "." + - llvm::Twine(TargetVersion[1]) + "." + - llvm::Twine(TargetVersion[2]))); + CmdArgs.push_back(Args.MakeArgString(Twine(TargetVersion[0]) + "." + + Twine(TargetVersion[1]) + "." + + Twine(TargetVersion[2]))); Args.AddLastArg(CmdArgs, options::OPT_nomultidefs); Args.AddLastArg(CmdArgs, options::OPT_multi__module); @@ -3691,7 +3692,7 @@ void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA, const ToolChain::path_list Paths = getToolChain().getFilePaths(); for (ToolChain::path_list::const_iterator i = Paths.begin(), e = Paths.end(); i != e; ++i) - CmdArgs.push_back(Args.MakeArgString(llvm::StringRef("-L") + *i)); + CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + *i)); Args.AddAllArgs(CmdArgs, options::OPT_T_Group); Args.AddAllArgs(CmdArgs, options::OPT_e); Args.AddAllArgs(CmdArgs, options::OPT_s); @@ -3944,7 +3945,7 @@ void linuxtools::Assemble::ConstructJob(Compilation &C, const JobAction &JA, } else if (getToolChain().getArch() == llvm::Triple::x86_64) { CmdArgs.push_back("--64"); } else if (getToolChain().getArch() == llvm::Triple::arm) { - llvm::StringRef MArch = getToolChain().getArchName(); + StringRef MArch = getToolChain().getArchName(); if (MArch == "armv7" || MArch == "armv7a" || MArch == "armv7-a") CmdArgs.push_back("-mfpu=neon"); } @@ -4079,7 +4080,7 @@ void linuxtools::Link::ConstructJob(Compilation &C, const JobAction &JA, for (ToolChain::path_list::const_iterator i = Paths.begin(), e = Paths.end(); i != e; ++i) - CmdArgs.push_back(Args.MakeArgString(llvm::StringRef("-L") + *i)); + CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + *i)); AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs); diff --git a/lib/Frontend/ASTConsumers.cpp b/lib/Frontend/ASTConsumers.cpp index 28d312a221..b0746b290c 100644 --- a/lib/Frontend/ASTConsumers.cpp +++ b/lib/Frontend/ASTConsumers.cpp @@ -31,11 +31,11 @@ using namespace clang; namespace { class ASTPrinter : public ASTConsumer { - llvm::raw_ostream &Out; + raw_ostream &Out; bool Dump; public: - ASTPrinter(llvm::raw_ostream* o = NULL, bool Dump = false) + ASTPrinter(raw_ostream* o = NULL, bool Dump = false) : Out(o? *o : llvm::outs()), Dump(Dump) { } virtual void HandleTranslationUnit(ASTContext &Context) { @@ -46,7 +46,7 @@ namespace { }; } // end anonymous namespace -ASTConsumer *clang::CreateASTPrinter(llvm::raw_ostream* out) { +ASTConsumer *clang::CreateASTPrinter(raw_ostream* out) { return new ASTPrinter(out); } @@ -95,7 +95,7 @@ ASTConsumer *clang::CreateASTViewer() { return new ASTViewer(); } namespace { class DeclContextPrinter : public ASTConsumer { - llvm::raw_ostream& Out; + raw_ostream& Out; public: DeclContextPrinter() : Out(llvm::errs()) {} @@ -404,10 +404,10 @@ ASTConsumer *clang::CreateDeclContextPrinter() { namespace { class ASTDumpXML : public ASTConsumer { - llvm::raw_ostream &OS; + raw_ostream &OS; public: - ASTDumpXML(llvm::raw_ostream &OS) : OS(OS) {} + ASTDumpXML(raw_ostream &OS) : OS(OS) {} void HandleTranslationUnit(ASTContext &C) { C.getTranslationUnitDecl()->dumpXML(OS); @@ -415,6 +415,6 @@ public: }; } -ASTConsumer *clang::CreateASTDumperXML(llvm::raw_ostream &OS) { +ASTConsumer *clang::CreateASTDumperXML(raw_ostream &OS) { return new ASTDumpXML(OS); } diff --git a/lib/Frontend/ASTMerge.cpp b/lib/Frontend/ASTMerge.cpp index 3905b99b02..df4650e68f 100644 --- a/lib/Frontend/ASTMerge.cpp +++ b/lib/Frontend/ASTMerge.cpp @@ -17,12 +17,12 @@ using namespace clang; ASTConsumer *ASTMergeAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { return AdaptedAction->CreateASTConsumer(CI, InFile); } bool ASTMergeAction::BeginSourceFileAction(CompilerInstance &CI, - llvm::StringRef Filename) { + StringRef Filename) { // FIXME: This is a hack. We need a better way to communicate the // AST file, compiler instance, and file name than member variables // of FrontendAction. diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index e43bdb4226..cd4627bc99 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -66,7 +66,7 @@ namespace { Start = TimeRecord::getCurrentTime(); } - void setOutput(const llvm::Twine &Output) { + void setOutput(const Twine &Output) { if (WantTiming) this->Output = Output.str(); } @@ -237,7 +237,7 @@ void ASTUnit::CacheCodeCompletionResults() { // Gather the set of global code completions. typedef CodeCompletionResult Result; - llvm::SmallVector<Result, 8> Results; + SmallVector<Result, 8> Results; CachedCompletionAllocator = new GlobalCodeCompletionAllocator; TheSema->GatherGlobalCodeCompletions(*CachedCompletionAllocator, Results); @@ -396,13 +396,13 @@ public: return false; } - virtual bool ReadTargetTriple(llvm::StringRef Triple) { + virtual bool ReadTargetTriple(StringRef Triple) { TargetTriple = Triple; return false; } virtual bool ReadPredefinesBuffer(const PCHPredefinesBlocks &Buffers, - llvm::StringRef OriginalFileName, + StringRef OriginalFileName, std::string &SuggestedPredefines, FileManager &FileMgr) { Predefines = Buffers[0].Data; @@ -422,11 +422,11 @@ public: }; class StoredDiagnosticClient : public DiagnosticClient { - llvm::SmallVectorImpl<StoredDiagnostic> &StoredDiags; + SmallVectorImpl<StoredDiagnostic> &StoredDiags; public: explicit StoredDiagnosticClient( - llvm::SmallVectorImpl<StoredDiagnostic> &StoredDiags) + SmallVectorImpl<StoredDiagnostic> &StoredDiags) : StoredDiags(StoredDiags) { } virtual void HandleDiagnostic(Diagnostic::Level Level, @@ -442,7 +442,7 @@ class CaptureDroppedDiagnostics { public: CaptureDroppedDiagnostics(bool RequestCapture, Diagnostic &Diags, - llvm::SmallVectorImpl<StoredDiagnostic> &StoredDiags) + SmallVectorImpl<StoredDiagnostic> &StoredDiags) : Diags(Diags), Client(StoredDiags), PreviousClient(0) { if (RequestCapture || Diags.getClient() == 0) { @@ -478,7 +478,7 @@ const std::string &ASTUnit::getASTFileName() { return static_cast<ASTReader *>(Ctx->getExternalSource())->getFileName(); } -llvm::MemoryBuffer *ASTUnit::getBufferForFile(llvm::StringRef Filename, +llvm::MemoryBuffer *ASTUnit::getBufferForFile(StringRef Filename, std::string *ErrorStr) { assert(FileMgr); return FileMgr->getBufferForFile(Filename, ErrorStr); @@ -711,7 +711,7 @@ void AddTopLevelDeclarationToHash(Decl *D, unsigned &Hash) { return; } - if (ObjCClassDecl *Class = llvm::dyn_cast<ObjCClassDecl>(D)) { + if (ObjCClassDecl *Class = dyn_cast<ObjCClassDecl>(D)) { for (ObjCClassDecl::iterator I = Class->begin(), IEnd = Class->end(); I != IEnd; ++I) AddTopLevelDeclarationToHash(I->getInterface(), Hash); @@ -753,7 +753,7 @@ public: ASTUnit &Unit; virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { CI.getPreprocessor().addPPCallbacks( new MacroDefinitionTrackerPPCallbacks(Unit.getCurrentTopLevelHashValue())); return new TopLevelDeclTrackerConsumer(Unit, @@ -778,7 +778,7 @@ class PrecompilePreambleConsumer : public PCHGenerator, public: PrecompilePreambleConsumer(ASTUnit &Unit, const Preprocessor &PP, bool Chaining, - StringRef isysroot, llvm::raw_ostream *Out) + StringRef isysroot, raw_ostream *Out) : PCHGenerator(PP, "", Chaining, isysroot, Out), Unit(Unit), Hash(Unit.getCurrentTopLevelHashValue()) { Hash = 0; @@ -828,10 +828,10 @@ public: explicit PrecompilePreambleAction(ASTUnit &Unit) : Unit(Unit) {} virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { std::string Sysroot; std::string OutputFile; - llvm::raw_ostream *OS = 0; + raw_ostream *OS = 0; bool Chaining; if (GeneratePCHAction::ComputeASTConsumerArguments(CI, InFile, Sysroot, OutputFile, @@ -1132,7 +1132,7 @@ ASTUnit::ComputePreamble(CompilerInvocation &Invocation, static llvm::MemoryBuffer *CreatePaddedMainFileBuffer(llvm::MemoryBuffer *Old, unsigned NewSize, - llvm::StringRef NewName) { + StringRef NewName) { llvm::MemoryBuffer *Result = llvm::MemoryBuffer::getNewUninitMemBuffer(NewSize, NewName); memcpy(const_cast<char*>(Result->getBufferStart()), @@ -1565,7 +1565,7 @@ unsigned ASTUnit::getMaxPCHLevel() const { return 0; } -llvm::StringRef ASTUnit::getMainFileName() const { +StringRef ASTUnit::getMainFileName() const { return Invocation->getFrontendOpts().Inputs[0].second; } @@ -1758,7 +1758,7 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocation(CompilerInvocation *CI, ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin, const char **ArgEnd, llvm::IntrusiveRefCntPtr<Diagnostic> Diags, - llvm::StringRef ResourceFilesPath, + StringRef ResourceFilesPath, bool OnlyLocalDecls, bool CaptureDiagnostics, RemappedFile *RemappedFiles, @@ -1778,7 +1778,7 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin, ArgBegin); } - llvm::SmallVector<StoredDiagnostic, 4> StoredDiagnostics; + SmallVector<StoredDiagnostic, 4> StoredDiagnostics; llvm::IntrusiveRefCntPtr<CompilerInvocation> CI; @@ -2064,7 +2064,7 @@ void AugmentedCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &S, // Contains the set of names that are hidden by "local" completion results. llvm::StringSet<llvm::BumpPtrAllocator> HiddenNames; typedef CodeCompletionResult Result; - llvm::SmallVector<Result, 8> AllResults; + SmallVector<Result, 8> AllResults; for (ASTUnit::cached_completion_iterator C = AST.cached_completion_begin(), CEnd = AST.cached_completion_end(); @@ -2146,7 +2146,7 @@ void AugmentedCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &S, -void ASTUnit::CodeComplete(llvm::StringRef File, unsigned Line, unsigned Column, +void ASTUnit::CodeComplete(StringRef File, unsigned Line, unsigned Column, RemappedFile *RemappedFiles, unsigned NumRemappedFiles, bool IncludeMacros, @@ -2154,14 +2154,14 @@ void ASTUnit::CodeComplete(llvm::StringRef File, unsigned Line, unsigned Column, CodeCompleteConsumer &Consumer, Diagnostic &Diag, LangOptions &LangOpts, SourceManager &SourceMgr, FileManager &FileMgr, - llvm::SmallVectorImpl<StoredDiagnostic> &StoredDiagnostics, - llvm::SmallVectorImpl<const llvm::MemoryBuffer *> &OwnedBuffers) { + SmallVectorImpl<StoredDiagnostic> &StoredDiagnostics, + SmallVectorImpl<const llvm::MemoryBuffer *> &OwnedBuffers) { if (!Invocation) return; SimpleTimer CompletionTimer(WantTiming); CompletionTimer.setOutput("Code completion @ " + File + ":" + - llvm::Twine(Line) + ":" + llvm::Twine(Column)); + Twine(Line) + ":" + Twine(Column)); llvm::IntrusiveRefCntPtr<CompilerInvocation> CCInvocation(new CompilerInvocation(*Invocation)); @@ -2303,7 +2303,7 @@ void ASTUnit::CodeComplete(llvm::StringRef File, unsigned Line, unsigned Column, } } -CXSaveError ASTUnit::Save(llvm::StringRef File) { +CXSaveError ASTUnit::Save(StringRef File) { if (getDiagnostics().hasUnrecoverableErrorOccurred()) return CXSaveError_TranslationErrors; @@ -2341,7 +2341,7 @@ CXSaveError ASTUnit::Save(llvm::StringRef File) { return CXSaveError_None; } -bool ASTUnit::serialize(llvm::raw_ostream &OS) { +bool ASTUnit::serialize(raw_ostream &OS) { if (getDiagnostics().hasErrorOccurred()) return true; @@ -2368,17 +2368,17 @@ static void TranslateSLoc(SourceLocation &L, SLocRemap &Remap) { void ASTUnit::TranslateStoredDiagnostics( ASTReader *MMan, - llvm::StringRef ModName, + StringRef ModName, SourceManager &SrcMgr, - const llvm::SmallVectorImpl<StoredDiagnostic> &Diags, - llvm::SmallVectorImpl<StoredDiagnostic> &Out) { + const SmallVectorImpl<StoredDiagnostic> &Diags, + SmallVectorImpl<StoredDiagnostic> &Out) { // The stored diagnostic has the old source manager in it; update // the locations to refer into the new source manager. We also need to remap // all the locations to the new view. This includes the diag location, any // associated source ranges, and the source ranges of associated fix-its. // FIXME: There should be a cleaner way to do this. - llvm::SmallVector<StoredDiagnostic, 4> Result; + SmallVector<StoredDiagnostic, 4> Result; Result.reserve(Diags.size()); assert(MMan && "Don't have a module manager"); serialization::Module *Mod = MMan->Modules.lookup(ModName); @@ -2391,7 +2391,7 @@ void ASTUnit::TranslateStoredDiagnostics( TranslateSLoc(L, Remap); FullSourceLoc Loc(L, SrcMgr); - llvm::SmallVector<CharSourceRange, 4> Ranges; + SmallVector<CharSourceRange, 4> Ranges; Ranges.reserve(SD.range_size()); for (StoredDiagnostic::range_iterator I = SD.range_begin(), E = SD.range_end(); @@ -2403,7 +2403,7 @@ void ASTUnit::TranslateStoredDiagnostics( Ranges.push_back(CharSourceRange(SourceRange(BL, EL), I->isTokenRange())); } - llvm::SmallVector<FixItHint, 2> FixIts; + SmallVector<FixItHint, 2> FixIts; FixIts.reserve(SD.fixit_size()); for (StoredDiagnostic::fixit_iterator I = SD.fixit_begin(), E = SD.fixit_end(); diff --git a/lib/Frontend/CacheTokens.cpp b/lib/Frontend/CacheTokens.cpp index 20b51893fc..8195445fe0 100644 --- a/lib/Frontend/CacheTokens.cpp +++ b/lib/Frontend/CacheTokens.cpp @@ -71,13 +71,13 @@ public: bool isFile() const { return Kind == IsFE; } - llvm::StringRef getString() const { + StringRef getString() const { return Kind == IsFE ? FE->getName() : Path; } unsigned getKind() const { return (unsigned) Kind; } - void EmitData(llvm::raw_ostream& Out) { + void EmitData(raw_ostream& Out) { switch (Kind) { case IsFE: // Emit stat information. @@ -119,7 +119,7 @@ public: } static std::pair<unsigned,unsigned> - EmitKeyDataLength(llvm::raw_ostream& Out, PTHEntryKeyVariant V, + EmitKeyDataLength(raw_ostream& Out, PTHEntryKeyVariant V, const PTHEntry& E) { unsigned n = V.getString().size() + 1 + 1; @@ -131,14 +131,14 @@ public: return std::make_pair(n, m); } - static void EmitKey(llvm::raw_ostream& Out, PTHEntryKeyVariant V, unsigned n){ + static void EmitKey(raw_ostream& Out, PTHEntryKeyVariant V, unsigned n){ // Emit the entry kind. ::Emit8(Out, (unsigned) V.getKind()); // Emit the string. Out.write(V.getString().data(), n - 1); } - static void EmitData(llvm::raw_ostream& Out, PTHEntryKeyVariant V, + static void EmitData(raw_ostream& Out, PTHEntryKeyVariant V, const PTHEntry& E, unsigned) { @@ -197,7 +197,7 @@ class PTHWriter { Out.write(Ptr, NumBytes); } - void EmitString(llvm::StringRef V) { + void EmitString(StringRef V) { ::Emit16(Out, V.size()); EmitBuf(V.data(), V.size()); } @@ -247,7 +247,7 @@ void PTHWriter::EmitToken(const Token& T) { } else { // We cache *un-cleaned* spellings. This gives us 100% fidelity with the // source code. - llvm::StringRef s(T.getLiteralData(), T.getLength()); + StringRef s(T.getLiteralData(), T.getLength()); // Get the string entry. llvm::StringMapEntry<OffsetOpt> *E = &CachedStrs.GetOrCreateValue(s); @@ -584,20 +584,20 @@ public: } static std::pair<unsigned,unsigned> - EmitKeyDataLength(llvm::raw_ostream& Out, const PTHIdKey* key, uint32_t) { + EmitKeyDataLength(raw_ostream& Out, const PTHIdKey* key, uint32_t) { unsigned n = key->II->getLength() + 1; ::Emit16(Out, n); return std::make_pair(n, sizeof(uint32_t)); } - static void EmitKey(llvm::raw_ostream& Out, PTHIdKey* key, unsigned n) { + static void EmitKey(raw_ostream& Out, PTHIdKey* key, unsigned n) { // Record the location of the key data. This is used when generating // the mapping from persistent IDs to strings. key->FileOffset = Out.tell(); Out.write(key->II->getNameStart(), n); } - static void EmitData(llvm::raw_ostream& Out, PTHIdKey*, uint32_t pID, + static void EmitData(raw_ostream& Out, PTHIdKey*, uint32_t pID, unsigned) { ::Emit32(Out, pID); } diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index 8bf9ed9f9d..ef0796ab01 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/lib/Frontend/CompilerInstance.cpp @@ -89,7 +89,7 @@ static void SetUpBuildDumpLog(const DiagnosticOptions &DiagOpts, unsigned argc, const char* const *argv, Diagnostic &Diags) { std::string ErrorInfo; - llvm::OwningPtr<llvm::raw_ostream> OS( + llvm::OwningPtr<raw_ostream> OS( new llvm::raw_fd_ostream(DiagOpts.DumpBuildInformation.c_str(), ErrorInfo)); if (!ErrorInfo.empty()) { Diags.Report(diag::err_fe_unable_to_open_logfile) @@ -113,7 +113,7 @@ static void SetUpDiagnosticLog(const DiagnosticOptions &DiagOpts, Diagnostic &Diags) { std::string ErrorInfo; bool OwnsStream = false; - llvm::raw_ostream *OS = &llvm::errs(); + raw_ostream *OS = &llvm::errs(); if (DiagOpts.DiagnosticLogFile != "-") { // Create the output stream. llvm::raw_fd_ostream *FileOS( @@ -241,7 +241,7 @@ CompilerInstance::createPreprocessor(Diagnostic &Diags, if (DepOpts.ShowHeaderIncludes) AttachHeaderIncludeGen(*PP); if (!DepOpts.HeaderIncludeOutputFile.empty()) { - llvm::StringRef OutputPath = DepOpts.HeaderIncludeOutputFile; + StringRef OutputPath = DepOpts.HeaderIncludeOutputFile; if (OutputPath == "-") OutputPath = ""; AttachHeaderIncludeGen(*PP, /*ShowAllHeaders=*/true, OutputPath, @@ -263,7 +263,7 @@ void CompilerInstance::createASTContext() { // ExternalASTSource -void CompilerInstance::createPCHExternalASTSource(llvm::StringRef Path, +void CompilerInstance::createPCHExternalASTSource(StringRef Path, bool DisablePCHValidation, bool DisableStatCache, void *DeserializationListener){ @@ -280,7 +280,7 @@ void CompilerInstance::createPCHExternalASTSource(llvm::StringRef Path, } ExternalASTSource * -CompilerInstance::createPCHExternalASTSource(llvm::StringRef Path, +CompilerInstance::createPCHExternalASTSource(StringRef Path, const std::string &Sysroot, bool DisablePCHValidation, bool DisableStatCache, @@ -373,7 +373,7 @@ CompilerInstance::createCodeCompletionConsumer(Preprocessor &PP, bool ShowMacros, bool ShowCodePatterns, bool ShowGlobals, - llvm::raw_ostream &OS) { + raw_ostream &OS) { if (EnableCodeCompletion(PP, Filename, Line, Column)) return 0; @@ -427,17 +427,17 @@ void CompilerInstance::clearOutputFiles(bool EraseFiles) { llvm::raw_fd_ostream * CompilerInstance::createDefaultOutputFile(bool Binary, - llvm::StringRef InFile, - llvm::StringRef Extension) { + StringRef InFile, + StringRef Extension) { return createOutputFile(getFrontendOpts().OutputFile, Binary, /*RemoveFileOnSignal=*/true, InFile, Extension); } llvm::raw_fd_ostream * -CompilerInstance::createOutputFile(llvm::StringRef OutputPath, +CompilerInstance::createOutputFile(StringRef OutputPath, bool Binary, bool RemoveFileOnSignal, - llvm::StringRef InFile, - llvm::StringRef Extension) { + StringRef InFile, + StringRef Extension) { std::string Error, OutputPathName, TempPathName; llvm::raw_fd_ostream *OS = createOutputFile(OutputPath, Error, Binary, RemoveFileOnSignal, @@ -459,12 +459,12 @@ CompilerInstance::createOutputFile(llvm::StringRef OutputPath, } llvm::raw_fd_ostream * -CompilerInstance::createOutputFile(llvm::StringRef OutputPath, +CompilerInstance::createOutputFile(StringRef OutputPath, std::string &Error, bool Binary, bool RemoveFileOnSignal, - llvm::StringRef InFile, - llvm::StringRef Extension, + StringRef InFile, + StringRef Extension, std::string *ResultPathName, std::string *TempPathName) { std::string OutFile, TempFile; @@ -519,12 +519,12 @@ CompilerInstance::createOutputFile(llvm::StringRef OutputPath, // Initialization Utilities -bool CompilerInstance::InitializeSourceManager(llvm::StringRef InputFile) { +bool CompilerInstance::InitializeSourceManager(StringRef InputFile) { return InitializeSourceManager(InputFile, getDiagnostics(), getFileManager(), getSourceManager(), getFrontendOpts()); } -bool CompilerInstance::InitializeSourceManager(llvm::StringRef InputFile, +bool CompilerInstance::InitializeSourceManager(StringRef InputFile, Diagnostic &Diags, FileManager &FileMgr, SourceManager &SourceMgr, @@ -567,7 +567,7 @@ bool CompilerInstance::ExecuteAction(FrontendAction &Act) { // FIXME: Take this as an argument, once all the APIs we used have moved to // taking it as an input instead of hard-coding llvm::errs. - llvm::raw_ostream &OS = llvm::errs(); + raw_ostream &OS = llvm::errs(); // Create the target instance. setTarget(TargetInfo::CreateTargetInfo(getDiagnostics(), getTargetOpts())); diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index d2cdde01d9..8967d5280b 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -878,7 +878,7 @@ static void ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args, using namespace cc1options; if (Arg *A = Args.getLastArg(OPT_analyzer_store)) { - llvm::StringRef Name = A->getValue(Args); + StringRef Name = A->getValue(Args); AnalysisStores Value = llvm::StringSwitch<AnalysisStores>(Name) #define ANALYSIS_STORE(NAME, CMDFLAG, DESC, CREATFN) \ .Case(CMDFLAG, NAME##Model) @@ -893,7 +893,7 @@ static void ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args, } if (Arg *A = Args.getLastArg(OPT_analyzer_constraints)) { - llvm::StringRef Name = A->getValue(Args); + StringRef Name = A->getValue(Args); AnalysisConstraints Value = llvm::StringSwitch<AnalysisConstraints>(Name) #define ANALYSIS_CONSTRAINTS(NAME, CMDFLAG, DESC, CREATFN) \ .Case(CMDFLAG, NAME##Model) @@ -908,7 +908,7 @@ static void ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args, } if (Arg *A = Args.getLastArg(OPT_analyzer_output)) { - llvm::StringRef Name = A->getValue(Args); + StringRef Name = A->getValue(Args); AnalysisDiagClients Value = llvm::StringSwitch<AnalysisDiagClients>(Name) #define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATFN, AUTOCREAT) \ .Case(CMDFLAG, PD_##NAME) @@ -950,8 +950,8 @@ static void ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args, bool enable = (A->getOption().getID() == OPT_analyzer_checker); // We can have a list of comma separated checker names, e.g: // '-analyzer-checker=cocoa,unix' - llvm::StringRef checkerList = A->getValue(Args); - llvm::SmallVector<llvm::StringRef, 4> checkers; + StringRef checkerList = A->getValue(Args); + SmallVector<StringRef, 4> checkers; checkerList.split(checkers, ","); for (unsigned i = 0, e = checkers.size(); i != e; ++i) Opts.CheckersControlList.push_back(std::make_pair(checkers[i], enable)); @@ -1034,7 +1034,7 @@ static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, Opts.CoverageFile = Args.getLastArgValue(OPT_coverage_file); if (Arg *A = Args.getLastArg(OPT_fobjc_dispatch_method_EQ)) { - llvm::StringRef Name = A->getValue(Args); + StringRef Name = A->getValue(Args); unsigned Method = llvm::StringSwitch<unsigned>(Name) .Case("legacy", CodeGenOptions::Legacy) .Case("non-legacy", CodeGenOptions::NonLegacy) @@ -1084,7 +1084,7 @@ static void ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args, if (A->getOption().matches(OPT_fdiagnostics_show_note_include_stack)) Opts.ShowNoteIncludeStack = true; - llvm::StringRef ShowOverloads = + StringRef ShowOverloads = Args.getLastArgValue(OPT_fshow_overloads_EQ, "all"); if (ShowOverloads == "best") Opts.ShowOverloads = Diagnostic::Ovl_Best; @@ -1095,7 +1095,7 @@ static void ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args, << Args.getLastArg(OPT_fshow_overloads_EQ)->getAsString(Args) << ShowOverloads; - llvm::StringRef ShowCategory = + StringRef ShowCategory = Args.getLastArgValue(OPT_fdiagnostics_show_category, "none"); if (ShowCategory == "none") Opts.ShowCategories = 0; @@ -1108,7 +1108,7 @@ static void ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args, << Args.getLastArg(OPT_fdiagnostics_show_category)->getAsString(Args) << ShowCategory; - llvm::StringRef Format = + StringRef Format = Args.getLastArgValue(OPT_fdiagnostics_format, "clang"); if (Format == "clang") Opts.Format = DiagnosticOptions::Clang; @@ -1325,7 +1325,7 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args, InputKind IK = DashX; if (IK == IK_None) { IK = FrontendOptions::getInputKindForExtension( - llvm::StringRef(Inputs[i]).rsplit('.').second); + StringRef(Inputs[i]).rsplit('.').second); // FIXME: Remove this hack. if (i == 0) DashX = IK; @@ -1371,7 +1371,7 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) { /*IsFramework=*/ (*it)->getOption().matches(OPT_F), false); // Add -iprefix/-iwith-prefix/-iwithprefixbefore options. - llvm::StringRef Prefix = ""; // FIXME: This isn't the correct default prefix. + StringRef Prefix = ""; // FIXME: This isn't the correct default prefix. for (arg_iterator it = Args.filtered_begin(OPT_iprefix, OPT_iwithprefix, OPT_iwithprefixbefore), ie = Args.filtered_end(); it != ie; ++it) { @@ -1593,7 +1593,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, if (Args.hasArg(OPT_fdelayed_template_parsing)) Opts.DelayedTemplateParsing = 1; - llvm::StringRef Vis = Args.getLastArgValue(OPT_fvisibility, "default"); + StringRef Vis = Args.getLastArgValue(OPT_fvisibility, "default"); if (Vis == "default") Opts.setVisibilityMode(DefaultVisibility); else if (Vis == "hidden") @@ -1731,12 +1731,12 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args, } if (const Arg *A = Args.getLastArg(OPT_preamble_bytes_EQ)) { - llvm::StringRef Value(A->getValue(Args)); + StringRef Value(A->getValue(Args)); size_t Comma = Value.find(','); unsigned Bytes = 0; unsigned EndOfLine = 0; - if (Comma == llvm::StringRef::npos || + if (Comma == StringRef::npos || Value.substr(0, Comma).getAsInteger(10, Bytes) || Value.substr(Comma + 1).getAsInteger(10, EndOfLine)) Diags.Report(diag::err_drv_preamble_format); @@ -1787,8 +1787,8 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args, for (arg_iterator it = Args.filtered_begin(OPT_remap_file), ie = Args.filtered_end(); it != ie; ++it) { const Arg *A = *it; - std::pair<llvm::StringRef,llvm::StringRef> Split = - llvm::StringRef(A->getValue(Args)).split(';'); + std::pair<StringRef,StringRef> Split = + StringRef(A->getValue(Args)).split(';'); if (Split.second.empty()) { Diags.Report(diag::err_drv_invalid_remap_file) << A->getAsString(Args); @@ -1799,7 +1799,7 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args, } if (Arg *A = Args.getLastArg(OPT_fobjc_arc_cxxlib_EQ)) { - llvm::StringRef Name = A->getValue(Args); + StringRef Name = A->getValue(Args); unsigned Library = llvm::StringSwitch<unsigned>(Name) .Case("libc++", ARCXX_libcxx) .Case("libstdc++", ARCXX_libstdcxx) diff --git a/lib/Frontend/CreateInvocationFromCommandLine.cpp b/lib/Frontend/CreateInvocationFromCommandLine.cpp index 42b648aa64..fa34334b5d 100644 --- a/lib/Frontend/CreateInvocationFromCommandLine.cpp +++ b/lib/Frontend/CreateInvocationFromCommandLine.cpp @@ -39,7 +39,7 @@ clang::createInvocationFromCommandLine(llvm::ArrayRef<const char *> ArgList, ArgList.begin()); } - llvm::SmallVector<const char *, 16> Args; + SmallVector<const char *, 16> Args; Args.push_back("<clang>"); // FIXME: Remove dummy argument. Args.insert(Args.end(), ArgList.begin(), ArgList.end()); @@ -74,7 +74,7 @@ clang::createInvocationFromCommandLine(llvm::ArrayRef<const char *> ArgList, } const driver::Command *Cmd = cast<driver::Command>(*Jobs.begin()); - if (llvm::StringRef(Cmd->getCreator().getName()) != "clang") { + if (StringRef(Cmd->getCreator().getName()) != "clang") { Diags->Report(diag::err_fe_expected_clang_command); return 0; } diff --git a/lib/Frontend/DependencyFile.cpp b/lib/Frontend/DependencyFile.cpp index 1edd09b06c..9cffed2b35 100644 --- a/lib/Frontend/DependencyFile.cpp +++ b/lib/Frontend/DependencyFile.cpp @@ -32,19 +32,19 @@ class DependencyFileCallback : public PPCallbacks { llvm::StringSet<> FilesSet; const Preprocessor *PP; std::vector<std::string> Targets; - llvm::raw_ostream *OS; + raw_ostream *OS; bool IncludeSystemHeaders; bool PhonyTarget; bool AddMissingHeaderDeps; private: bool FileMatchesDepCriteria(const char *Filename, SrcMgr::CharacteristicKind FileType); - void AddFilename(llvm::StringRef Filename); + void AddFilename(StringRef Filename); void OutputDependencyFile(); public: DependencyFileCallback(const Preprocessor *_PP, - llvm::raw_ostream *_OS, + raw_ostream *_OS, const DependencyOutputOptions &Opts) : PP(_PP), Targets(Opts.Targets), OS(_OS), IncludeSystemHeaders(Opts.IncludeSystemHeaders), @@ -55,12 +55,12 @@ public: SrcMgr::CharacteristicKind FileType); virtual void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok, - llvm::StringRef FileName, + StringRef FileName, bool IsAngled, const FileEntry *File, SourceLocation EndLoc, - llvm::StringRef SearchPath, - llvm::StringRef RelativePath); + StringRef SearchPath, + StringRef RelativePath); virtual void EndOfMainFile() { OutputDependencyFile(); @@ -78,7 +78,7 @@ void clang::AttachDependencyFileGen(Preprocessor &PP, } std::string Err; - llvm::raw_ostream *OS(new llvm::raw_fd_ostream(Opts.OutputFile.c_str(), Err)); + raw_ostream *OS(new llvm::raw_fd_ostream(Opts.OutputFile.c_str(), Err)); if (!Err.empty()) { PP.getDiagnostics().Report(diag::err_fe_error_opening) << Opts.OutputFile << Err; @@ -126,7 +126,7 @@ void DependencyFileCallback::FileChanged(SourceLocation Loc, SM.getFileEntryForID(SM.getFileID(SM.getInstantiationLoc(Loc))); if (FE == 0) return; - llvm::StringRef Filename = FE->getName(); + StringRef Filename = FE->getName(); if (!FileMatchesDepCriteria(Filename.data(), FileType)) return; @@ -143,24 +143,24 @@ void DependencyFileCallback::FileChanged(SourceLocation Loc, void DependencyFileCallback::InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok, - llvm::StringRef FileName, + StringRef FileName, bool IsAngled, const FileEntry *File, SourceLocation EndLoc, - llvm::StringRef SearchPath, - llvm::StringRef RelativePath) { + StringRef SearchPath, + StringRef RelativePath) { if (AddMissingHeaderDeps && !File) AddFilename(FileName); } -void DependencyFileCallback::AddFilename(llvm::StringRef Filename) { +void DependencyFileCallback::AddFilename(StringRef Filename) { if (FilesSet.insert(Filename)) Files.push_back(Filename); } /// PrintFilename - GCC escapes spaces, but apparently not ' or " or other /// scary characters. -static void PrintFilename(llvm::raw_ostream &OS, llvm::StringRef Filename) { +static void PrintFilename(raw_ostream &OS, StringRef Filename) { for (unsigned i = 0, e = Filename.size(); i != e; ++i) { if (Filename[i] == ' ') OS << '\\'; diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp index 344c85627f..89d95fc97d 100644 --- a/lib/Frontend/FrontendAction.cpp +++ b/lib/Frontend/FrontendAction.cpp @@ -82,7 +82,7 @@ FrontendAction::FrontendAction() : Instance(0) {} FrontendAction::~FrontendAction() {} -void FrontendAction::setCurrentFile(llvm::StringRef Value, InputKind Kind, +void FrontendAction::setCurrentFile(StringRef Value, InputKind Kind, ASTUnit *AST) { CurrentFile = Value; CurrentFileKind = Kind; @@ -90,7 +90,7 @@ void FrontendAction::setCurrentFile(llvm::StringRef Value, InputKind Kind, } ASTConsumer* FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { ASTConsumer* Consumer = CreateASTConsumer(CI, InFile); if (!Consumer) return 0; @@ -123,7 +123,7 @@ ASTConsumer* FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI, } bool FrontendAction::BeginSourceFile(CompilerInstance &CI, - llvm::StringRef Filename, + StringRef Filename, InputKind InputKind) { assert(!Instance && "Already processing a source file!"); assert(!Filename.empty() && "Unexpected empty filename!"); @@ -380,19 +380,19 @@ void ASTFrontendAction::ExecuteAction() { ASTConsumer * PreprocessorFrontendAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { llvm_unreachable("Invalid CreateASTConsumer on preprocessor action!"); } ASTConsumer *WrapperFrontendAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { return WrappedAction->CreateASTConsumer(CI, InFile); } bool WrapperFrontendAction::BeginInvocation(CompilerInstance &CI) { return WrappedAction->BeginInvocation(CI); } bool WrapperFrontendAction::BeginSourceFileAction(CompilerInstance &CI, - llvm::StringRef Filename) { + StringRef Filename) { WrappedAction->setCurrentFile(getCurrentFile(), getCurrentFileKind()); WrappedAction->setCompilerInstance(&CI); return WrappedAction->BeginSourceFileAction(CI, Filename); diff --git a/lib/Frontend/FrontendActions.cpp b/lib/Frontend/FrontendActions.cpp index 342a4c2465..44cd2dfe9b 100644 --- a/lib/Frontend/FrontendActions.cpp +++ b/lib/Frontend/FrontendActions.cpp @@ -29,7 +29,7 @@ using namespace clang; //===----------------------------------------------------------------------===// ASTConsumer *InitOnlyAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { return new ASTConsumer(); } @@ -41,20 +41,20 @@ void InitOnlyAction::ExecuteAction() { //===----------------------------------------------------------------------===// ASTConsumer *ASTPrintAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { - if (llvm::raw_ostream *OS = CI.createDefaultOutputFile(false, InFile)) + StringRef InFile) { + if (raw_ostream *OS = CI.createDefaultOutputFile(false, InFile)) return CreateASTPrinter(OS); return 0; } ASTConsumer *ASTDumpAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { return CreateASTDumper(); } ASTConsumer *ASTDumpXMLAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { - llvm::raw_ostream *OS; + StringRef InFile) { + raw_ostream *OS; if (CI.getFrontendOpts().OutputFile.empty()) OS = &llvm::outs(); else @@ -64,20 +64,20 @@ ASTConsumer *ASTDumpXMLAction::CreateASTConsumer(CompilerInstance &CI, } ASTConsumer *ASTViewAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { return CreateASTViewer(); } ASTConsumer *DeclContextPrintAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { return CreateDeclContextPrinter(); } ASTConsumer *GeneratePCHAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { std::string Sysroot; std::string OutputFile; - llvm::raw_ostream *OS = 0; + raw_ostream *OS = 0; bool Chaining; if (ComputeASTConsumerArguments(CI, InFile, Sysroot, OutputFile, OS, Chaining)) return 0; @@ -89,10 +89,10 @@ ASTConsumer *GeneratePCHAction::CreateASTConsumer(CompilerInstance &CI, } bool GeneratePCHAction::ComputeASTConsumerArguments(CompilerInstance &CI, - llvm::StringRef InFile, + StringRef InFile, std::string &Sysroot, std::string &OutputFile, - llvm::raw_ostream *&OS, + raw_ostream *&OS, bool &Chaining) { Sysroot = CI.getHeaderSearchOpts().Sysroot; if (CI.getFrontendOpts().RelocatablePCH && Sysroot.empty()) { @@ -114,7 +114,7 @@ bool GeneratePCHAction::ComputeASTConsumerArguments(CompilerInstance &CI, } ASTConsumer *SyntaxOnlyAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { return new ASTConsumer(); } @@ -185,7 +185,7 @@ void PrintPreprocessedAction::ExecuteAction() { CompilerInstance &CI = getCompilerInstance(); // Output file needs to be set to 'Binary', to avoid converting Unix style // line feeds (<LF>) to Microsoft style line feeds (<CR><LF>). - llvm::raw_ostream *OS = CI.createDefaultOutputFile(true, getCurrentFile()); + raw_ostream *OS = CI.createDefaultOutputFile(true, getCurrentFile()); if (!OS) return; DoPrintPreprocessedInput(CI.getPreprocessor(), OS, diff --git a/lib/Frontend/FrontendOptions.cpp b/lib/Frontend/FrontendOptions.cpp index 0a2005192a..ea4005f7c9 100644 --- a/lib/Frontend/FrontendOptions.cpp +++ b/lib/Frontend/FrontendOptions.cpp @@ -11,7 +11,7 @@ #include "llvm/ADT/StringSwitch.h" using namespace clang; -InputKind FrontendOptions::getInputKindForExtension(llvm::StringRef Extension) { +InputKind FrontendOptions::getInputKindForExtension(StringRef Extension) { return llvm::StringSwitch<InputKind>(Extension) .Case("ast", IK_AST) .Case("c", IK_C) diff --git a/lib/Frontend/HeaderIncludeGen.cpp b/lib/Frontend/HeaderIncludeGen.cpp index 51dec967cd..283239dde0 100644 --- a/lib/Frontend/HeaderIncludeGen.cpp +++ b/lib/Frontend/HeaderIncludeGen.cpp @@ -17,7 +17,7 @@ using namespace clang; namespace { class HeaderIncludesCallback : public PPCallbacks { SourceManager &SM; - llvm::raw_ostream *OutputFile; + raw_ostream *OutputFile; unsigned CurrentIncludeDepth; bool HasProcessedPredefines; bool OwnsOutputFile; @@ -26,7 +26,7 @@ class HeaderIncludesCallback : public PPCallbacks { public: HeaderIncludesCallback(const Preprocessor *PP, bool ShowAllHeaders_, - llvm::raw_ostream *OutputFile_, bool OwnsOutputFile_, + raw_ostream *OutputFile_, bool OwnsOutputFile_, bool ShowDepth_) : SM(PP->getSourceManager()), OutputFile(OutputFile_), CurrentIncludeDepth(0), HasProcessedPredefines(false), @@ -44,8 +44,8 @@ public: } void clang::AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders, - llvm::StringRef OutputPath, bool ShowDepth) { - llvm::raw_ostream *OutputFile = &llvm::errs(); + StringRef OutputPath, bool ShowDepth) { + raw_ostream *OutputFile = &llvm::errs(); bool OwnsOutputFile = false; // Open the output file, if used. diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp index e11a415db1..ed763e27c7 100644 --- a/lib/Frontend/InitHeaderSearch.cpp +++ b/lib/Frontend/InitHeaderSearch.cpp @@ -52,38 +52,38 @@ class InitHeaderSearch { public: - InitHeaderSearch(HeaderSearch &HS, bool verbose, llvm::StringRef sysroot) + InitHeaderSearch(HeaderSearch &HS, bool verbose, StringRef sysroot) : Headers(HS), Verbose(verbose), IncludeSysroot(sysroot), IsNotEmptyOrRoot(!(sysroot.empty() || sysroot == "/")) { } /// AddPath - Add the specified path to the specified group list. - void AddPath(const llvm::Twine &Path, IncludeDirGroup Group, + void AddPath(const Twine &Path, IncludeDirGroup Group, bool isCXXAware, bool isUserSupplied, bool isFramework, bool IgnoreSysRoot = false); /// AddGnuCPlusPlusIncludePaths - Add the necessary paths to support a gnu /// libstdc++. - void AddGnuCPlusPlusIncludePaths(llvm::StringRef Base, - llvm::StringRef ArchDir, - llvm::StringRef Dir32, - llvm::StringRef Dir64, + void AddGnuCPlusPlusIncludePaths(StringRef Base, + StringRef ArchDir, + StringRef Dir32, + StringRef Dir64, const llvm::Triple &triple); /// AddMinGWCPlusPlusIncludePaths - Add the necessary paths to support a MinGW /// libstdc++. - void AddMinGWCPlusPlusIncludePaths(llvm::StringRef Base, - llvm::StringRef Arch, - llvm::StringRef Version); + void AddMinGWCPlusPlusIncludePaths(StringRef Base, + StringRef Arch, + StringRef Version); /// AddMinGW64CXXPaths - Add the necessary paths to support /// libstdc++ of x86_64-w64-mingw32 aka mingw-w64. - void AddMinGW64CXXPaths(llvm::StringRef Base, - llvm::StringRef Version); + void AddMinGW64CXXPaths(StringRef Base, + StringRef Version); /// AddDelimitedPaths - Add a list of paths delimited by the system PATH /// separator. The processing follows that of the CPATH variable for gcc. - void AddDelimitedPaths(llvm::StringRef String); + void AddDelimitedPaths(StringRef String); // AddDefaultCIncludePaths - Add paths that should always be searched. void AddDefaultCIncludePaths(const llvm::Triple &triple, @@ -107,7 +107,7 @@ public: } // end anonymous namespace. -void InitHeaderSearch::AddPath(const llvm::Twine &Path, +void InitHeaderSearch::AddPath(const Twine &Path, IncludeDirGroup Group, bool isCXXAware, bool isUserSupplied, bool isFramework, bool IgnoreSysRoot) { @@ -116,7 +116,7 @@ void InitHeaderSearch::AddPath(const llvm::Twine &Path, // Compute the actual path, taking into consideration -isysroot. llvm::SmallString<256> MappedPathStorage; - llvm::StringRef MappedPathStr = Path.toStringRef(MappedPathStorage); + StringRef MappedPathStr = Path.toStringRef(MappedPathStorage); // Handle isysroot. if ((Group == System || Group == CXXSystem) && !IgnoreSysRoot && @@ -168,12 +168,12 @@ void InitHeaderSearch::AddPath(const llvm::Twine &Path, } -void InitHeaderSearch::AddDelimitedPaths(llvm::StringRef at) { +void InitHeaderSearch::AddDelimitedPaths(StringRef at) { if (at.empty()) // Empty string should not add '.' path. return; - llvm::StringRef::size_type delim; - while ((delim = at.find(llvm::sys::PathSeparator)) != llvm::StringRef::npos) { + StringRef::size_type delim; + while ((delim = at.find(llvm::sys::PathSeparator)) != StringRef::npos) { if (delim == 0) AddPath(".", Angled, false, true, false); else @@ -187,10 +187,10 @@ void InitHeaderSearch::AddDelimitedPaths(llvm::StringRef at) { AddPath(at, Angled, false, true, false); } -void InitHeaderSearch::AddGnuCPlusPlusIncludePaths(llvm::StringRef Base, - llvm::StringRef ArchDir, - llvm::StringRef Dir32, - llvm::StringRef Dir64, +void InitHeaderSearch::AddGnuCPlusPlusIncludePaths(StringRef Base, + StringRef ArchDir, + StringRef Dir32, + StringRef Dir64, const llvm::Triple &triple) { // Add the base dir AddPath(Base, CXXSystem, true, false, false); @@ -207,9 +207,9 @@ void InitHeaderSearch::AddGnuCPlusPlusIncludePaths(llvm::StringRef Base, AddPath(Base + "/backward", CXXSystem, true, false, false); } -void InitHeaderSearch::AddMinGWCPlusPlusIncludePaths(llvm::StringRef Base, - llvm::StringRef Arch, - llvm::StringRef Version) { +void InitHeaderSearch::AddMinGWCPlusPlusIncludePaths(StringRef Base, + StringRef Arch, + StringRef Version) { AddPath(Base + "/" + Arch + "/" + Version + "/include/c++", CXXSystem, true, false, false); AddPath(Base + "/" + Arch + "/" + Version + "/include/c++/" + Arch, @@ -218,8 +218,8 @@ void InitHeaderSearch::AddMinGWCPlusPlusIncludePaths(llvm::StringRef Base, CXXSystem, true, false, false); } -void InitHeaderSearch::AddMinGW64CXXPaths(llvm::StringRef Base, - llvm::StringRef Version) { +void InitHeaderSearch::AddMinGW64CXXPaths(StringRef Base, + StringRef Version) { // Assumes Base is HeaderSearchOpts' ResourceDir AddPath(Base + "/../../../include/c++/" + Version, CXXSystem, true, false, false); @@ -469,11 +469,11 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple, } // Add dirs specified via 'configure --with-c-include-dirs'. - llvm::StringRef CIncludeDirs(C_INCLUDE_DIRS); + StringRef CIncludeDirs(C_INCLUDE_DIRS); if (CIncludeDirs != "") { - llvm::SmallVector<llvm::StringRef, 5> dirs; + SmallVector<StringRef, 5> dirs; CIncludeDirs.split(dirs, ":"); - for (llvm::SmallVectorImpl<llvm::StringRef>::iterator i = dirs.begin(); + for (SmallVectorImpl<StringRef>::iterator i = dirs.begin(); i != dirs.end(); ++i) AddPath(*i, System, false, false, false); @@ -597,9 +597,9 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple, void InitHeaderSearch:: AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple, const HeaderSearchOptions &HSOpts) { llvm::Triple::OSType os = triple.getOS(); - llvm::StringRef CxxIncludeRoot(CXX_INCLUDE_ROOT); + StringRef CxxIncludeRoot(CXX_INCLUDE_ROOT); if (CxxIncludeRoot != "") { - llvm::StringRef CxxIncludeArch(CXX_INCLUDE_ARCH); + StringRef CxxIncludeArch(CXX_INCLUDE_ARCH); if (CxxIncludeArch == "") AddGnuCPlusPlusIncludePaths(CxxIncludeRoot, triple.str().c_str(), CXX_INCLUDE_32BIT_DIR, CXX_INCLUDE_64BIT_DIR, diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index 77a1b3f396..125242b5d4 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/lib/Frontend/InitPreprocessor.cpp @@ -30,15 +30,15 @@ using namespace clang; // Append a #define line to Buf for Macro. Macro should be of the form XXX, // in which case we emit "#define XXX 1" or "XXX=Y z W" in which case we emit // "#define XXX Y z W". To get a #define with no value, use "XXX=". -static void DefineBuiltinMacro(MacroBuilder &Builder, llvm::StringRef Macro, +static void DefineBuiltinMacro(MacroBuilder &Builder, StringRef Macro, Diagnostic &Diags) { - std::pair<llvm::StringRef, llvm::StringRef> MacroPair = Macro.split('='); - llvm::StringRef MacroName = MacroPair.first; - llvm::StringRef MacroBody = MacroPair.second; + std::pair<StringRef, StringRef> MacroPair = Macro.split('='); + StringRef MacroName = MacroPair.first; + StringRef MacroBody = MacroPair.second; if (MacroName.size() != Macro.size()) { // Per GCC -D semantics, the macro ends at \n if it exists. - llvm::StringRef::size_type End = MacroBody.find_first_of("\n\r"); - if (End != llvm::StringRef::npos) + StringRef::size_type End = MacroBody.find_first_of("\n\r"); + if (End != StringRef::npos) Diags.Report(diag::warn_fe_macro_contains_embedded_newline) << MacroName; Builder.defineMacro(MacroName, MacroBody.substr(0, End)); @@ -48,7 +48,7 @@ static void DefineBuiltinMacro(MacroBuilder &Builder, llvm::StringRef Macro, } } -std::string clang::NormalizeDashIncludePath(llvm::StringRef File, +std::string clang::NormalizeDashIncludePath(StringRef File, FileManager &FileMgr) { // Implicit include paths should be resolved relative to the current // working directory first, and then use the regular header search @@ -70,17 +70,17 @@ std::string clang::NormalizeDashIncludePath(llvm::StringRef File, /// AddImplicitInclude - Add an implicit #include of the specified file to the /// predefines buffer. -static void AddImplicitInclude(MacroBuilder &Builder, llvm::StringRef File, +static void AddImplicitInclude(MacroBuilder &Builder, StringRef File, FileManager &FileMgr) { Builder.append("#include \"" + - llvm::Twine(NormalizeDashIncludePath(File, FileMgr)) + "\""); + Twine(NormalizeDashIncludePath(File, FileMgr)) + "\""); } static void AddImplicitIncludeMacros(MacroBuilder &Builder, - llvm::StringRef File, + StringRef File, FileManager &FileMgr) { Builder.append("#__include_macros \"" + - llvm::Twine(NormalizeDashIncludePath(File, FileMgr)) + "\""); + Twine(NormalizeDashIncludePath(File, FileMgr)) + "\""); // Marker token to stop the __include_macros fetch loop. Builder.append("##"); // ##? } @@ -88,7 +88,7 @@ static void AddImplicitIncludeMacros(MacroBuilder &Builder, /// AddImplicitIncludePTH - Add an implicit #include using the original file /// used to generate a PTH cache. static void AddImplicitIncludePTH(MacroBuilder &Builder, Preprocessor &PP, - llvm::StringRef ImplicitIncludePTH) { + StringRef ImplicitIncludePTH) { PTHManager *P = PP.getPTHManager(); // Null check 'P' in the corner case where it couldn't be created. const char *OriginalFile = P ? P->getOriginalSourceFile() : 0; @@ -120,7 +120,7 @@ static T PickFP(const llvm::fltSemantics *Sem, T IEEESingleVal, return IEEEQuadVal; } -static void DefineFloatMacros(MacroBuilder &Builder, llvm::StringRef Prefix, +static void DefineFloatMacros(MacroBuilder &Builder, StringRef Prefix, const llvm::fltSemantics *Sem) { const char *DenormMin, *Epsilon, *Max, *Min; DenormMin = PickFP(Sem, "1.40129846e-45F", "4.9406564584124654e-324", @@ -153,27 +153,27 @@ static void DefineFloatMacros(MacroBuilder &Builder, llvm::StringRef Prefix, Builder.defineMacro(DefPrefix + "DENORM_MIN__", DenormMin); Builder.defineMacro(DefPrefix + "HAS_DENORM__"); - Builder.defineMacro(DefPrefix + "DIG__", llvm::Twine(Digits)); - Builder.defineMacro(DefPrefix + "EPSILON__", llvm::Twine(Epsilon)); + Builder.defineMacro(DefPrefix + "DIG__", Twine(Digits)); + Builder.defineMacro(DefPrefix + "EPSILON__", Twine(Epsilon)); Builder.defineMacro(DefPrefix + "HAS_INFINITY__"); Builder.defineMacro(DefPrefix + "HAS_QUIET_NAN__"); - Builder.defineMacro(DefPrefix + "MANT_DIG__", llvm::Twine(MantissaDigits)); + Builder.defineMacro(DefPrefix + "MANT_DIG__", Twine(MantissaDigits)); - Builder.defineMacro(DefPrefix + "MAX_10_EXP__", llvm::Twine(Max10Exp)); - Builder.defineMacro(DefPrefix + "MAX_EXP__", llvm::Twine(MaxExp)); - Builder.defineMacro(DefPrefix + "MAX__", llvm::Twine(Max)); + Builder.defineMacro(DefPrefix + "MAX_10_EXP__", Twine(Max10Exp)); + Builder.defineMacro(DefPrefix + "MAX_EXP__", Twine(MaxExp)); + Builder.defineMacro(DefPrefix + "MAX__", Twine(Max)); - Builder.defineMacro(DefPrefix + "MIN_10_EXP__","("+llvm::Twine(Min10Exp)+")"); - Builder.defineMacro(DefPrefix + "MIN_EXP__", "("+llvm::Twine(MinExp)+")"); - Builder.defineMacro(DefPrefix + "MIN__", llvm::Twine(Min)); + Builder.defineMacro(DefPrefix + "MIN_10_EXP__","("+Twine(Min10Exp)+")"); + Builder.defineMacro(DefPrefix + "MIN_EXP__", "("+Twine(MinExp)+")"); + Builder.defineMacro(DefPrefix + "MIN__", Twine(Min)); } /// DefineTypeSize - Emit a macro to the predefines buffer that declares a macro /// named MacroName with the max value for a type with width 'TypeWidth' a /// signedness of 'isSigned' and with a value suffix of 'ValSuffix' (e.g. LL). -static void DefineTypeSize(llvm::StringRef MacroName, unsigned TypeWidth, - llvm::StringRef ValSuffix, bool isSigned, +static void DefineTypeSize(StringRef MacroName, unsigned TypeWidth, + StringRef ValSuffix, bool isSigned, MacroBuilder &Builder) { llvm::APInt MaxVal = isSigned ? llvm::APInt::getSignedMaxValue(TypeWidth) : llvm::APInt::getMaxValue(TypeWidth); @@ -182,26 +182,26 @@ static void DefineTypeSize(llvm::StringRef MacroName, unsigned TypeWidth, /// DefineTypeSize - An overloaded helper that uses TargetInfo to determine /// the width, suffix, and signedness of the given type -static void DefineTypeSize(llvm::StringRef MacroName, TargetInfo::IntType Ty, +static void DefineTypeSize(StringRef MacroName, TargetInfo::IntType Ty, const TargetInfo &TI, MacroBuilder &Builder) { DefineTypeSize(MacroName, TI.getTypeWidth(Ty), TI.getTypeConstantSuffix(Ty), TI.isTypeSigned(Ty), Builder); } -static void DefineType(const llvm::Twine &MacroName, TargetInfo::IntType Ty, +static void DefineType(const Twine &MacroName, TargetInfo::IntType Ty, MacroBuilder &Builder) { Builder.defineMacro(MacroName, TargetInfo::getTypeName(Ty)); } -static void DefineTypeWidth(llvm::StringRef MacroName, TargetInfo::IntType Ty, +static void DefineTypeWidth(StringRef MacroName, TargetInfo::IntType Ty, const TargetInfo &TI, MacroBuilder &Builder) { - Builder.defineMacro(MacroName, llvm::Twine(TI.getTypeWidth(Ty))); + Builder.defineMacro(MacroName, Twine(TI.getTypeWidth(Ty))); } -static void DefineTypeSizeof(llvm::StringRef MacroName, unsigned BitWidth, +static void DefineTypeSizeof(StringRef MacroName, unsigned BitWidth, const TargetInfo &TI, MacroBuilder &Builder) { Builder.defineMacro(MacroName, - llvm::Twine(BitWidth / TI.getCharWidth())); + Twine(BitWidth / TI.getCharWidth())); } static void DefineExactWidthIntType(TargetInfo::IntType Ty, @@ -213,11 +213,11 @@ static void DefineExactWidthIntType(TargetInfo::IntType Ty, if (TypeWidth == 64) Ty = TI.getInt64Type(); - DefineType("__INT" + llvm::Twine(TypeWidth) + "_TYPE__", Ty, Builder); + DefineType("__INT" + Twine(TypeWidth) + "_TYPE__", Ty, Builder); - llvm::StringRef ConstSuffix(TargetInfo::getTypeConstantSuffix(Ty)); + StringRef ConstSuffix(TargetInfo::getTypeConstantSuffix(Ty)); if (!ConstSuffix.empty()) - Builder.defineMacro("__INT" + llvm::Twine(TypeWidth) + "_C_SUFFIX__", + Builder.defineMacro("__INT" + Twine(TypeWidth) + "_C_SUFFIX__", ConstSuffix); } @@ -412,7 +412,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI, // checks that it is necessary to report 4.2.1 (the base GCC version we claim // compatibility with) first. Builder.defineMacro("__VERSION__", "\"4.2.1 Compatible " + - llvm::Twine(getClangFullCPPVersion()) + "\""); + Twine(getClangFullCPPVersion()) + "\""); // Initialize language-specific preprocessor defines. @@ -546,7 +546,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI, // Define a __POINTER_WIDTH__ macro for stdint.h. Builder.defineMacro("__POINTER_WIDTH__", - llvm::Twine((int)TI.getPointerWidth(0))); + Twine((int)TI.getPointerWidth(0))); if (!LangOpts.CharIsSigned) Builder.defineMacro("__CHAR_UNSIGNED__"); @@ -558,7 +558,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI, Builder.defineMacro("__WCHAR_UNSIGNED__"); // Define exact-width integer types for stdint.h - Builder.defineMacro("__INT" + llvm::Twine(TI.getCharWidth()) + "_TYPE__", + Builder.defineMacro("__INT" + Twine(TI.getCharWidth()) + "_TYPE__", "char"); if (TI.getShortWidth() > TI.getCharWidth()) @@ -592,15 +592,15 @@ static void InitializePredefinedMacros(const TargetInfo &TI, Builder.defineMacro("__NO_INLINE__"); if (unsigned PICLevel = LangOpts.PICLevel) { - Builder.defineMacro("__PIC__", llvm::Twine(PICLevel)); - Builder.defineMacro("__pic__", llvm::Twine(PICLevel)); + Builder.defineMacro("__PIC__", Twine(PICLevel)); + Builder.defineMacro("__pic__", Twine(PICLevel)); } // Macros to control C99 numerics and <float.h> Builder.defineMacro("__FLT_EVAL_METHOD__", "0"); Builder.defineMacro("__FLT_RADIX__", "2"); int Dig = PickFP(&TI.getLongDoubleFormat(), -1/*FIXME*/, 17, 21, 33, 36); - Builder.defineMacro("__DECIMAL_DIG__", llvm::Twine(Dig)); + Builder.defineMacro("__DECIMAL_DIG__", Twine(Dig)); if (LangOpts.getStackProtectorMode() == LangOptions::SSPOn) Builder.defineMacro("__SSP__"); diff --git a/lib/Frontend/LangStandards.cpp b/lib/Frontend/LangStandards.cpp index af1721d0f9..abb521ba27 100644 --- a/lib/Frontend/LangStandards.cpp +++ b/lib/Frontend/LangStandards.cpp @@ -29,7 +29,7 @@ const LangStandard &LangStandard::getLangStandardForKind(Kind K) { } } -const LangStandard *LangStandard::getLangStandardForName(llvm::StringRef Name) { +const LangStandard *LangStandard::getLangStandardForName(StringRef Name) { Kind K = llvm::StringSwitch<Kind>(Name) #define LANGSTANDARD(id, name, desc, features) \ .Case(name, lang_##id) diff --git a/lib/Frontend/LogDiagnosticPrinter.cpp b/lib/Frontend/LogDiagnosticPrinter.cpp index 78eb1b2128..52e40efb82 100644 --- a/lib/Frontend/LogDiagnosticPrinter.cpp +++ b/lib/Frontend/LogDiagnosticPrinter.cpp @@ -14,7 +14,7 @@ #include "llvm/Support/raw_ostream.h" using namespace clang; -LogDiagnosticPrinter::LogDiagnosticPrinter(llvm::raw_ostream &os, +LogDiagnosticPrinter::LogDiagnosticPrinter(raw_ostream &os, const DiagnosticOptions &diags, bool _OwnsOutputStream) : OS(os), LangOpts(0), DiagOpts(&diags), @@ -26,7 +26,7 @@ LogDiagnosticPrinter::~LogDiagnosticPrinter() { delete &OS; } -static llvm::StringRef getLevelName(Diagnostic::Level Level) { +static StringRef getLevelName(Diagnostic::Level Level) { switch (Level) { default: return "<unknown>"; diff --git a/lib/Frontend/PrintPreprocessedOutput.cpp b/lib/Frontend/PrintPreprocessedOutput.cpp index c892960a18..0bfb6a27f3 100644 --- a/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/lib/Frontend/PrintPreprocessedOutput.cpp @@ -33,7 +33,7 @@ using namespace clang; /// PrintMacroDefinition - Print a macro definition in a form that will be /// properly accepted back as a definition. static void PrintMacroDefinition(const IdentifierInfo &II, const MacroInfo &MI, - Preprocessor &PP, llvm::raw_ostream &OS) { + Preprocessor &PP, raw_ostream &OS) { OS << "#define " << II.getName(); if (MI.isFunctionLike()) { @@ -83,7 +83,7 @@ class PrintPPOutputPPCallbacks : public PPCallbacks { SourceManager &SM; TokenConcatenation ConcatInfo; public: - llvm::raw_ostream &OS; + raw_ostream &OS; private: unsigned CurLine; @@ -96,7 +96,7 @@ private: bool DumpDefines; bool UseLineDirective; public: - PrintPPOutputPPCallbacks(Preprocessor &pp, llvm::raw_ostream &os, + PrintPPOutputPPCallbacks(Preprocessor &pp, raw_ostream &os, bool lineMarkers, bool defines) : PP(pp), SM(PP.getSourceManager()), ConcatInfo(PP), OS(os), DisableLineMarkers(lineMarkers), @@ -122,13 +122,13 @@ public: virtual void Ident(SourceLocation Loc, const std::string &str); virtual void PragmaComment(SourceLocation Loc, const IdentifierInfo *Kind, const std::string &Str); - virtual void PragmaMessage(SourceLocation Loc, llvm::StringRef Str); + virtual void PragmaMessage(SourceLocation Loc, StringRef Str); virtual void PragmaDiagnosticPush(SourceLocation Loc, - llvm::StringRef Namespace); + StringRef Namespace); virtual void PragmaDiagnosticPop(SourceLocation Loc, - llvm::StringRef Namespace); - virtual void PragmaDiagnostic(SourceLocation Loc, llvm::StringRef Namespace, - diag::Mapping Map, llvm::StringRef Str); + StringRef Namespace); + virtual void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace, + diag::Mapping Map, StringRef Str); bool HandleFirstTokOnLine(Token &Tok); bool MoveToLine(SourceLocation Loc) { @@ -346,7 +346,7 @@ void PrintPPOutputPPCallbacks::PragmaComment(SourceLocation Loc, } void PrintPPOutputPPCallbacks::PragmaMessage(SourceLocation Loc, - llvm::StringRef Str) { + StringRef Str) { MoveToLine(Loc); OS << "#pragma message("; @@ -369,22 +369,22 @@ void PrintPPOutputPPCallbacks::PragmaMessage(SourceLocation Loc, } void PrintPPOutputPPCallbacks:: -PragmaDiagnosticPush(SourceLocation Loc, llvm::StringRef Namespace) { +PragmaDiagnosticPush(SourceLocation Loc, StringRef Namespace) { MoveToLine(Loc); OS << "#pragma " << Namespace << " diagnostic push"; EmittedTokensOnThisLine = true; } void PrintPPOutputPPCallbacks:: -PragmaDiagnosticPop(SourceLocation Loc, llvm::StringRef Namespace) { +PragmaDiagnosticPop(SourceLocation Loc, StringRef Namespace) { MoveToLine(Loc); OS << "#pragma " << Namespace << " diagnostic pop"; EmittedTokensOnThisLine = true; } void PrintPPOutputPPCallbacks:: -PragmaDiagnostic(SourceLocation Loc, llvm::StringRef Namespace, - diag::Mapping Map, llvm::StringRef Str) { +PragmaDiagnostic(SourceLocation Loc, StringRef Namespace, + diag::Mapping Map, StringRef Str) { MoveToLine(Loc); OS << "#pragma " << Namespace << " diagnostic "; switch (Map) { @@ -491,7 +491,7 @@ struct UnknownPragmaHandler : public PragmaHandler { static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok, PrintPPOutputPPCallbacks *Callbacks, - llvm::raw_ostream &OS) { + raw_ostream &OS) { char Buffer[256]; Token PrevPrevTok, PrevTok; PrevPrevTok.startToken(); @@ -550,7 +550,7 @@ static int MacroIDCompare(const void* a, const void* b) { return LHS->first->getName().compare(RHS->first->getName()); } -static void DoPrintMacros(Preprocessor &PP, llvm::raw_ostream *OS) { +static void DoPrintMacros(Preprocessor &PP, raw_ostream *OS) { // Ignore unknown pragmas. PP.AddPragmaHandler(new EmptyPragmaHandler()); @@ -562,7 +562,7 @@ static void DoPrintMacros(Preprocessor &PP, llvm::raw_ostream *OS) { do PP.Lex(Tok); while (Tok.isNot(tok::eof)); - llvm::SmallVector<id_macro_pair, 128> + SmallVector<id_macro_pair, 128> MacrosByID(PP.macro_begin(), PP.macro_end()); llvm::array_pod_sort(MacrosByID.begin(), MacrosByID.end(), MacroIDCompare); @@ -578,7 +578,7 @@ static void DoPrintMacros(Preprocessor &PP, llvm::raw_ostream *OS) { /// DoPrintPreprocessedInput - This implements -E mode. /// -void clang::DoPrintPreprocessedInput(Preprocessor &PP, llvm::raw_ostream *OS, +void clang::DoPrintPreprocessedInput(Preprocessor &PP, raw_ostream *OS, const PreprocessorOutputOptions &Opts) { // Show macros with no output is handled specially. if (!Opts.ShowCPP) { diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp index e49e19a17c..83a1a37188 100644 --- a/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/lib/Frontend/TextDiagnosticPrinter.cpp @@ -23,24 +23,24 @@ #include <algorithm> using namespace clang; -static const enum llvm::raw_ostream::Colors noteColor = - llvm::raw_ostream::BLACK; -static const enum llvm::raw_ostream::Colors fixitColor = - llvm::raw_ostream::GREEN; -static const enum llvm::raw_ostream::Colors caretColor = - llvm::raw_ostream::GREEN; -static const enum llvm::raw_ostream::Colors warningColor = - llvm::raw_ostream::MAGENTA; -static const enum llvm::raw_ostream::Colors errorColor = llvm::raw_ostream::RED; -static const enum llvm::raw_ostream::Colors fatalColor = llvm::raw_ostream::RED; +static const enum raw_ostream::Colors noteColor = + raw_ostream::BLACK; +static const enum raw_ostream::Colors fixitColor = + raw_ostream::GREEN; +static const enum raw_ostream::Colors caretColor = + raw_ostream::GREEN; +static const enum raw_ostream::Colors warningColor = + raw_ostream::MAGENTA; +static const enum raw_ostream::Colors errorColor = raw_ostream::RED; +static const enum raw_ostream::Colors fatalColor = raw_ostream::RED; // Used for changing only the bold attribute. -static const enum llvm::raw_ostream::Colors savedColor = - llvm::raw_ostream::SAVEDCOLOR; +static const enum raw_ostream::Colors savedColor = + raw_ostream::SAVEDCOLOR; /// \brief Number of spaces to indent when word-wrapping. const unsigned WordWrapIndentation = 6; -TextDiagnosticPrinter::TextDiagnosticPrinter(llvm::raw_ostream &os, +TextDiagnosticPrinter::TextDiagnosticPrinter(raw_ostream &os, const DiagnosticOptions &diags, bool _OwnsOutputStream) : OS(os), LangOpts(0), DiagOpts(&diags), @@ -660,7 +660,7 @@ void TextDiagnosticPrinter::EmitCaretDiagnostic(SourceLocation Loc, /// greater than or equal to Idx or, if no such character exists, /// returns the end of the string. static unsigned skipWhitespace(unsigned Idx, - const llvm::SmallVectorImpl<char> &Str, + const SmallVectorImpl<char> &Str, unsigned Length) { while (Idx < Length && isspace(Str[Idx])) ++Idx; @@ -693,7 +693,7 @@ static inline char findMatchingPunctuation(char c) { /// \returns the index pointing one character past the end of the /// word. static unsigned findEndOfWord(unsigned Start, - const llvm::SmallVectorImpl<char> &Str, + const SmallVectorImpl<char> &Str, unsigned Length, unsigned Column, unsigned Columns) { assert(Start < Str.size() && "Invalid start position!"); @@ -764,8 +764,8 @@ static unsigned findEndOfWord(unsigned Start, /// /// \returns true if word-wrapping was required, or false if the /// string fit on the first line. -static bool PrintWordWrapped(llvm::raw_ostream &OS, - const llvm::SmallVectorImpl<char> &Str, +static bool PrintWordWrapped(raw_ostream &OS, + const SmallVectorImpl<char> &Str, unsigned Columns, unsigned Column = 0, unsigned Indentation = WordWrapIndentation) { @@ -1010,7 +1010,7 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, OptionName += "-Werror"; } - llvm::StringRef Opt = DiagnosticIDs::getWarningOptionForDiag(Info.getID()); + StringRef Opt = DiagnosticIDs::getWarningOptionForDiag(Info.getID()); if (!Opt.empty()) { if (!OptionName.empty()) OptionName += ','; diff --git a/lib/Frontend/VerifyDiagnosticsClient.cpp b/lib/Frontend/VerifyDiagnosticsClient.cpp index fff417e20d..9ffb0f676a 100644 --- a/lib/Frontend/VerifyDiagnosticsClient.cpp +++ b/lib/Frontend/VerifyDiagnosticsClient.cpp @@ -163,7 +163,7 @@ public: : Begin(Begin), End(End), C(Begin), P(Begin), PEnd(NULL) { } // Return true if string literal is next. - bool Next(llvm::StringRef S) { + bool Next(StringRef S) { P = C; PEnd = C + S.size(); if (PEnd > End) @@ -189,7 +189,7 @@ public: // Return true if string literal is found. // When true, P marks begin-position of S in content. - bool Search(llvm::StringRef S) { + bool Search(StringRef S) { P = std::search(C, End, S.begin(), S.end()); PEnd = P + S.size(); return P != End; @@ -296,11 +296,11 @@ static void ParseDirective(const char *CommentStart, unsigned CommentLen, // build directive text; convert \n to newlines std::string Text; - llvm::StringRef NewlineStr = "\\n"; - llvm::StringRef Content(ContentBegin, ContentEnd-ContentBegin); + StringRef NewlineStr = "\\n"; + StringRef Content(ContentBegin, ContentEnd-ContentBegin); size_t CPos = 0; size_t FPos; - while ((FPos = Content.find(NewlineStr, CPos)) != llvm::StringRef::npos) { + while ((FPos = Content.find(NewlineStr, CPos)) != StringRef::npos) { Text += Content.substr(CPos, FPos-CPos); Text += '\n'; CPos = FPos + NewlineStr.size(); diff --git a/lib/Frontend/Warnings.cpp b/lib/Frontend/Warnings.cpp index f12b484c05..215f8f8b22 100644 --- a/lib/Frontend/Warnings.cpp +++ b/lib/Frontend/Warnings.cpp @@ -55,7 +55,7 @@ void clang::ProcessWarningOptions(Diagnostic &Diags, Diags.setExtensionHandlingBehavior(Diagnostic::Ext_Ignore); for (unsigned i = 0, e = Opts.Warnings.size(); i != e; ++i) { - llvm::StringRef Opt = Opts.Warnings[i]; + StringRef Opt = Opts.Warnings[i]; // Check to see if this warning starts with "no-", if so, this is a negative // form of the option. @@ -79,7 +79,7 @@ void clang::ProcessWarningOptions(Diagnostic &Diags, // -Werror/-Wno-error is a special case, not controlled by the option table. // It also has the "specifier" form of -Werror=foo and -Werror-foo. if (Opt.startswith("error")) { - llvm::StringRef Specifier; + StringRef Specifier; if (Opt.size() > 5) { // Specifier must be present. if ((Opt[5] != '=' && Opt[5] != '-') || Opt.size() == 6) { Diags.Report(diag::warn_unknown_warning_specifier) @@ -101,7 +101,7 @@ void clang::ProcessWarningOptions(Diagnostic &Diags, // -Wfatal-errors is yet another special case. if (Opt.startswith("fatal-errors")) { - llvm::StringRef Specifier; + StringRef Specifier; if (Opt.size() != 12) { if ((Opt[12] != '=' && Opt[12] != '-') || Opt.size() == 13) { Diags.Report(diag::warn_unknown_warning_specifier) diff --git a/lib/Index/ASTLocation.cpp b/lib/Index/ASTLocation.cpp index bd3b5ee8bf..8ea49c16f8 100644 --- a/lib/Index/ASTLocation.cpp +++ b/lib/Index/ASTLocation.cpp @@ -75,7 +75,7 @@ SourceRange ASTLocation::getSourceRange() const { return SourceRange(); } -void ASTLocation::print(llvm::raw_ostream &OS) const { +void ASTLocation::print(raw_ostream &OS) const { if (isInvalid()) { OS << "<< Invalid ASTLocation >>\n"; return; diff --git a/lib/Index/CallGraph.cpp b/lib/Index/CallGraph.cpp index 94790b8fbc..741e78107f 100644 --- a/lib/Index/CallGraph.cpp +++ b/lib/Index/CallGraph.cpp @@ -110,7 +110,7 @@ Decl *CallGraph::getDecl(CallGraphNode *Node) { return Node->getDecl(*Ctx); } -void CallGraph::print(llvm::raw_ostream &os) { +void CallGraph::print(raw_ostream &os) { for (iterator I = begin(), E = end(); I != E; ++I) { if (I->second->hasCallee()) { os << "function: " << I->first.getPrintableName() diff --git a/lib/Index/Entity.cpp b/lib/Index/Entity.cpp index afac05c413..fbab6d8684 100644 --- a/lib/Index/Entity.cpp +++ b/lib/Index/Entity.cpp @@ -47,7 +47,7 @@ public: unsigned IdNS, bool isObjCInstanceMethod); // Get an Entity associated with the name in the global namespace. - Entity getGlobalEntity(llvm::StringRef Name); + Entity getGlobalEntity(StringRef Name); Entity VisitNamedDecl(NamedDecl *D); Entity VisitVarDecl(VarDecl *D); @@ -77,7 +77,7 @@ Entity EntityGetter::getEntity(Entity Parent, DeclarationName Name, return Entity(New); } -Entity EntityGetter::getGlobalEntity(llvm::StringRef Name) { +Entity EntityGetter::getGlobalEntity(StringRef Name) { IdentifierInfo *II = &ProgImpl.getIdents().get(Name); DeclarationName GlobName(II); unsigned IdNS = Decl::IDNS_Ordinary; @@ -209,7 +209,7 @@ Entity EntityImpl::get(Decl *D, Program &Prog, ProgramImpl &ProgImpl) { } /// \brief Get an Entity associated with a global name. -Entity EntityImpl::get(llvm::StringRef Name, Program &Prog, +Entity EntityImpl::get(StringRef Name, Program &Prog, ProgramImpl &ProgImpl) { return EntityGetter(Prog, ProgImpl).getGlobalEntity(Name); } @@ -259,7 +259,7 @@ Entity Entity::get(Decl *D, Program &Prog) { return EntityImpl::get(D, Prog, ProgImpl); } -Entity Entity::get(llvm::StringRef Name, Program &Prog) { +Entity Entity::get(StringRef Name, Program &Prog) { ProgramImpl &ProgImpl = *static_cast<ProgramImpl*>(Prog.Impl); return EntityImpl::get(Name, Prog, ProgImpl); } diff --git a/lib/Index/GlobalSelector.cpp b/lib/Index/GlobalSelector.cpp index 34679185b1..2fe6f95ec9 100644 --- a/lib/Index/GlobalSelector.cpp +++ b/lib/Index/GlobalSelector.cpp @@ -25,7 +25,7 @@ Selector GlobalSelector::getSelector(ASTContext &AST) const { Selector GlobSel = Selector(reinterpret_cast<uintptr_t>(Val)); - llvm::SmallVector<IdentifierInfo *, 8> Ids; + SmallVector<IdentifierInfo *, 8> Ids; for (unsigned i = 0, e = GlobSel.isUnarySelector() ? 1 : GlobSel.getNumArgs(); i != e; ++i) { IdentifierInfo *GlobII = GlobSel.getIdentifierInfoForSlot(i); @@ -52,7 +52,7 @@ GlobalSelector GlobalSelector::get(Selector Sel, Program &Prog) { ProgramImpl &ProgImpl = *static_cast<ProgramImpl*>(Prog.Impl); - llvm::SmallVector<IdentifierInfo *, 8> Ids; + SmallVector<IdentifierInfo *, 8> Ids; for (unsigned i = 0, e = Sel.isUnarySelector() ? 1 : Sel.getNumArgs(); i != e; ++i) { IdentifierInfo *II = Sel.getIdentifierInfoForSlot(i); diff --git a/lib/Lex/HeaderMap.cpp b/lib/Lex/HeaderMap.cpp index e102a6da60..0cb564c222 100644 --- a/lib/Lex/HeaderMap.cpp +++ b/lib/Lex/HeaderMap.cpp @@ -57,7 +57,7 @@ struct HMapHeader { /// HashHMapKey - This is the 'well known' hash function required by the file /// format, used to look up keys in the hash table. The hash table uses simple /// linear probing based on this function. -static inline unsigned HashHMapKey(llvm::StringRef Str) { +static inline unsigned HashHMapKey(StringRef Str) { unsigned Result = 0; const char *S = Str.begin(), *End = Str.end(); @@ -200,7 +200,7 @@ void HeaderMap::dump() const { /// LookupFile - Check to see if the specified relative filename is located in /// this HeaderMap. If so, open it and return its FileEntry. const FileEntry *HeaderMap::LookupFile( - llvm::StringRef Filename, FileManager &FM) const { + StringRef Filename, FileManager &FM) const { const HMapHeader &Hdr = getHeader(); unsigned NumBuckets = getEndianAdjustedWord(Hdr.NumBuckets); diff --git a/lib/Lex/HeaderSearch.cpp b/lib/Lex/HeaderSearch.cpp index 86ab9564a2..e2fd02983c 100644 --- a/lib/Lex/HeaderSearch.cpp +++ b/lib/Lex/HeaderSearch.cpp @@ -116,17 +116,17 @@ const char *DirectoryLookup::getName() const { /// LookupFile - Lookup the specified file in this search path, returning it /// if it exists or returning null if not. const FileEntry *DirectoryLookup::LookupFile( - llvm::StringRef Filename, + StringRef Filename, HeaderSearch &HS, - llvm::SmallVectorImpl<char> *SearchPath, - llvm::SmallVectorImpl<char> *RelativePath) const { + SmallVectorImpl<char> *SearchPath, + SmallVectorImpl<char> *RelativePath) const { llvm::SmallString<1024> TmpDir; if (isNormalDir()) { // Concatenate the requested file onto the directory. TmpDir = getDir()->getName(); llvm::sys::path::append(TmpDir, Filename); if (SearchPath != NULL) { - llvm::StringRef SearchPathRef(getDir()->getName()); + StringRef SearchPathRef(getDir()->getName()); SearchPath->clear(); SearchPath->append(SearchPathRef.begin(), SearchPathRef.end()); } @@ -145,7 +145,7 @@ const FileEntry *DirectoryLookup::LookupFile( Filename, HS.getFileMgr()); if (Result) { if (SearchPath != NULL) { - llvm::StringRef SearchPathRef(getName()); + StringRef SearchPathRef(getName()); SearchPath->clear(); SearchPath->append(SearchPathRef.begin(), SearchPathRef.end()); } @@ -161,15 +161,15 @@ const FileEntry *DirectoryLookup::LookupFile( /// DoFrameworkLookup - Do a lookup of the specified file in the current /// DirectoryLookup, which is a framework directory. const FileEntry *DirectoryLookup::DoFrameworkLookup( - llvm::StringRef Filename, + StringRef Filename, HeaderSearch &HS, - llvm::SmallVectorImpl<char> *SearchPath, - llvm::SmallVectorImpl<char> *RelativePath) const { + SmallVectorImpl<char> *SearchPath, + SmallVectorImpl<char> *RelativePath) const { FileManager &FileMgr = HS.getFileMgr(); // Framework names must have a '/' in the filename. size_t SlashPos = Filename.find('/'); - if (SlashPos == llvm::StringRef::npos) return 0; + if (SlashPos == StringRef::npos) return 0; // Find out if this is the home for the specified framework, by checking // HeaderSearch. Possible answer are yes/no and unknown. @@ -255,13 +255,13 @@ const FileEntry *DirectoryLookup::DoFrameworkLookup( /// non-null, indicates where the #including file is, in case a relative search /// is needed. const FileEntry *HeaderSearch::LookupFile( - llvm::StringRef Filename, + StringRef Filename, bool isAngled, const DirectoryLookup *FromDir, const DirectoryLookup *&CurDir, const FileEntry *CurFileEnt, - llvm::SmallVectorImpl<char> *SearchPath, - llvm::SmallVectorImpl<char> *RelativePath) { + SmallVectorImpl<char> *SearchPath, + SmallVectorImpl<char> *RelativePath) { // If 'Filename' is absolute, check to see if it exists and no searching. if (llvm::sys::path::is_absolute(Filename)) { CurDir = 0; @@ -301,7 +301,7 @@ const FileEntry *HeaderSearch::LookupFile( unsigned DirInfo = getFileInfo(CurFileEnt).DirInfo; getFileInfo(FE).DirInfo = DirInfo; if (SearchPath != NULL) { - llvm::StringRef SearchPathRef(CurFileEnt->getDir()->getName()); + StringRef SearchPathRef(CurFileEnt->getDir()->getName()); SearchPath->clear(); SearchPath->append(SearchPathRef.begin(), SearchPathRef.end()); } @@ -370,15 +370,15 @@ const FileEntry *HeaderSearch::LookupFile( /// is a subframework within Carbon.framework. If so, return the FileEntry /// for the designated file, otherwise return null. const FileEntry *HeaderSearch:: -LookupSubframeworkHeader(llvm::StringRef Filename, +LookupSubframeworkHeader(StringRef Filename, const FileEntry *ContextFileEnt, - llvm::SmallVectorImpl<char> *SearchPath, - llvm::SmallVectorImpl<char> *RelativePath) { + SmallVectorImpl<char> *SearchPath, + SmallVectorImpl<char> *RelativePath) { assert(ContextFileEnt && "No context file?"); // Framework names must have a '/' in the filename. Find it. size_t SlashPos = Filename.find('/'); - if (SlashPos == llvm::StringRef::npos) return 0; + if (SlashPos == StringRef::npos) return 0; // Look up the base framework name of the ContextFileEnt. const char *ContextName = ContextFileEnt->getName(); diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index 7b6b6a99b0..575cb4af25 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -76,7 +76,7 @@ void Lexer::InitLexer(const char *BufStart, const char *BufPtr, // skip the UTF-8 BOM if it's present. if (BufferStart == BufferPtr) { // Determine the size of the BOM. - llvm::StringRef Buf(BufferStart, BufferEnd - BufferStart); + StringRef Buf(BufferStart, BufferEnd - BufferStart); size_t BOMLength = llvm::StringSwitch<size_t>(Buf) .StartsWith("\xEF\xBB\xBF", 3) // UTF-8 BOM .Default(0); @@ -217,7 +217,7 @@ std::string Lexer::Stringify(const std::string &Str, bool Charify) { /// Stringify - Convert the specified string into a C string by escaping '\' /// and " characters. This does not add surrounding ""'s to the string. -void Lexer::Stringify(llvm::SmallVectorImpl<char> &Str) { +void Lexer::Stringify(SmallVectorImpl<char> &Str) { for (unsigned i = 0, e = Str.size(); i != e; ++i) { if (Str[i] == '\\' || Str[i] == '"') { Str.insert(Str.begin()+i, '\\'); @@ -235,8 +235,8 @@ void Lexer::Stringify(llvm::SmallVectorImpl<char> &Str) { /// after trigraph expansion and escaped-newline folding. In particular, this /// wants to get the true, uncanonicalized, spelling of things like digraphs /// UCNs, etc. -llvm::StringRef Lexer::getSpelling(SourceLocation loc, - llvm::SmallVectorImpl<char> &buffer, +StringRef Lexer::getSpelling(SourceLocation loc, + SmallVectorImpl<char> &buffer, const SourceManager &SM, const LangOptions &options, bool *invalid) { @@ -245,10 +245,10 @@ llvm::StringRef Lexer::getSpelling(SourceLocation loc, // Try to the load the file buffer. bool invalidTemp = false; - llvm::StringRef file = SM.getBufferData(locInfo.first, &invalidTemp); + StringRef file = SM.getBufferData(locInfo.first, &invalidTemp); if (invalidTemp) { if (invalid) *invalid = true; - return llvm::StringRef(); + return StringRef(); } const char *tokenBegin = file.data() + locInfo.second; @@ -263,7 +263,7 @@ llvm::StringRef Lexer::getSpelling(SourceLocation loc, // Common case: no need for cleaning. if (!token.needsCleaning()) - return llvm::StringRef(tokenBegin, length); + return StringRef(tokenBegin, length); // Hard case, we need to relex the characters into the string. buffer.clear(); @@ -275,7 +275,7 @@ llvm::StringRef Lexer::getSpelling(SourceLocation loc, ti += charSize; } - return llvm::StringRef(buffer.data(), buffer.size()); + return StringRef(buffer.data(), buffer.size()); } /// getSpelling() - Return the 'spelling' of this token. The spelling of a @@ -397,7 +397,7 @@ unsigned Lexer::MeasureTokenLength(SourceLocation Loc, Loc = SM.getInstantiationLoc(Loc); std::pair<FileID, unsigned> LocInfo = SM.getDecomposedLoc(Loc); bool Invalid = false; - llvm::StringRef Buffer = SM.getBufferData(LocInfo.first, &Invalid); + StringRef Buffer = SM.getBufferData(LocInfo.first, &Invalid); if (Invalid) return 0; @@ -423,7 +423,7 @@ SourceLocation Lexer::GetBeginningOfToken(SourceLocation Loc, return Loc; bool Invalid = false; - llvm::StringRef Buffer = SM.getBufferData(LocInfo.first, &Invalid); + StringRef Buffer = SM.getBufferData(LocInfo.first, &Invalid); if (Invalid) return Loc; @@ -544,7 +544,7 @@ Lexer::ComputePreamble(const llvm::MemoryBuffer *Buffer, unsigned MaxLines) { // the raw identifier to recognize and categorize preprocessor directives. TheLexer.LexFromRawLexer(TheTok); if (TheTok.getKind() == tok::raw_identifier && !TheTok.needsCleaning()) { - llvm::StringRef Keyword(TheTok.getRawIdentifierData(), + StringRef Keyword(TheTok.getRawIdentifierData(), TheTok.getLength()); PreambleDirectiveKind PDK = llvm::StringSwitch<PreambleDirectiveKind>(Keyword) @@ -978,7 +978,7 @@ static char DecodeTrigraphChar(const char *CP, Lexer *L) { } if (!L->isLexingRawMode()) - L->Diag(CP-2, diag::trigraph_converted) << llvm::StringRef(&Res, 1); + L->Diag(CP-2, diag::trigraph_converted) << StringRef(&Res, 1); return Res; } @@ -1952,9 +1952,9 @@ unsigned Lexer::isNextPPTokenLParen() { /// FindConflictEnd - Find the end of a version control conflict marker. static const char *FindConflictEnd(const char *CurPtr, const char *BufferEnd) { - llvm::StringRef RestOfBuffer(CurPtr+7, BufferEnd-CurPtr-7); + StringRef RestOfBuffer(CurPtr+7, BufferEnd-CurPtr-7); size_t Pos = RestOfBuffer.find(">>>>>>>"); - while (Pos != llvm::StringRef::npos) { + while (Pos != StringRef::npos) { // Must occur at start of line. if (RestOfBuffer[Pos-1] != '\r' && RestOfBuffer[Pos-1] != '\n') { @@ -1979,7 +1979,7 @@ bool Lexer::IsStartOfConflictMarker(const char *CurPtr) { // Check to see if we have <<<<<<<. if (BufferEnd-CurPtr < 8 || - llvm::StringRef(CurPtr, 7) != "<<<<<<<") + StringRef(CurPtr, 7) != "<<<<<<<") return false; // If we have a situation where we don't care about conflict markers, ignore diff --git a/lib/Lex/LiteralSupport.cpp b/lib/Lex/LiteralSupport.cpp index 2c96c4d4ee..f8a2a55117 100644 --- a/lib/Lex/LiteralSupport.cpp +++ b/lib/Lex/LiteralSupport.cpp @@ -16,7 +16,6 @@ #include "clang/Lex/Preprocessor.h" #include "clang/Lex/LexDiagnostic.h" #include "clang/Basic/TargetInfo.h" -#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringExtras.h" using namespace clang; @@ -371,7 +370,7 @@ NumericLiteralParser(const char *begin, const char *end, // Done. } else if (isxdigit(*s) && !(*s == 'e' || *s == 'E')) { PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s-begin), - diag::err_invalid_decimal_digit) << llvm::StringRef(s, 1); + diag::err_invalid_decimal_digit) << StringRef(s, 1); hadError = true; return; } else if (*s == '.') { @@ -498,7 +497,7 @@ NumericLiteralParser(const char *begin, const char *end, PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s-begin), isFPConstant ? diag::err_invalid_suffix_float_constant : diag::err_invalid_suffix_integer_constant) - << llvm::StringRef(SuffixBegin, ThisTokEnd-SuffixBegin); + << StringRef(SuffixBegin, ThisTokEnd-SuffixBegin); hadError = true; return; } @@ -569,7 +568,7 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) { // Done. } else if (isxdigit(*s)) { PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s-ThisTokBegin), - diag::err_invalid_binary_digit) << llvm::StringRef(s, 1); + diag::err_invalid_binary_digit) << StringRef(s, 1); hadError = true; } // Other suffixes will be diagnosed by the caller. @@ -599,7 +598,7 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) { // the code is using an incorrect base. if (isxdigit(*s) && *s != 'e' && *s != 'E') { PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s-ThisTokBegin), - diag::err_invalid_octal_digit) << llvm::StringRef(s, 1); + diag::err_invalid_octal_digit) << StringRef(s, 1); hadError = true; return; } @@ -688,7 +687,6 @@ bool NumericLiteralParser::GetIntegerValue(llvm::APInt &Val) { llvm::APFloat::opStatus NumericLiteralParser::GetFloatValue(llvm::APFloat &Result) { using llvm::APFloat; - using llvm::StringRef; unsigned n = std::min(SuffixBegin - ThisTokBegin, ThisTokEnd - ThisTokBegin); return Result.convertFromString(StringRef(ThisTokBegin, n), diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index 4af5fabe5c..7e4b9b2bd6 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/lib/Lex/PPDirectives.cpp @@ -275,9 +275,9 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation IfTokenLoc, // that we can't use Tok.getIdentifierInfo() because its lookup is disabled // when skipping. char DirectiveBuf[20]; - llvm::StringRef Directive; + StringRef Directive; if (!Tok.needsCleaning() && Tok.getLength() < 20) { - Directive = llvm::StringRef(RawCharData, Tok.getLength()); + Directive = StringRef(RawCharData, Tok.getLength()); } else { std::string DirectiveStr = getSpelling(Tok); unsigned IdLen = DirectiveStr.size(); @@ -288,11 +288,11 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation IfTokenLoc, continue; } memcpy(DirectiveBuf, &DirectiveStr[0], IdLen); - Directive = llvm::StringRef(DirectiveBuf, IdLen); + Directive = StringRef(DirectiveBuf, IdLen); } if (Directive.startswith("if")) { - llvm::StringRef Sub = Directive.substr(2); + StringRef Sub = Directive.substr(2); if (Sub.empty() || // "if" Sub == "def" || // "ifdef" Sub == "ndef") { // "ifndef" @@ -307,7 +307,7 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation IfTokenLoc, Callbacks->Endif(); } } else if (Directive[0] == 'e') { - llvm::StringRef Sub = Directive.substr(1); + StringRef Sub = Directive.substr(1); if (Sub == "ndif") { // "endif" CheckEndOfDirective("endif"); PPConditionalInfo CondInfo; @@ -472,12 +472,12 @@ void Preprocessor::PTHSkipExcludedConditionalBlock() { /// return null on failure. isAngled indicates whether the file reference is /// for system #include's or not (i.e. using <> instead of ""). const FileEntry *Preprocessor::LookupFile( - llvm::StringRef Filename, + StringRef Filename, bool isAngled, const DirectoryLookup *FromDir, const DirectoryLookup *&CurDir, - llvm::SmallVectorImpl<char> *SearchPath, - llvm::SmallVectorImpl<char> *RelativePath) { + SmallVectorImpl<char> *SearchPath, + SmallVectorImpl<char> *RelativePath) { // If the header lookup mechanism may be relative to the current file, pass in // info about where the current file is. const FileEntry *CurFileEnt = 0; @@ -1011,7 +1011,7 @@ void Preprocessor::HandleIdentSCCSDirective(Token &Tok) { /// spelling of the filename, but is also expected to handle the case when /// this method decides to use a different buffer. bool Preprocessor::GetIncludeFilenameSpelling(SourceLocation Loc, - llvm::StringRef &Buffer) { + StringRef &Buffer) { // Get the text form of the filename. assert(!Buffer.empty() && "Can't have tokens with empty spellings!"); @@ -1020,27 +1020,27 @@ bool Preprocessor::GetIncludeFilenameSpelling(SourceLocation Loc, if (Buffer[0] == '<') { if (Buffer.back() != '>') { Diag(Loc, diag::err_pp_expects_filename); - Buffer = llvm::StringRef(); + Buffer = StringRef(); return true; } isAngled = true; } else if (Buffer[0] == '"') { if (Buffer.back() != '"') { Diag(Loc, diag::err_pp_expects_filename); - Buffer = llvm::StringRef(); + Buffer = StringRef(); return true; } isAngled = false; } else { Diag(Loc, diag::err_pp_expects_filename); - Buffer = llvm::StringRef(); + Buffer = StringRef(); return true; } // Diagnose #include "" as invalid. if (Buffer.size() <= 2) { Diag(Loc, diag::err_pp_empty_filename); - Buffer = llvm::StringRef(); + Buffer = StringRef(); return true; } @@ -1122,7 +1122,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, // Reserve a buffer to get the spelling. llvm::SmallString<128> FilenameBuffer; - llvm::StringRef Filename; + StringRef Filename; SourceLocation End; switch (FilenameTok.getKind()) { @@ -1284,7 +1284,7 @@ void Preprocessor::HandleIncludeMacrosDirective(SourceLocation HashLoc, /// closing ), updating MI with what we learn. Return true if an error occurs /// parsing the arg list. bool Preprocessor::ReadMacroDefinitionArgList(MacroInfo *MI) { - llvm::SmallVector<IdentifierInfo*, 32> Arguments; + SmallVector<IdentifierInfo*, 32> Arguments; Token Tok; while (1) { diff --git a/lib/Lex/PPExpressions.cpp b/lib/Lex/PPExpressions.cpp index 8fcfc70a7c..08e2705ef1 100644 --- a/lib/Lex/PPExpressions.cpp +++ b/lib/Lex/PPExpressions.cpp @@ -188,7 +188,7 @@ static bool EvaluateValue(PPValue &Result, Token &PeekTok, DefinedTracker &DT, case tok::numeric_constant: { llvm::SmallString<64> IntegerBuffer; bool NumberInvalid = false; - llvm::StringRef Spelling = PP.getSpelling(PeekTok, IntegerBuffer, + StringRef Spelling = PP.getSpelling(PeekTok, IntegerBuffer, &NumberInvalid); if (NumberInvalid) return true; // a diagnostic was already reported @@ -239,7 +239,7 @@ static bool EvaluateValue(PPValue &Result, Token &PeekTok, DefinedTracker &DT, case tok::char_constant: { // 'x' llvm::SmallString<32> CharBuffer; bool CharInvalid = false; - llvm::StringRef ThisTok = PP.getSpelling(PeekTok, CharBuffer, &CharInvalid); + StringRef ThisTok = PP.getSpelling(PeekTok, CharBuffer, &CharInvalid); if (CharInvalid) return true; diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp index e8658255e4..5d31b8cb45 100644 --- a/lib/Lex/PPMacroExpansion.cpp +++ b/lib/Lex/PPMacroExpansion.cpp @@ -333,7 +333,7 @@ MacroArgs *Preprocessor::ReadFunctionLikeMacroArgs(Token &MacroName, // ArgTokens - Build up a list of tokens that make up each argument. Each // argument is separated by an EOF token. Use a SmallVector so we can avoid // heap allocations in the common case. - llvm::SmallVector<Token, 64> ArgTokens; + SmallVector<Token, 64> ArgTokens; unsigned NumActuals = 0; while (Tok.isNot(tok::r_paren)) { @@ -715,7 +715,7 @@ static bool EvaluateHasIncludeCommon(Token &Tok, // Reserve a buffer to get the spelling. llvm::SmallString<128> FilenameBuffer; - llvm::StringRef Filename; + StringRef Filename; SourceLocation EndLoc; switch (Tok.getKind()) { @@ -924,7 +924,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) { Result = "??? ??? ?? ??:??:?? ????\n"; } // Surround the string with " and strip the trailing newline. - OS << '"' << llvm::StringRef(Result, strlen(Result)-1) << '"'; + OS << '"' << StringRef(Result, strlen(Result)-1) << '"'; Tok.setKind(tok::string_literal); } else if (II == Ident__COUNTER__) { // __COUNTER__ expands to a simple numeric value. diff --git a/lib/Lex/PTHLexer.cpp b/lib/Lex/PTHLexer.cpp index e5ef0fdf20..b61b8f35f8 100644 --- a/lib/Lex/PTHLexer.cpp +++ b/lib/Lex/PTHLexer.cpp @@ -380,7 +380,7 @@ public: } static unsigned ComputeHash(const internal_key_type& a) { - return llvm::HashString(llvm::StringRef(a.first, a.second)); + return llvm::HashString(StringRef(a.first, a.second)); } // This hopefully will just get inlined and removed by the optimizer. @@ -572,7 +572,7 @@ IdentifierInfo* PTHManager::LazilyCreateIdentifierInfo(unsigned PersistentID) { return II; } -IdentifierInfo* PTHManager::get(llvm::StringRef Name) { +IdentifierInfo* PTHManager::get(StringRef Name) { PTHStringIdLookup& SL = *((PTHStringIdLookup*)StringIdLookup); // Double check our assumption that the last character isn't '\0'. assert(Name.empty() || Name.data()[Name.size()-1] != '\0'); diff --git a/lib/Lex/Pragma.cpp b/lib/Lex/Pragma.cpp index e6b28c1331..d94e2e8305 100644 --- a/lib/Lex/Pragma.cpp +++ b/lib/Lex/Pragma.cpp @@ -54,11 +54,11 @@ PragmaNamespace::~PragmaNamespace() { /// specified name. If not, return the handler for the null identifier if it /// exists, otherwise return null. If IgnoreNull is true (the default) then /// the null handler isn't returned on failure to match. -PragmaHandler *PragmaNamespace::FindHandler(llvm::StringRef Name, +PragmaHandler *PragmaNamespace::FindHandler(StringRef Name, bool IgnoreNull) const { if (PragmaHandler *Handler = Handlers.lookup(Name)) return Handler; - return IgnoreNull ? 0 : Handlers.lookup(llvm::StringRef()); + return IgnoreNull ? 0 : Handlers.lookup(StringRef()); } void PragmaNamespace::AddPragma(PragmaHandler *Handler) { @@ -85,7 +85,7 @@ void PragmaNamespace::HandlePragma(Preprocessor &PP, // Get the handler for this token. If there is no handler, ignore the pragma. PragmaHandler *Handler = FindHandler(Tok.getIdentifierInfo() ? Tok.getIdentifierInfo()->getName() - : llvm::StringRef(), + : StringRef(), /*IgnoreNull=*/false); if (Handler == 0) { PP.Diag(Tok, diag::warn_pragma_ignored); @@ -210,7 +210,7 @@ void Preprocessor::HandleMicrosoft__pragma(Token &Tok) { } // Get the tokens enclosed within the __pragma(), as well as the final ')'. - llvm::SmallVector<Token, 32> PragmaToks; + SmallVector<Token, 32> PragmaToks; int NumParens = 0; Lex(Tok); while (Tok.isNot(tok::eof)) { @@ -353,7 +353,7 @@ void Preprocessor::HandlePragmaDependency(Token &DependencyTok) { // Reserve a buffer to get the spelling. llvm::SmallString<128> FilenameBuffer; bool Invalid = false; - llvm::StringRef Filename = getSpelling(FilenameTok, FilenameBuffer, &Invalid); + StringRef Filename = getSpelling(FilenameTok, FilenameBuffer, &Invalid); if (Invalid) return; @@ -436,7 +436,7 @@ void Preprocessor::HandlePragmaComment(Token &Tok) { // String concatenation allows multiple strings, which can even come from // macro expansion. // "foo " "bar" "Baz" - llvm::SmallVector<Token, 4> StrToks; + SmallVector<Token, 4> StrToks; while (Tok.is(tok::string_literal)) { StrToks.push_back(Tok); Lex(Tok); @@ -512,7 +512,7 @@ void Preprocessor::HandlePragmaMessage(Token &Tok) { // String concatenation allows multiple strings, which can even come from // macro expansion. // "foo " "bar" "Baz" - llvm::SmallVector<Token, 4> StrToks; + SmallVector<Token, 4> StrToks; while (Tok.is(tok::string_literal)) { StrToks.push_back(Tok); Lex(Tok); @@ -528,7 +528,7 @@ void Preprocessor::HandlePragmaMessage(Token &Tok) { return; } - llvm::StringRef MessageString(Literal.GetString()); + StringRef MessageString(Literal.GetString()); if (ExpectClosingParen) { if (Tok.isNot(tok::r_paren)) { @@ -662,7 +662,7 @@ void Preprocessor::HandlePragmaPopMacro(Token &PopMacroTok) { /// AddPragmaHandler - Add the specified pragma handler to the preprocessor. /// If 'Namespace' is non-null, then it is a token required to exist on the /// pragma line before the pragma string starts, e.g. "STDC" or "GCC". -void Preprocessor::AddPragmaHandler(llvm::StringRef Namespace, +void Preprocessor::AddPragmaHandler(StringRef Namespace, PragmaHandler *Handler) { PragmaNamespace *InsertNS = PragmaHandlers; @@ -693,7 +693,7 @@ void Preprocessor::AddPragmaHandler(llvm::StringRef Namespace, /// preprocessor. If \arg Namespace is non-null, then it should be the /// namespace that \arg Handler was added to. It is an error to remove /// a handler that has not been registered. -void Preprocessor::RemovePragmaHandler(llvm::StringRef Namespace, +void Preprocessor::RemovePragmaHandler(StringRef Namespace, PragmaHandler *Handler) { PragmaNamespace *NS = PragmaHandlers; @@ -889,7 +889,7 @@ public: // String concatenation allows multiple strings, which can even come from // macro expansion. // "foo " "bar" "Baz" - llvm::SmallVector<Token, 4> StrToks; + SmallVector<Token, 4> StrToks; while (Tok.is(tok::string_literal)) { StrToks.push_back(Tok); PP.LexUnexpandedToken(Tok); @@ -910,7 +910,7 @@ public: return; } - llvm::StringRef WarningName(Literal.GetString()); + StringRef WarningName(Literal.GetString()); if (WarningName.size() < 3 || WarningName[0] != '-' || WarningName[1] != 'W') { diff --git a/lib/Lex/PreprocessingRecord.cpp b/lib/Lex/PreprocessingRecord.cpp index 6e2216ae86..55ae5dc233 100644 --- a/lib/Lex/PreprocessingRecord.cpp +++ b/lib/Lex/PreprocessingRecord.cpp @@ -24,7 +24,7 @@ ExternalPreprocessingRecordSource::~ExternalPreprocessingRecordSource() { } InclusionDirective::InclusionDirective(PreprocessingRecord &PPRec, InclusionKind Kind, - llvm::StringRef FileName, + StringRef FileName, bool InQuotes, const FileEntry *File, SourceRange Range) : PreprocessingDirective(InclusionDirectiveKind, Range), @@ -34,7 +34,7 @@ InclusionDirective::InclusionDirective(PreprocessingRecord &PPRec, = (char*)PPRec.Allocate(FileName.size() + 1, llvm::alignOf<char>()); memcpy(Memory, FileName.data(), FileName.size()); Memory[FileName.size()] = 0; - this->FileName = llvm::StringRef(Memory, FileName.size()); + this->FileName = StringRef(Memory, FileName.size()); } void PreprocessingRecord::MaybeLoadPreallocatedEntities() const { @@ -139,12 +139,12 @@ void PreprocessingRecord::MacroUndefined(const Token &Id, void PreprocessingRecord::InclusionDirective( SourceLocation HashLoc, const clang::Token &IncludeTok, - llvm::StringRef FileName, + StringRef FileName, bool IsAngled, const FileEntry *File, clang::SourceLocation EndLoc, - llvm::StringRef SearchPath, - llvm::StringRef RelativePath) { + StringRef SearchPath, + StringRef RelativePath) { InclusionDirective::InclusionKind Kind = InclusionDirective::Include; switch (IncludeTok.getIdentifierInfo()->getPPKeywordID()) { diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index e7aa286a16..fbdb903598 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -92,7 +92,7 @@ Preprocessor::Preprocessor(Diagnostic &diags, const LangOptions &opts, SetPoisonReason(Ident__VA_ARGS__,diag::ext_pp_bad_vaargs_use); // Initialize the pragma handlers. - PragmaHandlers = new PragmaNamespace(llvm::StringRef()); + PragmaHandlers = new PragmaNamespace(StringRef()); RegisterBuiltinPragmas(); // Initialize builtin macros like __LINE__ and friends. @@ -172,7 +172,7 @@ void Preprocessor::DumpToken(const Token &Tok, bool DumpFlags) const { llvm::errs() << " [ExpandDisabled]"; if (Tok.needsCleaning()) { const char *Start = SourceMgr.getCharacterData(Tok.getLocation()); - llvm::errs() << " [UnClean='" << llvm::StringRef(Start, Tok.getLength()) + llvm::errs() << " [UnClean='" << StringRef(Start, Tok.getLength()) << "']"; } @@ -279,7 +279,7 @@ bool Preprocessor::SetCodeCompletionPoint(const FileEntry *File, // Truncate the buffer. if (Position < Buffer->getBufferEnd()) { - llvm::StringRef Data(Buffer->getBufferStart(), + StringRef Data(Buffer->getBufferStart(), Position-Buffer->getBufferStart()); MemoryBuffer *TruncatedBuffer = MemoryBuffer::getMemBufferCopy(Data, Buffer->getBufferIdentifier()); @@ -305,8 +305,8 @@ void Preprocessor::CodeCompleteNaturalLanguage() { /// getSpelling - This method is used to get the spelling of a token into a /// SmallVector. Note that the returned StringRef may not point to the /// supplied buffer if a copy can be avoided. -llvm::StringRef Preprocessor::getSpelling(const Token &Tok, - llvm::SmallVectorImpl<char> &Buffer, +StringRef Preprocessor::getSpelling(const Token &Tok, + SmallVectorImpl<char> &Buffer, bool *Invalid) const { // NOTE: this has to be checked *before* testing for an IdentifierInfo. if (Tok.isNot(tok::raw_identifier)) { @@ -321,7 +321,7 @@ llvm::StringRef Preprocessor::getSpelling(const Token &Tok, const char *Ptr = Buffer.data(); unsigned Len = getSpelling(Tok, Ptr, Invalid); - return llvm::StringRef(Ptr, Len); + return StringRef(Ptr, Len); } /// CreateString - Plop the specified string into a scratch buffer and return a @@ -407,12 +407,12 @@ IdentifierInfo *Preprocessor::LookUpIdentifierInfo(Token &Identifier) const { IdentifierInfo *II; if (!Identifier.needsCleaning()) { // No cleaning needed, just use the characters from the lexed buffer. - II = getIdentifierInfo(llvm::StringRef(Identifier.getRawIdentifierData(), + II = getIdentifierInfo(StringRef(Identifier.getRawIdentifierData(), Identifier.getLength())); } else { // Cleaning needed, alloca a buffer, clean into it, then use the buffer. llvm::SmallString<64> IdentifierBuffer; - llvm::StringRef CleanedStr = getSpelling(Identifier, IdentifierBuffer); + StringRef CleanedStr = getSpelling(Identifier, IdentifierBuffer); II = getIdentifierInfo(CleanedStr); } diff --git a/lib/Lex/TokenLexer.cpp b/lib/Lex/TokenLexer.cpp index c3bf369fb1..aab72e0ef3 100644 --- a/lib/Lex/TokenLexer.cpp +++ b/lib/Lex/TokenLexer.cpp @@ -123,7 +123,7 @@ void TokenLexer::destroy() { void TokenLexer::ExpandFunctionArguments() { SourceManager &SM = PP.getSourceManager(); - llvm::SmallVector<Token, 128> ResultToks; + SmallVector<Token, 128> ResultToks; // Loop through 'Tokens', expanding them into ResultToks. Keep // track of whether we change anything. If not, no need to keep them. If so, diff --git a/lib/Parse/ParseAST.cpp b/lib/Parse/ParseAST.cpp index 56584c9618..5c2c2f785f 100644 --- a/lib/Parse/ParseAST.cpp +++ b/lib/Parse/ParseAST.cpp @@ -93,7 +93,7 @@ void clang::ParseAST(Sema &S, bool PrintStats) { Consumer->HandleTopLevelDecl(ADecl.get()); // Process any TopLevelDecls generated by #pragma weak. - for (llvm::SmallVector<Decl*,2>::iterator + for (SmallVector<Decl*,2>::iterator I = S.WeakTopLevelDecls().begin(), E = S.WeakTopLevelDecls().end(); I != E; ++I) Consumer->HandleTopLevelDecl(DeclGroupRef(*I)); diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 0e17295858..f946f798c7 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -832,7 +832,7 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS, return Actions.FinalizeDeclaratorGroup(getCurScope(), DS, &ThisDecl, 1); } - llvm::SmallVector<Decl *, 8> DeclsInGroup; + SmallVector<Decl *, 8> DeclsInGroup; Decl *FirstDecl = ParseDeclarationAfterDeclaratorAndAttributes(D); D.complete(FirstDecl); if (FirstDecl) @@ -2325,7 +2325,7 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, Diag(Tok, diag::ext_empty_struct_union) << (TagType == TST_union); - llvm::SmallVector<Decl *, 32> FieldDecls; + SmallVector<Decl *, 32> FieldDecls; // While we still have something to read, read the declarations in the struct. while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) { @@ -2347,10 +2347,10 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, struct CFieldCallback : FieldCallback { Parser &P; Decl *TagDecl; - llvm::SmallVectorImpl<Decl *> &FieldDecls; + SmallVectorImpl<Decl *> &FieldDecls; CFieldCallback(Parser &P, Decl *TagDecl, - llvm::SmallVectorImpl<Decl *> &FieldDecls) : + SmallVectorImpl<Decl *> &FieldDecls) : P(P), TagDecl(TagDecl), FieldDecls(FieldDecls) {} virtual Decl *invoke(FieldDeclarator &FD) { @@ -2378,7 +2378,7 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, SkipUntil(tok::semi, true); continue; } - llvm::SmallVector<Decl *, 16> Fields; + SmallVector<Decl *, 16> Fields; Actions.ActOnDefs(getCurScope(), TagDecl, Tok.getLocation(), Tok.getIdentifierInfo(), Fields); FieldDecls.insert(FieldDecls.end(), Fields.begin(), Fields.end()); @@ -2687,7 +2687,7 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, Decl *EnumDecl) { if (Tok.is(tok::r_brace) && !getLang().CPlusPlus) Diag(Tok, diag::error_empty_enum); - llvm::SmallVector<Decl *, 32> EnumConstantDecls; + SmallVector<Decl *, 32> EnumConstantDecls; Decl *LastEnumConstDecl = 0; @@ -3678,7 +3678,7 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D, // Otherwise, it is treated as a K&R-style function. bool HasProto = false; // Build up an array of information about the parsed arguments. - llvm::SmallVector<DeclaratorChunk::ParamInfo, 16> ParamInfo; + SmallVector<DeclaratorChunk::ParamInfo, 16> ParamInfo; // Remember where we see an ellipsis, if any. SourceLocation EllipsisLoc; @@ -3687,8 +3687,8 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D, SourceLocation RefQualifierLoc; ExceptionSpecificationType ESpecType = EST_None; SourceRange ESpecRange; - llvm::SmallVector<ParsedType, 2> DynamicExceptions; - llvm::SmallVector<SourceRange, 2> DynamicExceptionRanges; + SmallVector<ParsedType, 2> DynamicExceptions; + SmallVector<SourceRange, 2> DynamicExceptionRanges; ExprResult NoexceptExpr; ParsedType TrailingReturnType; @@ -3811,7 +3811,7 @@ bool Parser::isFunctionDeclaratorIdentifierList() { /// void Parser::ParseFunctionDeclaratorIdentifierList( Declarator &D, - llvm::SmallVector<DeclaratorChunk::ParamInfo, 16> &ParamInfo) { + SmallVector<DeclaratorChunk::ParamInfo, 16> &ParamInfo) { // If there was no identifier specified for the declarator, either we are in // an abstract-declarator, or we are in a parameter declarator which was found // to be abstract. In abstract-declarators, identifier lists are not valid: @@ -3890,7 +3890,7 @@ void Parser::ParseFunctionDeclaratorIdentifierList( void Parser::ParseParameterDeclarationClause( Declarator &D, ParsedAttributes &attrs, - llvm::SmallVector<DeclaratorChunk::ParamInfo, 16> &ParamInfo, + SmallVector<DeclaratorChunk::ParamInfo, 16> &ParamInfo, SourceLocation &EllipsisLoc) { while (1) { diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index 172049c340..0da743f2a9 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -262,7 +262,7 @@ Decl *Parser::ParseLinkage(ParsingDeclSpec &DS, unsigned Context) { assert(Tok.is(tok::string_literal) && "Not a string literal!"); llvm::SmallString<8> LangBuffer; bool Invalid = false; - llvm::StringRef Lang = PP.getSpelling(Tok, LangBuffer, &Invalid); + StringRef Lang = PP.getSpelling(Tok, LangBuffer, &Invalid); if (Invalid) return 0; @@ -1321,7 +1321,7 @@ void Parser::ParseBaseClause(Decl *ClassDecl) { ConsumeToken(); // Build up an array of parsed base specifiers. - llvm::SmallVector<CXXBaseSpecifier *, 8> BaseInfo; + SmallVector<CXXBaseSpecifier *, 8> BaseInfo; while (true) { // Parse a base-specifier. @@ -1791,7 +1791,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, // member-declarator // member-declarator-list ',' member-declarator - llvm::SmallVector<Decl *, 8> DeclsInGroup; + SmallVector<Decl *, 8> DeclsInGroup; ExprResult BitfieldSize; while (1) { @@ -2192,7 +2192,7 @@ void Parser::ParseConstructorInitializer(Decl *ConstructorDecl) { PoisonSEHIdentifiersRAIIObject PoisonSEHIdentifiers(*this, true); SourceLocation ColonLoc = ConsumeToken(); - llvm::SmallVector<CXXCtorInitializer*, 4> MemInitializers; + SmallVector<CXXCtorInitializer*, 4> MemInitializers; bool AnyErrors = false; do { @@ -2313,8 +2313,8 @@ Parser::MemInitResult Parser::ParseMemInitializer(Decl *ConstructorDecl) { /// 'noexcept' '(' constant-expression ')' ExceptionSpecificationType Parser::MaybeParseExceptionSpecification(SourceRange &SpecificationRange, - llvm::SmallVectorImpl<ParsedType> &DynamicExceptions, - llvm::SmallVectorImpl<SourceRange> &DynamicExceptionRanges, + SmallVectorImpl<ParsedType> &DynamicExceptions, + SmallVectorImpl<SourceRange> &DynamicExceptionRanges, ExprResult &NoexceptExpr) { ExceptionSpecificationType Result = EST_None; @@ -2386,8 +2386,8 @@ Parser::MaybeParseExceptionSpecification(SourceRange &SpecificationRange, /// ExceptionSpecificationType Parser::ParseDynamicExceptionSpecification( SourceRange &SpecificationRange, - llvm::SmallVectorImpl<ParsedType> &Exceptions, - llvm::SmallVectorImpl<SourceRange> &Ranges) { + SmallVectorImpl<ParsedType> &Exceptions, + SmallVectorImpl<SourceRange> &Ranges) { assert(Tok.is(tok::kw_throw) && "expected throw"); SpecificationRange.setBegin(ConsumeToken()); diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp index fc64ae0226..2799fedecd 100644 --- a/lib/Parse/ParseExpr.cpp +++ b/lib/Parse/ParseExpr.cpp @@ -1607,7 +1607,7 @@ ExprResult Parser::ParseBuiltinPrimaryExpression() { } // Keep track of the various subcomponents we see. - llvm::SmallVector<Sema::OffsetOfComponent, 4> Comps; + SmallVector<Sema::OffsetOfComponent, 4> Comps; Comps.push_back(Sema::OffsetOfComponent()); Comps.back().isBrackets = false; @@ -1978,7 +1978,7 @@ ExprResult Parser::ParseStringLiteralExpression() { // String concat. Note that keywords like __func__ and __FUNCTION__ are not // considered to be strings for concatenation purposes. - llvm::SmallVector<Token, 4> StringToks; + SmallVector<Token, 4> StringToks; do { StringToks.push_back(Tok); @@ -2104,8 +2104,8 @@ ExprResult Parser::ParseGenericSelectionExpression() { /// [C++0x] assignment-expression /// [C++0x] braced-init-list /// -bool Parser::ParseExpressionList(llvm::SmallVectorImpl<Expr*> &Exprs, - llvm::SmallVectorImpl<SourceLocation> &CommaLocs, +bool Parser::ParseExpressionList(SmallVectorImpl<Expr*> &Exprs, + SmallVectorImpl<SourceLocation> &CommaLocs, void (Sema::*Completer)(Scope *S, Expr *Data, Expr **Args, diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp index b32eeda242..d88356ca33 100644 --- a/lib/Parse/ParseExprCXX.cpp +++ b/lib/Parse/ParseExprCXX.cpp @@ -1885,7 +1885,7 @@ void Parser::ParseDirectNewDeclarator(Declarator &D) { /// '(' expression-list ')' /// bool Parser::ParseExpressionListOrTypeId( - llvm::SmallVectorImpl<Expr*> &PlacementArgs, + SmallVectorImpl<Expr*> &PlacementArgs, Declarator &D) { // The '(' was already consumed. if (isTypeIdInParens()) { diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 7641565d1c..ff9e20504b 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -71,8 +71,8 @@ Decl *Parser::ParseObjCAtDirectives() { /// Decl *Parser::ParseObjCAtClassDeclaration(SourceLocation atLoc) { ConsumeToken(); // the identifier "class" - llvm::SmallVector<IdentifierInfo *, 8> ClassNames; - llvm::SmallVector<SourceLocation, 8> ClassLocs; + SmallVector<IdentifierInfo *, 8> ClassNames; + SmallVector<SourceLocation, 8> ClassLocs; while (1) { @@ -177,8 +177,8 @@ Decl *Parser::ParseObjCAtInterfaceDeclaration(SourceLocation atLoc, rparenLoc = ConsumeParen(); // Next, we need to check for any protocol references. SourceLocation LAngleLoc, EndProtoLoc; - llvm::SmallVector<Decl *, 8> ProtocolRefs; - llvm::SmallVector<SourceLocation, 8> ProtocolLocs; + SmallVector<Decl *, 8> ProtocolRefs; + SmallVector<SourceLocation, 8> ProtocolLocs; if (Tok.is(tok::less) && ParseObjCProtocolReferences(ProtocolRefs, ProtocolLocs, true, LAngleLoc, EndProtoLoc)) @@ -223,8 +223,8 @@ Decl *Parser::ParseObjCAtInterfaceDeclaration(SourceLocation atLoc, superClassLoc = ConsumeToken(); } // Next, we need to check for any protocol references. - llvm::SmallVector<Decl *, 8> ProtocolRefs; - llvm::SmallVector<SourceLocation, 8> ProtocolLocs; + SmallVector<Decl *, 8> ProtocolRefs; + SmallVector<SourceLocation, 8> ProtocolLocs; SourceLocation LAngleLoc, EndProtoLoc; if (Tok.is(tok::less) && ParseObjCProtocolReferences(ProtocolRefs, ProtocolLocs, true, @@ -250,13 +250,13 @@ Decl *Parser::ParseObjCAtInterfaceDeclaration(SourceLocation atLoc, struct Parser::ObjCPropertyCallback : FieldCallback { Parser &P; Decl *IDecl; - llvm::SmallVectorImpl<Decl *> &Props; + SmallVectorImpl<Decl *> &Props; ObjCDeclSpec &OCDS; SourceLocation AtLoc; tok::ObjCKeywordKind MethodImplKind; ObjCPropertyCallback(Parser &P, Decl *IDecl, - llvm::SmallVectorImpl<Decl *> &Props, + SmallVectorImpl<Decl *> &Props, ObjCDeclSpec &OCDS, SourceLocation AtLoc, tok::ObjCKeywordKind MethodImplKind) : P(P), IDecl(IDecl), Props(Props), OCDS(OCDS), AtLoc(AtLoc), @@ -316,9 +316,9 @@ struct Parser::ObjCPropertyCallback : FieldCallback { /// void Parser::ParseObjCInterfaceDeclList(Decl *interfaceDecl, tok::ObjCKeywordKind contextKey) { - llvm::SmallVector<Decl *, 32> allMethods; - llvm::SmallVector<Decl *, 16> allProperties; - llvm::SmallVector<DeclGroupPtrTy, 8> allTUVariables; + SmallVector<Decl *, 32> allMethods; + SmallVector<Decl *, 16> allProperties; + SmallVector<DeclGroupPtrTy, 8> allTUVariables; tok::ObjCKeywordKind MethodImplKind = tok::objc_not_keyword; SourceRange AtEnd; @@ -876,7 +876,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, return 0; } - llvm::SmallVector<DeclaratorChunk::ParamInfo, 8> CParamInfo; + SmallVector<DeclaratorChunk::ParamInfo, 8> CParamInfo; if (Tok.isNot(tok::colon)) { // If attributes exist after the method, parse them. if (getLang().ObjC2) @@ -894,8 +894,8 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, return Result; } - llvm::SmallVector<IdentifierInfo *, 12> KeyIdents; - llvm::SmallVector<Sema::ObjCArgInfo, 12> ArgInfos; + SmallVector<IdentifierInfo *, 12> KeyIdents; + SmallVector<Sema::ObjCArgInfo, 12> ArgInfos; ParseScope PrototypeScope(this, Scope::FunctionPrototypeScope|Scope::DeclScope); @@ -1027,15 +1027,15 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, /// '<' identifier-list '>' /// bool Parser:: -ParseObjCProtocolReferences(llvm::SmallVectorImpl<Decl *> &Protocols, - llvm::SmallVectorImpl<SourceLocation> &ProtocolLocs, +ParseObjCProtocolReferences(SmallVectorImpl<Decl *> &Protocols, + SmallVectorImpl<SourceLocation> &ProtocolLocs, bool WarnOnDeclarations, SourceLocation &LAngleLoc, SourceLocation &EndLoc) { assert(Tok.is(tok::less) && "expected <"); LAngleLoc = ConsumeToken(); // the "<" - llvm::SmallVector<IdentifierLocPair, 8> ProtocolIdents; + SmallVector<IdentifierLocPair, 8> ProtocolIdents; while (1) { if (Tok.is(tok::code_completion)) { @@ -1080,8 +1080,8 @@ bool Parser::ParseObjCProtocolQualifiers(DeclSpec &DS) { assert(Tok.is(tok::less) && "Protocol qualifiers start with '<'"); assert(getLang().ObjC1 && "Protocol qualifiers only exist in Objective-C"); SourceLocation LAngleLoc, EndProtoLoc; - llvm::SmallVector<Decl *, 8> ProtocolDecl; - llvm::SmallVector<SourceLocation, 8> ProtocolLocs; + SmallVector<Decl *, 8> ProtocolDecl; + SmallVector<SourceLocation, 8> ProtocolLocs; bool Result = ParseObjCProtocolReferences(ProtocolDecl, ProtocolLocs, false, LAngleLoc, EndProtoLoc); DS.setProtocolQualifiers(ProtocolDecl.data(), ProtocolDecl.size(), @@ -1116,7 +1116,7 @@ void Parser::ParseObjCClassInstanceVariables(Decl *interfaceDecl, tok::ObjCKeywordKind visibility, SourceLocation atLoc) { assert(Tok.is(tok::l_brace) && "expected {"); - llvm::SmallVector<Decl *, 32> AllIvarDecls; + SmallVector<Decl *, 32> AllIvarDecls; ParseScope ClassScope(this, Scope::DeclScope|Scope::ClassScope); @@ -1167,10 +1167,10 @@ void Parser::ParseObjCClassInstanceVariables(Decl *interfaceDecl, Parser &P; Decl *IDecl; tok::ObjCKeywordKind visibility; - llvm::SmallVectorImpl<Decl *> &AllIvarDecls; + SmallVectorImpl<Decl *> &AllIvarDecls; ObjCIvarCallback(Parser &P, Decl *IDecl, tok::ObjCKeywordKind V, - llvm::SmallVectorImpl<Decl *> &AllIvarDecls) : + SmallVectorImpl<Decl *> &AllIvarDecls) : P(P), IDecl(IDecl), visibility(V), AllIvarDecls(AllIvarDecls) { } @@ -1251,7 +1251,7 @@ Decl *Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc, } if (Tok.is(tok::comma)) { // list of forward declarations. - llvm::SmallVector<IdentifierLocPair, 8> ProtocolRefs; + SmallVector<IdentifierLocPair, 8> ProtocolRefs; ProtocolRefs.push_back(std::make_pair(protocolName, nameLoc)); // Parse the list of forward declarations. @@ -1282,8 +1282,8 @@ Decl *Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc, // Last, and definitely not least, parse a protocol declaration. SourceLocation LAngleLoc, EndProtoLoc; - llvm::SmallVector<Decl *, 8> ProtocolRefs; - llvm::SmallVector<SourceLocation, 8> ProtocolLocs; + SmallVector<Decl *, 8> ProtocolRefs; + SmallVector<SourceLocation, 8> ProtocolLocs; if (Tok.is(tok::less) && ParseObjCProtocolReferences(ProtocolRefs, ProtocolLocs, false, LAngleLoc, EndProtoLoc)) @@ -2125,7 +2125,7 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc, SourceLocation SelectorLoc = Loc; - llvm::SmallVector<IdentifierInfo *, 12> KeyIdents; + SmallVector<IdentifierInfo *, 12> KeyIdents; ExprVector KeyExprs(Actions); if (Tok.is(tok::colon)) { @@ -2278,7 +2278,7 @@ ExprResult Parser::ParseObjCStringLiteral(SourceLocation AtLoc) { // @"foo" @"bar" is a valid concatenated string. Eat any subsequent string // expressions. At this point, we know that the only valid thing that starts // with '@' is an @"". - llvm::SmallVector<SourceLocation, 4> AtLocs; + SmallVector<SourceLocation, 4> AtLocs; ExprVector AtStrings(Actions); AtLocs.push_back(AtLoc); AtStrings.push_back(Res.release()); @@ -2356,7 +2356,7 @@ ExprResult Parser::ParseObjCSelectorExpression(SourceLocation AtLoc) { if (Tok.isNot(tok::l_paren)) return ExprError(Diag(Tok, diag::err_expected_lparen_after) << "@selector"); - llvm::SmallVector<IdentifierInfo *, 12> KeyIdents; + SmallVector<IdentifierInfo *, 12> KeyIdents; SourceLocation LParenLoc = ConsumeParen(); SourceLocation sLoc; diff --git a/lib/Parse/ParsePragma.cpp b/lib/Parse/ParsePragma.cpp index 445a72465c..16a731b09e 100644 --- a/lib/Parse/ParsePragma.cpp +++ b/lib/Parse/ParsePragma.cpp @@ -297,7 +297,7 @@ void PragmaUnusedHandler::HandlePragma(Preprocessor &PP, } // Lex the declaration reference(s). - llvm::SmallVector<Token, 5> Identifiers; + SmallVector<Token, 5> Identifiers; SourceLocation RParenLoc; bool LexID = true; diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index b91bca55a9..8b325dab9c 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -715,7 +715,7 @@ StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) { SourceLocation LabelLoc = ConsumeToken(); Diag(LabelLoc, diag::ext_gnu_local_label); - llvm::SmallVector<Decl *, 8> DeclsInGroup; + SmallVector<Decl *, 8> DeclsInGroup; while (1) { if (Tok.isNot(tok::identifier)) { Diag(Tok, diag::err_expected_ident); @@ -1649,7 +1649,7 @@ StmtResult Parser::ParseAsmStatement(bool &msAsm) { if (AsmString.isInvalid()) return StmtError(); - llvm::SmallVector<IdentifierInfo *, 4> Names; + SmallVector<IdentifierInfo *, 4> Names; ExprVector Constraints(Actions); ExprVector Exprs(Actions); ExprVector Clobbers(Actions); @@ -1742,9 +1742,9 @@ StmtResult Parser::ParseAsmStatement(bool &msAsm) { /// // // FIXME: Avoid unnecessary std::string trashing. -bool Parser::ParseAsmOperandsOpt(llvm::SmallVectorImpl<IdentifierInfo *> &Names, - llvm::SmallVectorImpl<ExprTy *> &Constraints, - llvm::SmallVectorImpl<ExprTy *> &Exprs) { +bool Parser::ParseAsmOperandsOpt(SmallVectorImpl<IdentifierInfo *> &Names, + SmallVectorImpl<ExprTy *> &Constraints, + SmallVectorImpl<ExprTy *> &Exprs) { // 'asm-operands' isn't present? if (!isTokenStringLiteral() && Tok.isNot(tok::l_square)) return false; diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp index 9eab40a3ec..05fabebed2 100644 --- a/lib/Parse/ParseTemplate.cpp +++ b/lib/Parse/ParseTemplate.cpp @@ -129,7 +129,7 @@ Parser::ParseTemplateDeclarationOrSpecialization(unsigned Context, // Parse the '<' template-parameter-list '>' SourceLocation LAngleLoc, RAngleLoc; - llvm::SmallVector<Decl*, 4> TemplateParams; + SmallVector<Decl*, 4> TemplateParams; if (ParseTemplateParameters(Depth, TemplateParams, LAngleLoc, RAngleLoc)) { // Skip until the semi-colon or a }. @@ -289,7 +289,7 @@ Parser::ParseSingleDeclarationAfterTemplate( /// /// \returns true if an error occurred, false otherwise. bool Parser::ParseTemplateParameters(unsigned Depth, - llvm::SmallVectorImpl<Decl*> &TemplateParams, + SmallVectorImpl<Decl*> &TemplateParams, SourceLocation &LAngleLoc, SourceLocation &RAngleLoc) { // Get the template parameter list. @@ -322,7 +322,7 @@ bool Parser::ParseTemplateParameters(unsigned Depth, /// template-parameter-list ',' template-parameter bool Parser::ParseTemplateParameterList(unsigned Depth, - llvm::SmallVectorImpl<Decl*> &TemplateParams) { + SmallVectorImpl<Decl*> &TemplateParams) { while (1) { if (Decl *TmpParam = ParseTemplateParameter(Depth, TemplateParams.size())) { @@ -516,7 +516,7 @@ Parser::ParseTemplateTemplateParameter(unsigned Depth, unsigned Position) { // Handle the template <...> part. SourceLocation TemplateLoc = ConsumeToken(); - llvm::SmallVector<Decl*,8> TemplateParams; + SmallVector<Decl*,8> TemplateParams; SourceLocation LAngleLoc, RAngleLoc; { ParseScope TemplateParmScope(this, Scope::TemplateParamScope); diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index 5c502907bc..9dc867c92b 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -72,7 +72,7 @@ Parser::Parser(Preprocessor &pp, Sema &actions) /// If a crash happens while the parser is active, print out a line indicating /// what the current token is. -void PrettyStackTraceParserEntry::print(llvm::raw_ostream &OS) const { +void PrettyStackTraceParserEntry::print(raw_ostream &OS) const { const Token &Tok = P.getCurToken(); if (Tok.is(tok::eof)) { OS << "<eof> parser at end of file\n"; diff --git a/lib/Rewrite/DeltaTree.cpp b/lib/Rewrite/DeltaTree.cpp index 085dfd89ef..4297dc8de6 100644 --- a/lib/Rewrite/DeltaTree.cpp +++ b/lib/Rewrite/DeltaTree.cpp @@ -12,12 +12,10 @@ //===----------------------------------------------------------------------===// #include "clang/Rewrite/DeltaTree.h" -#include "llvm/Support/Casting.h" +#include "clang/Basic/LLVM.h" #include <cstring> #include <cstdio> using namespace clang; -using llvm::cast; -using llvm::dyn_cast; /// The DeltaTree class is a multiway search tree (BTree) structure with some /// fancy features. B-Trees are generally more memory and cache efficient diff --git a/lib/Rewrite/FixItRewriter.cpp b/lib/Rewrite/FixItRewriter.cpp index e50793e277..706b6eafd3 100644 --- a/lib/Rewrite/FixItRewriter.cpp +++ b/lib/Rewrite/FixItRewriter.cpp @@ -41,7 +41,7 @@ FixItRewriter::~FixItRewriter() { Diags.setClient(Client); } -bool FixItRewriter::WriteFixedFile(FileID ID, llvm::raw_ostream &OS) { +bool FixItRewriter::WriteFixedFile(FileID ID, raw_ostream &OS) { const RewriteBuffer *RewriteBuf = Rewrite.getRewriteBufferFor(ID); if (!RewriteBuf) return true; RewriteBuf->write(OS); diff --git a/lib/Rewrite/FrontendActions.cpp b/lib/Rewrite/FrontendActions.cpp index 33e79edaf9..f00e7fd9c9 100644 --- a/lib/Rewrite/FrontendActions.cpp +++ b/lib/Rewrite/FrontendActions.cpp @@ -28,8 +28,8 @@ using namespace clang; //===----------------------------------------------------------------------===// ASTConsumer *HTMLPrintAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { - if (llvm::raw_ostream *OS = CI.createDefaultOutputFile(false, InFile)) + StringRef InFile) { + if (raw_ostream *OS = CI.createDefaultOutputFile(false, InFile)) return CreateHTMLPrinter(OS, CI.getPreprocessor()); return 0; } @@ -38,7 +38,7 @@ FixItAction::FixItAction() {} FixItAction::~FixItAction() {} ASTConsumer *FixItAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { return new ASTConsumer(); } @@ -67,7 +67,7 @@ public: } // end anonymous namespace bool FixItAction::BeginSourceFileAction(CompilerInstance &CI, - llvm::StringRef Filename) { + StringRef Filename) { const FrontendOptions &FEOpts = getCompilerInstance().getFrontendOpts(); if (!FEOpts.FixItSuffix.empty()) { FixItOpts.reset(new FixItActionSuffixInserter(FEOpts.FixItSuffix, @@ -91,8 +91,8 @@ void FixItAction::EndSourceFileAction() { //===----------------------------------------------------------------------===// ASTConsumer *RewriteObjCAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { - if (llvm::raw_ostream *OS = CI.createDefaultOutputFile(false, InFile, "cpp")) + StringRef InFile) { + if (raw_ostream *OS = CI.createDefaultOutputFile(false, InFile, "cpp")) return CreateObjCRewriter(InFile, OS, CI.getDiagnostics(), CI.getLangOpts(), CI.getDiagnosticOpts().NoRewriteMacros); @@ -101,7 +101,7 @@ ASTConsumer *RewriteObjCAction::CreateASTConsumer(CompilerInstance &CI, void RewriteMacrosAction::ExecuteAction() { CompilerInstance &CI = getCompilerInstance(); - llvm::raw_ostream *OS = CI.createDefaultOutputFile(true, getCurrentFile()); + raw_ostream *OS = CI.createDefaultOutputFile(true, getCurrentFile()); if (!OS) return; RewriteMacrosInInput(CI.getPreprocessor(), OS); @@ -109,7 +109,7 @@ void RewriteMacrosAction::ExecuteAction() { void RewriteTestAction::ExecuteAction() { CompilerInstance &CI = getCompilerInstance(); - llvm::raw_ostream *OS = CI.createDefaultOutputFile(false, getCurrentFile()); + raw_ostream *OS = CI.createDefaultOutputFile(false, getCurrentFile()); if (!OS) return; DoRewriteTest(CI.getPreprocessor(), OS); diff --git a/lib/Rewrite/HTMLPrint.cpp b/lib/Rewrite/HTMLPrint.cpp index f66bfcb2df..6a89265ef2 100644 --- a/lib/Rewrite/HTMLPrint.cpp +++ b/lib/Rewrite/HTMLPrint.cpp @@ -32,12 +32,12 @@ using namespace clang; namespace { class HTMLPrinter : public ASTConsumer { Rewriter R; - llvm::raw_ostream *Out; + raw_ostream *Out; Preprocessor &PP; bool SyntaxHighlight, HighlightMacros; public: - HTMLPrinter(llvm::raw_ostream *OS, Preprocessor &pp, + HTMLPrinter(raw_ostream *OS, Preprocessor &pp, bool _SyntaxHighlight, bool _HighlightMacros) : Out(OS), PP(pp), SyntaxHighlight(_SyntaxHighlight), HighlightMacros(_HighlightMacros) {} @@ -47,7 +47,7 @@ namespace { }; } -ASTConsumer* clang::CreateHTMLPrinter(llvm::raw_ostream *OS, +ASTConsumer* clang::CreateHTMLPrinter(raw_ostream *OS, Preprocessor &PP, bool SyntaxHighlight, bool HighlightMacros) { diff --git a/lib/Rewrite/HTMLRewrite.cpp b/lib/Rewrite/HTMLRewrite.cpp index 0b54755dc5..be75f973a7 100644 --- a/lib/Rewrite/HTMLRewrite.cpp +++ b/lib/Rewrite/HTMLRewrite.cpp @@ -140,10 +140,10 @@ void html::EscapeText(Rewriter &R, FileID FID, unsigned NumSpaces = 8-(ColNo&7); if (EscapeSpaces) RB.ReplaceText(FilePos, 1, - llvm::StringRef(" " + StringRef(" " " ", 6*NumSpaces)); else - RB.ReplaceText(FilePos, 1, llvm::StringRef(" ", NumSpaces)); + RB.ReplaceText(FilePos, 1, StringRef(" ", NumSpaces)); ColNo += NumSpaces; break; } diff --git a/lib/Rewrite/RewriteMacros.cpp b/lib/Rewrite/RewriteMacros.cpp index 0453098a56..d1dda91ad0 100644 --- a/lib/Rewrite/RewriteMacros.cpp +++ b/lib/Rewrite/RewriteMacros.cpp @@ -87,7 +87,7 @@ static void LexRawTokensFromMainFile(Preprocessor &PP, /// RewriteMacrosInInput - Implement -rewrite-macros mode. -void clang::RewriteMacrosInInput(Preprocessor &PP, llvm::raw_ostream *OS) { +void clang::RewriteMacrosInInput(Preprocessor &PP, raw_ostream *OS) { SourceManager &SM = PP.getSourceManager(); Rewriter Rewrite; diff --git a/lib/Rewrite/RewriteObjC.cpp b/lib/Rewrite/RewriteObjC.cpp index 8202164ebc..524d78e9ce 100644 --- a/lib/Rewrite/RewriteObjC.cpp +++ b/lib/Rewrite/RewriteObjC.cpp @@ -67,14 +67,14 @@ namespace { const char *MainFileStart, *MainFileEnd; SourceLocation LastIncLoc; - llvm::SmallVector<ObjCImplementationDecl *, 8> ClassImplementation; - llvm::SmallVector<ObjCCategoryImplDecl *, 8> CategoryImplementation; + SmallVector<ObjCImplementationDecl *, 8> ClassImplementation; + SmallVector<ObjCCategoryImplDecl *, 8> CategoryImplementation; llvm::SmallPtrSet<ObjCInterfaceDecl*, 8> ObjCSynthesizedStructs; llvm::SmallPtrSet<ObjCProtocolDecl*, 8> ObjCSynthesizedProtocols; llvm::SmallPtrSet<ObjCInterfaceDecl*, 8> ObjCForwardDecls; llvm::DenseMap<ObjCMethodDecl*, std::string> MethodInternalNames; - llvm::SmallVector<Stmt *, 32> Stmts; - llvm::SmallVector<int, 8> ObjCBcLabelNo; + SmallVector<Stmt *, 32> Stmts; + SmallVector<int, 8> ObjCBcLabelNo; // Remember all the @protocol(<expr>) expressions. llvm::SmallPtrSet<ObjCProtocolDecl *, 32> ProtocolExprDecls; @@ -113,7 +113,7 @@ namespace { bool IsHeader; std::string InFileName; - llvm::raw_ostream* OutFile; + raw_ostream* OutFile; bool SilenceRewriteMacroWarning; bool objc_impl_method; @@ -121,16 +121,16 @@ namespace { std::string Preamble; // Block expressions. - llvm::SmallVector<BlockExpr *, 32> Blocks; - llvm::SmallVector<int, 32> InnerDeclRefsCount; - llvm::SmallVector<BlockDeclRefExpr *, 32> InnerDeclRefs; + SmallVector<BlockExpr *, 32> Blocks; + SmallVector<int, 32> InnerDeclRefsCount; + SmallVector<BlockDeclRefExpr *, 32> InnerDeclRefs; - llvm::SmallVector<BlockDeclRefExpr *, 32> BlockDeclRefs; + SmallVector<BlockDeclRefExpr *, 32> BlockDeclRefs; // Block related declarations. - llvm::SmallVector<ValueDecl *, 8> BlockByCopyDecls; + SmallVector<ValueDecl *, 8> BlockByCopyDecls; llvm::SmallPtrSet<ValueDecl *, 8> BlockByCopyDeclsPtrSet; - llvm::SmallVector<ValueDecl *, 8> BlockByRefDecls; + SmallVector<ValueDecl *, 8> BlockByRefDecls; llvm::SmallPtrSet<ValueDecl *, 8> BlockByRefDeclsPtrSet; llvm::DenseMap<ValueDecl *, unsigned> BlockByRefDeclNo; llvm::SmallPtrSet<ValueDecl *, 8> ImportedBlockDecls; @@ -166,7 +166,7 @@ namespace { } void HandleTopLevelSingleDecl(Decl *D); void HandleDeclInMainFile(Decl *D); - RewriteObjC(std::string inFile, llvm::raw_ostream *OS, + RewriteObjC(std::string inFile, raw_ostream *OS, Diagnostic &D, const LangOptions &LOpts, bool silenceMacroWarn); @@ -219,7 +219,7 @@ namespace { << Old->getSourceRange(); } - void InsertText(SourceLocation Loc, llvm::StringRef Str, + void InsertText(SourceLocation Loc, StringRef Str, bool InsertAfter = true) { // If insertion succeeded or warning disabled return with no warning. if (!Rewrite.InsertText(Loc, Str, InsertAfter) || @@ -230,7 +230,7 @@ namespace { } void ReplaceText(SourceLocation Start, unsigned OrigLength, - llvm::StringRef Str) { + StringRef Str) { // If removal succeeded or warning disabled return with no warning. if (!Rewrite.ReplaceText(Start, OrigLength, Str) || SilenceRewriteMacroWarning) @@ -332,17 +332,17 @@ namespace { void RewriteObjCMethodsMetaData(MethodIterator MethodBegin, MethodIterator MethodEnd, bool IsInstanceMethod, - llvm::StringRef prefix, - llvm::StringRef ClassName, + StringRef prefix, + StringRef ClassName, std::string &Result); void RewriteObjCProtocolMetaData(ObjCProtocolDecl *Protocol, - llvm::StringRef prefix, - llvm::StringRef ClassName, + StringRef prefix, + StringRef ClassName, std::string &Result); void RewriteObjCProtocolListMetaData(const ObjCList<ObjCProtocolDecl> &Prots, - llvm::StringRef prefix, - llvm::StringRef ClassName, + StringRef prefix, + StringRef ClassName, std::string &Result); void SynthesizeObjCInternalStruct(ObjCInterfaceDecl *CDecl, std::string &Result); @@ -367,24 +367,24 @@ namespace { void RewriteBlockPointerFunctionArgs(FunctionDecl *FD); std::string SynthesizeBlockHelperFuncs(BlockExpr *CE, int i, - llvm::StringRef funcName, std::string Tag); + StringRef funcName, std::string Tag); std::string SynthesizeBlockFunc(BlockExpr *CE, int i, - llvm::StringRef funcName, std::string Tag); + StringRef funcName, std::string Tag); std::string SynthesizeBlockImpl(BlockExpr *CE, std::string Tag, std::string Desc); std::string SynthesizeBlockDescriptor(std::string DescTag, std::string ImplTag, - int i, llvm::StringRef funcName, + int i, StringRef funcName, unsigned hasCopy); Stmt *SynthesizeBlockCall(CallExpr *Exp, const Expr* BlockExp); void SynthesizeBlockLiterals(SourceLocation FunLocStart, - llvm::StringRef FunName); + StringRef FunName); void RewriteRecordBody(RecordDecl *RD); void CollectBlockDeclRefInfo(BlockExpr *Exp); void GetBlockDeclRefExprs(Stmt *S); void GetInnerBlockDeclRefExprs(Stmt *S, - llvm::SmallVector<BlockDeclRefExpr *, 8> &InnerBlockDeclRefs, + SmallVector<BlockDeclRefExpr *, 8> &InnerBlockDeclRefs, llvm::SmallPtrSet<const DeclContext *, 8> &InnerContexts); // We avoid calling Type::isBlockPointerType(), since it operates on the @@ -439,9 +439,9 @@ namespace { const char *&RParen); void RewriteCastExpr(CStyleCastExpr *CE); - FunctionDecl *SynthBlockInitFunctionDecl(llvm::StringRef name); + FunctionDecl *SynthBlockInitFunctionDecl(StringRef name); Stmt *SynthBlockInitExpr(BlockExpr *Exp, - const llvm::SmallVector<BlockDeclRefExpr *, 8> &InnerBlockDeclRefs); + const SmallVector<BlockDeclRefExpr *, 8> &InnerBlockDeclRefs); void QuoteDoublequotes(std::string &From, std::string &To) { for (unsigned i = 0; i < From.length(); i++) { @@ -505,7 +505,7 @@ static bool IsHeaderFile(const std::string &Filename) { return Ext == "h" || Ext == "hh" || Ext == "H"; } -RewriteObjC::RewriteObjC(std::string inFile, llvm::raw_ostream* OS, +RewriteObjC::RewriteObjC(std::string inFile, raw_ostream* OS, Diagnostic &D, const LangOptions &LOpts, bool silenceMacroWarn) : Diags(D), LangOpts(LOpts), InFileName(inFile), OutFile(OS), @@ -519,7 +519,7 @@ RewriteObjC::RewriteObjC(std::string inFile, llvm::raw_ostream* OS, } ASTConsumer *clang::CreateObjCRewriter(const std::string& InFile, - llvm::raw_ostream* OS, + raw_ostream* OS, Diagnostic &Diags, const LangOptions &LOpts, bool SilenceRewriteMacroWarning) { @@ -731,7 +731,7 @@ void RewriteObjC::HandleTopLevelSingleDecl(Decl *D) { void RewriteObjC::RewriteInclude() { SourceLocation LocStart = SM->getLocForStartOfFile(MainFileID); - llvm::StringRef MainBuf = SM->getBufferData(MainFileID); + StringRef MainBuf = SM->getBufferData(MainFileID); const char *MainBufStart = MainBuf.begin(); const char *MainBufEnd = MainBuf.end(); size_t ImportLen = strlen("import"); @@ -1265,7 +1265,7 @@ Stmt *RewriteObjC::RewritePropertyOrImplicitSetter(BinaryOperator *BinOp, Expr * } assert(OMD && "RewritePropertyOrImplicitSetter - null OMD"); - llvm::SmallVector<Expr *, 1> ExprVec; + SmallVector<Expr *, 1> ExprVec; ExprVec.push_back(newStmt); ObjCMessageExpr *MsgExpr; @@ -1611,7 +1611,7 @@ Stmt *RewriteObjC::RewriteObjCForCollectionStmt(ObjCForCollectionStmt *S, SourceLocation startLoc = S->getLocStart(); const char *startBuf = SM->getCharacterData(startLoc); - llvm::StringRef elementName; + StringRef elementName; std::string elementTypeAsString; std::string buf; buf = "\n{\n\t"; @@ -2125,7 +2125,7 @@ Stmt *RewriteObjC::RewriteAtSelector(ObjCSelectorExpr *Exp) { SynthSelGetUidFunctionDecl(); assert(SelGetUidFunctionDecl && "Can't find sel_registerName() decl"); // Create a call to sel_registerName("selName"). - llvm::SmallVector<Expr*, 8> SelExprs; + SmallVector<Expr*, 8> SelExprs; QualType argType = Context->getPointerType(Context->CharTy); SelExprs.push_back(StringLiteral::Create(*Context, Exp->getSelector().getAsString(), @@ -2357,7 +2357,7 @@ void RewriteObjC::RewriteTypeOfDecl(VarDecl *ND) { // SynthSelGetUidFunctionDecl - SEL sel_registerName(const char *str); void RewriteObjC::SynthSelGetUidFunctionDecl() { IdentifierInfo *SelGetUidIdent = &Context->Idents.get("sel_registerName"); - llvm::SmallVector<QualType, 16> ArgTys; + SmallVector<QualType, 16> ArgTys; ArgTys.push_back(Context->getPointerType(Context->CharTy.withConst())); QualType getFuncType = getSimpleFunctionType(Context->getObjCSelType(), &ArgTys[0], ArgTys.size()); @@ -2451,7 +2451,7 @@ void RewriteObjC::SynthSuperContructorFunctionDecl() { if (SuperContructorFunctionDecl) return; IdentifierInfo *msgSendIdent = &Context->Idents.get("__rw_objc_super"); - llvm::SmallVector<QualType, 16> ArgTys; + SmallVector<QualType, 16> ArgTys; QualType argT = Context->getObjCIdType(); assert(!argT.isNull() && "Can't find 'id' type"); ArgTys.push_back(argT); @@ -2469,7 +2469,7 @@ void RewriteObjC::SynthSuperContructorFunctionDecl() { // SynthMsgSendFunctionDecl - id objc_msgSend(id self, SEL op, ...); void RewriteObjC::SynthMsgSendFunctionDecl() { IdentifierInfo *msgSendIdent = &Context->Idents.get("objc_msgSend"); - llvm::SmallVector<QualType, 16> ArgTys; + SmallVector<QualType, 16> ArgTys; QualType argT = Context->getObjCIdType(); assert(!argT.isNull() && "Can't find 'id' type"); ArgTys.push_back(argT); @@ -2490,7 +2490,7 @@ void RewriteObjC::SynthMsgSendFunctionDecl() { // SynthMsgSendSuperFunctionDecl - id objc_msgSendSuper(struct objc_super *, SEL op, ...); void RewriteObjC::SynthMsgSendSuperFunctionDecl() { IdentifierInfo *msgSendIdent = &Context->Idents.get("objc_msgSendSuper"); - llvm::SmallVector<QualType, 16> ArgTys; + SmallVector<QualType, 16> ArgTys; RecordDecl *RD = RecordDecl::Create(*Context, TTK_Struct, TUDecl, SourceLocation(), SourceLocation(), &Context->Idents.get("objc_super")); @@ -2514,7 +2514,7 @@ void RewriteObjC::SynthMsgSendSuperFunctionDecl() { // SynthMsgSendStretFunctionDecl - id objc_msgSend_stret(id self, SEL op, ...); void RewriteObjC::SynthMsgSendStretFunctionDecl() { IdentifierInfo *msgSendIdent = &Context->Idents.get("objc_msgSend_stret"); - llvm::SmallVector<QualType, 16> ArgTys; + SmallVector<QualType, 16> ArgTys; QualType argT = Context->getObjCIdType(); assert(!argT.isNull() && "Can't find 'id' type"); ArgTys.push_back(argT); @@ -2537,7 +2537,7 @@ void RewriteObjC::SynthMsgSendStretFunctionDecl() { void RewriteObjC::SynthMsgSendSuperStretFunctionDecl() { IdentifierInfo *msgSendIdent = &Context->Idents.get("objc_msgSendSuper_stret"); - llvm::SmallVector<QualType, 16> ArgTys; + SmallVector<QualType, 16> ArgTys; RecordDecl *RD = RecordDecl::Create(*Context, TTK_Struct, TUDecl, SourceLocation(), SourceLocation(), &Context->Idents.get("objc_super")); @@ -2561,7 +2561,7 @@ void RewriteObjC::SynthMsgSendSuperStretFunctionDecl() { // SynthMsgSendFpretFunctionDecl - double objc_msgSend_fpret(id self, SEL op, ...); void RewriteObjC::SynthMsgSendFpretFunctionDecl() { IdentifierInfo *msgSendIdent = &Context->Idents.get("objc_msgSend_fpret"); - llvm::SmallVector<QualType, 16> ArgTys; + SmallVector<QualType, 16> ArgTys; QualType argT = Context->getObjCIdType(); assert(!argT.isNull() && "Can't find 'id' type"); ArgTys.push_back(argT); @@ -2582,7 +2582,7 @@ void RewriteObjC::SynthMsgSendFpretFunctionDecl() { // SynthGetClassFunctionDecl - id objc_getClass(const char *name); void RewriteObjC::SynthGetClassFunctionDecl() { IdentifierInfo *getClassIdent = &Context->Idents.get("objc_getClass"); - llvm::SmallVector<QualType, 16> ArgTys; + SmallVector<QualType, 16> ArgTys; ArgTys.push_back(Context->getPointerType(Context->CharTy.withConst())); QualType getClassType = getSimpleFunctionType(Context->getObjCIdType(), &ArgTys[0], ArgTys.size()); @@ -2598,7 +2598,7 @@ void RewriteObjC::SynthGetClassFunctionDecl() { void RewriteObjC::SynthGetSuperClassFunctionDecl() { IdentifierInfo *getSuperClassIdent = &Context->Idents.get("class_getSuperclass"); - llvm::SmallVector<QualType, 16> ArgTys; + SmallVector<QualType, 16> ArgTys; ArgTys.push_back(Context->getObjCClassType()); QualType getClassType = getSimpleFunctionType(Context->getObjCClassType(), &ArgTys[0], ArgTys.size()); @@ -2615,7 +2615,7 @@ void RewriteObjC::SynthGetSuperClassFunctionDecl() { // SynthGetMetaClassFunctionDecl - id objc_getClass(const char *name); void RewriteObjC::SynthGetMetaClassFunctionDecl() { IdentifierInfo *getClassIdent = &Context->Idents.get("objc_getMetaClass"); - llvm::SmallVector<QualType, 16> ArgTys; + SmallVector<QualType, 16> ArgTys; ArgTys.push_back(Context->getPointerType(Context->CharTy.withConst())); QualType getClassType = getSimpleFunctionType(Context->getObjCIdType(), &ArgTys[0], ArgTys.size()); @@ -2770,7 +2770,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp, } // Synthesize a call to objc_msgSend(). - llvm::SmallVector<Expr*, 8> MsgExprs; + SmallVector<Expr*, 8> MsgExprs; switch (Exp->getReceiverKind()) { case ObjCMessageExpr::SuperClass: { MsgSendFlavor = MsgSendSuperFunctionDecl; @@ -2780,7 +2780,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp, ObjCInterfaceDecl *ClassDecl = CurMethodDef->getClassInterface(); - llvm::SmallVector<Expr*, 4> InitExprs; + SmallVector<Expr*, 4> InitExprs; // set the receiver to self, the first argument to all methods. InitExprs.push_back( @@ -2793,7 +2793,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp, ); // set the 'receiver'. // (id)class_getSuperclass((Class)objc_getClass("CurrentClass")) - llvm::SmallVector<Expr*, 8> ClsExprs; + SmallVector<Expr*, 8> ClsExprs; QualType argType = Context->getPointerType(Context->CharTy); ClsExprs.push_back(StringLiteral::Create(*Context, ClassDecl->getIdentifier()->getName(), @@ -2868,7 +2868,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp, } case ObjCMessageExpr::Class: { - llvm::SmallVector<Expr*, 8> ClsExprs; + SmallVector<Expr*, 8> ClsExprs; QualType argType = Context->getPointerType(Context->CharTy); ObjCInterfaceDecl *Class = Exp->getClassReceiver()->getAs<ObjCObjectType>()->getInterface(); @@ -2891,7 +2891,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp, MsgSendStretFlavor = MsgSendSuperStretFunctionDecl; assert(MsgSendFlavor && "MsgSendFlavor is NULL!"); ObjCInterfaceDecl *ClassDecl = CurMethodDef->getClassInterface(); - llvm::SmallVector<Expr*, 4> InitExprs; + SmallVector<Expr*, 4> InitExprs; InitExprs.push_back( NoTypeInfoCStyleCastExpr(Context, Context->getObjCIdType(), @@ -2902,7 +2902,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp, ); // set the 'receiver'. // (id)class_getSuperclass((Class)objc_getClass("CurrentClass")) - llvm::SmallVector<Expr*, 8> ClsExprs; + SmallVector<Expr*, 8> ClsExprs; QualType argType = Context->getPointerType(Context->CharTy); ClsExprs.push_back(StringLiteral::Create(*Context, ClassDecl->getIdentifier()->getName(), @@ -2983,7 +2983,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp, } // Create a call to sel_registerName("selName"), it will be the 2nd argument. - llvm::SmallVector<Expr*, 8> SelExprs; + SmallVector<Expr*, 8> SelExprs; QualType argType = Context->getPointerType(Context->CharTy); SelExprs.push_back(StringLiteral::Create(*Context, Exp->getSelector().getAsString(), @@ -3025,7 +3025,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp, } // Generate the funky cast. CastExpr *cast; - llvm::SmallVector<QualType, 8> ArgTypes; + SmallVector<QualType, 8> ArgTypes; QualType returnType; // Push 'id' and 'SEL', the 2 implicit arguments. @@ -3358,8 +3358,8 @@ template<typename MethodIterator> void RewriteObjC::RewriteObjCMethodsMetaData(MethodIterator MethodBegin, MethodIterator MethodEnd, bool IsInstanceMethod, - llvm::StringRef prefix, - llvm::StringRef ClassName, + StringRef prefix, + StringRef ClassName, std::string &Result) { if (MethodBegin == MethodEnd) return; @@ -3428,8 +3428,8 @@ void RewriteObjC::RewriteObjCMethodsMetaData(MethodIterator MethodBegin, /// RewriteObjCProtocolMetaData - Rewrite protocols meta-data. void RewriteObjC:: -RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl, llvm::StringRef prefix, - llvm::StringRef ClassName, std::string &Result) { +RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl, StringRef prefix, + StringRef ClassName, std::string &Result) { static bool objc_protocol_methods = false; // Output struct protocol_methods holder of method selector and type. @@ -3576,7 +3576,7 @@ RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl, llvm::StringRef prefix, void RewriteObjC:: RewriteObjCProtocolListMetaData(const ObjCList<ObjCProtocolDecl> &Protocols, - llvm::StringRef prefix, llvm::StringRef ClassName, + StringRef prefix, StringRef ClassName, std::string &Result) { if (Protocols.empty()) return; @@ -3634,7 +3634,7 @@ void RewriteObjC::RewriteObjCCategoryImplDecl(ObjCCategoryImplDecl *IDecl, FullCategoryName += IDecl->getNameAsString(); // Build _objc_method_list for class's instance methods if needed - llvm::SmallVector<ObjCMethodDecl *, 32> + SmallVector<ObjCMethodDecl *, 32> InstanceMethods(IDecl->instmeth_begin(), IDecl->instmeth_end()); // If any of our property implementations have associated getters or @@ -3804,7 +3804,7 @@ void RewriteObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl, Result += "\n"; ObjCInterfaceDecl::ivar_iterator IVI, IVE; - llvm::SmallVector<ObjCIvarDecl *, 8> IVars; + SmallVector<ObjCIvarDecl *, 8> IVars; if (!IDecl->ivar_empty()) { for (ObjCInterfaceDecl::ivar_iterator IV = IDecl->ivar_begin(), IVEnd = IDecl->ivar_end(); @@ -3843,7 +3843,7 @@ void RewriteObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl, } // Build _objc_method_list for class's instance methods if needed - llvm::SmallVector<ObjCMethodDecl *, 32> + SmallVector<ObjCMethodDecl *, 32> InstanceMethods(IDecl->instmeth_begin(), IDecl->instmeth_end()); // If any of our property implementations have associated getters or @@ -4144,7 +4144,7 @@ static bool HasLocalVariableExternalStorage(ValueDecl *VD) { } std::string RewriteObjC::SynthesizeBlockFunc(BlockExpr *CE, int i, - llvm::StringRef funcName, + StringRef funcName, std::string Tag) { const FunctionType *AFT = CE->getFunctionType(); QualType RT = AFT->getResultType(); @@ -4188,7 +4188,7 @@ std::string RewriteObjC::SynthesizeBlockFunc(BlockExpr *CE, int i, // Create local declarations to avoid rewriting all closure decl ref exprs. // First, emit a declaration for all "by ref" decls. - for (llvm::SmallVector<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(), + for (SmallVector<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(), E = BlockByRefDecls.end(); I != E; ++I) { S += " "; std::string Name = (*I)->getNameAsString(); @@ -4199,7 +4199,7 @@ std::string RewriteObjC::SynthesizeBlockFunc(BlockExpr *CE, int i, S += Name + " = __cself->" + (*I)->getNameAsString() + "; // bound by ref\n"; } // Next, emit a declaration for all "by copy" declarations. - for (llvm::SmallVector<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(), + for (SmallVector<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(), E = BlockByCopyDecls.end(); I != E; ++I) { S += " "; // Handle nested closure invocation. For example: @@ -4238,7 +4238,7 @@ std::string RewriteObjC::SynthesizeBlockFunc(BlockExpr *CE, int i, } std::string RewriteObjC::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i, - llvm::StringRef funcName, + StringRef funcName, std::string Tag) { std::string StructRef = "struct " + Tag; std::string S = "static void __"; @@ -4294,7 +4294,7 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag, if (BlockDeclRefs.size()) { // Output all "by copy" declarations. - for (llvm::SmallVector<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(), + for (SmallVector<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(), E = BlockByCopyDecls.end(); I != E; ++I) { S += " "; std::string FieldName = (*I)->getNameAsString(); @@ -4323,7 +4323,7 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag, S += FieldName + ";\n"; } // Output all "by ref" declarations. - for (llvm::SmallVector<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(), + for (SmallVector<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(), E = BlockByRefDecls.end(); I != E; ++I) { S += " "; std::string FieldName = (*I)->getNameAsString(); @@ -4342,7 +4342,7 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag, Constructor += ", int flags=0)"; // Initialize all "by copy" arguments. bool firsTime = true; - for (llvm::SmallVector<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(), + for (SmallVector<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(), E = BlockByCopyDecls.end(); I != E; ++I) { std::string Name = (*I)->getNameAsString(); if (firsTime) { @@ -4357,7 +4357,7 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag, Constructor += Name + "(_" + Name + ")"; } // Initialize all "by ref" arguments. - for (llvm::SmallVector<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(), + for (SmallVector<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(), E = BlockByRefDecls.end(); I != E; ++I) { std::string Name = (*I)->getNameAsString(); if (firsTime) { @@ -4396,7 +4396,7 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag, std::string RewriteObjC::SynthesizeBlockDescriptor(std::string DescTag, std::string ImplTag, int i, - llvm::StringRef FunName, + StringRef FunName, unsigned hasCopy) { std::string S = "\nstatic struct " + DescTag; @@ -4423,7 +4423,7 @@ std::string RewriteObjC::SynthesizeBlockDescriptor(std::string DescTag, } void RewriteObjC::SynthesizeBlockLiterals(SourceLocation FunLocStart, - llvm::StringRef FunName) { + StringRef FunName) { // Insert declaration for the function in which block literal is used. if (CurFunctionDeclToDeclareForBlock && !Blocks.empty()) RewriteBlockLiteralFunctionDecl(CurFunctionDeclToDeclareForBlock); @@ -4512,7 +4512,7 @@ void RewriteObjC::SynthesizeBlockLiterals(SourceLocation FunLocStart, void RewriteObjC::InsertBlockLiteralsWithinFunction(FunctionDecl *FD) { SourceLocation FunLocStart = FD->getTypeSpecStartLoc(); - llvm::StringRef FuncName = FD->getName(); + StringRef FuncName = FD->getName(); SynthesizeBlockLiterals(FunLocStart, FuncName); } @@ -4564,7 +4564,7 @@ void RewriteObjC::GetBlockDeclRefExprs(Stmt *S) { } void RewriteObjC::GetInnerBlockDeclRefExprs(Stmt *S, - llvm::SmallVector<BlockDeclRefExpr *, 8> &InnerBlockDeclRefs, + SmallVector<BlockDeclRefExpr *, 8> &InnerBlockDeclRefs, llvm::SmallPtrSet<const DeclContext *, 8> &InnerContexts) { for (Stmt::child_range CI = S->children(); CI; ++CI) if (*CI) { @@ -4603,7 +4603,7 @@ QualType RewriteObjC::convertFunctionTypeOfBlocks(const FunctionType *FT) { const FunctionProtoType *FTP = dyn_cast<FunctionProtoType>(FT); // FTP will be null for closures that don't take arguments. // Generate a funky cast. - llvm::SmallVector<QualType, 8> ArgTypes; + SmallVector<QualType, 8> ArgTypes; QualType Res = FT->getResultType(); bool HasBlockType = convertBlockPointerToFunctionPointer(Res); @@ -4673,7 +4673,7 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp) { QualType PtrBlock = Context->getPointerType(Context->getTagDeclType(RD)); // Generate a funky cast. - llvm::SmallVector<QualType, 8> ArgTypes; + SmallVector<QualType, 8> ArgTypes; // Push the block argument type. ArgTypes.push_back(PtrBlock); @@ -4716,7 +4716,7 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp) { CK_BitCast, ME); PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(), FunkCast); - llvm::SmallVector<Expr*, 8> BlkExprs; + SmallVector<Expr*, 8> BlkExprs; // Add the implicit argument. BlkExprs.push_back(BlkCast); // Add the user arguments. @@ -4767,7 +4767,7 @@ Stmt *RewriteObjC::RewriteBlockDeclRefExpr(Expr *DeclRefExp) { FD->getType(), VK_LValue, OK_Ordinary); - llvm::StringRef Name = VD->getName(); + StringRef Name = VD->getName(); FD = FieldDecl::Create(*Context, 0, SourceLocation(), SourceLocation(), &Context->Idents.get(Name), Context->VoidPtrTy, 0, @@ -5271,7 +5271,7 @@ void RewriteObjC::CollectBlockDeclRefInfo(BlockExpr *Exp) { } } -FunctionDecl *RewriteObjC::SynthBlockInitFunctionDecl(llvm::StringRef name) { +FunctionDecl *RewriteObjC::SynthBlockInitFunctionDecl(StringRef name) { IdentifierInfo *ID = &Context->Idents.get(name); QualType FType = Context->getFunctionNoProtoType(Context->VoidPtrTy); return FunctionDecl::Create(*Context, TUDecl, SourceLocation(), @@ -5280,7 +5280,7 @@ FunctionDecl *RewriteObjC::SynthBlockInitFunctionDecl(llvm::StringRef name) { } Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp, - const llvm::SmallVector<BlockDeclRefExpr *, 8> &InnerBlockDeclRefs) { + const SmallVector<BlockDeclRefExpr *, 8> &InnerBlockDeclRefs) { const BlockDecl *block = Exp->getBlockDecl(); Blocks.push_back(Exp); @@ -5343,7 +5343,7 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp, DeclRefExpr *DRE = new (Context) DeclRefExpr(FD, FType, VK_RValue, SourceLocation()); - llvm::SmallVector<Expr*, 4> InitExprs; + SmallVector<Expr*, 4> InitExprs; // Initialize the block function. FD = SynthBlockInitFunctionDecl(Func); @@ -5376,7 +5376,7 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp, if (BlockDeclRefs.size()) { Expr *Exp; // Output all "by copy" declarations. - for (llvm::SmallVector<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(), + for (SmallVector<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(), E = BlockByCopyDecls.end(); I != E; ++I) { if (isObjCType((*I)->getType())) { // FIXME: Conform to ABI ([[obj retain] autorelease]). @@ -5410,7 +5410,7 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp, InitExprs.push_back(Exp); } // Output all "by ref" declarations. - for (llvm::SmallVector<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(), + for (SmallVector<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(), E = BlockByRefDecls.end(); I != E; ++I) { ValueDecl *ND = (*I); std::string Name(ND->getNameAsString()); @@ -5557,7 +5557,7 @@ Stmt *RewriteObjC::RewriteFunctionBodyOrGlobalInitializer(Stmt *S) { } if (BlockExpr *BE = dyn_cast<BlockExpr>(S)) { - llvm::SmallVector<BlockDeclRefExpr *, 8> InnerBlockDeclRefs; + SmallVector<BlockDeclRefExpr *, 8> InnerBlockDeclRefs; llvm::SmallPtrSet<const DeclContext *, 8> InnerContexts; InnerContexts.insert(BE->getBlockDecl()); ImportedLocalExternalDecls.clear(); diff --git a/lib/Rewrite/RewriteRope.cpp b/lib/Rewrite/RewriteRope.cpp index cfedd4b41f..6c211b28fd 100644 --- a/lib/Rewrite/RewriteRope.cpp +++ b/lib/Rewrite/RewriteRope.cpp @@ -12,11 +12,9 @@ //===----------------------------------------------------------------------===// #include "clang/Rewrite/RewriteRope.h" -#include "llvm/Support/Casting.h" +#include "clang/Basic/LLVM.h" #include <algorithm> using namespace clang; -using llvm::dyn_cast; -using llvm::cast; /// RewriteRope is a "strong" string class, designed to make insertions and /// deletions in the middle of the string nearly constant time (really, they are diff --git a/lib/Rewrite/RewriteTest.cpp b/lib/Rewrite/RewriteTest.cpp index 36207000c9..c446324d3e 100644 --- a/lib/Rewrite/RewriteTest.cpp +++ b/lib/Rewrite/RewriteTest.cpp @@ -16,7 +16,7 @@ #include "clang/Rewrite/TokenRewriter.h" #include "llvm/Support/raw_ostream.h" -void clang::DoRewriteTest(Preprocessor &PP, llvm::raw_ostream* OS) { +void clang::DoRewriteTest(Preprocessor &PP, raw_ostream* OS) { SourceManager &SM = PP.getSourceManager(); const LangOptions &LangOpts = PP.getLangOptions(); diff --git a/lib/Rewrite/Rewriter.cpp b/lib/Rewrite/Rewriter.cpp index 92f516074e..464b299ccd 100644 --- a/lib/Rewrite/Rewriter.cpp +++ b/lib/Rewrite/Rewriter.cpp @@ -17,10 +17,9 @@ #include "clang/AST/Decl.h" #include "clang/Lex/Lexer.h" #include "clang/Basic/SourceManager.h" -#include "llvm/Support/raw_ostream.h" using namespace clang; -llvm::raw_ostream &RewriteBuffer::write(llvm::raw_ostream &os) const { +raw_ostream &RewriteBuffer::write(raw_ostream &os) const { // FIXME: eliminate the copy by writing out each chunk at a time os << std::string(begin(), end()); return os; @@ -84,7 +83,7 @@ void RewriteBuffer::RemoveText(unsigned OrigOffset, unsigned Size, } } -void RewriteBuffer::InsertText(unsigned OrigOffset, llvm::StringRef Str, +void RewriteBuffer::InsertText(unsigned OrigOffset, StringRef Str, bool InsertAfter) { // Nothing to insert, exit early. @@ -101,7 +100,7 @@ void RewriteBuffer::InsertText(unsigned OrigOffset, llvm::StringRef Str, /// buffer with a new string. This is effectively a combined "remove+insert" /// operation. void RewriteBuffer::ReplaceText(unsigned OrigOffset, unsigned OrigLength, - llvm::StringRef NewStr) { + StringRef NewStr) { unsigned RealOffset = getMappedOffset(OrigOffset, true); Buffer.erase(RealOffset, OrigLength); Buffer.insert(RealOffset, NewStr.begin(), NewStr.end()); @@ -222,7 +221,7 @@ RewriteBuffer &Rewriter::getEditBuffer(FileID FID) { return I->second; I = RewriteBuffers.insert(I, std::make_pair(FID, RewriteBuffer())); - llvm::StringRef MB = SourceMgr->getBufferData(FID); + StringRef MB = SourceMgr->getBufferData(FID); I->second.Initialize(MB.begin(), MB.end()); return I->second; @@ -230,10 +229,8 @@ RewriteBuffer &Rewriter::getEditBuffer(FileID FID) { /// InsertText - Insert the specified string at the specified location in the /// original buffer. -bool Rewriter::InsertText(SourceLocation Loc, llvm::StringRef Str, +bool Rewriter::InsertText(SourceLocation Loc, StringRef Str, bool InsertAfter, bool indentNewLines) { - using llvm::StringRef; - if (!isRewritable(Loc)) return true; FileID FID; unsigned StartOffs = getLocationOffsetAndFileID(Loc, FID); @@ -256,7 +253,7 @@ bool Rewriter::InsertText(SourceLocation Loc, llvm::StringRef Str, indentSpace = MB.substr(lineOffs, i-lineOffs); } - llvm::SmallVector<StringRef, 4> lines; + SmallVector<StringRef, 4> lines; Str.split(lines, "\n"); for (unsigned i = 0, e = lines.size(); i != e; ++i) { @@ -273,7 +270,7 @@ bool Rewriter::InsertText(SourceLocation Loc, llvm::StringRef Str, return false; } -bool Rewriter::InsertTextAfterToken(SourceLocation Loc, llvm::StringRef Str) { +bool Rewriter::InsertTextAfterToken(SourceLocation Loc, StringRef Str) { if (!isRewritable(Loc)) return true; FileID FID; unsigned StartOffs = getLocationOffsetAndFileID(Loc, FID); @@ -298,7 +295,7 @@ bool Rewriter::RemoveText(SourceLocation Start, unsigned Length, /// buffer with a new string. This is effectively a combined "remove/insert" /// operation. bool Rewriter::ReplaceText(SourceLocation Start, unsigned OrigLength, - llvm::StringRef NewStr) { + StringRef NewStr) { if (!isRewritable(Start)) return true; FileID StartFileID; unsigned StartOffs = getLocationOffsetAndFileID(Start, StartFileID); @@ -317,7 +314,7 @@ bool Rewriter::ReplaceText(SourceRange range, SourceRange replacementRange) { FileID FID; unsigned newOffs = getLocationOffsetAndFileID(replacementRange.getBegin(), FID); - llvm::StringRef MB = SourceMgr->getBufferData(FID); + StringRef MB = SourceMgr->getBufferData(FID); return ReplaceText(start, origLength, MB.substr(newOffs, newLength)); } @@ -349,8 +346,6 @@ std::string Rewriter::ConvertToString(Stmt *From) { bool Rewriter::IncreaseIndentation(CharSourceRange range, SourceLocation parentIndent) { - using llvm::StringRef; - if (range.isInvalid()) return true; if (!isRewritable(range.getBegin())) return true; if (!isRewritable(range.getEnd())) return true; @@ -400,7 +395,7 @@ bool Rewriter::IncreaseIndentation(CharSourceRange range, if (!startSpace.startswith(parentSpace)) return true; - llvm::StringRef indent = startSpace.substr(parentSpace.size()); + StringRef indent = startSpace.substr(parentSpace.size()); // Indent the lines between start/end offsets. RewriteBuffer &RB = getEditBuffer(FID); diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp index 3dae7b4d7e..9f5ab50266 100644 --- a/lib/Sema/AnalysisBasedWarnings.cpp +++ b/lib/Sema/AnalysisBasedWarnings.cpp @@ -530,7 +530,7 @@ struct SLocSort { class UninitValsDiagReporter : public UninitVariablesHandler { Sema &S; - typedef llvm::SmallVector<UninitUse, 2> UsesVec; + typedef SmallVector<UninitUse, 2> UsesVec; typedef llvm::DenseMap<const VarDecl *, UsesVec*> UsesMap; UsesMap *uses; @@ -613,7 +613,7 @@ clang::sema::AnalysisBasedWarnings::AnalysisBasedWarnings(Sema &s) } static void flushDiagnostics(Sema &S, sema::FunctionScopeInfo *fscope) { - for (llvm::SmallVectorImpl<sema::PossiblyUnreachableDiag>::iterator + for (SmallVectorImpl<sema::PossiblyUnreachableDiag>::iterator i = fscope->PossiblyUnreachableDiags.begin(), e = fscope->PossiblyUnreachableDiags.end(); i != e; ++i) { @@ -684,7 +684,7 @@ AnalysisBasedWarnings::IssueWarnings(sema::AnalysisBasedWarnings::Policy P, bool analyzed = false; // Register the expressions with the CFGBuilder. - for (llvm::SmallVectorImpl<sema::PossiblyUnreachableDiag>::iterator + for (SmallVectorImpl<sema::PossiblyUnreachableDiag>::iterator i = fscope->PossiblyUnreachableDiags.begin(), e = fscope->PossiblyUnreachableDiags.end(); i != e; ++i) { @@ -694,7 +694,7 @@ AnalysisBasedWarnings::IssueWarnings(sema::AnalysisBasedWarnings::Policy P, if (AC.getCFG()) { analyzed = true; - for (llvm::SmallVectorImpl<sema::PossiblyUnreachableDiag>::iterator + for (SmallVectorImpl<sema::PossiblyUnreachableDiag>::iterator i = fscope->PossiblyUnreachableDiags.begin(), e = fscope->PossiblyUnreachableDiags.end(); i != e; ++i) diff --git a/lib/Sema/AttributeList.cpp b/lib/Sema/AttributeList.cpp index 21068538e8..f90c6dc0ab 100644 --- a/lib/Sema/AttributeList.cpp +++ b/lib/Sema/AttributeList.cpp @@ -98,7 +98,7 @@ AttributePool::createIntegerAttribute(ASTContext &C, IdentifierInfo *Name, } AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) { - llvm::StringRef AttrName = Name->getName(); + StringRef AttrName = Name->getName(); // Normalize the attribute name, __foo__ becomes foo. if (AttrName.startswith("__") && AttrName.endswith("__")) diff --git a/lib/Sema/CodeCompleteConsumer.cpp b/lib/Sema/CodeCompleteConsumer.cpp index d7dc5b2538..e753d6224a 100644 --- a/lib/Sema/CodeCompleteConsumer.cpp +++ b/lib/Sema/CodeCompleteConsumer.cpp @@ -26,7 +26,6 @@ #include <functional> using namespace clang; -using llvm::StringRef; //===----------------------------------------------------------------------===// // Code completion context implementation @@ -228,14 +227,14 @@ const char *CodeCompletionString::getTypedText() const { return 0; } -const char *CodeCompletionAllocator::CopyString(llvm::StringRef String) { +const char *CodeCompletionAllocator::CopyString(StringRef String) { char *Mem = (char *)Allocate(String.size() + 1, 1); std::copy(String.begin(), String.end(), Mem); Mem[String.size()] = 0; return Mem; } -const char *CodeCompletionAllocator::CopyString(llvm::Twine String) { +const char *CodeCompletionAllocator::CopyString(Twine String) { // FIXME: It would be more efficient to teach Twine to tell us its size and // then add a routine there to fill in an allocated char* with the contents // of the string. @@ -425,7 +424,7 @@ void CodeCompletionResult::computeCursorKindAndAvailability() { /// /// If the name needs to be constructed as a string, that string will be /// saved into Saved and the returned StringRef will refer to it. -static llvm::StringRef getOrderedName(const CodeCompletionResult &R, +static StringRef getOrderedName(const CodeCompletionResult &R, std::string &Saved) { switch (R.Kind) { case CodeCompletionResult::RK_Keyword: @@ -460,8 +459,8 @@ static llvm::StringRef getOrderedName(const CodeCompletionResult &R, bool clang::operator<(const CodeCompletionResult &X, const CodeCompletionResult &Y) { std::string XSaved, YSaved; - llvm::StringRef XStr = getOrderedName(X, XSaved); - llvm::StringRef YStr = getOrderedName(Y, YSaved); + StringRef XStr = getOrderedName(X, XSaved); + StringRef YStr = getOrderedName(Y, YSaved); int cmp = XStr.compare_lower(YStr); if (cmp) return cmp < 0; diff --git a/lib/Sema/DelayedDiagnostic.cpp b/lib/Sema/DelayedDiagnostic.cpp index c6744ed80d..d6c1ad13a8 100644 --- a/lib/Sema/DelayedDiagnostic.cpp +++ b/lib/Sema/DelayedDiagnostic.cpp @@ -21,7 +21,7 @@ using namespace sema; DelayedDiagnostic DelayedDiagnostic::makeDeprecation(SourceLocation Loc, const NamedDecl *D, - llvm::StringRef Msg) { + StringRef Msg) { DelayedDiagnostic DD; DD.Kind = Deprecation; DD.Triggered = false; diff --git a/lib/Sema/JumpDiagnostics.cpp b/lib/Sema/JumpDiagnostics.cpp index 59bc2637c8..d7f6769f74 100644 --- a/lib/Sema/JumpDiagnostics.cpp +++ b/lib/Sema/JumpDiagnostics.cpp @@ -58,12 +58,12 @@ class JumpScopeChecker { : ParentScope(parentScope), InDiag(InDiag), OutDiag(OutDiag), Loc(L) {} }; - llvm::SmallVector<GotoScope, 48> Scopes; + SmallVector<GotoScope, 48> Scopes; llvm::DenseMap<Stmt*, unsigned> LabelAndGotoScopes; - llvm::SmallVector<Stmt*, 16> Jumps; + SmallVector<Stmt*, 16> Jumps; - llvm::SmallVector<IndirectGotoStmt*, 4> IndirectJumps; - llvm::SmallVector<LabelDecl*, 4> IndirectJumpTargets; + SmallVector<IndirectGotoStmt*, 4> IndirectJumps; + SmallVector<LabelDecl*, 4> IndirectJumpTargets; public: JumpScopeChecker(Stmt *Body, Sema &S); private: @@ -532,10 +532,10 @@ void JumpScopeChecker::VerifyIndirectJumps() { // indirect goto. For most code bases, this substantially cuts // down on the number of jump sites we'll have to consider later. typedef std::pair<unsigned, IndirectGotoStmt*> JumpScope; - llvm::SmallVector<JumpScope, 32> JumpScopes; + SmallVector<JumpScope, 32> JumpScopes; { llvm::DenseMap<unsigned, IndirectGotoStmt*> JumpScopesMap; - for (llvm::SmallVectorImpl<IndirectGotoStmt*>::iterator + for (SmallVectorImpl<IndirectGotoStmt*>::iterator I = IndirectJumps.begin(), E = IndirectJumps.end(); I != E; ++I) { IndirectGotoStmt *IG = *I; assert(LabelAndGotoScopes.count(IG) && @@ -554,7 +554,7 @@ void JumpScopeChecker::VerifyIndirectJumps() { // label whose address was taken somewhere in the function. // For most code bases, there will be only one such scope. llvm::DenseMap<unsigned, LabelDecl*> TargetScopes; - for (llvm::SmallVectorImpl<LabelDecl*>::iterator + for (SmallVectorImpl<LabelDecl*>::iterator I = IndirectJumpTargets.begin(), E = IndirectJumpTargets.end(); I != E; ++I) { LabelDecl *TheLabel = *I; @@ -599,7 +599,7 @@ void JumpScopeChecker::VerifyIndirectJumps() { // Walk through all the jump sites, checking that they can trivially // reach this label scope. - for (llvm::SmallVectorImpl<JumpScope>::iterator + for (SmallVectorImpl<JumpScope>::iterator I = JumpScopes.begin(), E = JumpScopes.end(); I != E; ++I) { unsigned Scope = I->first; @@ -679,7 +679,7 @@ void JumpScopeChecker::CheckJump(Stmt *From, Stmt *To, if (CommonScope == ToScope) return; // Pull out (and reverse) any scopes we might need to diagnose skipping. - llvm::SmallVector<unsigned, 10> ToScopes; + SmallVector<unsigned, 10> ToScopes; for (unsigned I = ToScope; I != CommonScope; I = Scopes[I].ParentScope) if (Scopes[I].InDiag) ToScopes.push_back(I); diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index fdf3bb3cb0..7f0e4769c5 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -210,7 +210,7 @@ Sema::~Sema() { /// make the relevant declaration unavailable instead of erroring, do /// so and return true. bool Sema::makeUnavailableInSystemHeader(SourceLocation loc, - llvm::StringRef msg) { + StringRef msg) { // If we're not in a function, it's an error. FunctionDecl *fn = dyn_cast<FunctionDecl>(CurContext); if (!fn) return false; @@ -358,7 +358,7 @@ static void checkUndefinedInternals(Sema &S) { if (S.UndefinedInternals.empty()) return; // Collect all the still-undefined entities with internal linkage. - llvm::SmallVector<UndefinedInternal, 16> undefined; + SmallVector<UndefinedInternal, 16> undefined; for (llvm::DenseMap<NamedDecl*,SourceLocation>::iterator i = S.UndefinedInternals.begin(), e = S.UndefinedInternals.end(); i != e; ++i) { @@ -389,7 +389,7 @@ static void checkUndefinedInternals(Sema &S) { // the iteration order through an llvm::DenseMap. llvm::array_pod_sort(undefined.begin(), undefined.end()); - for (llvm::SmallVectorImpl<UndefinedInternal>::iterator + for (SmallVectorImpl<UndefinedInternal>::iterator i = undefined.begin(), e = undefined.end(); i != e; ++i) { NamedDecl *decl = i->decl; S.Diag(decl->getLocation(), diag::warn_undefined_internal) @@ -517,7 +517,7 @@ void Sema::ActOnEndOfTranslationUnit() { // noise. if (!Diags.hasErrorOccurred()) { // Output warning for unused file scoped decls. - for (llvm::SmallVectorImpl<const DeclaratorDecl*>::iterator + for (SmallVectorImpl<const DeclaratorDecl*>::iterator I = UnusedFileScopedDecls.begin(), E = UnusedFileScopedDecls.end(); I != E; ++I) { if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(*I)) { @@ -681,7 +681,7 @@ Sema::Diag(SourceLocation Loc, const PartialDiagnostic& PD) { /// location, looking for a macro instantiation with the given name. /// If one is found, returns true and sets the location to that /// instantiation loc. -bool Sema::findMacroSpelling(SourceLocation &locref, llvm::StringRef name) { +bool Sema::findMacroSpelling(SourceLocation &locref, StringRef name) { SourceLocation loc = locref; if (!loc.isMacroID()) return false; @@ -690,7 +690,7 @@ bool Sema::findMacroSpelling(SourceLocation &locref, llvm::StringRef name) { loc = getSourceManager().getInstantiationLoc(loc); // If that's written with the name, stop here. - llvm::SmallVector<char, 16> buffer; + SmallVector<char, 16> buffer; if (getPreprocessor().getSpelling(loc, buffer) == name) { locref = loc; return true; @@ -754,7 +754,7 @@ void Sema::PopFunctionOrBlockScope(const AnalysisBasedWarnings::Policy *WP, if (WP && D) AnalysisWarnings.IssueWarnings(*WP, Scope, D, blkExpr); else { - for (llvm::SmallVectorImpl<sema::PossiblyUnreachableDiag>::iterator + for (SmallVectorImpl<sema::PossiblyUnreachableDiag>::iterator i = Scope->PossiblyUnreachableDiags.begin(), e = Scope->PossiblyUnreachableDiags.end(); i != e; ++i) { @@ -790,10 +790,10 @@ ExternalSemaSource::ReadMethodPool(Selector Sel) { } void ExternalSemaSource::ReadKnownNamespaces( - llvm::SmallVectorImpl<NamespaceDecl *> &Namespaces) { + SmallVectorImpl<NamespaceDecl *> &Namespaces) { } -void PrettyDeclStackTraceEntry::print(llvm::raw_ostream &OS) const { +void PrettyDeclStackTraceEntry::print(raw_ostream &OS) const { SourceLocation Loc = this->Loc; if (!Loc.isValid() && TheDecl) Loc = TheDecl->getLocation(); if (Loc.isValid()) { diff --git a/lib/Sema/SemaAccess.cpp b/lib/Sema/SemaAccess.cpp index a26737e00e..abea1ba61b 100644 --- a/lib/Sema/SemaAccess.cpp +++ b/lib/Sema/SemaAccess.cpp @@ -126,11 +126,11 @@ struct EffectiveContext { return Inner; } - typedef llvm::SmallVectorImpl<CXXRecordDecl*>::const_iterator record_iterator; + typedef SmallVectorImpl<CXXRecordDecl*>::const_iterator record_iterator; DeclContext *Inner; - llvm::SmallVector<FunctionDecl*, 4> Functions; - llvm::SmallVector<CXXRecordDecl*, 4> Records; + SmallVector<FunctionDecl*, 4> Functions; + SmallVector<CXXRecordDecl*, 4> Records; bool Dependent; }; @@ -260,7 +260,7 @@ static AccessResult IsDerivedFromInclusive(const CXXRecordDecl *Derived, return AR_dependent; AccessResult OnFailure = AR_inaccessible; - llvm::SmallVector<const CXXRecordDecl*, 8> Queue; // actually a stack + SmallVector<const CXXRecordDecl*, 8> Queue; // actually a stack while (true) { for (CXXRecordDecl::base_class_const_iterator @@ -421,7 +421,7 @@ static AccessResult MatchesFriend(Sema &S, // Check whether the friend is the template of a class in the // context chain. - for (llvm::SmallVectorImpl<CXXRecordDecl*>::const_iterator + for (SmallVectorImpl<CXXRecordDecl*>::const_iterator I = EC.Records.begin(), E = EC.Records.end(); I != E; ++I) { CXXRecordDecl *Record = *I; @@ -472,7 +472,7 @@ static AccessResult MatchesFriend(Sema &S, FunctionDecl *Friend) { AccessResult OnFailure = AR_inaccessible; - for (llvm::SmallVectorImpl<FunctionDecl*>::const_iterator + for (SmallVectorImpl<FunctionDecl*>::const_iterator I = EC.Functions.begin(), E = EC.Functions.end(); I != E; ++I) { if (Friend == *I) return AR_accessible; @@ -493,7 +493,7 @@ static AccessResult MatchesFriend(Sema &S, AccessResult OnFailure = AR_inaccessible; - for (llvm::SmallVectorImpl<FunctionDecl*>::const_iterator + for (SmallVectorImpl<FunctionDecl*>::const_iterator I = EC.Functions.begin(), E = EC.Functions.end(); I != E; ++I) { FunctionTemplateDecl *FTD = (*I)->getPrimaryTemplate(); @@ -584,7 +584,7 @@ struct ProtectedFriendContext { bool EverDependent; /// The path down to the current base class. - llvm::SmallVector<const CXXRecordDecl*, 20> CurPath; + SmallVector<const CXXRecordDecl*, 20> CurPath; ProtectedFriendContext(Sema &S, const EffectiveContext &EC, const CXXRecordDecl *InstanceContext, diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp index d053d5a9e9..2c6b8e748b 100644 --- a/lib/Sema/SemaCXXCast.cpp +++ b/lib/Sema/SemaCXXCast.cpp @@ -410,7 +410,7 @@ CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType, QualType UnwrappedSrcType = Self.Context.getCanonicalType(SrcType), UnwrappedDestType = Self.Context.getCanonicalType(DestType); - llvm::SmallVector<Qualifiers, 8> cv1, cv2; + SmallVector<Qualifiers, 8> cv1, cv2; // Find the qualifiers. We only care about cvr-qualifiers for the // purpose of this check, because other qualifiers (address spaces, @@ -442,7 +442,7 @@ CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType, QualType SrcConstruct = Self.Context.VoidTy; QualType DestConstruct = Self.Context.VoidTy; ASTContext &Context = Self.Context; - for (llvm::SmallVector<Qualifiers, 8>::reverse_iterator i1 = cv1.rbegin(), + for (SmallVector<Qualifiers, 8>::reverse_iterator i1 = cv1.rbegin(), i2 = cv2.rbegin(); i1 != cv1.rend(); ++i1, ++i2) { SrcConstruct diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index cdcacd84d7..25256b0407 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -612,9 +612,9 @@ bool Sema::CheckObjCString(Expr *Arg) { } if (Literal->containsNonAsciiOrNull()) { - llvm::StringRef String = Literal->getString(); + StringRef String = Literal->getString(); unsigned NumBytes = String.size(); - llvm::SmallVector<UTF16, 128> ToBuf(NumBytes); + SmallVector<UTF16, 128> ToBuf(NumBytes); const UTF8 *FromPtr = (UTF8 *)String.data(); UTF16 *ToPtr = &ToBuf[0]; @@ -844,7 +844,7 @@ ExprResult Sema::SemaBuiltinShuffleVector(CallExpr *TheCall) { << TheCall->getArg(i)->getSourceRange()); } - llvm::SmallVector<Expr*, 32> exprs; + SmallVector<Expr*, 32> exprs; for (unsigned i = 0, e = TheCall->getNumArgs(); i != e; i++) { exprs.push_back(TheCall->getArg(i)); @@ -1322,7 +1322,7 @@ CheckFormatHandler::HandleInvalidConversionSpecifier(unsigned argIndex, } S.Diag(Loc, diag::warn_format_invalid_conversion) - << llvm::StringRef(csStart, csLen) + << StringRef(csStart, csLen) << getSpecifierRange(startSpec, specifierLen); return keepGoing; @@ -1813,7 +1813,7 @@ void Sema::CheckFormatString(const StringLiteral *FExpr, } // Str - The format string. NOTE: this is NOT null-terminated! - llvm::StringRef StrRef = FExpr->getString(); + StringRef StrRef = FExpr->getString(); const char *Str = StrRef.data(); unsigned StrLen = StrRef.size(); @@ -1985,8 +1985,8 @@ void Sema::CheckMemsetcpymoveArguments(const CallExpr *Call, //===--- CHECK: Return Address of Stack Variable --------------------------===// -static Expr *EvalVal(Expr *E, llvm::SmallVectorImpl<DeclRefExpr *> &refVars); -static Expr *EvalAddr(Expr* E, llvm::SmallVectorImpl<DeclRefExpr *> &refVars); +static Expr *EvalVal(Expr *E, SmallVectorImpl<DeclRefExpr *> &refVars); +static Expr *EvalAddr(Expr* E, SmallVectorImpl<DeclRefExpr *> &refVars); /// CheckReturnStackAddr - Check if a return statement returns the address /// of a stack variable. @@ -1995,7 +1995,7 @@ Sema::CheckReturnStackAddr(Expr *RetValExp, QualType lhsType, SourceLocation ReturnLoc) { Expr *stackE = 0; - llvm::SmallVector<DeclRefExpr *, 8> refVars; + SmallVector<DeclRefExpr *, 8> refVars; // Perform checking for returned stack addresses, local blocks, // label addresses or references to temporaries. @@ -2077,7 +2077,7 @@ Sema::CheckReturnStackAddr(Expr *RetValExp, QualType lhsType, /// * arbitrary interplay between "&" and "*" operators /// * pointer arithmetic from an address of a stack variable /// * taking the address of an array element where the array is on the stack -static Expr *EvalAddr(Expr *E, llvm::SmallVectorImpl<DeclRefExpr *> &refVars) { +static Expr *EvalAddr(Expr *E, SmallVectorImpl<DeclRefExpr *> &refVars) { if (E->isTypeDependent()) return NULL; @@ -2222,7 +2222,7 @@ static Expr *EvalAddr(Expr *E, llvm::SmallVectorImpl<DeclRefExpr *> &refVars) { /// EvalVal - This function is complements EvalAddr in the mutual recursion. /// See the comments for EvalAddr for more details. -static Expr *EvalVal(Expr *E, llvm::SmallVectorImpl<DeclRefExpr *> &refVars) { +static Expr *EvalVal(Expr *E, SmallVectorImpl<DeclRefExpr *> &refVars) { do { // We should only be called for evaluating non-pointer expressions, or // expressions with a pointer type that are not used as references but instead @@ -3710,7 +3710,7 @@ static void diagnoseRetainCycle(Sema &S, Expr *capturer, static bool isSetterLikeSelector(Selector sel) { if (sel.isUnarySelector()) return false; - llvm::StringRef str = sel.getNameForSlot(0); + StringRef str = sel.getNameForSlot(0); while (!str.empty() && str.front() == '_') str = str.substr(1); if (str.startswith("set") || str.startswith("add")) str = str.substr(3); diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index a65026e4b0..b8d64ba39b 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -61,7 +61,7 @@ namespace { /// a single (declaration, index) mapping (the common case) but /// can also store a list of (declaration, index) mappings. class ShadowMapEntry { - typedef llvm::SmallVector<DeclIndexPair, 4> DeclIndexPairVector; + typedef SmallVector<DeclIndexPair, 4> DeclIndexPairVector; /// \brief Contains either the solitary NamedDecl * or a vector /// of (declaration, index) pairs. @@ -434,7 +434,7 @@ static NestedNameSpecifier * getRequiredQualification(ASTContext &Context, DeclContext *CurContext, DeclContext *TargetContext) { - llvm::SmallVector<DeclContext *, 4> TargetParents; + SmallVector<DeclContext *, 4> TargetParents; for (DeclContext *CommonAncestor = TargetContext; CommonAncestor && !CommonAncestor->Encloses(CurContext); @@ -2404,7 +2404,7 @@ CodeCompletionResult::CreateCodeCompletionString(Sema &S, // Figure out which template parameters are deduced (or have default // arguments). - llvm::SmallVector<bool, 16> Deduced; + SmallVector<bool, 16> Deduced; S.MarkDeducedTemplateParameters(FunTmpl, Deduced); unsigned LastDeducibleArgument; for (LastDeducibleArgument = Deduced.size(); LastDeducibleArgument > 0; @@ -2624,7 +2624,7 @@ CodeCompleteConsumer::OverloadCandidate::CreateSignatureString( return Result.TakeString(); } -unsigned clang::getMacroUsagePriority(llvm::StringRef MacroName, +unsigned clang::getMacroUsagePriority(StringRef MacroName, const LangOptions &LangOpts, bool PreferredTypeIsPointer) { unsigned Priority = CCP_Macro; @@ -3059,7 +3059,7 @@ struct Sema::CodeCompleteExpressionData { QualType PreferredType; bool IntegralConstantExpression; bool ObjCCollection; - llvm::SmallVector<Decl *, 4> IgnoreDecls; + SmallVector<Decl *, 4> IgnoreDecls; }; /// \brief Perform code-completion in an expression context when we know what @@ -3556,7 +3556,7 @@ void Sema::CodeCompleteCall(Scope *S, ExprTy *FnIn, // FIXME: What if we're calling a member function? typedef CodeCompleteConsumer::OverloadCandidate ResultCandidate; - llvm::SmallVector<ResultCandidate, 8> Results; + SmallVector<ResultCandidate, 8> Results; Expr *NakedFn = Fn->IgnoreParenCasts(); if (UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(NakedFn)) @@ -5675,7 +5675,7 @@ static void AddObjCPassingTypeChunk(QualType Type, /// \brief Determine whether the given class is or inherits from a class by /// the given name. static bool InheritsFromClassNamed(ObjCInterfaceDecl *Class, - llvm::StringRef Name) { + StringRef Name) { if (!Class) return false; @@ -5710,10 +5710,10 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, // on demand. struct KeyHolder { CodeCompletionAllocator &Allocator; - llvm::StringRef Key; + StringRef Key; const char *CopiedKey; - KeyHolder(CodeCompletionAllocator &Allocator, llvm::StringRef Key) + KeyHolder(CodeCompletionAllocator &Allocator, StringRef Key) : Allocator(Allocator), Key(Key), CopiedKey(0) { } operator const char *() { @@ -5755,7 +5755,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, (ReturnType.isNull() && (Property->getType()->isIntegerType() || Property->getType()->isBooleanType())))) { - std::string SelectorName = (llvm::Twine("is") + UpperKey).str(); + std::string SelectorName = (Twine("is") + UpperKey).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); if (KnownSelectors.insert(Selectors.getNullarySelector(SelectorId))) { if (ReturnType.isNull()) { @@ -5774,7 +5774,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, // Add the normal mutator. if (IsInstanceMethod && ReturnTypeMatchesVoid && !Property->getSetterMethodDecl()) { - std::string SelectorName = (llvm::Twine("set") + UpperKey).str(); + std::string SelectorName = (Twine("set") + UpperKey).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { if (ReturnType.isNull()) { @@ -5825,7 +5825,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, // Add -(NSUInteger)countOf<key> if (IsInstanceMethod && (ReturnType.isNull() || ReturnType->isIntegerType())) { - std::string SelectorName = (llvm::Twine("countOf") + UpperKey).str(); + std::string SelectorName = (Twine("countOf") + UpperKey).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); if (KnownSelectors.insert(Selectors.getNullarySelector(SelectorId))) { if (ReturnType.isNull()) { @@ -5848,7 +5848,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, if (IsInstanceMethod && (ReturnType.isNull() || ReturnType->isObjCObjectPointerType())) { std::string SelectorName - = (llvm::Twine("objectIn") + UpperKey + "AtIndex").str(); + = (Twine("objectIn") + UpperKey + "AtIndex").str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { if (ReturnType.isNull()) { @@ -5875,7 +5875,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, ReturnType->getAs<ObjCObjectPointerType>()->getInterfaceDecl() ->getName() == "NSArray"))) { std::string SelectorName - = (llvm::Twine(Property->getName()) + "AtIndexes").str(); + = (Twine(Property->getName()) + "AtIndexes").str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { if (ReturnType.isNull()) { @@ -5896,7 +5896,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, // Add -(void)getKey:(type **)buffer range:(NSRange)inRange if (IsInstanceMethod && ReturnTypeMatchesVoid) { - std::string SelectorName = (llvm::Twine("get") + UpperKey).str(); + std::string SelectorName = (Twine("get") + UpperKey).str(); IdentifierInfo *SelectorIds[2] = { &Context.Idents.get(SelectorName), &Context.Idents.get("range") @@ -5930,7 +5930,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, // - (void)insertObject:(type *)object inKeyAtIndex:(NSUInteger)index if (IsInstanceMethod && ReturnTypeMatchesVoid) { - std::string SelectorName = (llvm::Twine("in") + UpperKey + "AtIndex").str(); + std::string SelectorName = (Twine("in") + UpperKey + "AtIndex").str(); IdentifierInfo *SelectorIds[2] = { &Context.Idents.get("insertObject"), &Context.Idents.get(SelectorName) @@ -5962,7 +5962,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, // - (void)insertKey:(NSArray *)array atIndexes:(NSIndexSet *)indexes if (IsInstanceMethod && ReturnTypeMatchesVoid) { - std::string SelectorName = (llvm::Twine("insert") + UpperKey).str(); + std::string SelectorName = (Twine("insert") + UpperKey).str(); IdentifierInfo *SelectorIds[2] = { &Context.Idents.get(SelectorName), &Context.Idents.get("atIndexes") @@ -5994,7 +5994,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, // -(void)removeObjectFromKeyAtIndex:(NSUInteger)index if (IsInstanceMethod && ReturnTypeMatchesVoid) { std::string SelectorName - = (llvm::Twine("removeObjectFrom") + UpperKey + "AtIndex").str(); + = (Twine("removeObjectFrom") + UpperKey + "AtIndex").str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { if (ReturnType.isNull()) { @@ -6016,7 +6016,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, // -(void)removeKeyAtIndexes:(NSIndexSet *)indexes if (IsInstanceMethod && ReturnTypeMatchesVoid) { std::string SelectorName - = (llvm::Twine("remove") + UpperKey + "AtIndexes").str(); + = (Twine("remove") + UpperKey + "AtIndexes").str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { if (ReturnType.isNull()) { @@ -6038,7 +6038,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, // - (void)replaceObjectInKeyAtIndex:(NSUInteger)index withObject:(id)object if (IsInstanceMethod && ReturnTypeMatchesVoid) { std::string SelectorName - = (llvm::Twine("replaceObjectIn") + UpperKey + "AtIndex").str(); + = (Twine("replaceObjectIn") + UpperKey + "AtIndex").str(); IdentifierInfo *SelectorIds[2] = { &Context.Idents.get(SelectorName), &Context.Idents.get("withObject") @@ -6070,8 +6070,8 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, // - (void)replaceKeyAtIndexes:(NSIndexSet *)indexes withKey:(NSArray *)array if (IsInstanceMethod && ReturnTypeMatchesVoid) { std::string SelectorName1 - = (llvm::Twine("replace") + UpperKey + "AtIndexes").str(); - std::string SelectorName2 = (llvm::Twine("with") + UpperKey).str(); + = (Twine("replace") + UpperKey + "AtIndexes").str(); + std::string SelectorName2 = (Twine("with") + UpperKey).str(); IdentifierInfo *SelectorIds[2] = { &Context.Idents.get(SelectorName1), &Context.Idents.get(SelectorName2) @@ -6108,7 +6108,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, ReturnType->getAs<ObjCObjectPointerType>()->getInterfaceDecl() && ReturnType->getAs<ObjCObjectPointerType>()->getInterfaceDecl() ->getName() == "NSEnumerator"))) { - std::string SelectorName = (llvm::Twine("enumeratorOf") + UpperKey).str(); + std::string SelectorName = (Twine("enumeratorOf") + UpperKey).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); if (KnownSelectors.insert(Selectors.getNullarySelector(SelectorId))) { if (ReturnType.isNull()) { @@ -6126,7 +6126,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, // - (type *)memberOfKey:(type *)object if (IsInstanceMethod && (ReturnType.isNull() || ReturnType->isObjCObjectPointerType())) { - std::string SelectorName = (llvm::Twine("memberOf") + UpperKey).str(); + std::string SelectorName = (Twine("memberOf") + UpperKey).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { if (ReturnType.isNull()) { @@ -6156,7 +6156,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, // - (void)addKeyObject:(type *)object if (IsInstanceMethod && ReturnTypeMatchesVoid) { std::string SelectorName - = (llvm::Twine("add") + UpperKey + llvm::Twine("Object")).str(); + = (Twine("add") + UpperKey + Twine("Object")).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { if (ReturnType.isNull()) { @@ -6178,7 +6178,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, // - (void)addKey:(NSSet *)objects if (IsInstanceMethod && ReturnTypeMatchesVoid) { - std::string SelectorName = (llvm::Twine("add") + UpperKey).str(); + std::string SelectorName = (Twine("add") + UpperKey).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { if (ReturnType.isNull()) { @@ -6200,7 +6200,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, // - (void)removeKeyObject:(type *)object if (IsInstanceMethod && ReturnTypeMatchesVoid) { std::string SelectorName - = (llvm::Twine("remove") + UpperKey + llvm::Twine("Object")).str(); + = (Twine("remove") + UpperKey + Twine("Object")).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { if (ReturnType.isNull()) { @@ -6222,7 +6222,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, // - (void)removeKey:(NSSet *)objects if (IsInstanceMethod && ReturnTypeMatchesVoid) { - std::string SelectorName = (llvm::Twine("remove") + UpperKey).str(); + std::string SelectorName = (Twine("remove") + UpperKey).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { if (ReturnType.isNull()) { @@ -6243,7 +6243,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, // - (void)intersectKey:(NSSet *)objects if (IsInstanceMethod && ReturnTypeMatchesVoid) { - std::string SelectorName = (llvm::Twine("intersect") + UpperKey).str(); + std::string SelectorName = (Twine("intersect") + UpperKey).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { if (ReturnType.isNull()) { @@ -6271,7 +6271,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, ReturnType->getAs<ObjCObjectPointerType>()->getInterfaceDecl() ->getName() == "NSSet"))) { std::string SelectorName - = (llvm::Twine("keyPathsForValuesAffecting") + UpperKey).str(); + = (Twine("keyPathsForValuesAffecting") + UpperKey).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); if (KnownSelectors.insert(Selectors.getNullarySelector(SelectorId))) { if (ReturnType.isNull()) { @@ -6292,7 +6292,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, ReturnType->isIntegerType() || ReturnType->isBooleanType())) { std::string SelectorName - = (llvm::Twine("automaticallyNotifiesObserversOf") + UpperKey).str(); + = (Twine("automaticallyNotifiesObserversOf") + UpperKey).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); if (KnownSelectors.insert(Selectors.getNullarySelector(SelectorId))) { if (ReturnType.isNull()) { @@ -6432,7 +6432,7 @@ void Sema::CodeCompleteObjCMethodDecl(Scope *S, // Add Key-Value-Coding and Key-Value-Observing accessor methods for all of // the properties in this class and its categories. if (Context.getLangOptions().ObjC2) { - llvm::SmallVector<ObjCContainerDecl *, 4> Containers; + SmallVector<ObjCContainerDecl *, 4> Containers; Containers.push_back(SearchDecl); VisitedSelectorSet KnownSelectors; @@ -6767,7 +6767,7 @@ void Sema::CodeCompleteNaturalLanguage() { } void Sema::GatherGlobalCodeCompletions(CodeCompletionAllocator &Allocator, - llvm::SmallVectorImpl<CodeCompletionResult> &Results) { + SmallVectorImpl<CodeCompletionResult> &Results) { ResultBuilder Builder(*this, Allocator, CodeCompletionContext::CCC_Recovery); if (!CodeCompleter || CodeCompleter->includeGlobals()) { CodeCompletionDeclConsumer Consumer(Builder, diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 22a9f37bf1..8b02390b58 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -1263,7 +1263,7 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid, // Create Decl objects for each parameter, adding them to the // FunctionDecl. if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(R)) { - llvm::SmallVector<ParmVarDecl*, 16> Params; + SmallVector<ParmVarDecl*, 16> Params; for (unsigned i = 0, e = FT->getNumArgs(); i != e; ++i) { ParmVarDecl *parm = ParmVarDecl::Create(Context, New, SourceLocation(), @@ -1795,7 +1795,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { // The old declaration provided a function prototype, but the // new declaration does not. Merge in the prototype. assert(!OldProto->hasExceptionSpec() && "Exception spec in C"); - llvm::SmallVector<QualType, 16> ParamTypes(OldProto->arg_type_begin(), + SmallVector<QualType, 16> ParamTypes(OldProto->arg_type_begin(), OldProto->arg_type_end()); NewQType = Context.getFunctionType(NewFuncType->getResultType(), ParamTypes.data(), ParamTypes.size(), @@ -1804,7 +1804,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { New->setHasInheritedPrototype(); // Synthesize a parameter for each argument type. - llvm::SmallVector<ParmVarDecl*, 16> Params; + SmallVector<ParmVarDecl*, 16> Params; for (FunctionProtoType::arg_type_iterator ParamType = OldProto->arg_type_begin(), ParamEnd = OldProto->arg_type_end(); @@ -1841,8 +1841,8 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { Old->hasPrototype() && !New->hasPrototype() && New->getType()->getAs<FunctionProtoType>() && Old->getNumParams() == New->getNumParams()) { - llvm::SmallVector<QualType, 16> ArgTypes; - llvm::SmallVector<GNUCompatibleParamWarning, 16> Warnings; + SmallVector<QualType, 16> ArgTypes; + SmallVector<GNUCompatibleParamWarning, 16> Warnings; const FunctionProtoType *OldProto = Old->getType()->getAs<FunctionProtoType>(); const FunctionProtoType *NewProto @@ -2388,7 +2388,7 @@ static bool InjectAnonymousStructOrUnionMembers(Sema &SemaRef, Scope *S, DeclContext *Owner, RecordDecl *AnonRecord, AccessSpecifier AS, - llvm::SmallVector<NamedDecl*, 2> &Chaining, + SmallVector<NamedDecl*, 2> &Chaining, bool MSAnonStruct) { unsigned diagKind = AnonRecord->isUnion() ? diag::err_anonymous_union_member_redecl @@ -2685,7 +2685,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, // Inject the members of the anonymous struct/union into the owning // context and into the identifier resolver chain for name lookup // purposes. - llvm::SmallVector<NamedDecl*, 2> Chain; + SmallVector<NamedDecl*, 2> Chain; Chain.push_back(Anon); if (InjectAnonymousStructOrUnionMembers(*this, S, Owner, Record, AS, @@ -2749,7 +2749,7 @@ Decl *Sema::BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS, // Inject the members of the anonymous struct into the current // context and into the identifier resolver chain for name lookup // purposes. - llvm::SmallVector<NamedDecl*, 2> Chain; + SmallVector<NamedDecl*, 2> Chain; Chain.push_back(Anon); if (InjectAnonymousStructOrUnionMembers(*this, S, CurContext, @@ -3731,7 +3731,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, if (Expr *E = (Expr*)D.getAsmLabel()) { // The parser guarantees this is a string. StringLiteral *SE = cast<StringLiteral>(E); - llvm::StringRef Label = SE->getString(); + StringRef Label = SE->getString(); if (S->getFnParent() != 0) { switch (SC) { case SC_None: @@ -4550,7 +4550,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, // Copy the parameter declarations from the declarator D to the function // declaration NewFD, if they are available. First scavenge them into Params. - llvm::SmallVector<ParmVarDecl*, 16> Params; + SmallVector<ParmVarDecl*, 16> Params; if (D.isFunctionDeclarator()) { DeclaratorChunk::FunctionTypeInfo &FTI = D.getFunctionTypeInfo(); @@ -5925,7 +5925,7 @@ Sema::FinalizeDeclaration(Decl *ThisDecl) { Sema::DeclGroupPtrTy Sema::FinalizeDeclaratorGroup(Scope *S, const DeclSpec &DS, Decl **Group, unsigned NumDecls) { - llvm::SmallVector<Decl*, 8> Decls; + SmallVector<Decl*, 8> Decls; if (DS.isTypeSpecOwned()) Decls.push_back(DS.getRepAsDecl()); @@ -8237,7 +8237,7 @@ Decl *Sema::ActOnIvar(Scope *S, /// extension @interface, if the last ivar is a bitfield of any type, /// then add an implicit `char :0` ivar to the end of that interface. void Sema::ActOnLastBitfield(SourceLocation DeclLoc, Decl *EnclosingDecl, - llvm::SmallVectorImpl<Decl *> &AllIvarDecls) { + SmallVectorImpl<Decl *> &AllIvarDecls) { if (!LangOpts.ObjCNonFragileABI2 || AllIvarDecls.empty()) return; @@ -8290,7 +8290,7 @@ void Sema::ActOnFields(Scope* S, // Verify that all the fields are okay. unsigned NumNamedMembers = 0; - llvm::SmallVector<FieldDecl*, 32> RecFields; + SmallVector<FieldDecl*, 32> RecFields; RecordDecl *Record = dyn_cast<RecordDecl>(EnclosingDecl); bool ARCErrReported = false; diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index ad9b6ddba9..9e20bc9018 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -394,7 +394,7 @@ static void handleNonNullAttr(Sema &S, Decl *D, const AttributeList &Attr) { unsigned NumArgs = getFunctionOrMethodNumArgs(D) + HasImplicitThisParam; // The nonnull attribute only applies to pointers. - llvm::SmallVector<unsigned, 10> NonNullArgs; + SmallVector<unsigned, 10> NonNullArgs; for (AttributeList::arg_iterator I=Attr.arg_begin(), E=Attr.arg_end(); I!=E; ++I) { @@ -526,13 +526,13 @@ static void handleOwnershipAttr(Sema &S, Decl *D, const AttributeList &AL) { bool HasImplicitThisParam = isInstanceMethod(D); unsigned NumArgs = getFunctionOrMethodNumArgs(D) + HasImplicitThisParam; - llvm::StringRef Module = AL.getParameterName()->getName(); + StringRef Module = AL.getParameterName()->getName(); // Normalize the argument, __foo__ becomes foo. if (Module.startswith("__") && Module.endswith("__")) Module = Module.substr(2, Module.size() - 4); - llvm::SmallVector<unsigned, 10> OwnershipArgs; + SmallVector<unsigned, 10> OwnershipArgs; for (AttributeList::arg_iterator I = AL.arg_begin(), E = AL.arg_end(); I != E; ++I) { @@ -1053,7 +1053,7 @@ static void handleDeprecatedAttr(Sema &S, Decl *D, const AttributeList &Attr) { } // Handle the case where deprecated attribute has a text message. - llvm::StringRef Str; + StringRef Str; if (NumArgs == 1) { StringLiteral *SE = dyn_cast<StringLiteral>(Attr.getArg(0)); if (!SE) { @@ -1075,7 +1075,7 @@ static void handleUnavailableAttr(Sema &S, Decl *D, const AttributeList &Attr) { } // Handle the case where unavailable attribute has a text message. - llvm::StringRef Str; + StringRef Str; if (NumArgs == 1) { StringLiteral *SE = dyn_cast<StringLiteral>(Attr.getArg(0)); if (!SE) { @@ -1105,7 +1105,7 @@ static void handleAvailabilityAttr(Sema &S, Decl *D, IdentifierInfo *Platform = Attr.getParameterName(); SourceLocation PlatformLoc = Attr.getParameterLoc(); - llvm::StringRef PlatformName + StringRef PlatformName = AvailabilityAttr::getPrettyPlatformName(Platform->getName()); if (PlatformName.empty()) { S.Diag(PlatformLoc, diag::warn_availability_unknown_platform) @@ -1168,7 +1168,7 @@ static void handleVisibilityAttr(Sema &S, Decl *D, const AttributeList &Attr) { return; } - llvm::StringRef TypeStr = Str->getString(); + StringRef TypeStr = Str->getString(); VisibilityAttr::VisibilityType type; if (TypeStr == "default") @@ -1207,7 +1207,7 @@ static void handleObjCMethodFamilyAttr(Sema &S, Decl *decl, return; } - llvm::StringRef param = Attr.getParameterName()->getName(); + StringRef param = Attr.getParameterName()->getName(); ObjCMethodFamilyAttr::FamilyKind family; if (param == "none") family = ObjCMethodFamilyAttr::OMF_None; @@ -1719,7 +1719,7 @@ enum FormatAttrKind { /// getFormatAttrKind - Map from format attribute names to supported format /// types. -static FormatAttrKind getFormatAttrKind(llvm::StringRef Format) { +static FormatAttrKind getFormatAttrKind(StringRef Format) { // Check for formats that get handled specially. if (Format == "NSString") return NSStringFormat; @@ -1819,7 +1819,7 @@ static void handleFormatAttr(Sema &S, Decl *D, const AttributeList &Attr) { unsigned NumArgs = getFunctionOrMethodNumArgs(D) + HasImplicitThisParam; unsigned FirstIdx = 1; - llvm::StringRef Format = Attr.getParameterName()->getName(); + StringRef Format = Attr.getParameterName()->getName(); // Normalize the argument, __foo__ becomes foo. if (Format.startswith("__") && Format.endswith("__")) @@ -2104,7 +2104,7 @@ static void handleModeAttr(Sema &S, Decl *D, const AttributeList &Attr) { return; } - llvm::StringRef Str = Attr.getParameterName()->getName(); + StringRef Str = Attr.getParameterName()->getName(); // Normalize the attribute name, __foo__ becomes foo. if (Str.startswith("__") && Str.endswith("__")) @@ -2471,7 +2471,7 @@ static void handleCallConvAttr(Sema &S, Decl *D, const AttributeList &Attr) { return; } - llvm::StringRef StrRef = Str->getString(); + StringRef StrRef = Str->getString(); PcsAttr::PCSType PCS; if (StrRef == "aapcs") PCS = PcsAttr::AAPCS; @@ -2526,7 +2526,7 @@ bool Sema::CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC) { return true; } - llvm::StringRef StrRef = Str->getString(); + StringRef StrRef = Str->getString(); if (StrRef == "aapcs") { CC = CC_AAPCS; break; @@ -2874,7 +2874,7 @@ static void handleUuidAttr(Sema &S, Decl *D, const AttributeList &Attr) { return; } - llvm::StringRef StrRef = Str->getString(); + StringRef StrRef = Str->getString(); bool IsCurly = StrRef.size() > 1 && StrRef.front() == '{' && StrRef.back() == '}'; @@ -2891,7 +2891,7 @@ static void handleUuidAttr(Sema &S, Decl *D, const AttributeList &Attr) { // GUID format is "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" or // "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" - llvm::StringRef::iterator I = StrRef.begin(); + StringRef::iterator I = StrRef.begin(); if (IsCurly) // Skip the optional '{' ++I; @@ -3336,7 +3336,7 @@ void Sema::HandleDelayedDeprecationCheck(DelayedDiagnostic &DD, << DD.getDeprecationDecl()->getDeclName(); } -void Sema::EmitDeprecationWarning(NamedDecl *D, llvm::StringRef Message, +void Sema::EmitDeprecationWarning(NamedDecl *D, StringRef Message, SourceLocation Loc, const ObjCInterfaceDecl *UnknownObjCClass) { // Delay if we're currently parsing a declaration. diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 9ad9a2f0f0..e45df45b31 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -1017,7 +1017,7 @@ Decl *Sema::ActOnAccessSpecifier(AccessSpecifier Access, /// CheckOverrideControl - Check C++0x override control semantics. void Sema::CheckOverrideControl(const Decl *D) { - const CXXMethodDecl *MD = llvm::dyn_cast<CXXMethodDecl>(D); + const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D); if (!MD || !MD->isVirtual()) return; @@ -1985,7 +1985,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, // each dimension of the array. We use these index variables to subscript // the source array, and other clients (e.g., CodeGen) will perform the // necessary iteration with these index variables. - llvm::SmallVector<VarDecl *, 4> IndexVariables; + SmallVector<VarDecl *, 4> IndexVariables; QualType BaseType = Field->getType(); QualType SizeType = SemaRef.Context.getSizeType(); while (const ConstantArrayType *Array @@ -2025,7 +2025,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, // Construct the entity that we will be initializing. For an array, this // will be first element in the array, which may require several levels // of array-subscript entities. - llvm::SmallVector<InitializedEntity, 4> Entities; + SmallVector<InitializedEntity, 4> Entities; Entities.reserve(1 + IndexVariables.size()); Entities.push_back(InitializedEntity::InitializeMember(Field)); for (unsigned I = 0, N = IndexVariables.size(); I != N; ++I) @@ -2130,7 +2130,7 @@ struct BaseAndFieldInfo { bool AnyErrorsInInits; ImplicitInitializerKind IIK; llvm::DenseMap<const void *, CXXCtorInitializer*> AllBaseFields; - llvm::SmallVector<CXXCtorInitializer*, 8> AllToInit; + SmallVector<CXXCtorInitializer*, 8> AllToInit; BaseAndFieldInfo(Sema &S, CXXConstructorDecl *Ctor, bool ErrorsInInits) : S(S), Ctor(Ctor), AnyErrorsInInits(ErrorsInInits) { @@ -2426,7 +2426,7 @@ DiagnoseBaseOrMemInitializerOrder(Sema &SemaRef, // Build the list of bases and members in the order that they'll // actually be initialized. The explicit initializers should be in // this same order but may be missing things. - llvm::SmallVector<const void*, 32> IdealInitKeys; + SmallVector<const void*, 32> IdealInitKeys; const CXXRecordDecl *ClassDecl = Constructor->getParent(); @@ -3960,7 +3960,7 @@ namespace { Sema *S; CXXMethodDecl *Method; llvm::SmallPtrSet<const CXXMethodDecl *, 8> OverridenAndUsingBaseMethods; - llvm::SmallVector<CXXMethodDecl *, 8> OverloadedMethods; + SmallVector<CXXMethodDecl *, 8> OverloadedMethods; }; } @@ -3979,7 +3979,7 @@ static bool FindHiddenVirtualMethod(const CXXBaseSpecifier *Specifier, assert(Name.getNameKind() == DeclarationName::Identifier); bool foundSameNameMethod = false; - llvm::SmallVector<CXXMethodDecl *, 8> overloadedMethods; + SmallVector<CXXMethodDecl *, 8> overloadedMethods; for (Path.Decls = BaseRecord->lookup(Name); Path.Decls.first != Path.Decls.second; ++Path.Decls.first) { @@ -6076,7 +6076,7 @@ void Sema::DeclareInheritedConstructors(CXXRecordDecl *ClassDecl) { // We start with an initial pass over the base classes to collect those that // inherit constructors from. If there are none, we can forgo all further // processing. - typedef llvm::SmallVector<const RecordType *, 4> BasesVector; + typedef SmallVector<const RecordType *, 4> BasesVector; BasesVector BasesToInheritFrom; for (CXXRecordDecl::base_class_iterator BaseIt = ClassDecl->bases_begin(), BaseE = ClassDecl->bases_end(); @@ -6172,7 +6172,7 @@ void Sema::DeclareInheritedConstructors(CXXRecordDecl *ClassDecl) { if (params == maxParams) NewCtorType = BaseCtorType; else { - llvm::SmallVector<QualType, 16> Args; + SmallVector<QualType, 16> Args; for (unsigned i = 0; i < params; ++i) { Args.push_back(BaseCtorType->getArgType(i)); } @@ -6229,7 +6229,7 @@ void Sema::DeclareInheritedConstructors(CXXRecordDecl *ClassDecl) { NewCtor->setAccess(BaseCtor->getAccess()); // Build up the parameter decls and add them. - llvm::SmallVector<ParmVarDecl *, 16> ParamDecls; + SmallVector<ParmVarDecl *, 16> ParamDecls; for (unsigned i = 0; i < params; ++i) { ParamDecls.push_back(ParmVarDecl::Create(Context, NewCtor, UsingLoc, UsingLoc, @@ -7567,7 +7567,7 @@ Sema::CompleteConstructorCall(CXXConstructorDecl *Constructor, VariadicCallType CallType = Proto->isVariadic() ? VariadicConstructor : VariadicDoesNotApply; - llvm::SmallVector<Expr *, 8> AllArgs; + SmallVector<Expr *, 8> AllArgs; bool Invalid = GatherArgumentsForCall(Loc, Constructor, Proto, 0, Args, NumArgs, AllArgs, CallType); @@ -7941,7 +7941,7 @@ FinishedParams: /// have any braces. Decl *Sema::ActOnStartLinkageSpecification(Scope *S, SourceLocation ExternLoc, SourceLocation LangLoc, - llvm::StringRef Lang, + StringRef Lang, SourceLocation LBraceLoc) { LinkageSpecDecl::LanguageIDs Language; if (Lang == "\"C\"") @@ -9079,11 +9079,11 @@ void Sema::SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation) { if (!getLangOptions().CPlusPlus) return; if (ObjCInterfaceDecl *OID = ObjCImplementation->getClassInterface()) { - llvm::SmallVector<ObjCIvarDecl*, 8> ivars; + SmallVector<ObjCIvarDecl*, 8> ivars; CollectIvarsToConstructOrDestruct(OID, ivars); if (ivars.empty()) return; - llvm::SmallVector<CXXCtorInitializer*, 32> AllToInit; + SmallVector<CXXCtorInitializer*, 32> AllToInit; for (unsigned i = 0; i < ivars.size(); i++) { FieldDecl *Field = ivars[i]; if (Field->isInvalidDecl()) @@ -9200,7 +9200,7 @@ void Sema::CheckDelegatingCtorCycles() { llvm::SmallSet<CXXConstructorDecl*, 4>::iterator CI = Current.begin(), CE = Current.end(); - for (llvm::SmallVector<CXXConstructorDecl*, 4>::iterator + for (SmallVector<CXXConstructorDecl*, 4>::iterator I = DelegatingCtorDecls.begin(), E = DelegatingCtorDecls.end(); I != E; ++I) { diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 22920afe00..da3bedd12a 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -559,7 +559,7 @@ void Sema::FindProtocolDeclaration(bool WarnOnDeclarations, const IdentifierLocPair *ProtocolId, unsigned NumProtocols, - llvm::SmallVectorImpl<Decl *> &Protocols) { + SmallVectorImpl<Decl *> &Protocols) { for (unsigned i = 0; i != NumProtocols; ++i) { ObjCProtocolDecl *PDecl = LookupProtocol(ProtocolId[i].first, ProtocolId[i].second); @@ -627,8 +627,8 @@ Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc, const IdentifierLocPair *IdentList, unsigned NumElts, AttributeList *attrList) { - llvm::SmallVector<ObjCProtocolDecl*, 32> Protocols; - llvm::SmallVector<SourceLocation, 8> ProtoLocs; + SmallVector<ObjCProtocolDecl*, 32> Protocols; + SmallVector<SourceLocation, 8> ProtoLocs; for (unsigned i = 0; i != NumElts; ++i) { IdentifierInfo *Ident = IdentList[i].first; @@ -1511,7 +1511,7 @@ Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc, IdentifierInfo **IdentList, SourceLocation *IdentLocs, unsigned NumElts) { - llvm::SmallVector<ObjCInterfaceDecl*, 32> Interfaces; + SmallVector<ObjCInterfaceDecl*, 32> Interfaces; for (unsigned i = 0; i != NumElts; ++i) { // Check for another declaration kind with the same name. @@ -2334,7 +2334,7 @@ Decl *Sema::ActOnMethodDeclaration( : ObjCMethodDecl::Required, false); - llvm::SmallVector<ParmVarDecl*, 16> Params; + SmallVector<ParmVarDecl*, 16> Params; for (unsigned i = 0, e = Sel.getNumArgs(); i != e; ++i) { QualType ArgType; @@ -2521,7 +2521,7 @@ bool Sema::CheckObjCDeclScope(Decl *D) { /// instance variables of ClassName into Decls. void Sema::ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart, IdentifierInfo *ClassName, - llvm::SmallVectorImpl<Decl*> &Decls) { + SmallVectorImpl<Decl*> &Decls) { // Check that ClassName is a valid class ObjCInterfaceDecl *Class = getObjCInterfaceDecl(ClassName, DeclStart); if (!Class) { @@ -2549,7 +2549,7 @@ void Sema::ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart, } // Introduce all of these fields into the appropriate scope. - for (llvm::SmallVectorImpl<Decl*>::iterator D = Decls.begin(); + for (SmallVectorImpl<Decl*>::iterator D = Decls.begin(); D != Decls.end(); ++D) { FieldDecl *FD = cast<FieldDecl>(*D); if (getLangOptions().CPlusPlus) @@ -2651,7 +2651,7 @@ Decl *Sema::ActOnObjCExceptionDecl(Scope *S, Declarator &D) { /// CollectIvarsToConstructOrDestruct - Collect those ivars which require /// initialization. void Sema::CollectIvarsToConstructOrDestruct(ObjCInterfaceDecl *OI, - llvm::SmallVectorImpl<ObjCIvarDecl*> &Ivars) { + SmallVectorImpl<ObjCIvarDecl*> &Ivars) { for (ObjCIvarDecl *Iv = OI->all_declared_ivar_begin(); Iv; Iv= Iv->getNextIvar()) { QualType QT = Context.getBaseElementType(Iv->getType()); diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 5efc36559d..3d4846d98c 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -61,10 +61,10 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc, if (getLangOptions().CPlusPlus && isa<FunctionDecl>(D)) { // If there were any diagnostics suppressed by template argument deduction, // emit them now. - llvm::DenseMap<Decl *, llvm::SmallVector<PartialDiagnosticAt, 1> >::iterator + llvm::DenseMap<Decl *, SmallVector<PartialDiagnosticAt, 1> >::iterator Pos = SuppressedDiagnostics.find(D->getCanonicalDecl()); if (Pos != SuppressedDiagnostics.end()) { - llvm::SmallVectorImpl<PartialDiagnosticAt> &Suppressed = Pos->second; + SmallVectorImpl<PartialDiagnosticAt> &Suppressed = Pos->second; for (unsigned I = 0, N = Suppressed.size(); I != N; ++I) Diag(Suppressed[I].first, Suppressed[I].second); @@ -922,7 +922,7 @@ Sema::CreateGenericSelectionExpr(SourceLocation KeyLoc, Types, Exprs, NumAssocs, DefaultLoc, RParenLoc, ContainsUnexpandedParameterPack)); - llvm::SmallVector<unsigned, 1> CompatIndices; + SmallVector<unsigned, 1> CompatIndices; unsigned DefaultIndex = -1U; for (unsigned i = 0; i < NumAssocs; ++i) { if (!Types[i]) @@ -942,7 +942,7 @@ Sema::CreateGenericSelectionExpr(SourceLocation KeyLoc, Diag(ControllingExpr->getLocStart(), diag::err_generic_sel_multi_match) << ControllingExpr->getSourceRange() << ControllingExpr->getType() << (unsigned) CompatIndices.size(); - for (llvm::SmallVector<unsigned, 1>::iterator I = CompatIndices.begin(), + for (SmallVector<unsigned, 1>::iterator I = CompatIndices.begin(), E = CompatIndices.end(); I != E; ++I) { Diag(Types[*I]->getTypeLoc().getBeginLoc(), diag::note_compat_assoc) @@ -993,7 +993,7 @@ Sema::ActOnStringLiteral(const Token *StringToks, unsigned NumStringToks) { if (Literal.hadError) return ExprError(); - llvm::SmallVector<SourceLocation, 4> StringTokLocs; + SmallVector<SourceLocation, 4> StringTokLocs; for (unsigned i = 0; i != NumStringToks; ++i) StringTokLocs.push_back(StringToks[i].getLocation()); @@ -2408,7 +2408,7 @@ ExprResult Sema::ActOnPredefinedExpr(SourceLocation Loc, tok::TokenKind Kind) { ExprResult Sema::ActOnCharacterConstant(const Token &Tok) { llvm::SmallString<16> CharBuffer; bool Invalid = false; - llvm::StringRef ThisTok = PP.getSpelling(Tok, CharBuffer, &Invalid); + StringRef ThisTok = PP.getSpelling(Tok, CharBuffer, &Invalid); if (Invalid) return ExprError(); @@ -2492,7 +2492,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok) { Diag(Tok.getLocation(), diagnostic) << Ty - << llvm::StringRef(buffer.data(), buffer.size()); + << StringRef(buffer.data(), buffer.size()); } bool isExact = (result == APFloat::opOK); @@ -3235,7 +3235,7 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, return true; } } - llvm::SmallVector<Expr *, 8> AllArgs; + SmallVector<Expr *, 8> AllArgs; VariadicCallType CallType = Proto->isVariadic() ? VariadicFunction : VariadicDoesNotApply; if (Fn->getType()->isBlockPointerType()) @@ -3258,7 +3258,7 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, const FunctionProtoType *Proto, unsigned FirstProtoArg, Expr **Args, unsigned NumArgs, - llvm::SmallVector<Expr *, 8> &AllArgs, + SmallVector<Expr *, 8> &AllArgs, VariadicCallType CallType) { unsigned NumArgsInProto = Proto->getNumArgs(); unsigned NumArgsToCheck = NumArgs; @@ -4221,7 +4221,7 @@ ExprResult Sema::BuildVectorLiteral(SourceLocation LParenLoc, QualType Ty = TInfo->getType(); assert(Ty->isVectorType() && "Expected vector type"); - llvm::SmallVector<Expr *, 8> initExprs; + SmallVector<Expr *, 8> initExprs; const VectorType *VTy = Ty->getAs<VectorType>(); unsigned numElems = Ty->getAs<VectorType>()->getNumElements(); @@ -8091,8 +8091,8 @@ ExprResult Sema::BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, bool DidWarnAboutNonPOD = false; QualType CurrentType = ArgTy; typedef OffsetOfExpr::OffsetOfNode OffsetOfNode; - llvm::SmallVector<OffsetOfNode, 4> Comps; - llvm::SmallVector<Expr*, 4> Exprs; + SmallVector<OffsetOfNode, 4> Comps; + SmallVector<Expr*, 4> Exprs; for (unsigned i = 0; i != NumComponents; ++i) { const OffsetOfComponent &OC = CompPtr[i]; if (OC.isBrackets) { @@ -8351,7 +8351,7 @@ void Sema::ActOnBlockArguments(Declarator &ParamInfo, Scope *CurScope) { CurBlock->ReturnType = RetTy; // Push block parameters from the declarator if we had them. - llvm::SmallVector<ParmVarDecl*, 8> Params; + SmallVector<ParmVarDecl*, 8> Params; if (ExplicitSignature) { for (unsigned I = 0, E = ExplicitSignature.getNumArgs(); I != E; ++I) { ParmVarDecl *Param = ExplicitSignature.getArg(I); diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index e804fcd60c..0225c6629e 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -1058,7 +1058,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, UsualArrayDeleteWantsSize = doesUsualArrayDeleteWantSize(*this, StartLoc, AllocType); - llvm::SmallVector<Expr *, 8> AllPlaceArgs; + SmallVector<Expr *, 8> AllPlaceArgs; if (OperatorNew) { // Add default arguments, if any. const FunctionProtoType *Proto = @@ -1246,7 +1246,7 @@ bool Sema::FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, // 3) The first argument is always size_t. Append the arguments from the // placement form. - llvm::SmallVector<Expr*, 8> AllocArgs(1 + NumPlaceArgs); + SmallVector<Expr*, 8> AllocArgs(1 + NumPlaceArgs); // We don't care about the actual value of this argument. // FIXME: Should the Sema create the expression and embed it in the syntax // tree? Or should the consumer just recalculate the value? @@ -1325,7 +1325,7 @@ bool Sema::FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, FoundDelete.suppressDiagnostics(); - llvm::SmallVector<std::pair<DeclAccessPair,FunctionDecl*>, 2> Matches; + SmallVector<std::pair<DeclAccessPair,FunctionDecl*>, 2> Matches; // Whether we're looking for a placement operator delete is dictated // by whether we selected a placement operator new, not by whether @@ -1352,7 +1352,7 @@ bool Sema::FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, const FunctionProtoType *Proto = OperatorNew->getType()->getAs<FunctionProtoType>(); - llvm::SmallVector<QualType, 4> ArgTypes; + SmallVector<QualType, 4> ArgTypes; ArgTypes.push_back(Context.VoidPtrTy); for (unsigned I = 1, N = Proto->getNumArgs(); I < N; ++I) ArgTypes.push_back(Proto->getArgType(I)); @@ -1691,7 +1691,7 @@ bool Sema::FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD, Found.suppressDiagnostics(); - llvm::SmallVector<DeclAccessPair,4> Matches; + SmallVector<DeclAccessPair,4> Matches; for (LookupResult::iterator F = Found.begin(), FEnd = Found.end(); F != FEnd; ++F) { NamedDecl *ND = (*F)->getUnderlyingDecl(); @@ -1727,7 +1727,7 @@ bool Sema::FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD, Diag(StartLoc, diag::err_ambiguous_suitable_delete_member_function_found) << Name << RD; - for (llvm::SmallVectorImpl<DeclAccessPair>::iterator + for (SmallVectorImpl<DeclAccessPair>::iterator F = Matches.begin(), FEnd = Matches.end(); F != FEnd; ++F) Diag((*F)->getUnderlyingDecl()->getLocation(), diag::note_member_declared_here) << Name; @@ -1792,7 +1792,7 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, PDiag(diag::err_delete_incomplete_class_type))) return ExprError(); - llvm::SmallVector<CXXConversionDecl*, 4> ObjectPtrConversions; + SmallVector<CXXConversionDecl*, 4> ObjectPtrConversions; CXXRecordDecl *RD = cast<CXXRecordDecl>(Record->getDecl()); const UnresolvedSetImpl *Conversions = RD->getVisibleConversionFunctions(); @@ -3838,9 +3838,9 @@ QualType Sema::FindCompositePointerType(SourceLocation Loc, // conversions in both directions. If only one works, or if the two composite // types are the same, we have succeeded. // FIXME: extended qualifiers? - typedef llvm::SmallVector<unsigned, 4> QualifierVector; + typedef SmallVector<unsigned, 4> QualifierVector; QualifierVector QualifierUnion; - typedef llvm::SmallVector<std::pair<const Type *, const Type *>, 4> + typedef SmallVector<std::pair<const Type *, const Type *>, 4> ContainingClassVector; ContainingClassVector MemberOfClass; QualType Composite1 = Context.getCanonicalType(T1), @@ -4172,7 +4172,7 @@ Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, if (OpKind == tok::arrow) { // The set of types we've considered so far. llvm::SmallPtrSet<CanQualType,8> CTypes; - llvm::SmallVector<SourceLocation, 8> Locations; + SmallVector<SourceLocation, 8> Locations; CTypes.insert(Context.getCanonicalType(BaseType)); while (BaseType->isRecordType()) { diff --git a/lib/Sema/SemaExprMember.cpp b/lib/Sema/SemaExprMember.cpp index 2488dc8849..e5940c667f 100644 --- a/lib/Sema/SemaExprMember.cpp +++ b/lib/Sema/SemaExprMember.cpp @@ -298,7 +298,7 @@ CheckExtVectorComponent(Sema &S, QualType baseType, ExprValueKind &VK, // We didn't get to the end of the string. This means the component names // didn't come from the same set *or* we encountered an illegal name. S.Diag(OpLoc, diag::err_ext_vector_component_name_illegal) - << llvm::StringRef(compStr, 1) << SourceRange(CompLoc); + << StringRef(compStr, 1) << SourceRange(CompLoc); return QualType(); } diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index 02a4682cc8..fccea7c0e1 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -42,7 +42,7 @@ ExprResult Sema::ParseObjCStringLiteral(SourceLocation *AtLocs, if (NumStrings != 1) { // Concatenate objc strings. llvm::SmallString<128> StrBuf; - llvm::SmallVector<SourceLocation, 8> StrLocs; + SmallVector<SourceLocation, 8> StrLocs; for (unsigned i = 0; i != NumStrings; ++i) { S = Strings[i]; diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 9fbcbab0b7..78eb6d3e8d 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -1269,7 +1269,7 @@ static void ExpandAnonymousFieldDesignator(Sema &SemaRef, typedef DesignatedInitExpr::Designator Designator; // Build the replacement designators. - llvm::SmallVector<Designator, 4> Replacements; + SmallVector<Designator, 4> Replacements; for (IndirectFieldDecl::chain_iterator PI = IndirectField->chain_begin(), PE = IndirectField->chain_end(); PI != PE; ++PI) { if (PI + 1 == PE) @@ -1915,8 +1915,8 @@ ExprResult Sema::ActOnDesignatedInitializer(Designation &Desig, typedef DesignatedInitExpr::Designator ASTDesignator; bool Invalid = false; - llvm::SmallVector<ASTDesignator, 32> Designators; - llvm::SmallVector<Expr *, 32> InitExpressions; + SmallVector<ASTDesignator, 32> Designators; + SmallVector<Expr *, 32> InitExpressions; // Build designators and check array designator expressions. for (unsigned Idx = 0; Idx < Desig.getNumDesignators(); ++Idx) { @@ -3577,7 +3577,7 @@ InitializationSequence::InitializationSequence(Sema &S, } InitializationSequence::~InitializationSequence() { - for (llvm::SmallVectorImpl<Step>::iterator Step = Steps.begin(), + for (SmallVectorImpl<Step>::iterator Step = Steps.begin(), StepEnd = Steps.end(); Step != StepEnd; ++Step) Step->Destroy(); @@ -4769,7 +4769,7 @@ bool InitializationSequence::Diagnose(Sema &S, return true; } -void InitializationSequence::dump(llvm::raw_ostream &OS) const { +void InitializationSequence::dump(raw_ostream &OS) const { switch (SequenceKind) { case FailedSequence: { OS << "Failed sequence: "; diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index f18b6ecdfe..c5ba95a1f4 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -87,7 +87,7 @@ namespace { /// A collection of using directives, as used by C++ unqualified /// lookup. class UnqualUsingDirectiveSet { - typedef llvm::SmallVector<UnqualUsingEntry, 8> ListTy; + typedef SmallVector<UnqualUsingEntry, 8> ListTy; ListTy list; llvm::SmallPtrSet<DeclContext*, 8> visited; @@ -148,7 +148,7 @@ namespace { // by its using directives, transitively) as if they appeared in // the given effective context. void addUsingDirectives(DeclContext *DC, DeclContext *EffectiveDC) { - llvm::SmallVector<DeclContext*,4> queue; + SmallVector<DeclContext*,4> queue; while (true) { DeclContext::udir_iterator I, End; for (llvm::tie(I, End) = DC->getUsingDirectives(); I != End; ++I) { @@ -461,7 +461,7 @@ void LookupResult::setAmbiguousBaseSubobjectTypes(CXXBasePaths &P) { setAmbiguous(AmbiguousBaseSubobjectTypes); } -void LookupResult::print(llvm::raw_ostream &Out) { +void LookupResult::print(raw_ostream &Out) { Out << Decls.size() << " result(s)"; if (isAmbiguous()) Out << ", ambiguous"; if (Paths) Out << ", base paths present"; @@ -1188,7 +1188,7 @@ static bool LookupQualifiedNameInUsingDirectives(Sema &S, LookupResult &R, // We have not yet looked into these namespaces, much less added // their "using-children" to the queue. - llvm::SmallVector<NamespaceDecl*, 8> Queue; + SmallVector<NamespaceDecl*, 8> Queue; // We have already looked into the initial namespace; seed the queue // with its using-children. @@ -1803,7 +1803,7 @@ addAssociatedClassesAndNamespaces(AssociatedLookup &Result, // Add direct and indirect base classes along with their associated // namespaces. - llvm::SmallVector<CXXRecordDecl *, 32> Bases; + SmallVector<CXXRecordDecl *, 32> Bases; Bases.push_back(Class); while (!Bases.empty()) { // Pop this class off the stack. @@ -1853,7 +1853,7 @@ addAssociatedClassesAndNamespaces(AssociatedLookup &Result, QualType Ty) { // the types do not contribute to this set. The sets of namespaces // and classes are determined in the following way: - llvm::SmallVector<const Type *, 16> Queue; + SmallVector<const Type *, 16> Queue; const Type *T = Ty->getCanonicalTypeInternal().getTypePtr(); while (true) { @@ -2988,7 +2988,7 @@ static const unsigned MaxTypoDistanceResultSets = 5; class TypoCorrectionConsumer : public VisibleDeclConsumer { /// \brief The name written that is a typo in the source. - llvm::StringRef Typo; + StringRef Typo; /// \brief The results found that have the smallest edit distance /// found (so far) with the typo name. @@ -3017,9 +3017,9 @@ public: } virtual void FoundDecl(NamedDecl *ND, NamedDecl *Hiding, bool InBaseClass); - void FoundName(llvm::StringRef Name); - void addKeywordResult(llvm::StringRef Keyword); - void addName(llvm::StringRef Name, NamedDecl *ND, unsigned Distance, + void FoundName(StringRef Name); + void addKeywordResult(StringRef Keyword); + void addName(StringRef Name, NamedDecl *ND, unsigned Distance, NestedNameSpecifier *NNS=NULL); void addCorrection(TypoCorrection Correction); @@ -3031,7 +3031,7 @@ public: unsigned size() const { return BestResults.size(); } bool empty() const { return BestResults.empty(); } - TypoCorrection &operator[](llvm::StringRef Name) { + TypoCorrection &operator[](StringRef Name) { return (*BestResults.begin()->second)[Name]; } @@ -3062,7 +3062,7 @@ void TypoCorrectionConsumer::FoundDecl(NamedDecl *ND, NamedDecl *Hiding, FoundName(Name->getName()); } -void TypoCorrectionConsumer::FoundName(llvm::StringRef Name) { +void TypoCorrectionConsumer::FoundName(StringRef Name) { // Use a simple length-based heuristic to determine the minimum possible // edit distance. If the minimum isn't good enough, bail out early. unsigned MinED = abs((int)Name.size() - (int)Typo.size()); @@ -3088,7 +3088,7 @@ void TypoCorrectionConsumer::FoundName(llvm::StringRef Name) { addName(Name, NULL, ED); } -void TypoCorrectionConsumer::addKeywordResult(llvm::StringRef Keyword) { +void TypoCorrectionConsumer::addKeywordResult(StringRef Keyword) { // Compute the edit distance between the typo and this keyword. // If this edit distance is not worse than the best edit // distance we've seen so far, add it to the list of results. @@ -3102,7 +3102,7 @@ void TypoCorrectionConsumer::addKeywordResult(llvm::StringRef Keyword) { addName(Keyword, TypoCorrection::KeywordDecl(), ED); } -void TypoCorrectionConsumer::addName(llvm::StringRef Name, +void TypoCorrectionConsumer::addName(StringRef Name, NamedDecl *ND, unsigned Distance, NestedNameSpecifier *NNS) { @@ -3111,7 +3111,7 @@ void TypoCorrectionConsumer::addName(llvm::StringRef Name, } void TypoCorrectionConsumer::addCorrection(TypoCorrection Correction) { - llvm::StringRef Name = Correction.getCorrectionAsIdentifierInfo()->getName(); + StringRef Name = Correction.getCorrectionAsIdentifierInfo()->getName(); TypoResultsMap *& Map = BestResults[Correction.getEditDistance()]; if (!Map) Map = new TypoResultsMap; @@ -3145,8 +3145,8 @@ class SpecifierInfo { : DeclCtx(Ctx), NameSpecifier(NNS), EditDistance(ED) {} }; -typedef llvm::SmallVector<DeclContext*, 4> DeclContextList; -typedef llvm::SmallVector<SpecifierInfo, 16> SpecifierInfoList; +typedef SmallVector<DeclContext*, 4> DeclContextList; +typedef SmallVector<SpecifierInfo, 16> SpecifierInfoList; class NamespaceSpecifierSet { ASTContext &Context; @@ -3196,14 +3196,14 @@ DeclContextList NamespaceSpecifierSet::BuildContextChain(DeclContext *Start) { } void NamespaceSpecifierSet::SortNamespaces() { - llvm::SmallVector<unsigned, 4> sortedDistances; + SmallVector<unsigned, 4> sortedDistances; sortedDistances.append(Distances.begin(), Distances.end()); if (sortedDistances.size() > 1) std::sort(sortedDistances.begin(), sortedDistances.end()); Specifiers.clear(); - for (llvm::SmallVector<unsigned, 4>::iterator DI = sortedDistances.begin(), + for (SmallVector<unsigned, 4>::iterator DI = sortedDistances.begin(), DIEnd = sortedDistances.end(); DI != DIEnd; ++DI) { SpecifierInfoList &SpecList = DistanceMap[*DI]; @@ -3580,7 +3580,7 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName, = Context.Idents.getExternalIdentifierLookup()) { llvm::OwningPtr<IdentifierIterator> Iter(External->getIdentifiers()); do { - llvm::StringRef Name = Iter->Next(); + StringRef Name = Iter->Next(); if (Name.empty()) break; @@ -3624,7 +3624,7 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName, if (getLangOptions().CPlusPlus) { // Load any externally-known namespaces. if (ExternalSource && !LoadedExternalKnownNamespaces) { - llvm::SmallVector<NamespaceDecl *, 4> ExternalKnownNamespaces; + SmallVector<NamespaceDecl *, 4> ExternalKnownNamespaces; LoadedExternalKnownNamespaces = true; ExternalSource->ReadKnownNamespaces(ExternalKnownNamespaces); for (unsigned I = 0, N = ExternalKnownNamespaces.size(); I != N; ++I) diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 793e427629..c4586fbfd8 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -258,7 +258,7 @@ isPointerConversionToVoidPointer(ASTContext& Context) const { /// DebugPrint - Print this standard conversion sequence to standard /// error. Useful for debugging overloading issues. void StandardConversionSequence::DebugPrint() const { - llvm::raw_ostream &OS = llvm::errs(); + raw_ostream &OS = llvm::errs(); bool PrintedSomething = false; if (First != ICK_Identity) { OS << GetImplicitConversionName(First); @@ -297,7 +297,7 @@ void StandardConversionSequence::DebugPrint() const { /// DebugPrint - Print this user-defined conversion sequence to standard /// error. Useful for debugging overloading issues. void UserDefinedConversionSequence::DebugPrint() const { - llvm::raw_ostream &OS = llvm::errs(); + raw_ostream &OS = llvm::errs(); if (Before.First || Before.Second || Before.Third) { Before.DebugPrint(); OS << " -> "; @@ -312,7 +312,7 @@ void UserDefinedConversionSequence::DebugPrint() const { /// DebugPrint - Print this implicit conversion sequence to standard /// error. Useful for debugging overloading issues. void ImplicitConversionSequence::DebugPrint() const { - llvm::raw_ostream &OS = llvm::errs(); + raw_ostream &OS = llvm::errs(); switch (ConversionKind) { case StandardConversion: OS << "Standard conversion: "; @@ -5227,7 +5227,7 @@ class BuiltinOperatorOverloadBuilder { unsigned NumArgs; Qualifiers VisibleTypeConversionsQuals; bool HasArithmeticOrEnumeralCandidateType; - llvm::SmallVectorImpl<BuiltinCandidateTypeSet> &CandidateTypes; + SmallVectorImpl<BuiltinCandidateTypeSet> &CandidateTypes; OverloadCandidateSet &CandidateSet; // Define some constants used to index and iterate over the arithemetic types @@ -5363,7 +5363,7 @@ public: Sema &S, Expr **Args, unsigned NumArgs, Qualifiers VisibleTypeConversionsQuals, bool HasArithmeticOrEnumeralCandidateType, - llvm::SmallVectorImpl<BuiltinCandidateTypeSet> &CandidateTypes, + SmallVectorImpl<BuiltinCandidateTypeSet> &CandidateTypes, OverloadCandidateSet &CandidateSet) : S(S), Args(Args), NumArgs(NumArgs), VisibleTypeConversionsQuals(VisibleTypeConversionsQuals), @@ -6232,7 +6232,7 @@ Sema::AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, bool HasNonRecordCandidateType = false; bool HasArithmeticOrEnumeralCandidateType = false; - llvm::SmallVector<BuiltinCandidateTypeSet, 2> CandidateTypes; + SmallVector<BuiltinCandidateTypeSet, 2> CandidateTypes; for (unsigned ArgIdx = 0; ArgIdx < NumArgs; ++ArgIdx) { CandidateTypes.push_back(BuiltinCandidateTypeSet(*this)); CandidateTypes[ArgIdx].AddTypesConvertedFrom(Args[ArgIdx]->getType(), @@ -7024,7 +7024,7 @@ void DiagnoseBadConversion(Sema &S, OverloadCandidate *Cand, unsigned I) { << (unsigned) (Cand->Fix.Kind); // If we can fix the conversion, suggest the FixIts. - for (llvm::SmallVector<FixItHint, 1>::iterator + for (SmallVector<FixItHint, 1>::iterator HI = Cand->Fix.Hints.begin(), HE = Cand->Fix.Hints.end(); HI != HE; ++HI) FDiag << *HI; @@ -7537,7 +7537,7 @@ void OverloadCandidateSet::NoteCandidates(Sema &S, SourceLocation OpLoc) { // Sort the candidates by viability and position. Sorting directly would // be prohibitive, so we make a set of pointers and sort those. - llvm::SmallVector<OverloadCandidate*, 32> Cands; + SmallVector<OverloadCandidate*, 32> Cands; if (OCD == OCD_AllCandidates) Cands.reserve(size()); for (iterator Cand = begin(), LastCand = end(); Cand != LastCand; ++Cand) { if (Cand->Viable) @@ -7556,7 +7556,7 @@ void OverloadCandidateSet::NoteCandidates(Sema &S, bool ReportedAmbiguousConversions = false; - llvm::SmallVectorImpl<OverloadCandidate*>::iterator I, E; + SmallVectorImpl<OverloadCandidate*>::iterator I, E; const Diagnostic::OverloadsShown ShowOverloads = S.Diags.getShowOverloads(); unsigned CandsShown = 0; for (I = Cands.begin(), E = Cands.end(); I != E; ++I) { @@ -7638,7 +7638,7 @@ class AddressOfFunctionResolver OverloadExpr::FindResult OvlExprInfo; OverloadExpr *OvlExpr; TemplateArgumentListInfo OvlExplicitTemplateArgs; - llvm::SmallVector<std::pair<DeclAccessPair, FunctionDecl*>, 4> Matches; + SmallVector<std::pair<DeclAccessPair, FunctionDecl*>, 4> Matches; public: AddressOfFunctionResolver(Sema &S, Expr* SourceExpr, diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 7acfc985db..3b46f1dc2f 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -533,7 +533,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, // Accumulate all of the case values in a vector so that we can sort them // and detect duplicates. This vector contains the APInt for the case after // it has been converted to the condition type. - typedef llvm::SmallVector<std::pair<llvm::APSInt, CaseStmt*>, 64> CaseValsTy; + typedef SmallVector<std::pair<llvm::APSInt, CaseStmt*>, 64> CaseValsTy; CaseValsTy CaseVals; // Keep track of any GNU case ranges we see. The APSInt is the low value. @@ -750,7 +750,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, // If switch has default case, then ignore it. if (!CaseListIsErroneous && !HasConstantCond && ET) { const EnumDecl *ED = ET->getDecl(); - typedef llvm::SmallVector<std::pair<llvm::APSInt, EnumConstantDecl*>, 64> + typedef SmallVector<std::pair<llvm::APSInt, EnumConstantDecl*>, 64> EnumValsTy; EnumValsTy EnumVals; @@ -806,7 +806,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, CaseRangesTy::const_iterator RI = CaseRanges.begin(); bool hasCasesNotInSwitch = false; - llvm::SmallVector<DeclarationName,8> UnhandledNames; + SmallVector<DeclarationName,8> UnhandledNames; for (EnumValsTy::const_iterator EI = EnumVals.begin(); EI != EIend; EI++){ // Drop unneeded case values @@ -1011,7 +1011,7 @@ Sema::ActOnObjCForCollectionStmt(SourceLocation ForLoc, << SecondType << Second->getSourceRange(); else if (const ObjCObjectPointerType *OPT = SecondType->getAsObjCInterfacePointerType()) { - llvm::SmallVector<IdentifierInfo *, 4> KeyIdents; + SmallVector<IdentifierInfo *, 4> KeyIdents; IdentifierInfo* selIdent = &Context.Idents.get("countByEnumeratingWithState"); KeyIdents.push_back(selIdent); @@ -1910,7 +1910,7 @@ StmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc, bool IsSimple, StringLiteral *AsmString = cast<StringLiteral>(asmString); StringLiteral **Clobbers = reinterpret_cast<StringLiteral**>(clobbers.get()); - llvm::SmallVector<TargetInfo::ConstraintInfo, 4> OutputConstraintInfos; + SmallVector<TargetInfo::ConstraintInfo, 4> OutputConstraintInfos; // The parser verifies that there is a string literal here. if (AsmString->isWide()) @@ -1923,7 +1923,7 @@ StmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc, bool IsSimple, return StmtError(Diag(Literal->getLocStart(),diag::err_asm_wide_character) << Literal->getSourceRange()); - llvm::StringRef OutputName; + StringRef OutputName; if (Names[i]) OutputName = Names[i]->getName(); @@ -1944,7 +1944,7 @@ StmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc, bool IsSimple, OutputConstraintInfos.push_back(Info); } - llvm::SmallVector<TargetInfo::ConstraintInfo, 4> InputConstraintInfos; + SmallVector<TargetInfo::ConstraintInfo, 4> InputConstraintInfos; for (unsigned i = NumOutputs, e = NumOutputs + NumInputs; i != e; i++) { StringLiteral *Literal = Constraints[i]; @@ -1952,7 +1952,7 @@ StmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc, bool IsSimple, return StmtError(Diag(Literal->getLocStart(),diag::err_asm_wide_character) << Literal->getSourceRange()); - llvm::StringRef InputName; + StringRef InputName; if (Names[i]) InputName = Names[i]->getName(); @@ -1999,7 +1999,7 @@ StmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc, bool IsSimple, return StmtError(Diag(Literal->getLocStart(),diag::err_asm_wide_character) << Literal->getSourceRange()); - llvm::StringRef Clobber = Literal->getString(); + StringRef Clobber = Literal->getString(); if (!Context.Target.isValidClobber(Clobber)) return StmtError(Diag(Literal->getLocStart(), @@ -2012,7 +2012,7 @@ StmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc, bool IsSimple, AsmString, NumClobbers, Clobbers, RParenLoc); // Validate the asm string, ensuring it makes sense given the operands we // have. - llvm::SmallVector<AsmStmt::AsmStringPiece, 8> Pieces; + SmallVector<AsmStmt::AsmStringPiece, 8> Pieces; unsigned DiagOffs; if (unsigned DiagID = NS->AnalyzeAsmString(Pieces, Context, DiagOffs)) { Diag(getLocationOfStringLiteralByte(AsmString, DiagOffs), DiagID) @@ -2279,10 +2279,10 @@ Sema::ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, "The parser shouldn't call this if there are no handlers."); Stmt **Handlers = RawHandlers.get(); - llvm::SmallVector<TypeWithHandler, 8> TypesWithHandlers; + SmallVector<TypeWithHandler, 8> TypesWithHandlers; for (unsigned i = 0; i < NumHandlers; ++i) { - CXXCatchStmt *Handler = llvm::cast<CXXCatchStmt>(Handlers[i]); + CXXCatchStmt *Handler = cast<CXXCatchStmt>(Handlers[i]); if (!Handler->getExceptionDecl()) { if (i < NumHandlers - 1) return StmtError(Diag(Handler->getLocStart(), diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 3ac190e1d4..ceab7e93ac 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -1519,7 +1519,7 @@ Sema::MatchTemplateParametersToScopeSpecifier(SourceLocation DeclStartLoc, // The sequence of nested types to which we will match up the template // parameter lists. We first build this list by starting with the type named // by the nested-name-specifier and walking out until we run out of types. - llvm::SmallVector<QualType, 4> NestedTypes; + SmallVector<QualType, 4> NestedTypes; QualType T; if (SS.getScopeRep()) { if (CXXRecordDecl *Record @@ -1888,7 +1888,7 @@ QualType Sema::CheckTemplateIdType(TemplateName Name, // Check that the template argument list is well-formed for this // template. - llvm::SmallVector<TemplateArgument, 4> Converted; + SmallVector<TemplateArgument, 4> Converted; if (CheckTemplateArgumentList(Template, TemplateLoc, TemplateArgs, false, Converted)) return QualType(); @@ -2327,7 +2327,7 @@ TemplateNameKind Sema::ActOnDependentTemplateName(Scope *S, bool Sema::CheckTemplateTypeArgument(TemplateTypeParmDecl *Param, const TemplateArgumentLoc &AL, - llvm::SmallVectorImpl<TemplateArgument> &Converted) { + SmallVectorImpl<TemplateArgument> &Converted) { const TemplateArgument &Arg = AL.getArgument(); // Check template type parameter. @@ -2408,7 +2408,7 @@ SubstDefaultTemplateArgument(Sema &SemaRef, SourceLocation TemplateLoc, SourceLocation RAngleLoc, TemplateTypeParmDecl *Param, - llvm::SmallVectorImpl<TemplateArgument> &Converted) { + SmallVectorImpl<TemplateArgument> &Converted) { TypeSourceInfo *ArgType = Param->getDefaultArgumentInfo(); // If the argument type is dependent, instantiate it now based @@ -2461,7 +2461,7 @@ SubstDefaultTemplateArgument(Sema &SemaRef, SourceLocation TemplateLoc, SourceLocation RAngleLoc, NonTypeTemplateParmDecl *Param, - llvm::SmallVectorImpl<TemplateArgument> &Converted) { + SmallVectorImpl<TemplateArgument> &Converted) { TemplateArgumentList TemplateArgs(TemplateArgumentList::OnStack, Converted.data(), Converted.size()); @@ -2507,7 +2507,7 @@ SubstDefaultTemplateArgument(Sema &SemaRef, SourceLocation TemplateLoc, SourceLocation RAngleLoc, TemplateTemplateParmDecl *Param, - llvm::SmallVectorImpl<TemplateArgument> &Converted, + SmallVectorImpl<TemplateArgument> &Converted, NestedNameSpecifierLoc &QualifierLoc) { TemplateArgumentList TemplateArgs(TemplateArgumentList::OnStack, Converted.data(), Converted.size()); @@ -2543,7 +2543,7 @@ Sema::SubstDefaultTemplateArgumentIfAvailable(TemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, Decl *Param, - llvm::SmallVectorImpl<TemplateArgument> &Converted) { + SmallVectorImpl<TemplateArgument> &Converted) { if (TemplateTypeParmDecl *TypeParm = dyn_cast<TemplateTypeParmDecl>(Param)) { if (!TypeParm->hasDefaultArgument()) return TemplateArgumentLoc(); @@ -2629,7 +2629,7 @@ bool Sema::CheckTemplateArgument(NamedDecl *Param, SourceLocation TemplateLoc, SourceLocation RAngleLoc, unsigned ArgumentPackIndex, - llvm::SmallVectorImpl<TemplateArgument> &Converted, + SmallVectorImpl<TemplateArgument> &Converted, CheckTemplateArgumentKind CTAK) { // Check template type parameters. if (TemplateTypeParmDecl *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) @@ -2834,7 +2834,7 @@ bool Sema::CheckTemplateArgumentList(TemplateDecl *Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateArgs, - llvm::SmallVectorImpl<TemplateArgument> &Converted) { + SmallVectorImpl<TemplateArgument> &Converted) { TemplateParameterList *Params = Template->getTemplateParameters(); unsigned NumParams = Params->size(); unsigned NumArgs = TemplateArgs.size(); @@ -2871,7 +2871,7 @@ bool Sema::CheckTemplateArgumentList(TemplateDecl *Template, // corresponding parameter declared by the template in its // template-parameter-list. bool isTemplateTemplateParameter = isa<TemplateTemplateParmDecl>(Template); - llvm::SmallVector<TemplateArgument, 2> ArgumentPack; + SmallVector<TemplateArgument, 2> ArgumentPack; TemplateParameterList::iterator Param = Params->begin(), ParamEnd = Params->end(); unsigned ArgIdx = 0; @@ -4653,7 +4653,7 @@ static bool CheckNonTypeClassTemplatePartialSpecializationArgs(Sema &S, /// \returns true if there was an error, false otherwise. static bool CheckClassTemplatePartialSpecializationArgs(Sema &S, TemplateParameterList *TemplateParams, - llvm::SmallVectorImpl<TemplateArgument> &TemplateArgs) { + SmallVectorImpl<TemplateArgument> &TemplateArgs) { const TemplateArgument *ArgList = TemplateArgs.data(); for (unsigned I = 0, N = TemplateParams->size(); I != N; ++I) { @@ -4821,7 +4821,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, // Check that the template argument list is well-formed for this // template. - llvm::SmallVector<TemplateArgument, 4> Converted; + SmallVector<TemplateArgument, 4> Converted; if (CheckTemplateArgumentList(ClassTemplate, TemplateNameLoc, TemplateArgs, false, Converted)) return true; @@ -4956,7 +4956,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, // partial specialization are deducible from the template // arguments. If not, this class template partial specialization // will never be used. - llvm::SmallVector<bool, 8> DeducibleParams; + SmallVector<bool, 8> DeducibleParams; DeducibleParams.resize(TemplateParams->size()); MarkUsedTemplateParameters(Partial->getTemplateArgs(), true, TemplateParams->getDepth(), @@ -5793,7 +5793,7 @@ Sema::ActOnExplicitInstantiation(Scope *S, // Check that the template argument list is well-formed for this // template. - llvm::SmallVector<TemplateArgument, 4> Converted; + SmallVector<TemplateArgument, 4> Converted; if (CheckTemplateArgumentList(ClassTemplate, TemplateNameLoc, TemplateArgs, false, Converted)) return true; diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index dcb4ff2860..888d3bee5f 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/lib/Sema/SemaTemplateDeduction.cpp @@ -85,7 +85,7 @@ DeduceTemplateArguments(Sema &S, const TemplateArgument &Param, TemplateArgument Arg, TemplateDeductionInfo &Info, - llvm::SmallVectorImpl<DeducedTemplateArgument> &Deduced); + SmallVectorImpl<DeducedTemplateArgument> &Deduced); /// \brief Whether template argument deduction for two reference parameters /// resulted in the argument type, parameter type, or neither type being more @@ -117,10 +117,10 @@ DeduceTemplateArguments(Sema &S, QualType Param, QualType Arg, TemplateDeductionInfo &Info, - llvm::SmallVectorImpl<DeducedTemplateArgument> &Deduced, + SmallVectorImpl<DeducedTemplateArgument> &Deduced, unsigned TDF, bool PartialOrdering = false, - llvm::SmallVectorImpl<RefParamPartialOrderingComparison> * + SmallVectorImpl<RefParamPartialOrderingComparison> * RefParamComparisons = 0); static Sema::TemplateDeductionResult @@ -129,7 +129,7 @@ DeduceTemplateArguments(Sema &S, const TemplateArgument *Params, unsigned NumParams, const TemplateArgument *Args, unsigned NumArgs, TemplateDeductionInfo &Info, - llvm::SmallVectorImpl<DeducedTemplateArgument> &Deduced, + SmallVectorImpl<DeducedTemplateArgument> &Deduced, bool NumberOfArgumentsMustMatch = true); /// \brief If the given expression is of a form that permits the deduction @@ -288,7 +288,7 @@ DeduceNonTypeTemplateArgument(Sema &S, llvm::APSInt Value, QualType ValueType, bool DeducedFromArrayBound, TemplateDeductionInfo &Info, - llvm::SmallVectorImpl<DeducedTemplateArgument> &Deduced) { + SmallVectorImpl<DeducedTemplateArgument> &Deduced) { assert(NTTP->getDepth() == 0 && "Cannot deduce non-type template argument with depth > 0"); @@ -316,7 +316,7 @@ DeduceNonTypeTemplateArgument(Sema &S, NonTypeTemplateParmDecl *NTTP, Expr *Value, TemplateDeductionInfo &Info, - llvm::SmallVectorImpl<DeducedTemplateArgument> &Deduced) { + SmallVectorImpl<DeducedTemplateArgument> &Deduced) { assert(NTTP->getDepth() == 0 && "Cannot deduce non-type template argument with depth > 0"); assert((Value->isTypeDependent() || Value->isValueDependent()) && @@ -347,7 +347,7 @@ DeduceNonTypeTemplateArgument(Sema &S, NonTypeTemplateParmDecl *NTTP, Decl *D, TemplateDeductionInfo &Info, - llvm::SmallVectorImpl<DeducedTemplateArgument> &Deduced) { + SmallVectorImpl<DeducedTemplateArgument> &Deduced) { assert(NTTP->getDepth() == 0 && "Cannot deduce non-type template argument with depth > 0"); @@ -372,7 +372,7 @@ DeduceTemplateArguments(Sema &S, TemplateName Param, TemplateName Arg, TemplateDeductionInfo &Info, - llvm::SmallVectorImpl<DeducedTemplateArgument> &Deduced) { + SmallVectorImpl<DeducedTemplateArgument> &Deduced) { TemplateDecl *ParamDecl = Param.getAsTemplateDecl(); if (!ParamDecl) { // The parameter type is dependent and is not a template template parameter, @@ -431,7 +431,7 @@ DeduceTemplateArguments(Sema &S, const TemplateSpecializationType *Param, QualType Arg, TemplateDeductionInfo &Info, - llvm::SmallVectorImpl<DeducedTemplateArgument> &Deduced) { + SmallVectorImpl<DeducedTemplateArgument> &Deduced) { assert(Arg.isCanonical() && "Argument type must be canonical"); // Check whether the template argument is a dependent template-id. @@ -546,11 +546,11 @@ static TemplateParameter makeTemplateParameter(Decl *D) { /// \brief Prepare to perform template argument deduction for all of the /// arguments in a set of argument packs. static void PrepareArgumentPackDeduction(Sema &S, - llvm::SmallVectorImpl<DeducedTemplateArgument> &Deduced, - const llvm::SmallVectorImpl<unsigned> &PackIndices, - llvm::SmallVectorImpl<DeducedTemplateArgument> &SavedPacks, - llvm::SmallVectorImpl< - llvm::SmallVector<DeducedTemplateArgument, 4> > &NewlyDeducedPacks) { + SmallVectorImpl<DeducedTemplateArgument> &Deduced, + const SmallVectorImpl<unsigned> &PackIndices, + SmallVectorImpl<DeducedTemplateArgument> &SavedPacks, + SmallVectorImpl< + SmallVector<DeducedTemplateArgument, 4> > &NewlyDeducedPacks) { // Save the deduced template arguments for each parameter pack expanded // by this pack expansion, then clear out the deduction. for (unsigned I = 0, N = PackIndices.size(); I != N; ++I) { @@ -581,11 +581,11 @@ static Sema::TemplateDeductionResult FinishArgumentPackDeduction(Sema &S, TemplateParameterList *TemplateParams, bool HasAnyArguments, - llvm::SmallVectorImpl<DeducedTemplateArgument> &Deduced, - const llvm::SmallVectorImpl<unsigned> &PackIndices, - llvm::SmallVectorImpl<DeducedTemplateArgument> &SavedPacks, - llvm::SmallVectorImpl< - llvm::SmallVector<DeducedTemplateArgument, 4> > &NewlyDeducedPacks, + SmallVectorImpl<DeducedTemplateArgument> &Deduced, + const SmallVectorImpl<unsigned> &PackIndices, + SmallVectorImpl<DeducedTemplateArgument> &SavedPacks, + SmallVectorImpl< + SmallVector<DeducedTemplateArgument, 4> > &NewlyDeducedPacks, TemplateDeductionInfo &Info) { // Build argument packs for each of the parameter packs expanded by this // pack expansion. @@ -668,10 +668,10 @@ DeduceTemplateArguments(Sema &S, const QualType *Params, unsigned NumParams, const QualType *Args, unsigned NumArgs, TemplateDeductionInfo &Info, - llvm::SmallVectorImpl<DeducedTemplateArgument> &Deduced, + SmallVectorImpl<DeducedTemplateArgument> &Deduced, unsigned TDF, bool PartialOrdering = false, - llvm::SmallVectorImpl<RefParamPartialOrderingComparison> * + SmallVectorImpl<RefParamPartialOrderingComparison> * RefParamComparisons = 0) { // Fast-path check to see if we have too many/too few arguments. if (NumParams != NumArgs && @@ -733,11 +733,11 @@ DeduceTemplateArguments(Sema &S, // Compute the set of template parameter indices that correspond to // parameter packs expanded by the pack expansion. - llvm::SmallVector<unsigned, 2> PackIndices; + SmallVector<unsigned, 2> PackIndices; QualType Pattern = Expansion->getPattern(); { llvm::BitVector SawIndices(TemplateParams->size()); - llvm::SmallVector<UnexpandedParameterPack, 2> Unexpanded; + SmallVector<UnexpandedParameterPack, 2> Unexpanded; S.collectUnexpandedParameterPacks(Pattern, Unexpanded); for (unsigned I = 0, N = Unexpanded.size(); I != N; ++I) { unsigned Depth, Index; @@ -753,9 +753,9 @@ DeduceTemplateArguments(Sema &S, // Keep track of the deduced template arguments for each parameter pack // expanded by this pack expansion (the outer index) and for each // template argument (the inner SmallVectors). - llvm::SmallVector<llvm::SmallVector<DeducedTemplateArgument, 4>, 2> + SmallVector<SmallVector<DeducedTemplateArgument, 4>, 2> NewlyDeducedPacks(PackIndices.size()); - llvm::SmallVector<DeducedTemplateArgument, 2> + SmallVector<DeducedTemplateArgument, 2> SavedPacks(PackIndices.size()); PrepareArgumentPackDeduction(S, Deduced, PackIndices, SavedPacks, NewlyDeducedPacks); @@ -862,10 +862,10 @@ DeduceTemplateArguments(Sema &S, TemplateParameterList *TemplateParams, QualType ParamIn, QualType ArgIn, TemplateDeductionInfo &Info, - llvm::SmallVectorImpl<DeducedTemplateArgument> &Deduced, + SmallVectorImpl<DeducedTemplateArgument> &Deduced, unsigned TDF, bool PartialOrdering, - llvm::SmallVectorImpl<RefParamPartialOrderingComparison> *RefParamComparisons) { + SmallVectorImpl<RefParamPartialOrderingComparison> *RefParamComparisons) { // We only want to look at the canonical types, since typedefs and // sugar are not part of template argument deduction. QualType Param = S.Context.getCanonicalType(ParamIn); @@ -1306,10 +1306,10 @@ DeduceTemplateArguments(Sema &S, // Visited contains the set of nodes we have already visited, while // ToVisit is our stack of records that we still need to visit. llvm::SmallPtrSet<const RecordType *, 8> Visited; - llvm::SmallVector<const RecordType *, 8> ToVisit; + SmallVector<const RecordType *, 8> ToVisit; ToVisit.push_back(RecordT); bool Successful = false; - llvm::SmallVectorImpl<DeducedTemplateArgument> DeducedOrig(0); + SmallVectorImpl<DeducedTemplateArgument> DeducedOrig(0); DeducedOrig = Deduced; while (!ToVisit.empty()) { // Retrieve the next class in the inheritance hierarchy. @@ -1515,7 +1515,7 @@ DeduceTemplateArguments(Sema &S, const TemplateArgument &Param, TemplateArgument Arg, TemplateDeductionInfo &Info, - llvm::SmallVectorImpl<DeducedTemplateArgument> &Deduced) { + SmallVectorImpl<DeducedTemplateArgument> &Deduced) { // If the template argument is a pack expansion, perform template argument // deduction against the pattern of that expansion. This only occurs during // partial ordering. @@ -1667,7 +1667,7 @@ DeduceTemplateArguments(Sema &S, const TemplateArgument *Params, unsigned NumParams, const TemplateArgument *Args, unsigned NumArgs, TemplateDeductionInfo &Info, - llvm::SmallVectorImpl<DeducedTemplateArgument> &Deduced, + SmallVectorImpl<DeducedTemplateArgument> &Deduced, bool NumberOfArgumentsMustMatch) { // C++0x [temp.deduct.type]p9: // If the template argument list of P contains a pack expansion that is not @@ -1720,10 +1720,10 @@ DeduceTemplateArguments(Sema &S, // Compute the set of template parameter indices that correspond to // parameter packs expanded by the pack expansion. - llvm::SmallVector<unsigned, 2> PackIndices; + SmallVector<unsigned, 2> PackIndices; { llvm::BitVector SawIndices(TemplateParams->size()); - llvm::SmallVector<UnexpandedParameterPack, 2> Unexpanded; + SmallVector<UnexpandedParameterPack, 2> Unexpanded; S.collectUnexpandedParameterPacks(Pattern, Unexpanded); for (unsigned I = 0, N = Unexpanded.size(); I != N; ++I) { unsigned Depth, Index; @@ -1742,9 +1742,9 @@ DeduceTemplateArguments(Sema &S, // Save the deduced template arguments for each parameter pack expanded // by this pack expansion, then clear out the deduction. - llvm::SmallVector<DeducedTemplateArgument, 2> + SmallVector<DeducedTemplateArgument, 2> SavedPacks(PackIndices.size()); - llvm::SmallVector<llvm::SmallVector<DeducedTemplateArgument, 4>, 2> + SmallVector<SmallVector<DeducedTemplateArgument, 4>, 2> NewlyDeducedPacks(PackIndices.size()); PrepareArgumentPackDeduction(S, Deduced, PackIndices, SavedPacks, NewlyDeducedPacks); @@ -1799,7 +1799,7 @@ DeduceTemplateArguments(Sema &S, const TemplateArgumentList &ParamList, const TemplateArgumentList &ArgList, TemplateDeductionInfo &Info, - llvm::SmallVectorImpl<DeducedTemplateArgument> &Deduced) { + SmallVectorImpl<DeducedTemplateArgument> &Deduced) { return DeduceTemplateArguments(S, TemplateParams, ParamList.data(), ParamList.size(), ArgList.data(), ArgList.size(), @@ -1940,11 +1940,11 @@ static bool ConvertDeducedTemplateArgument(Sema &S, NamedDecl *Param, unsigned ArgumentPackIndex, TemplateDeductionInfo &Info, bool InFunctionTemplate, - llvm::SmallVectorImpl<TemplateArgument> &Output) { + SmallVectorImpl<TemplateArgument> &Output) { if (Arg.getKind() == TemplateArgument::Pack) { // This is a template argument pack, so check each of its arguments against // the template parameter. - llvm::SmallVector<TemplateArgument, 2> PackedArgsBuilder; + SmallVector<TemplateArgument, 2> PackedArgsBuilder; for (TemplateArgument::pack_iterator PA = Arg.pack_begin(), PAEnd = Arg.pack_end(); PA != PAEnd; ++PA) { @@ -1996,7 +1996,7 @@ static Sema::TemplateDeductionResult FinishTemplateArgumentDeduction(Sema &S, ClassTemplatePartialSpecializationDecl *Partial, const TemplateArgumentList &TemplateArgs, - llvm::SmallVectorImpl<DeducedTemplateArgument> &Deduced, + SmallVectorImpl<DeducedTemplateArgument> &Deduced, TemplateDeductionInfo &Info) { // Trap errors. Sema::SFINAETrap Trap(S); @@ -2006,7 +2006,7 @@ FinishTemplateArgumentDeduction(Sema &S, // C++ [temp.deduct.type]p2: // [...] or if any template argument remains neither deduced nor // explicitly specified, template argument deduction fails. - llvm::SmallVector<TemplateArgument, 4> Builder; + SmallVector<TemplateArgument, 4> Builder; TemplateParameterList *PartialParams = Partial->getTemplateParameters(); for (unsigned I = 0, N = PartialParams->size(); I != N; ++I) { NamedDecl *Param = PartialParams->getParam(I); @@ -2089,7 +2089,7 @@ FinishTemplateArgumentDeduction(Sema &S, return Sema::TDK_SubstitutionFailure; } - llvm::SmallVector<TemplateArgument, 4> ConvertedInstArgs; + SmallVector<TemplateArgument, 4> ConvertedInstArgs; if (S.CheckTemplateArgumentList(ClassTemplate, Partial->getLocation(), InstArgs, false, ConvertedInstArgs)) return Sema::TDK_SubstitutionFailure; @@ -2125,7 +2125,7 @@ Sema::DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial, // specialization can be deduced from the actual template argument // list (14.8.2). SFINAETrap Trap(*this); - llvm::SmallVector<DeducedTemplateArgument, 4> Deduced; + SmallVector<DeducedTemplateArgument, 4> Deduced; Deduced.resize(Partial->getTemplateParameters()->size()); if (TemplateDeductionResult Result = ::DeduceTemplateArguments(*this, @@ -2183,8 +2183,8 @@ Sema::TemplateDeductionResult Sema::SubstituteExplicitTemplateArguments( FunctionTemplateDecl *FunctionTemplate, TemplateArgumentListInfo &ExplicitTemplateArgs, - llvm::SmallVectorImpl<DeducedTemplateArgument> &Deduced, - llvm::SmallVectorImpl<QualType> &ParamTypes, + SmallVectorImpl<DeducedTemplateArgument> &Deduced, + SmallVectorImpl<QualType> &ParamTypes, QualType *FunctionType, TemplateDeductionInfo &Info) { FunctionDecl *Function = FunctionTemplate->getTemplatedDecl(); @@ -2214,7 +2214,7 @@ Sema::SubstituteExplicitTemplateArguments( // declaration order of their corresponding template-parameters. The // template argument list shall not specify more template-arguments than // there are corresponding template-parameters. - llvm::SmallVector<TemplateArgument, 4> Builder; + SmallVector<TemplateArgument, 4> Builder; // Enter a new template instantiation context where we check the // explicitly-specified template arguments against this function template, @@ -2420,11 +2420,11 @@ CheckOriginalCallArgDeduction(Sema &S, Sema::OriginalCallArg OriginalArg, /// which the deduced argument types should be compared. Sema::TemplateDeductionResult Sema::FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate, - llvm::SmallVectorImpl<DeducedTemplateArgument> &Deduced, + SmallVectorImpl<DeducedTemplateArgument> &Deduced, unsigned NumExplicitlySpecified, FunctionDecl *&Specialization, TemplateDeductionInfo &Info, - llvm::SmallVectorImpl<OriginalCallArg> const *OriginalCallArgs) { + SmallVectorImpl<OriginalCallArg> const *OriginalCallArgs) { TemplateParameterList *TemplateParams = FunctionTemplate->getTemplateParameters(); @@ -2446,7 +2446,7 @@ Sema::FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate, // C++ [temp.deduct.type]p2: // [...] or if any template argument remains neither deduced nor // explicitly specified, template argument deduction fails. - llvm::SmallVector<TemplateArgument, 4> Builder; + SmallVector<TemplateArgument, 4> Builder; for (unsigned I = 0, N = TemplateParams->size(); I != N; ++I) { NamedDecl *Param = TemplateParams->getParam(I); @@ -2609,7 +2609,7 @@ Sema::FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate, // keep track of these diagnostics. They'll be emitted if this specialization // is actually used. if (Info.diag_begin() != Info.diag_end()) { - llvm::DenseMap<Decl *, llvm::SmallVector<PartialDiagnosticAt, 1> >::iterator + llvm::DenseMap<Decl *, SmallVector<PartialDiagnosticAt, 1> >::iterator Pos = SuppressedDiagnostics.find(Specialization->getCanonicalDecl()); if (Pos == SuppressedDiagnostics.end()) SuppressedDiagnostics[Specialization->getCanonicalDecl()] @@ -2710,7 +2710,7 @@ ResolveOverloadForDeduction(Sema &S, TemplateParameterList *TemplateParams, // Type deduction is done independently for each P/A pair, and // the deduced template argument values are then combined. // So we do not reject deductions which were made elsewhere. - llvm::SmallVector<DeducedTemplateArgument, 8> + SmallVector<DeducedTemplateArgument, 8> Deduced(TemplateParams->size()); TemplateDeductionInfo Info(S.Context, Ovl->getNameLoc()); Sema::TemplateDeductionResult Result @@ -2900,8 +2900,8 @@ Sema::DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate, LocalInstantiationScope InstScope(*this); TemplateParameterList *TemplateParams = FunctionTemplate->getTemplateParameters(); - llvm::SmallVector<DeducedTemplateArgument, 4> Deduced; - llvm::SmallVector<QualType, 4> ParamTypes; + SmallVector<DeducedTemplateArgument, 4> Deduced; + SmallVector<QualType, 4> ParamTypes; unsigned NumExplicitlySpecified = 0; if (ExplicitTemplateArgs) { TemplateDeductionResult Result = @@ -2924,7 +2924,7 @@ Sema::DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate, // Deduce template arguments from the function parameters. Deduced.resize(TemplateParams->size()); unsigned ArgIdx = 0; - llvm::SmallVector<OriginalCallArg, 4> OriginalCallArgs; + SmallVector<OriginalCallArg, 4> OriginalCallArgs; for (unsigned ParamIdx = 0, NumParams = ParamTypes.size(); ParamIdx != NumParams; ++ParamIdx) { QualType OrigParamType = ParamTypes[ParamIdx]; @@ -2974,10 +2974,10 @@ Sema::DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate, break; QualType ParamPattern = ParamExpansion->getPattern(); - llvm::SmallVector<unsigned, 2> PackIndices; + SmallVector<unsigned, 2> PackIndices; { llvm::BitVector SawIndices(TemplateParams->size()); - llvm::SmallVector<UnexpandedParameterPack, 2> Unexpanded; + SmallVector<UnexpandedParameterPack, 2> Unexpanded; collectUnexpandedParameterPacks(ParamPattern, Unexpanded); for (unsigned I = 0, N = Unexpanded.size(); I != N; ++I) { unsigned Depth, Index; @@ -2993,9 +2993,9 @@ Sema::DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate, // Keep track of the deduced template arguments for each parameter pack // expanded by this pack expansion (the outer index) and for each // template argument (the inner SmallVectors). - llvm::SmallVector<llvm::SmallVector<DeducedTemplateArgument, 4>, 2> + SmallVector<SmallVector<DeducedTemplateArgument, 4>, 2> NewlyDeducedPacks(PackIndices.size()); - llvm::SmallVector<DeducedTemplateArgument, 2> + SmallVector<DeducedTemplateArgument, 2> SavedPacks(PackIndices.size()); PrepareArgumentPackDeduction(*this, Deduced, PackIndices, SavedPacks, NewlyDeducedPacks); @@ -3095,9 +3095,9 @@ Sema::DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate, // Substitute any explicit template arguments. LocalInstantiationScope InstScope(*this); - llvm::SmallVector<DeducedTemplateArgument, 4> Deduced; + SmallVector<DeducedTemplateArgument, 4> Deduced; unsigned NumExplicitlySpecified = 0; - llvm::SmallVector<QualType, 4> ParamTypes; + SmallVector<QualType, 4> ParamTypes; if (ExplicitTemplateArgs) { if (TemplateDeductionResult Result = SubstituteExplicitTemplateArguments(FunctionTemplate, @@ -3205,7 +3205,7 @@ Sema::DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate, // A) as described in 14.8.2.4. TemplateParameterList *TemplateParams = FunctionTemplate->getTemplateParameters(); - llvm::SmallVector<DeducedTemplateArgument, 4> Deduced; + SmallVector<DeducedTemplateArgument, 4> Deduced; Deduced.resize(TemplateParams->size()); // C++0x [temp.deduct.conv]p4: @@ -3342,7 +3342,7 @@ Sema::DeduceAutoType(TypeSourceInfo *Type, Expr *Init, QualType FuncParam = FuncParamInfo->getType(); // Deduce type of TemplParam in Func(Init) - llvm::SmallVector<DeducedTemplateArgument, 1> Deduced; + SmallVector<DeducedTemplateArgument, 1> Deduced; Deduced.resize(1); QualType InitType = Init->getType(); unsigned TDF = 0; @@ -3380,12 +3380,12 @@ static void MarkUsedTemplateParameters(Sema &SemaRef, QualType T, bool OnlyDeduced, unsigned Level, - llvm::SmallVectorImpl<bool> &Deduced); + SmallVectorImpl<bool> &Deduced); /// \brief If this is a non-static member function, static void MaybeAddImplicitObjectParameterType(ASTContext &Context, CXXMethodDecl *Method, - llvm::SmallVectorImpl<QualType> &ArgTypes) { + SmallVectorImpl<QualType> &ArgTypes) { if (Method->isStatic()) return; @@ -3414,7 +3414,7 @@ static bool isAtLeastAsSpecializedAs(Sema &S, FunctionTemplateDecl *FT2, TemplatePartialOrderingContext TPOC, unsigned NumCallArguments, - llvm::SmallVectorImpl<RefParamPartialOrderingComparison> *RefParamComparisons) { + SmallVectorImpl<RefParamPartialOrderingComparison> *RefParamComparisons) { FunctionDecl *FD1 = FT1->getTemplatedDecl(); FunctionDecl *FD2 = FT2->getTemplatedDecl(); const FunctionProtoType *Proto1 = FD1->getType()->getAs<FunctionProtoType>(); @@ -3422,7 +3422,7 @@ static bool isAtLeastAsSpecializedAs(Sema &S, assert(Proto1 && Proto2 && "Function templates must have prototypes"); TemplateParameterList *TemplateParams = FT2->getTemplateParameters(); - llvm::SmallVector<DeducedTemplateArgument, 4> Deduced; + SmallVector<DeducedTemplateArgument, 4> Deduced; Deduced.resize(TemplateParams->size()); // C++0x [temp.deduct.partial]p3: @@ -3454,7 +3454,7 @@ static bool isAtLeastAsSpecializedAs(Sema &S, // C++98/03 doesn't have this provision, so instead we drop the // first argument of the free function or static member, which // seems to match existing practice. - llvm::SmallVector<QualType, 4> Args1; + SmallVector<QualType, 4> Args1; unsigned Skip1 = !S.getLangOptions().CPlusPlus0x && IsNonStatic2 && !IsNonStatic1; if (S.getLangOptions().CPlusPlus0x && IsNonStatic1 && !IsNonStatic2) @@ -3462,7 +3462,7 @@ static bool isAtLeastAsSpecializedAs(Sema &S, Args1.insert(Args1.end(), Proto1->arg_type_begin() + Skip1, Proto1->arg_type_end()); - llvm::SmallVector<QualType, 4> Args2; + SmallVector<QualType, 4> Args2; Skip2 = !S.getLangOptions().CPlusPlus0x && IsNonStatic1 && !IsNonStatic2; if (S.getLangOptions().CPlusPlus0x && IsNonStatic2 && !IsNonStatic1) @@ -3524,7 +3524,7 @@ static bool isAtLeastAsSpecializedAs(Sema &S, } // Figure out which template parameters were used. - llvm::SmallVector<bool, 4> UsedParameters; + SmallVector<bool, 4> UsedParameters; UsedParameters.resize(TemplateParams->size()); switch (TPOC) { case TPOC_Call: { @@ -3605,7 +3605,7 @@ Sema::getMoreSpecializedTemplate(FunctionTemplateDecl *FT1, SourceLocation Loc, TemplatePartialOrderingContext TPOC, unsigned NumCallArguments) { - llvm::SmallVector<RefParamPartialOrderingComparison, 4> RefParamComparisons; + SmallVector<RefParamPartialOrderingComparison, 4> RefParamComparisons; bool Better1 = isAtLeastAsSpecializedAs(*this, Loc, FT1, FT2, TPOC, NumCallArguments, 0); bool Better2 = isAtLeastAsSpecializedAs(*this, Loc, FT2, FT1, TPOC, @@ -3853,7 +3853,7 @@ Sema::getMoreSpecializedPartialSpecialization( // know that every template parameter is deducible from the class // template partial specialization's template arguments, for // example. - llvm::SmallVector<DeducedTemplateArgument, 4> Deduced; + SmallVector<DeducedTemplateArgument, 4> Deduced; TemplateDeductionInfo Info(Context, Loc); QualType PT1 = PS1->getInjectedSpecializationType(); @@ -3899,7 +3899,7 @@ MarkUsedTemplateParameters(Sema &SemaRef, const TemplateArgument &TemplateArg, bool OnlyDeduced, unsigned Depth, - llvm::SmallVectorImpl<bool> &Used); + SmallVectorImpl<bool> &Used); /// \brief Mark the template parameters that are used by the given /// expression. @@ -3908,7 +3908,7 @@ MarkUsedTemplateParameters(Sema &SemaRef, const Expr *E, bool OnlyDeduced, unsigned Depth, - llvm::SmallVectorImpl<bool> &Used) { + SmallVectorImpl<bool> &Used) { // We can deduce from a pack expansion. if (const PackExpansionExpr *Expansion = dyn_cast<PackExpansionExpr>(E)) E = Expansion->getPattern(); @@ -3939,7 +3939,7 @@ MarkUsedTemplateParameters(Sema &SemaRef, NestedNameSpecifier *NNS, bool OnlyDeduced, unsigned Depth, - llvm::SmallVectorImpl<bool> &Used) { + SmallVectorImpl<bool> &Used) { if (!NNS) return; @@ -3956,7 +3956,7 @@ MarkUsedTemplateParameters(Sema &SemaRef, TemplateName Name, bool OnlyDeduced, unsigned Depth, - llvm::SmallVectorImpl<bool> &Used) { + SmallVectorImpl<bool> &Used) { if (TemplateDecl *Template = Name.getAsTemplateDecl()) { if (TemplateTemplateParmDecl *TTP = dyn_cast<TemplateTemplateParmDecl>(Template)) { @@ -3980,7 +3980,7 @@ static void MarkUsedTemplateParameters(Sema &SemaRef, QualType T, bool OnlyDeduced, unsigned Depth, - llvm::SmallVectorImpl<bool> &Used) { + SmallVectorImpl<bool> &Used) { if (T.isNull()) return; @@ -4206,7 +4206,7 @@ MarkUsedTemplateParameters(Sema &SemaRef, const TemplateArgument &TemplateArg, bool OnlyDeduced, unsigned Depth, - llvm::SmallVectorImpl<bool> &Used) { + SmallVectorImpl<bool> &Used) { switch (TemplateArg.getKind()) { case TemplateArgument::Null: case TemplateArgument::Integral: @@ -4251,7 +4251,7 @@ MarkUsedTemplateParameters(Sema &SemaRef, void Sema::MarkUsedTemplateParameters(const TemplateArgumentList &TemplateArgs, bool OnlyDeduced, unsigned Depth, - llvm::SmallVectorImpl<bool> &Used) { + SmallVectorImpl<bool> &Used) { // C++0x [temp.deduct.type]p9: // If the template argument list of P contains a pack expansion that is not // the last template argument, the entire template argument list is a @@ -4269,7 +4269,7 @@ Sema::MarkUsedTemplateParameters(const TemplateArgumentList &TemplateArgs, /// call to the given function template. void Sema::MarkDeducedTemplateParameters(FunctionTemplateDecl *FunctionTemplate, - llvm::SmallVectorImpl<bool> &Deduced) { + SmallVectorImpl<bool> &Deduced) { TemplateParameterList *TemplateParams = FunctionTemplate->getTemplateParameters(); Deduced.clear(); @@ -4289,7 +4289,7 @@ bool hasDeducibleTemplateParameters(Sema &S, TemplateParameterList *TemplateParams = FunctionTemplate->getTemplateParameters(); - llvm::SmallVector<bool, 4> Deduced; + SmallVector<bool, 4> Deduced; Deduced.resize(TemplateParams->size()); ::MarkUsedTemplateParameters(S, T, true, TemplateParams->getDepth(), Deduced); diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 8d52951701..67e2d871c3 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -428,7 +428,7 @@ void Sema::PrintInstantiationStack() { // FIXME: In all of these cases, we need to show the template arguments unsigned InstantiationIdx = 0; - for (llvm::SmallVector<ActiveTemplateInstantiation, 16>::reverse_iterator + for (SmallVector<ActiveTemplateInstantiation, 16>::reverse_iterator Active = ActiveTemplateInstantiations.rbegin(), ActiveEnd = ActiveTemplateInstantiations.rend(); Active != ActiveEnd; @@ -591,7 +591,6 @@ void Sema::PrintInstantiationStack() { } llvm::Optional<TemplateDeductionInfo *> Sema::isSFINAEContext() const { - using llvm::SmallVector; if (InNonInstantiationSFINAEContext) return llvm::Optional<TemplateDeductionInfo *>(0); @@ -1535,8 +1534,8 @@ ParmVarDecl *Sema::SubstParmVarDecl(ParmVarDecl *OldParm, bool Sema::SubstParmTypes(SourceLocation Loc, ParmVarDecl **Params, unsigned NumParams, const MultiLevelTemplateArgumentList &TemplateArgs, - llvm::SmallVectorImpl<QualType> &ParamTypes, - llvm::SmallVectorImpl<ParmVarDecl *> *OutParams) { + SmallVectorImpl<QualType> &ParamTypes, + SmallVectorImpl<ParmVarDecl *> *OutParams) { assert(!ActiveTemplateInstantiations.empty() && "Cannot perform an instantiation without some context on the " "instantiation stack"); @@ -1558,7 +1557,7 @@ Sema::SubstBaseSpecifiers(CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs) { bool Invalid = false; - llvm::SmallVector<CXXBaseSpecifier*, 4> InstantiatedBases; + SmallVector<CXXBaseSpecifier*, 4> InstantiatedBases; for (ClassTemplateSpecializationDecl::base_class_iterator Base = Pattern->bases_begin(), BaseEnd = Pattern->bases_end(); Base != BaseEnd; ++Base) { @@ -1572,7 +1571,7 @@ Sema::SubstBaseSpecifiers(CXXRecordDecl *Instantiation, if (Base->isPackExpansion()) { // This is a pack expansion. See whether we should expand it now, or // wait until later. - llvm::SmallVector<UnexpandedParameterPack, 2> Unexpanded; + SmallVector<UnexpandedParameterPack, 2> Unexpanded; collectUnexpandedParameterPacks(Base->getTypeSourceInfo()->getTypeLoc(), Unexpanded); bool ShouldExpand = false; @@ -1755,8 +1754,8 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, Invalid = true; TemplateDeclInstantiator Instantiator(*this, Instantiation, TemplateArgs); - llvm::SmallVector<Decl*, 4> Fields; - llvm::SmallVector<std::pair<FieldDecl*, FieldDecl*>, 4> + SmallVector<Decl*, 4> Fields; + SmallVector<std::pair<FieldDecl*, FieldDecl*>, 4> FieldsWithMemberInitializers; for (RecordDecl::decl_iterator Member = Pattern->decls_begin(), MemberEnd = Pattern->decls_end(); @@ -1913,8 +1912,8 @@ Sema::InstantiateClassTemplateSpecialization( // specialization with the template argument lists of the partial // specializations. typedef PartialSpecMatchResult MatchResult; - llvm::SmallVector<MatchResult, 4> Matched; - llvm::SmallVector<ClassTemplatePartialSpecializationDecl *, 4> PartialSpecs; + SmallVector<MatchResult, 4> Matched; + SmallVector<ClassTemplatePartialSpecializationDecl *, 4> PartialSpecs; Template->getPartialSpecializations(PartialSpecs); for (unsigned I = 0, N = PartialSpecs.size(); I != N; ++I) { ClassTemplatePartialSpecializationDecl *Partial = PartialSpecs[I]; @@ -1936,10 +1935,10 @@ Sema::InstantiateClassTemplateSpecialization( // If we're dealing with a member template where the template parameters // have been instantiated, this provides the original template parameters // from which the member template's parameters were instantiated. - llvm::SmallVector<const NamedDecl *, 4> InstantiatedTemplateParameters; + SmallVector<const NamedDecl *, 4> InstantiatedTemplateParameters; if (Matched.size() >= 1) { - llvm::SmallVector<MatchResult, 4>::iterator Best = Matched.begin(); + SmallVector<MatchResult, 4>::iterator Best = Matched.begin(); if (Matched.size() == 1) { // -- If exactly one matching specialization is found, the // instantiation is generated from that specialization. @@ -1952,7 +1951,7 @@ Sema::InstantiateClassTemplateSpecialization( // specialized than all of the other matching // specializations, then the use of the class template is // ambiguous and the program is ill-formed. - for (llvm::SmallVector<MatchResult, 4>::iterator P = Best + 1, + for (SmallVector<MatchResult, 4>::iterator P = Best + 1, PEnd = Matched.end(); P != PEnd; ++P) { if (getMoreSpecializedPartialSpecialization(P->Partial, Best->Partial, @@ -1964,7 +1963,7 @@ Sema::InstantiateClassTemplateSpecialization( // Determine if the best partial specialization is more specialized than // the others. bool Ambiguous = false; - for (llvm::SmallVector<MatchResult, 4>::iterator P = Matched.begin(), + for (SmallVector<MatchResult, 4>::iterator P = Matched.begin(), PEnd = Matched.end(); P != PEnd; ++P) { if (P != Best && @@ -1983,7 +1982,7 @@ Sema::InstantiateClassTemplateSpecialization( << ClassTemplateSpec; // Print the matching partial specializations. - for (llvm::SmallVector<MatchResult, 4>::iterator P = Matched.begin(), + for (SmallVector<MatchResult, 4>::iterator P = Matched.begin(), PEnd = Matched.end(); P != PEnd; ++P) Diag(P->Partial->getLocation(), diag::note_partial_spec_match) @@ -2222,7 +2221,7 @@ Sema::SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs) { bool Sema::SubstExprs(Expr **Exprs, unsigned NumExprs, bool IsCall, const MultiLevelTemplateArgumentList &TemplateArgs, - llvm::SmallVectorImpl<Expr *> &Outputs) { + SmallVectorImpl<Expr *> &Outputs) { if (NumExprs == 0) return false; diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 81fd011ac6..41818d329c 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -640,7 +640,7 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) { if (D->getDeclContext()->isFunctionOrMethod()) SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, Enum); - llvm::SmallVector<Decl*, 4> Enumerators; + SmallVector<Decl*, 4> Enumerators; EnumConstantDecl *LastEnumConst = 0; for (EnumDecl::enumerator_iterator EC = D->enumerator_begin(), @@ -874,7 +874,7 @@ Decl *TemplateDeclInstantiator::VisitClassTemplateDecl(ClassTemplateDecl *D) { // Queue up any out-of-line partial specializations of this member // class template; the client will force their instantiation once // the enclosing class has been instantiated. - llvm::SmallVector<ClassTemplatePartialSpecializationDecl *, 4> PartialSpecs; + SmallVector<ClassTemplatePartialSpecializationDecl *, 4> PartialSpecs; D->getPartialSpecializations(PartialSpecs); for (unsigned I = 0, N = PartialSpecs.size(); I != N; ++I) if (PartialSpecs[I]->isOutOfLine()) @@ -1040,7 +1040,7 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D, cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod()); LocalInstantiationScope Scope(SemaRef, MergeWithParentScope); - llvm::SmallVector<ParmVarDecl *, 4> Params; + SmallVector<ParmVarDecl *, 4> Params; TypeSourceInfo *TInfo = D->getTypeSourceInfo(); TInfo = SubstFunctionType(D, Params); if (!TInfo) @@ -1319,7 +1319,7 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D, LocalInstantiationScope Scope(SemaRef, MergeWithParentScope); // Instantiate enclosing template arguments for friends. - llvm::SmallVector<TemplateParameterList *, 4> TempParamLists; + SmallVector<TemplateParameterList *, 4> TempParamLists; unsigned NumTempParamLists = 0; if (isFriend && (NumTempParamLists = D->getNumTemplateParameterLists())) { TempParamLists.set_size(NumTempParamLists); @@ -1332,7 +1332,7 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D, } } - llvm::SmallVector<ParmVarDecl *, 4> Params; + SmallVector<ParmVarDecl *, 4> Params; TypeSourceInfo *TInfo = D->getTypeSourceInfo(); TInfo = SubstFunctionType(D, Params); if (!TInfo) @@ -1350,7 +1350,7 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D, // synthesized in the method declaration. if (!isa<FunctionProtoType>(T.IgnoreParens())) { assert(!Params.size() && "Instantiating type could not yield parameters"); - llvm::SmallVector<QualType, 4> ParamTypes; + SmallVector<QualType, 4> ParamTypes; if (SemaRef.SubstParmTypes(D->getLocation(), D->param_begin(), D->getNumParams(), TemplateArgs, ParamTypes, &Params)) @@ -1571,8 +1571,8 @@ Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl( NonTypeTemplateParmDecl *D) { // Substitute into the type of the non-type template parameter. TypeLoc TL = D->getTypeSourceInfo()->getTypeLoc(); - llvm::SmallVector<TypeSourceInfo *, 4> ExpandedParameterPackTypesAsWritten; - llvm::SmallVector<QualType, 4> ExpandedParameterPackTypes; + SmallVector<TypeSourceInfo *, 4> ExpandedParameterPackTypesAsWritten; + SmallVector<QualType, 4> ExpandedParameterPackTypes; bool IsExpandedParameterPack = false; TypeSourceInfo *DI; QualType T; @@ -1608,7 +1608,7 @@ Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl( // types. PackExpansionTypeLoc Expansion = cast<PackExpansionTypeLoc>(TL); TypeLoc Pattern = Expansion.getPatternLoc(); - llvm::SmallVector<UnexpandedParameterPack, 2> Unexpanded; + SmallVector<UnexpandedParameterPack, 2> Unexpanded; SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded); // Determine whether the set of unexpanded parameter packs can and should @@ -1928,7 +1928,7 @@ TemplateDeclInstantiator::SubstTemplateParams(TemplateParameterList *L) { bool Invalid = false; unsigned N = L->size(); - typedef llvm::SmallVector<NamedDecl *, 8> ParamVector; + typedef SmallVector<NamedDecl *, 8> ParamVector; ParamVector Params; Params.reserve(N); for (TemplateParameterList::iterator PI = L->begin(), PE = L->end(); @@ -1986,7 +1986,7 @@ TemplateDeclInstantiator::InstantiateClassTemplatePartialSpecialization( // Check that the template argument list is well-formed for this // class template. - llvm::SmallVector<TemplateArgument, 4> Converted; + SmallVector<TemplateArgument, 4> Converted; if (SemaRef.CheckTemplateArgumentList(ClassTemplate, PartialSpec->getLocation(), InstTemplateArgs, @@ -2076,7 +2076,7 @@ TemplateDeclInstantiator::InstantiateClassTemplatePartialSpecialization( TypeSourceInfo* TemplateDeclInstantiator::SubstFunctionType(FunctionDecl *D, - llvm::SmallVectorImpl<ParmVarDecl *> &Params) { + SmallVectorImpl<ParmVarDecl *> &Params) { TypeSourceInfo *OldTInfo = D->getTypeSourceInfo(); assert(OldTInfo && "substituting function without type source info"); assert(Params.empty() && "parameter vector is non-empty at start"); @@ -2182,13 +2182,13 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New, if (Proto->hasExceptionSpec() || Proto->getNoReturnAttr()) { // The function has an exception specification or a "noreturn" // attribute. Substitute into each of the exception types. - llvm::SmallVector<QualType, 4> Exceptions; + SmallVector<QualType, 4> Exceptions; for (unsigned I = 0, N = Proto->getNumExceptions(); I != N; ++I) { // FIXME: Poor location information! if (const PackExpansionType *PackExpansion = Proto->getExceptionType(I)->getAs<PackExpansionType>()) { // We have a pack expansion. Instantiate it. - llvm::SmallVector<UnexpandedParameterPack, 2> Unexpanded; + SmallVector<UnexpandedParameterPack, 2> Unexpanded; SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(), Unexpanded); assert(!Unexpanded.empty() && @@ -2407,7 +2407,7 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, // If we're performing recursive template instantiation, create our own // queue of pending implicit instantiations that we will instantiate later, // while we're still within our own instantiation context. - llvm::SmallVector<VTableUse, 16> SavedVTableUses; + SmallVector<VTableUse, 16> SavedVTableUses; std::deque<PendingImplicitInstantiation> SavedPendingInstantiations; if (Recursive) { VTableUses.swap(SavedVTableUses); @@ -2589,7 +2589,7 @@ void Sema::InstantiateStaticDataMemberDefinition( // If we're performing recursive template instantiation, create our own // queue of pending implicit instantiations that we will instantiate later, // while we're still within our own instantiation context. - llvm::SmallVector<VTableUse, 16> SavedVTableUses; + SmallVector<VTableUse, 16> SavedVTableUses; std::deque<PendingImplicitInstantiation> SavedPendingInstantiations; if (Recursive) { VTableUses.swap(SavedVTableUses); @@ -2642,7 +2642,7 @@ Sema::InstantiateMemInitializers(CXXConstructorDecl *New, const CXXConstructorDecl *Tmpl, const MultiLevelTemplateArgumentList &TemplateArgs) { - llvm::SmallVector<MemInitTy*, 4> NewInits; + SmallVector<MemInitTy*, 4> NewInits; bool AnyErrors = false; // Instantiate all the initializers. @@ -2664,7 +2664,7 @@ Sema::InstantiateMemInitializers(CXXConstructorDecl *New, if (Init->isPackExpansion()) { // This is a pack expansion. We should expand it now. TypeLoc BaseTL = Init->getBaseClassInfo()->getTypeLoc(); - llvm::SmallVector<UnexpandedParameterPack, 2> Unexpanded; + SmallVector<UnexpandedParameterPack, 2> Unexpanded; collectUnexpandedParameterPacks(BaseTL, Unexpanded); bool ShouldExpand = false; bool RetainExpansion = false; diff --git a/lib/Sema/SemaTemplateVariadic.cpp b/lib/Sema/SemaTemplateVariadic.cpp index daa1523363..2e61accd51 100644 --- a/lib/Sema/SemaTemplateVariadic.cpp +++ b/lib/Sema/SemaTemplateVariadic.cpp @@ -32,11 +32,11 @@ namespace { typedef RecursiveASTVisitor<CollectUnexpandedParameterPacksVisitor> inherited; - llvm::SmallVectorImpl<UnexpandedParameterPack> &Unexpanded; + SmallVectorImpl<UnexpandedParameterPack> &Unexpanded; public: explicit CollectUnexpandedParameterPacksVisitor( - llvm::SmallVectorImpl<UnexpandedParameterPack> &Unexpanded) + SmallVectorImpl<UnexpandedParameterPack> &Unexpanded) : Unexpanded(Unexpanded) { } bool shouldWalkTypesOfTypeLocs() const { return false; } @@ -158,9 +158,9 @@ namespace { static void DiagnoseUnexpandedParameterPacks(Sema &S, SourceLocation Loc, Sema::UnexpandedParameterPackContext UPPC, - const llvm::SmallVectorImpl<UnexpandedParameterPack> &Unexpanded) { - llvm::SmallVector<SourceLocation, 4> Locations; - llvm::SmallVector<IdentifierInfo *, 4> Names; + const SmallVectorImpl<UnexpandedParameterPack> &Unexpanded) { + SmallVector<SourceLocation, 4> Locations; + SmallVector<IdentifierInfo *, 4> Names; llvm::SmallPtrSet<IdentifierInfo *, 4> NamesKnown; for (unsigned I = 0, N = Unexpanded.size(); I != N; ++I) { @@ -201,7 +201,7 @@ bool Sema::DiagnoseUnexpandedParameterPack(SourceLocation Loc, if (!T->getType()->containsUnexpandedParameterPack()) return false; - llvm::SmallVector<UnexpandedParameterPack, 2> Unexpanded; + SmallVector<UnexpandedParameterPack, 2> Unexpanded; CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseTypeLoc( T->getTypeLoc()); assert(!Unexpanded.empty() && "Unable to find unexpanded parameter packs"); @@ -217,7 +217,7 @@ bool Sema::DiagnoseUnexpandedParameterPack(Expr *E, if (!E->containsUnexpandedParameterPack()) return false; - llvm::SmallVector<UnexpandedParameterPack, 2> Unexpanded; + SmallVector<UnexpandedParameterPack, 2> Unexpanded; CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseStmt(E); assert(!Unexpanded.empty() && "Unable to find unexpanded parameter packs"); DiagnoseUnexpandedParameterPacks(*this, E->getLocStart(), UPPC, Unexpanded); @@ -233,7 +233,7 @@ bool Sema::DiagnoseUnexpandedParameterPack(const CXXScopeSpec &SS, !SS.getScopeRep()->containsUnexpandedParameterPack()) return false; - llvm::SmallVector<UnexpandedParameterPack, 2> Unexpanded; + SmallVector<UnexpandedParameterPack, 2> Unexpanded; CollectUnexpandedParameterPacksVisitor(Unexpanded) .TraverseNestedNameSpecifier(SS.getScopeRep()); assert(!Unexpanded.empty() && "Unable to find unexpanded parameter packs"); @@ -270,7 +270,7 @@ bool Sema::DiagnoseUnexpandedParameterPack(const DeclarationNameInfo &NameInfo, break; } - llvm::SmallVector<UnexpandedParameterPack, 2> Unexpanded; + SmallVector<UnexpandedParameterPack, 2> Unexpanded; CollectUnexpandedParameterPacksVisitor(Unexpanded) .TraverseType(NameInfo.getName().getCXXNameType()); assert(!Unexpanded.empty() && "Unable to find unexpanded parameter packs"); @@ -285,7 +285,7 @@ bool Sema::DiagnoseUnexpandedParameterPack(SourceLocation Loc, if (Template.isNull() || !Template.containsUnexpandedParameterPack()) return false; - llvm::SmallVector<UnexpandedParameterPack, 2> Unexpanded; + SmallVector<UnexpandedParameterPack, 2> Unexpanded; CollectUnexpandedParameterPacksVisitor(Unexpanded) .TraverseTemplateName(Template); assert(!Unexpanded.empty() && "Unable to find unexpanded parameter packs"); @@ -299,7 +299,7 @@ bool Sema::DiagnoseUnexpandedParameterPack(TemplateArgumentLoc Arg, !Arg.getArgument().containsUnexpandedParameterPack()) return false; - llvm::SmallVector<UnexpandedParameterPack, 2> Unexpanded; + SmallVector<UnexpandedParameterPack, 2> Unexpanded; CollectUnexpandedParameterPacksVisitor(Unexpanded) .TraverseTemplateArgumentLoc(Arg); assert(!Unexpanded.empty() && "Unable to find unexpanded parameter packs"); @@ -308,24 +308,24 @@ bool Sema::DiagnoseUnexpandedParameterPack(TemplateArgumentLoc Arg, } void Sema::collectUnexpandedParameterPacks(TemplateArgument Arg, - llvm::SmallVectorImpl<UnexpandedParameterPack> &Unexpanded) { + SmallVectorImpl<UnexpandedParameterPack> &Unexpanded) { CollectUnexpandedParameterPacksVisitor(Unexpanded) .TraverseTemplateArgument(Arg); } void Sema::collectUnexpandedParameterPacks(TemplateArgumentLoc Arg, - llvm::SmallVectorImpl<UnexpandedParameterPack> &Unexpanded) { + SmallVectorImpl<UnexpandedParameterPack> &Unexpanded) { CollectUnexpandedParameterPacksVisitor(Unexpanded) .TraverseTemplateArgumentLoc(Arg); } void Sema::collectUnexpandedParameterPacks(QualType T, - llvm::SmallVectorImpl<UnexpandedParameterPack> &Unexpanded) { + SmallVectorImpl<UnexpandedParameterPack> &Unexpanded) { CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseType(T); } void Sema::collectUnexpandedParameterPacks(TypeLoc TL, - llvm::SmallVectorImpl<UnexpandedParameterPack> &Unexpanded) { + SmallVectorImpl<UnexpandedParameterPack> &Unexpanded) { CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseTypeLoc(TL); } @@ -572,7 +572,7 @@ bool Sema::CheckParameterPacksForExpansion(SourceLocation EllipsisLoc, unsigned Sema::getNumArgumentsInExpansion(QualType T, const MultiLevelTemplateArgumentList &TemplateArgs) { QualType Pattern = cast<PackExpansionType>(T)->getPattern(); - llvm::SmallVector<UnexpandedParameterPack, 2> Unexpanded; + SmallVector<UnexpandedParameterPack, 2> Unexpanded; CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseType(Pattern); for (unsigned I = 0, N = Unexpanded.size(); I != N; ++I) { diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index f3e73ec5a7..b84c3aec27 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -73,7 +73,7 @@ static void diagnoseBadTypeAttribute(Sema &S, const AttributeList &attr, } SourceLocation loc = attr.getLoc(); - llvm::StringRef name = attr.getName()->getName(); + StringRef name = attr.getName()->getName(); // The GC attributes are usually written with macros; special-case them. if (useInstantiationLoc && loc.isMacroID() && attr.getParameterName()) { @@ -125,11 +125,11 @@ namespace { bool hasSavedAttrs; /// The original set of attributes on the DeclSpec. - llvm::SmallVector<AttributeList*, 2> savedAttrs; + SmallVector<AttributeList*, 2> savedAttrs; /// A list of attributes to diagnose the uselessness of when the /// processing is complete. - llvm::SmallVector<AttributeList*, 2> ignoredTypeAttrs; + SmallVector<AttributeList*, 2> ignoredTypeAttrs; public: TypeProcessingState(Sema &sema, Declarator &declarator) @@ -183,7 +183,7 @@ namespace { /// Diagnose all the ignored type attributes, given that the /// declarator worked out to the given type. void diagnoseIgnoredTypeAttrs(QualType type) const { - for (llvm::SmallVectorImpl<AttributeList*>::const_iterator + for (SmallVectorImpl<AttributeList*>::const_iterator i = ignoredTypeAttrs.begin(), e = ignoredTypeAttrs.end(); i != e; ++i) diagnoseBadTypeAttribute(getSema(), **i, type); @@ -2127,10 +2127,10 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, // Otherwise, we have a function with an argument list that is // potentially variadic. - llvm::SmallVector<QualType, 16> ArgTys; + SmallVector<QualType, 16> ArgTys; ArgTys.reserve(FTI.NumArgs); - llvm::SmallVector<bool, 16> ConsumedArguments; + SmallVector<bool, 16> ConsumedArguments; ConsumedArguments.reserve(FTI.NumArgs); bool HasAnyConsumedArguments = false; @@ -2192,7 +2192,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, if (HasAnyConsumedArguments) EPI.ConsumedArguments = ConsumedArguments.data(); - llvm::SmallVector<QualType, 4> Exceptions; + SmallVector<QualType, 4> Exceptions; EPI.ExceptionSpecType = FTI.getExceptionSpecType(); if (FTI.getExceptionSpecType() == EST_Dynamic) { Exceptions.reserve(FTI.NumExceptions); @@ -3283,7 +3283,7 @@ namespace { QualType Original; const FunctionType *Fn; - llvm::SmallVector<unsigned char /*WrapKind*/, 8> Stack; + SmallVector<unsigned char /*WrapKind*/, 8> Stack; FunctionTypeUnwrapper(Sema &S, QualType T) : Original(T) { while (true) { diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 424d6313ec..627a394561 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -159,7 +159,7 @@ PCHValidator::ReadLanguageOptions(const LangOptions &LangOpts) { return false; } -bool PCHValidator::ReadTargetTriple(llvm::StringRef Triple) { +bool PCHValidator::ReadTargetTriple(StringRef Triple) { if (Triple == PP.getTargetInfo().getTriple().str()) return false; @@ -170,14 +170,14 @@ bool PCHValidator::ReadTargetTriple(llvm::StringRef Triple) { namespace { struct EmptyStringRef { - bool operator ()(llvm::StringRef r) const { return r.empty(); } + bool operator ()(StringRef r) const { return r.empty(); } }; struct EmptyBlock { bool operator ()(const PCHPredefinesBlock &r) const {return r.Data.empty();} }; } -static bool EqualConcatenations(llvm::SmallVector<llvm::StringRef, 2> L, +static bool EqualConcatenations(SmallVector<StringRef, 2> L, PCHPredefinesBlocks R) { // First, sum up the lengths. unsigned LL = 0, RL = 0; @@ -197,7 +197,7 @@ static bool EqualConcatenations(llvm::SmallVector<llvm::StringRef, 2> L, R.erase(std::remove_if(R.begin(), R.end(), EmptyBlock()), R.end()); // Do it the hard way. At this point, both vectors must be non-empty. - llvm::StringRef LR = L[0], RR = R[0].Data; + StringRef LR = L[0], RR = R[0].Data; unsigned LI = 0, RI = 0, LN = L.size(), RN = R.size(); (void) RN; for (;;) { @@ -237,12 +237,12 @@ static bool EqualConcatenations(llvm::SmallVector<llvm::StringRef, 2> L, } } -static std::pair<FileID, llvm::StringRef::size_type> -FindMacro(const PCHPredefinesBlocks &Buffers, llvm::StringRef MacroDef) { - std::pair<FileID, llvm::StringRef::size_type> Res; +static std::pair<FileID, StringRef::size_type> +FindMacro(const PCHPredefinesBlocks &Buffers, StringRef MacroDef) { + std::pair<FileID, StringRef::size_type> Res; for (unsigned I = 0, N = Buffers.size(); I != N; ++I) { Res.second = Buffers[I].Data.find(MacroDef); - if (Res.second != llvm::StringRef::npos) { + if (Res.second != StringRef::npos) { Res.first = Buffers[I].BufferID; break; } @@ -251,7 +251,7 @@ FindMacro(const PCHPredefinesBlocks &Buffers, llvm::StringRef MacroDef) { } bool PCHValidator::ReadPredefinesBuffer(const PCHPredefinesBlocks &Buffers, - llvm::StringRef OriginalFileName, + StringRef OriginalFileName, std::string &SuggestedPredefines, FileManager &FileMgr) { // We are in the context of an implicit include, so the predefines buffer will @@ -262,9 +262,9 @@ bool PCHValidator::ReadPredefinesBuffer(const PCHPredefinesBlocks &Buffers, PCHInclude += "#include \""; PCHInclude += NormalizeDashIncludePath(OriginalFileName, FileMgr); PCHInclude += "\"\n"; - std::pair<llvm::StringRef,llvm::StringRef> Split = - llvm::StringRef(PP.getPredefines()).split(PCHInclude.str()); - llvm::StringRef Left = Split.first, Right = Split.second; + std::pair<StringRef,StringRef> Split = + StringRef(PP.getPredefines()).split(PCHInclude.str()); + StringRef Left = Split.first, Right = Split.second; if (Left == PP.getPredefines()) { Error("Missing PCH include entry!"); return true; @@ -272,7 +272,7 @@ bool PCHValidator::ReadPredefinesBuffer(const PCHPredefinesBlocks &Buffers, // If the concatenation of all the PCH buffers is equal to the adjusted // command line, we're done. - llvm::SmallVector<llvm::StringRef, 2> CommandLine; + SmallVector<StringRef, 2> CommandLine; CommandLine.push_back(Left); CommandLine.push_back(Right); if (EqualConcatenations(CommandLine, Buffers)) @@ -282,18 +282,18 @@ bool PCHValidator::ReadPredefinesBuffer(const PCHPredefinesBlocks &Buffers, // The predefines buffers are different. Determine what the differences are, // and whether they require us to reject the PCH file. - llvm::SmallVector<llvm::StringRef, 8> PCHLines; + SmallVector<StringRef, 8> PCHLines; for (unsigned I = 0, N = Buffers.size(); I != N; ++I) Buffers[I].Data.split(PCHLines, "\n", /*MaxSplit=*/-1, /*KeepEmpty=*/false); - llvm::SmallVector<llvm::StringRef, 8> CmdLineLines; + SmallVector<StringRef, 8> CmdLineLines; Left.split(CmdLineLines, "\n", /*MaxSplit=*/-1, /*KeepEmpty=*/false); // Pick out implicit #includes after the PCH and don't consider them for // validation; we will insert them into SuggestedPredefines so that the // preprocessor includes them. std::string IncludesAfterPCH; - llvm::SmallVector<llvm::StringRef, 8> AfterPCHLines; + SmallVector<StringRef, 8> AfterPCHLines; Right.split(AfterPCHLines, "\n", /*MaxSplit=*/-1, /*KeepEmpty=*/false); for (unsigned i = 0, e = AfterPCHLines.size(); i != e; ++i) { if (AfterPCHLines[i].startswith("#include ")) { @@ -326,7 +326,7 @@ bool PCHValidator::ReadPredefinesBuffer(const PCHPredefinesBlocks &Buffers, // Determine which predefines that were used to build the PCH file are missing // from the command line. - std::vector<llvm::StringRef> MissingPredefines; + std::vector<StringRef> MissingPredefines; std::set_difference(PCHLines.begin(), PCHLines.end(), CmdLineLines.begin(), CmdLineLines.end(), std::back_inserter(MissingPredefines)); @@ -334,7 +334,7 @@ bool PCHValidator::ReadPredefinesBuffer(const PCHPredefinesBlocks &Buffers, bool MissingDefines = false; bool ConflictingDefines = false; for (unsigned I = 0, N = MissingPredefines.size(); I != N; ++I) { - llvm::StringRef Missing = MissingPredefines[I]; + StringRef Missing = MissingPredefines[I]; if (Missing.startswith("#include ")) { // An -include was specified when generating the PCH; it is included in // the PCH, just ignore it. @@ -352,13 +352,13 @@ bool PCHValidator::ReadPredefinesBuffer(const PCHPredefinesBlocks &Buffers, = Missing.find_first_of("( \n\r", StartOfMacroName); assert(EndOfMacroName != std::string::npos && "Couldn't find the end of the macro name"); - llvm::StringRef MacroName = Missing.slice(StartOfMacroName, EndOfMacroName); + StringRef MacroName = Missing.slice(StartOfMacroName, EndOfMacroName); // Determine whether this macro was given a different definition on the // command line. std::string MacroDefStart = "#define " + MacroName.str(); std::string::size_type MacroDefLen = MacroDefStart.size(); - llvm::SmallVector<llvm::StringRef, 8>::iterator ConflictPos + SmallVector<StringRef, 8>::iterator ConflictPos = std::lower_bound(CmdLineLines.begin(), CmdLineLines.end(), MacroDefStart); for (; ConflictPos != CmdLineLines.end(); ++ConflictPos) { @@ -383,9 +383,9 @@ bool PCHValidator::ReadPredefinesBuffer(const PCHPredefinesBlocks &Buffers, << MacroName; // Show the definition of this macro within the PCH file. - std::pair<FileID, llvm::StringRef::size_type> MacroLoc = + std::pair<FileID, StringRef::size_type> MacroLoc = FindMacro(Buffers, Missing); - assert(MacroLoc.second!=llvm::StringRef::npos && "Unable to find macro!"); + assert(MacroLoc.second!=StringRef::npos && "Unable to find macro!"); SourceLocation PCHMissingLoc = SourceMgr.getLocForStartOfFile(MacroLoc.first) .getFileLocWithOffset(MacroLoc.second); @@ -406,9 +406,9 @@ bool PCHValidator::ReadPredefinesBuffer(const PCHPredefinesBlocks &Buffers, } // Show the definition of this macro within the PCH file. - std::pair<FileID, llvm::StringRef::size_type> MacroLoc = + std::pair<FileID, StringRef::size_type> MacroLoc = FindMacro(Buffers, Missing); - assert(MacroLoc.second!=llvm::StringRef::npos && "Unable to find macro!"); + assert(MacroLoc.second!=StringRef::npos && "Unable to find macro!"); SourceLocation PCHMissingLoc = SourceMgr.getLocForStartOfFile(MacroLoc.first) .getFileLocWithOffset(MacroLoc.second); @@ -422,12 +422,12 @@ bool PCHValidator::ReadPredefinesBuffer(const PCHPredefinesBlocks &Buffers, // parameters that were not present when building the PCH // file. Extra #defines are okay, so long as the identifiers being // defined were not used within the precompiled header. - std::vector<llvm::StringRef> ExtraPredefines; + std::vector<StringRef> ExtraPredefines; std::set_difference(CmdLineLines.begin(), CmdLineLines.end(), PCHLines.begin(), PCHLines.end(), std::back_inserter(ExtraPredefines)); for (unsigned I = 0, N = ExtraPredefines.size(); I != N; ++I) { - llvm::StringRef &Extra = ExtraPredefines[I]; + StringRef &Extra = ExtraPredefines[I]; if (!Extra.startswith("#define ")) { Reader.Diag(diag::warn_pch_compiler_options_mismatch); return true; @@ -440,7 +440,7 @@ bool PCHValidator::ReadPredefinesBuffer(const PCHPredefinesBlocks &Buffers, = Extra.find_first_of("( \n\r", StartOfMacroName); assert(EndOfMacroName != std::string::npos && "Couldn't find the end of the macro name"); - llvm::StringRef MacroName = Extra.slice(StartOfMacroName, EndOfMacroName); + StringRef MacroName = Extra.slice(StartOfMacroName, EndOfMacroName); // Check whether this name was used somewhere in the PCH file. If // so, defining it as a macro could change behavior, so we reject @@ -529,7 +529,7 @@ public: else if (N == 1) return SelTable.getUnarySelector(FirstII); - llvm::SmallVector<IdentifierInfo *, 16> Args; + SmallVector<IdentifierInfo *, 16> Args; Args.push_back(FirstII); for (unsigned I = 1; I != N; ++I) Args.push_back(Reader.DecodeIdentifierInfo(ReadUnalignedLE32(d))); @@ -620,7 +620,7 @@ public: } static unsigned ComputeHash(const internal_key_type& a) { - return llvm::HashString(llvm::StringRef(a.first, a.second)); + return llvm::HashString(StringRef(a.first, a.second)); } // This hopefully will just get inlined and removed by the optimizer. @@ -660,7 +660,7 @@ public: // and associate it with the persistent ID. IdentifierInfo *II = KnownII; if (!II) - II = &Reader.getIdentifierTable().getOwn(llvm::StringRef(k.first, + II = &Reader.getIdentifierTable().getOwn(StringRef(k.first, k.second)); Reader.SetIdentifierInfo(ID, II); II->setIsFromAST(); @@ -688,7 +688,7 @@ public: // the new IdentifierInfo. IdentifierInfo *II = KnownII; if (!II) - II = &Reader.getIdentifierTable().getOwn(llvm::StringRef(k.first, + II = &Reader.getIdentifierTable().getOwn(StringRef(k.first, k.second)); Reader.SetIdentifierInfo(ID, II); @@ -717,7 +717,7 @@ public: // name. if (Reader.getContext() == 0) return II; if (DataLen > 0) { - llvm::SmallVector<uint32_t, 4> DeclIDs; + SmallVector<uint32_t, 4> DeclIDs; for (; DataLen > 0; DataLen -= 4) DeclIDs.push_back(Reader.getGlobalDeclID(F, ReadUnalignedLE32(d))); Reader.SetGloballyVisibleDecls(II, DeclIDs); @@ -968,12 +968,12 @@ bool ASTReader::ReadDeclContextStorage(llvm::BitstreamCursor &Cursor, return false; } -void ASTReader::Error(llvm::StringRef Msg) { +void ASTReader::Error(StringRef Msg) { Error(diag::err_fe_pch_malformed, Msg); } void ASTReader::Error(unsigned DiagID, - llvm::StringRef Arg1, llvm::StringRef Arg2) { + StringRef Arg1, StringRef Arg2) { if (Diags.isDiagnosticInFlight()) Diags.SetDelayedDiagnostic(DiagID, Arg1, Arg2); else @@ -997,7 +997,7 @@ bool ASTReader::CheckPredefinesBuffers() { /// \brief Read the line table in the source manager block. /// \returns true if there was an error. bool ASTReader::ParseLineTable(Module &F, - llvm::SmallVectorImpl<uint64_t> &Record) { + SmallVectorImpl<uint64_t> &Record) { unsigned Idx = 0; LineTableInfo &LineTable = SourceMgr.getLineTable(); @@ -1341,7 +1341,7 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(int ID) { } llvm::MemoryBuffer *Buffer - = llvm::MemoryBuffer::getMemBuffer(llvm::StringRef(BlobStart, BlobLen - 1), + = llvm::MemoryBuffer::getMemBuffer(StringRef(BlobStart, BlobLen - 1), Name); FileID BufferID = SourceMgr.createFileIDForMemBuffer(Buffer, ID, BaseOffset + Offset); @@ -1349,7 +1349,7 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(int ID) { if (strcmp(Name, "<built-in>") == 0) { PCHPredefinesBlock Block = { BufferID, - llvm::StringRef(BlobStart, BlobLen - 1) + StringRef(BlobStart, BlobLen - 1) }; PCHPredefinesBuffers.push_back(Block); } @@ -1422,7 +1422,7 @@ PreprocessedEntity *ASTReader::ReadMacroRecord(Module &F, uint64_t Offset) { Stream.JumpToBit(Offset); RecordData Record; - llvm::SmallVector<IdentifierInfo*, 16> MacroArgs; + SmallVector<IdentifierInfo*, 16> MacroArgs; MacroInfo *Macro = 0; while (true) { @@ -1614,7 +1614,7 @@ PreprocessedEntity *ASTReader::LoadPreprocessedEntity(Module &F) { const char *FullFileNameStart = BlobStart + Record[3]; const FileEntry *File - = PP->getFileManager().getFile(llvm::StringRef(FullFileNameStart, + = PP->getFileManager().getFile(StringRef(FullFileNameStart, BlobLen - Record[3])); // FIXME: Stable encoding @@ -1622,7 +1622,7 @@ PreprocessedEntity *ASTReader::LoadPreprocessedEntity(Module &F) { = static_cast<InclusionDirective::InclusionKind>(Record[5]); InclusionDirective *ID = new (PPRec) InclusionDirective(PPRec, Kind, - llvm::StringRef(BlobStart, Record[3]), + StringRef(BlobStart, Record[3]), Record[4], File, SourceRange(ReadSourceLocation(F, Record[1]), @@ -1831,7 +1831,7 @@ MacroDefinition *ASTReader::getMacroDefinition(MacroID ID) { return MacroDefinitionsLoaded[ID - 1]; } -const FileEntry *ASTReader::getFileEntry(llvm::StringRef filenameStrRef) { +const FileEntry *ASTReader::getFileEntry(StringRef filenameStrRef) { std::string Filename = filenameStrRef; MaybeAddSystemRootToFilename(Filename); const FileEntry *File = FileMgr.getFile(Filename); @@ -2003,7 +2003,7 @@ ASTReader::ReadASTBlock(Module &F) { // Load the chained file, which is always a PCH file. // FIXME: This could end up being a module. - switch(ReadASTCore(llvm::StringRef(BlobStart, BlobLen), MK_PCH)) { + switch(ReadASTCore(StringRef(BlobStart, BlobLen), MK_PCH)) { case Failure: return Failure; // If we have to ignore the dependency, we'll have to ignore this too. case IgnorePCH: return IgnorePCH; @@ -2222,7 +2222,7 @@ ASTReader::ReadASTBlock(Module &F) { while(Data < DataEnd) { uint32_t Offset = io::ReadUnalignedLE32(Data); uint16_t Len = io::ReadUnalignedLE16(Data); - llvm::StringRef Name = llvm::StringRef((const char*)Data, Len); + StringRef Name = StringRef((const char*)Data, Len); Module *OM = Modules.lookup(Name); if (!OM) { Error("SourceLocation remap refers to unknown module"); @@ -2319,8 +2319,8 @@ ASTReader::ReadASTBlock(Module &F) { case VERSION_CONTROL_BRANCH_REVISION: { const std::string &CurBranch = getClangFullRepositoryVersion(); - llvm::StringRef ASTBranch(BlobStart, BlobLen); - if (llvm::StringRef(CurBranch) != ASTBranch && !DisableValidation) { + StringRef ASTBranch(BlobStart, BlobLen); + if (StringRef(CurBranch) != ASTBranch && !DisableValidation) { Diag(diag::warn_pch_different_branch) << ASTBranch << CurBranch; return IgnorePCH; } @@ -2488,7 +2488,7 @@ ASTReader::ASTReadResult ASTReader::validateFileEntries() { return Failure; case SM_SLOC_FILE_ENTRY: { - llvm::StringRef Filename(BlobStart, BlobLen); + StringRef Filename(BlobStart, BlobLen); const FileEntry *File = getFileEntry(Filename); if (File == 0) { @@ -2576,7 +2576,7 @@ ASTReader::ASTReadResult ASTReader::ReadAST(const std::string &FileName, // since de-serializing declarations or macro definitions can add // new entries into the identifier table, invalidating the // iterators. - llvm::SmallVector<IdentifierInfo *, 128> Identifiers; + SmallVector<IdentifierInfo *, 128> Identifiers; for (IdentifierTable::iterator Id = PP->getIdentifierTable().begin(), IdEnd = PP->getIdentifierTable().end(); Id != IdEnd; ++Id) @@ -2633,7 +2633,7 @@ ASTReader::ASTReadResult ASTReader::ReadAST(const std::string &FileName, return Success; } -ASTReader::ASTReadResult ASTReader::ReadASTCore(llvm::StringRef FileName, +ASTReader::ASTReadResult ASTReader::ReadASTCore(StringRef FileName, ModuleKind Type) { Module *Prev = Chain.empty() ? 0 : Chain.back(); Chain.push_back(new Module(Type)); @@ -2975,7 +2975,7 @@ std::string ASTReader::getOriginalSourceFile(const std::string &ASTFileName, /// /// \returns true if the listener deems the file unacceptable, false otherwise. bool ASTReader::ParseLanguageOptions( - const llvm::SmallVectorImpl<uint64_t> &Record) { + const SmallVectorImpl<uint64_t> &Record) { if (Listener) { LangOptions LangOpts; @@ -3305,7 +3305,7 @@ QualType ASTReader::readTypeRecord(unsigned Index) { unsigned Idx = 6; unsigned NumParams = Record[Idx++]; - llvm::SmallVector<QualType, 16> ParamTypes; + SmallVector<QualType, 16> ParamTypes; for (unsigned I = 0; I != NumParams; ++I) ParamTypes.push_back(readType(*Loc.F, Record, Idx)); @@ -3317,7 +3317,7 @@ QualType ASTReader::readTypeRecord(unsigned Index) { EPI.ExceptionSpecType = EST; if (EST == EST_Dynamic) { EPI.NumExceptions = Record[Idx++]; - llvm::SmallVector<QualType, 2> Exceptions; + SmallVector<QualType, 2> Exceptions; for (unsigned I = 0; I != EPI.NumExceptions; ++I) Exceptions.push_back(readType(*Loc.F, Record, Idx)); EPI.Exceptions = Exceptions.data(); @@ -3451,7 +3451,7 @@ QualType ASTReader::readTypeRecord(unsigned Index) { unsigned Idx = 0; QualType Base = readType(*Loc.F, Record, Idx); unsigned NumProtos = Record[Idx++]; - llvm::SmallVector<ObjCProtocolDecl*, 4> Protos; + SmallVector<ObjCProtocolDecl*, 4> Protos; for (unsigned I = 0; I != NumProtos; ++I) Protos.push_back(ReadDeclAs<ObjCProtocolDecl>(*Loc.F, Record, Idx)); return Context->getObjCObjectType(Base, Protos.data(), NumProtos); @@ -3517,7 +3517,7 @@ QualType ASTReader::readTypeRecord(unsigned Index) { NestedNameSpecifier *NNS = ReadNestedNameSpecifier(*Loc.F, Record, Idx); const IdentifierInfo *Name = this->GetIdentifierInfo(Record, Idx); unsigned NumArgs = Record[Idx++]; - llvm::SmallVector<TemplateArgument, 8> Args; + SmallVector<TemplateArgument, 8> Args; Args.reserve(NumArgs); while (NumArgs--) Args.push_back(ReadTemplateArgument(*Loc.F, Record, Idx)); @@ -3546,7 +3546,7 @@ QualType ASTReader::readTypeRecord(unsigned Index) { unsigned Idx = 0; bool IsDependent = Record[Idx++]; TemplateName Name = ReadTemplateName(*Loc.F, Record, Idx); - llvm::SmallVector<TemplateArgument, 8> Args; + SmallVector<TemplateArgument, 8> Args; ReadTemplateArgumentList(Args, *Loc.F, Record, Idx); QualType Underlying = readType(*Loc.F, Record, Idx); QualType T; @@ -4060,7 +4060,7 @@ Stmt *ASTReader::GetExternalDeclStmt(uint64_t Offset) { ExternalLoadResult ASTReader::FindExternalLexicalDecls(const DeclContext *DC, bool (*isKindWeWant)(Decl::Kind), - llvm::SmallVectorImpl<Decl*> &Decls) { + SmallVectorImpl<Decl*> &Decls) { // There might be lexical decls in multiple parts of the chain, for the TU // at least. // DeclContextOffsets might reallocate as we load additional decls below, @@ -4097,7 +4097,7 @@ ASTReader::FindExternalVisibleDeclsByName(const DeclContext *DC, return DeclContext::lookup_result(DeclContext::lookup_iterator(0), DeclContext::lookup_iterator(0)); - llvm::SmallVector<NamedDecl *, 64> Decls; + SmallVector<NamedDecl *, 64> Decls; // There might be visible decls in multiple parts of the chain, for the TU // and namespaces. For any given name, the last available results replace // all earlier ones. For this reason, we walk in reverse. @@ -4129,7 +4129,7 @@ void ASTReader::MaterializeVisibleDecls(const DeclContext *DC) { assert(DC->hasExternalVisibleStorage() && "DeclContext has no visible decls in storage"); - llvm::SmallVector<NamedDecl *, 64> Decls; + SmallVector<NamedDecl *, 64> Decls; // There might be visible decls in multiple parts of the chain, for the TU // and namespaces. DeclContextInfos &Infos = DeclContextOffsets[DC]; @@ -4250,7 +4250,7 @@ void ASTReader::PrintStats() { template<typename Key, typename Module, unsigned InitialCapacity> static void -dumpModuleIDMap(llvm::StringRef Name, +dumpModuleIDMap(StringRef Name, const ContinuousRangeMap<Key, Module *, InitialCapacity> &Map) { if (Map.begin() == Map.end()) @@ -4268,7 +4268,7 @@ dumpModuleIDMap(llvm::StringRef Name, template<typename Key, typename Module, typename Adjustment, unsigned InitialCapacity> static void -dumpModuleIDOffsetMap(llvm::StringRef Name, +dumpModuleIDOffsetMap(StringRef Name, const ContinuousRangeMap<Key, std::pair<Module *, Adjustment>, @@ -4499,7 +4499,7 @@ namespace clang { public: explicit ASTIdentifierIterator(const ASTReader &Reader); - virtual llvm::StringRef Next(); + virtual StringRef Next(); }; } @@ -4511,11 +4511,11 @@ ASTIdentifierIterator::ASTIdentifierIterator(const ASTReader &Reader) End = IdTable->key_end(); } -llvm::StringRef ASTIdentifierIterator::Next() { +StringRef ASTIdentifierIterator::Next() { while (Current == End) { // If we have exhausted all of our AST files, we're done. if (Index == 0) - return llvm::StringRef(); + return StringRef(); --Index; ASTIdentifierLookupTable *IdTable @@ -4528,7 +4528,7 @@ llvm::StringRef ASTIdentifierIterator::Next() { // the next one. std::pair<const char*, unsigned> Key = *Current; ++Current; - return llvm::StringRef(Key.first, Key.second); + return StringRef(Key.first, Key.second); } IdentifierIterator *ASTReader::getIdentifiers() const { @@ -4564,7 +4564,7 @@ ASTReader::ReadMethodPool(Selector Sel) { } void ASTReader::ReadKnownNamespaces( - llvm::SmallVectorImpl<NamespaceDecl *> &Namespaces) { + SmallVectorImpl<NamespaceDecl *> &Namespaces) { Namespaces.clear(); for (unsigned I = 0, N = KnownNamespaces.size(); I != N; ++I) { @@ -4605,7 +4605,7 @@ void ASTReader::SetIdentifierInfo(unsigned ID, IdentifierInfo *II) { /// will not be placed onto the pending queue. void ASTReader::SetGloballyVisibleDecls(IdentifierInfo *II, - const llvm::SmallVectorImpl<uint32_t> &DeclIDs, + const SmallVectorImpl<uint32_t> &DeclIDs, bool Nonrecursive) { if (NumCurrentElementsDeserializing && !Nonrecursive) { PendingIdentifierInfos.push_back(PendingIdentifierInfo()); @@ -4661,7 +4661,7 @@ IdentifierInfo *ASTReader::DecodeIdentifierInfo(unsigned ID) { unsigned StrLen = (((unsigned) StrLenPtr[0]) | (((unsigned) StrLenPtr[1]) << 8)) - 1; IdentifiersLoaded[ID] - = &PP->getIdentifierTable().get(llvm::StringRef(Str, StrLen)); + = &PP->getIdentifierTable().get(StringRef(Str, StrLen)); if (DeserializationListener) DeserializationListener->IdentifierRead(ID + 1, IdentifiersLoaded[ID]); } @@ -4909,7 +4909,7 @@ ASTReader::ReadTemplateParameterList(Module &F, SourceLocation RAngleLoc = ReadSourceLocation(F, Record, Idx); unsigned NumParams = Record[Idx++]; - llvm::SmallVector<NamedDecl *, 16> Params; + SmallVector<NamedDecl *, 16> Params; Params.reserve(NumParams); while (NumParams--) Params.push_back(ReadDeclAs<NamedDecl>(F, Record, Idx)); @@ -4922,7 +4922,7 @@ ASTReader::ReadTemplateParameterList(Module &F, void ASTReader:: -ReadTemplateArgumentList(llvm::SmallVector<TemplateArgument, 8> &TemplArgs, +ReadTemplateArgumentList(SmallVector<TemplateArgument, 8> &TemplArgs, Module &F, const RecordData &Record, unsigned &Idx) { unsigned NumTemplateArgs = Record[Idx++]; @@ -5001,7 +5001,7 @@ ASTReader::ReadCXXCtorInitializers(Module &F, const RecordData &Record, SourceLocation RParenLoc = ReadSourceLocation(F, Record, Idx); bool IsWritten = Record[Idx++]; unsigned SourceOrderOrNumArrayIndices; - llvm::SmallVector<VarDecl *, 8> Indices; + SmallVector<VarDecl *, 8> Indices; if (IsWritten) { SourceOrderOrNumArrayIndices = Record[Idx++]; } else { diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp index 30800fbe82..289b6c835e 100644 --- a/lib/Serialization/ASTReaderDecl.cpp +++ b/lib/Serialization/ASTReaderDecl.cpp @@ -359,11 +359,11 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) { TemplateSpecializationKind TSK = (TemplateSpecializationKind)Record[Idx++]; // Template arguments. - llvm::SmallVector<TemplateArgument, 8> TemplArgs; + SmallVector<TemplateArgument, 8> TemplArgs; Reader.ReadTemplateArgumentList(TemplArgs, F, Record, Idx); // Template args as written. - llvm::SmallVector<TemplateArgumentLoc, 8> TemplArgLocs; + SmallVector<TemplateArgumentLoc, 8> TemplArgLocs; SourceLocation LAngleLoc, RAngleLoc; if (Record[Idx++]) { // TemplateArgumentsAsWritten != 0 unsigned NumTemplateArgLocs = Record[Idx++]; @@ -452,7 +452,7 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) { // Read in the parameters. unsigned NumParams = Record[Idx++]; - llvm::SmallVector<ParmVarDecl *, 16> Params; + SmallVector<ParmVarDecl *, 16> Params; Params.reserve(NumParams); for (unsigned I = 0; I != NumParams; ++I) Params.push_back(ReadDeclAs<ParmVarDecl>(Record, Idx)); @@ -480,7 +480,7 @@ void ASTDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) { MD->setResultTypeSourceInfo(GetTypeSourceInfo(Record, Idx)); MD->setEndLoc(ReadSourceLocation(Record, Idx)); unsigned NumParams = Record[Idx++]; - llvm::SmallVector<ParmVarDecl *, 16> Params; + SmallVector<ParmVarDecl *, 16> Params; Params.reserve(NumParams); for (unsigned I = 0; I != NumParams; ++I) Params.push_back(ReadDeclAs<ParmVarDecl>(Record, Idx)); @@ -502,11 +502,11 @@ void ASTDeclReader::VisitObjCInterfaceDecl(ObjCInterfaceDecl *ID) { // Read the directly referenced protocols and their SourceLocations. unsigned NumProtocols = Record[Idx++]; - llvm::SmallVector<ObjCProtocolDecl *, 16> Protocols; + SmallVector<ObjCProtocolDecl *, 16> Protocols; Protocols.reserve(NumProtocols); for (unsigned I = 0; I != NumProtocols; ++I) Protocols.push_back(ReadDeclAs<ObjCProtocolDecl>(Record, Idx)); - llvm::SmallVector<SourceLocation, 16> ProtoLocs; + SmallVector<SourceLocation, 16> ProtoLocs; ProtoLocs.reserve(NumProtocols); for (unsigned I = 0; I != NumProtocols; ++I) ProtoLocs.push_back(ReadSourceLocation(Record, Idx)); @@ -524,7 +524,7 @@ void ASTDeclReader::VisitObjCInterfaceDecl(ObjCInterfaceDecl *ID) { // Read the ivars. unsigned NumIvars = Record[Idx++]; - llvm::SmallVector<ObjCIvarDecl *, 16> IVars; + SmallVector<ObjCIvarDecl *, 16> IVars; IVars.reserve(NumIvars); for (unsigned I = 0; I != NumIvars; ++I) IVars.push_back(ReadDeclAs<ObjCIvarDecl>(Record, Idx)); @@ -553,11 +553,11 @@ void ASTDeclReader::VisitObjCProtocolDecl(ObjCProtocolDecl *PD) { PD->setForwardDecl(Record[Idx++]); PD->setLocEnd(ReadSourceLocation(Record, Idx)); unsigned NumProtoRefs = Record[Idx++]; - llvm::SmallVector<ObjCProtocolDecl *, 16> ProtoRefs; + SmallVector<ObjCProtocolDecl *, 16> ProtoRefs; ProtoRefs.reserve(NumProtoRefs); for (unsigned I = 0; I != NumProtoRefs; ++I) ProtoRefs.push_back(ReadDeclAs<ObjCProtocolDecl>(Record, Idx)); - llvm::SmallVector<SourceLocation, 16> ProtoLocs; + SmallVector<SourceLocation, 16> ProtoLocs; ProtoLocs.reserve(NumProtoRefs); for (unsigned I = 0; I != NumProtoRefs; ++I) ProtoLocs.push_back(ReadSourceLocation(Record, Idx)); @@ -572,11 +572,11 @@ void ASTDeclReader::VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *FD) { void ASTDeclReader::VisitObjCClassDecl(ObjCClassDecl *CD) { VisitDecl(CD); unsigned NumClassRefs = Record[Idx++]; - llvm::SmallVector<ObjCInterfaceDecl *, 16> ClassRefs; + SmallVector<ObjCInterfaceDecl *, 16> ClassRefs; ClassRefs.reserve(NumClassRefs); for (unsigned I = 0; I != NumClassRefs; ++I) ClassRefs.push_back(ReadDeclAs<ObjCInterfaceDecl>(Record, Idx)); - llvm::SmallVector<SourceLocation, 16> SLocs; + SmallVector<SourceLocation, 16> SLocs; SLocs.reserve(NumClassRefs); for (unsigned I = 0; I != NumClassRefs; ++I) SLocs.push_back(ReadSourceLocation(Record, Idx)); @@ -587,11 +587,11 @@ void ASTDeclReader::VisitObjCClassDecl(ObjCClassDecl *CD) { void ASTDeclReader::VisitObjCForwardProtocolDecl(ObjCForwardProtocolDecl *FPD) { VisitDecl(FPD); unsigned NumProtoRefs = Record[Idx++]; - llvm::SmallVector<ObjCProtocolDecl *, 16> ProtoRefs; + SmallVector<ObjCProtocolDecl *, 16> ProtoRefs; ProtoRefs.reserve(NumProtoRefs); for (unsigned I = 0; I != NumProtoRefs; ++I) ProtoRefs.push_back(ReadDeclAs<ObjCProtocolDecl>(Record, Idx)); - llvm::SmallVector<SourceLocation, 16> ProtoLocs; + SmallVector<SourceLocation, 16> ProtoLocs; ProtoLocs.reserve(NumProtoRefs); for (unsigned I = 0; I != NumProtoRefs; ++I) ProtoLocs.push_back(ReadSourceLocation(Record, Idx)); @@ -603,11 +603,11 @@ void ASTDeclReader::VisitObjCCategoryDecl(ObjCCategoryDecl *CD) { VisitObjCContainerDecl(CD); CD->setClassInterface(ReadDeclAs<ObjCInterfaceDecl>(Record, Idx)); unsigned NumProtoRefs = Record[Idx++]; - llvm::SmallVector<ObjCProtocolDecl *, 16> ProtoRefs; + SmallVector<ObjCProtocolDecl *, 16> ProtoRefs; ProtoRefs.reserve(NumProtoRefs); for (unsigned I = 0; I != NumProtoRefs; ++I) ProtoRefs.push_back(ReadDeclAs<ObjCProtocolDecl>(Record, Idx)); - llvm::SmallVector<SourceLocation, 16> ProtoLocs; + SmallVector<SourceLocation, 16> ProtoLocs; ProtoLocs.reserve(NumProtoRefs); for (unsigned I = 0; I != NumProtoRefs; ++I) ProtoLocs.push_back(ReadSourceLocation(Record, Idx)); @@ -753,7 +753,7 @@ void ASTDeclReader::VisitBlockDecl(BlockDecl *BD) { BD->setBody(cast_or_null<CompoundStmt>(Reader.ReadStmt(F))); BD->setSignatureAsWritten(GetTypeSourceInfo(Record, Idx)); unsigned NumParams = Record[Idx++]; - llvm::SmallVector<ParmVarDecl *, 16> Params; + SmallVector<ParmVarDecl *, 16> Params; Params.reserve(NumParams); for (unsigned I = 0; I != NumParams; ++I) Params.push_back(ReadDeclAs<ParmVarDecl>(Record, Idx)); @@ -761,7 +761,7 @@ void ASTDeclReader::VisitBlockDecl(BlockDecl *BD) { bool capturesCXXThis = Record[Idx++]; unsigned numCaptures = Record[Idx++]; - llvm::SmallVector<BlockDecl::Capture, 16> captures; + SmallVector<BlockDecl::Capture, 16> captures; captures.reserve(numCaptures); for (unsigned i = 0; i != numCaptures; ++i) { VarDecl *decl = ReadDeclAs<VarDecl>(Record, Idx); @@ -1109,7 +1109,7 @@ void ASTDeclReader::VisitClassTemplateDecl(ClassTemplateDecl *D) { if (D->getPreviousDeclaration() == 0) { // This ClassTemplateDecl owns a CommonPtr; read it to keep track of all of // the specializations. - llvm::SmallVector<serialization::DeclID, 2> SpecIDs; + SmallVector<serialization::DeclID, 2> SpecIDs; SpecIDs.push_back(0); // Specializations. @@ -1147,7 +1147,7 @@ void ASTDeclReader::VisitClassTemplateSpecializationDecl( if (ClassTemplateDecl *CTD = dyn_cast<ClassTemplateDecl>(InstD)) { D->SpecializedTemplate = CTD; } else { - llvm::SmallVector<TemplateArgument, 8> TemplArgs; + SmallVector<TemplateArgument, 8> TemplArgs; Reader.ReadTemplateArgumentList(TemplArgs, F, Record, Idx); TemplateArgumentList *ArgList = TemplateArgumentList::CreateCopy(C, TemplArgs.data(), @@ -1172,7 +1172,7 @@ void ASTDeclReader::VisitClassTemplateSpecializationDecl( D->ExplicitInfo = ExplicitInfo; } - llvm::SmallVector<TemplateArgument, 8> TemplArgs; + SmallVector<TemplateArgument, 8> TemplArgs; Reader.ReadTemplateArgumentList(TemplArgs, F, Record, Idx); D->TemplateArgs = TemplateArgumentList::CreateCopy(C, TemplArgs.data(), TemplArgs.size()); diff --git a/lib/Serialization/ASTReaderStmt.cpp b/lib/Serialization/ASTReaderStmt.cpp index f6c91b4fa7..3559ccecd3 100644 --- a/lib/Serialization/ASTReaderStmt.cpp +++ b/lib/Serialization/ASTReaderStmt.cpp @@ -114,7 +114,7 @@ void ASTStmtReader::VisitNullStmt(NullStmt *S) { void ASTStmtReader::VisitCompoundStmt(CompoundStmt *S) { VisitStmt(S); - llvm::SmallVector<Stmt *, 16> Stmts; + SmallVector<Stmt *, 16> Stmts; unsigned NumStmts = Record[Idx++]; while (NumStmts--) Stmts.push_back(Reader.ReadSubStmt()); @@ -259,7 +259,7 @@ void ASTStmtReader::VisitDeclStmt(DeclStmt *S) { // Single declaration S->setDeclGroup(DeclGroupRef(ReadDecl(Record, Idx))); } else { - llvm::SmallVector<Decl *, 16> Decls; + SmallVector<Decl *, 16> Decls; Decls.reserve(Record.size() - Idx); for (unsigned N = Record.size(); Idx != N; ) Decls.push_back(ReadDecl(Record, Idx)); @@ -283,9 +283,9 @@ void ASTStmtReader::VisitAsmStmt(AsmStmt *S) { S->setAsmString(cast_or_null<StringLiteral>(Reader.ReadSubStmt())); // Outputs and inputs - llvm::SmallVector<IdentifierInfo *, 16> Names; - llvm::SmallVector<StringLiteral*, 16> Constraints; - llvm::SmallVector<Stmt*, 16> Exprs; + SmallVector<IdentifierInfo *, 16> Names; + SmallVector<StringLiteral*, 16> Constraints; + SmallVector<Stmt*, 16> Exprs; for (unsigned I = 0, N = NumOutputs + NumInputs; I != N; ++I) { Names.push_back(Reader.GetIdentifierInfo(Record, Idx)); Constraints.push_back(cast_or_null<StringLiteral>(Reader.ReadSubStmt())); @@ -293,7 +293,7 @@ void ASTStmtReader::VisitAsmStmt(AsmStmt *S) { } // Constraints - llvm::SmallVector<StringLiteral*, 16> Clobbers; + SmallVector<StringLiteral*, 16> Clobbers; for (unsigned I = 0; I != NumClobbers; ++I) Clobbers.push_back(cast_or_null<StringLiteral>(Reader.ReadSubStmt())); @@ -634,7 +634,7 @@ void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) { E->setEqualOrColonLoc(ReadSourceLocation(Record, Idx)); E->setGNUSyntax(Record[Idx++]); - llvm::SmallVector<Designator, 4> Designators; + SmallVector<Designator, 4> Designators; while (Idx < Record.size()) { switch ((DesignatorTypes)Record[Idx++]) { case DESIG_FIELD_DECL: { @@ -729,7 +729,7 @@ void ASTStmtReader::VisitGNUNullExpr(GNUNullExpr *E) { void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) { VisitExpr(E); - llvm::SmallVector<Expr *, 16> Exprs; + SmallVector<Expr *, 16> Exprs; unsigned NumExprs = Record[Idx++]; while (NumExprs--) Exprs.push_back(Reader.ReadSubExpr()); diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index e291b7fd57..7620cb7ee0 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -53,15 +53,15 @@ using namespace clang; using namespace clang::serialization; template <typename T, typename Allocator> -static llvm::StringRef data(const std::vector<T, Allocator> &v) { - if (v.empty()) return llvm::StringRef(); - return llvm::StringRef(reinterpret_cast<const char*>(&v[0]), +static StringRef data(const std::vector<T, Allocator> &v) { + if (v.empty()) return StringRef(); + return StringRef(reinterpret_cast<const char*>(&v[0]), sizeof(T) * v.size()); } template <typename T> -static llvm::StringRef data(const llvm::SmallVectorImpl<T> &v) { - return llvm::StringRef(reinterpret_cast<const char*>(v.data()), +static StringRef data(const SmallVectorImpl<T> &v) { + return StringRef(reinterpret_cast<const char*>(v.data()), sizeof(T) * v.size()); } @@ -1137,7 +1137,7 @@ public: } std::pair<unsigned,unsigned> - EmitKeyDataLength(llvm::raw_ostream& Out, const char *path, + EmitKeyDataLength(raw_ostream& Out, const char *path, data_type_ref Data) { unsigned StrLen = strlen(path); clang::io::Emit16(Out, StrLen); @@ -1146,11 +1146,11 @@ public: return std::make_pair(StrLen + 1, DataLen); } - void EmitKey(llvm::raw_ostream& Out, const char *path, unsigned KeyLen) { + void EmitKey(raw_ostream& Out, const char *path, unsigned KeyLen) { Out.write(path, KeyLen); } - void EmitData(llvm::raw_ostream &Out, key_type_ref, + void EmitData(raw_ostream &Out, key_type_ref, data_type_ref Data, unsigned DataLen) { using namespace clang::io; uint64_t Start = Out.tell(); (void)Start; @@ -1175,7 +1175,7 @@ void ASTWriter::WriteStatCache(MemorizeStatCalls &StatCalls) { for (MemorizeStatCalls::iterator Stat = StatCalls.begin(), StatEnd = StatCalls.end(); Stat != StatEnd; ++Stat, ++NumStatEntries) { - llvm::StringRef Filename = Stat->first(); + StringRef Filename = Stat->first(); Generator.insert(Filename.data(), Stat->second); } @@ -1290,7 +1290,7 @@ namespace { } std::pair<unsigned,unsigned> - EmitKeyDataLength(llvm::raw_ostream& Out, const char *path, + EmitKeyDataLength(raw_ostream& Out, const char *path, data_type_ref Data) { unsigned StrLen = strlen(path); clang::io::Emit16(Out, StrLen); @@ -1299,11 +1299,11 @@ namespace { return std::make_pair(StrLen + 1, DataLen); } - void EmitKey(llvm::raw_ostream& Out, const char *path, unsigned KeyLen) { + void EmitKey(raw_ostream& Out, const char *path, unsigned KeyLen) { Out.write(path, KeyLen); } - void EmitData(llvm::raw_ostream &Out, key_type_ref, + void EmitData(raw_ostream &Out, key_type_ref, data_type_ref Data, unsigned DataLen) { using namespace clang::io; uint64_t Start = Out.tell(); (void)Start; @@ -1330,7 +1330,7 @@ namespace { /// /// \param Chain Whether we're creating a chained AST file. void ASTWriter::WriteHeaderSearch(HeaderSearch &HS, StringRef isysroot) { - llvm::SmallVector<const FileEntry *, 16> FilesByUID; + SmallVector<const FileEntry *, 16> FilesByUID; HS.getFileMgr().GetUniqueIDMapping(FilesByUID); if (FilesByUID.size() > HS.header_file_size()) @@ -1338,7 +1338,7 @@ void ASTWriter::WriteHeaderSearch(HeaderSearch &HS, StringRef isysroot) { HeaderFileInfoTrait GeneratorTrait(*this, HS); OnDiskChainedHashTableGenerator<HeaderFileInfoTrait> Generator; - llvm::SmallVector<const char *, 4> SavedStrings; + SmallVector<const char *, 4> SavedStrings; unsigned NumHeaderSearchEntries = 0; for (unsigned UID = 0, LastUID = FilesByUID.size(); UID != LastUID; ++UID) { const FileEntry *File = FilesByUID[UID]; @@ -1492,11 +1492,11 @@ void ASTWriter::WriteSourceManagerBlock(SourceManager &SourceMgr, = Content->getBuffer(PP.getDiagnostics(), PP.getSourceManager()); const char *Name = Buffer->getBufferIdentifier(); Stream.EmitRecordWithBlob(SLocBufferAbbrv, Record, - llvm::StringRef(Name, strlen(Name) + 1)); + StringRef(Name, strlen(Name) + 1)); Record.clear(); Record.push_back(SM_SLOC_BUFFER_BLOB); Stream.EmitRecordWithBlob(SLocBufferBlobAbbrv, Record, - llvm::StringRef(Buffer->getBufferStart(), + StringRef(Buffer->getBufferStart(), Buffer->getBufferSize() + 1)); if (strcmp(Name, "<built-in>") == 0) { @@ -1546,8 +1546,8 @@ void ASTWriter::WriteSourceManagerBlock(SourceManager &SourceMgr, // The map consists solely of a blob with the following format: // *(offset:i32 len:i16 name:len*i8) // Sorted by offset. - typedef std::pair<uint32_t, llvm::StringRef> ModuleOffset; - llvm::SmallVector<ModuleOffset, 16> Modules; + typedef std::pair<uint32_t, StringRef> ModuleOffset; + SmallVector<ModuleOffset, 16> Modules; Modules.reserve(Chain->Modules.size()); for (llvm::StringMap<Module*>::const_iterator I = Chain->Modules.begin(), E = Chain->Modules.end(); @@ -1564,7 +1564,7 @@ void ASTWriter::WriteSourceManagerBlock(SourceManager &SourceMgr, llvm::SmallString<2048> Buffer; { llvm::raw_svector_ostream Out(Buffer); - for (llvm::SmallVector<ModuleOffset, 16>::iterator I = Modules.begin(), + for (SmallVector<ModuleOffset, 16>::iterator I = Modules.begin(), E = Modules.end(); I != E; ++I) { io::Emit32(Out, I->first); @@ -1677,7 +1677,7 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP) { PreprocessingRecord *PPRec = PP.getPreprocessingRecord(); // Construct the list of macro definitions that need to be serialized. - llvm::SmallVector<std::pair<const IdentifierInfo *, MacroInfo *>, 2> + SmallVector<std::pair<const IdentifierInfo *, MacroInfo *>, 2> MacrosToEmit; llvm::SmallPtrSet<const IdentifierInfo*, 4> MacroDefinitionsSeen; for (Preprocessor::macro_iterator I = PP.macro_begin(Chain == 0), @@ -2010,7 +2010,7 @@ uint64_t ASTWriter::WriteDeclContextLexicalBlock(ASTContext &Context, uint64_t Offset = Stream.GetCurrentBitNo(); RecordData Record; Record.push_back(DECL_CONTEXT_LEXICAL); - llvm::SmallVector<KindDeclIDPair, 64> Decls; + SmallVector<KindDeclIDPair, 64> Decls; for (DeclContext::decl_iterator D = DC->decls_begin(), DEnd = DC->decls_end(); D != DEnd; ++D) Decls.push_back(std::make_pair((*D)->getKind(), GetDeclRef(*D))); @@ -2073,7 +2073,7 @@ public: } std::pair<unsigned,unsigned> - EmitKeyDataLength(llvm::raw_ostream& Out, Selector Sel, + EmitKeyDataLength(raw_ostream& Out, Selector Sel, data_type_ref Methods) { unsigned KeyLen = 2 + (Sel.getNumArgs()? Sel.getNumArgs() * 4 : 4); clang::io::Emit16(Out, KeyLen); @@ -2090,7 +2090,7 @@ public: return std::make_pair(KeyLen, DataLen); } - void EmitKey(llvm::raw_ostream& Out, Selector Sel, unsigned) { + void EmitKey(raw_ostream& Out, Selector Sel, unsigned) { uint64_t Start = Out.tell(); assert((Start >> 32) == 0 && "Selector key offset too large"); Writer.SetSelectorOffset(Sel, Start); @@ -2103,7 +2103,7 @@ public: Writer.getIdentifierRef(Sel.getIdentifierInfoForSlot(I))); } - void EmitData(llvm::raw_ostream& Out, key_type_ref, + void EmitData(raw_ostream& Out, key_type_ref, data_type_ref Methods, unsigned DataLen) { uint64_t Start = Out.tell(); (void)Start; clang::io::Emit32(Out, Methods.ID); @@ -2292,7 +2292,7 @@ public: } std::pair<unsigned,unsigned> - EmitKeyDataLength(llvm::raw_ostream& Out, const IdentifierInfo* II, + EmitKeyDataLength(raw_ostream& Out, const IdentifierInfo* II, IdentID ID) { unsigned KeyLen = II->getLength() + 1; unsigned DataLen = 4; // 4 bytes for the persistent ID << 1 @@ -2314,7 +2314,7 @@ public: return std::make_pair(KeyLen, DataLen); } - void EmitKey(llvm::raw_ostream& Out, const IdentifierInfo* II, + void EmitKey(raw_ostream& Out, const IdentifierInfo* II, unsigned KeyLen) { // Record the location of the key data. This is used when generating // the mapping from persistent IDs to strings. @@ -2322,7 +2322,7 @@ public: Out.write(II->getNameStart(), KeyLen); } - void EmitData(llvm::raw_ostream& Out, const IdentifierInfo* II, + void EmitData(raw_ostream& Out, const IdentifierInfo* II, IdentID ID, unsigned) { if (!isInterestingIdentifier(II)) { clang::io::Emit32(Out, ID << 1); @@ -2352,9 +2352,9 @@ public: // adds declarations to the end of the list (so we need to see the // struct "status" before the function "status"). // Only emit declarations that aren't from a chained PCH, though. - llvm::SmallVector<Decl *, 16> Decls(IdentifierResolver::begin(II), + SmallVector<Decl *, 16> Decls(IdentifierResolver::begin(II), IdentifierResolver::end()); - for (llvm::SmallVector<Decl *, 16>::reverse_iterator D = Decls.rbegin(), + for (SmallVector<Decl *, 16>::reverse_iterator D = Decls.rbegin(), DEnd = Decls.rend(); D != DEnd; ++D) clang::io::Emit32(Out, Writer.getDeclID(*D)); @@ -2485,7 +2485,7 @@ public: } std::pair<unsigned,unsigned> - EmitKeyDataLength(llvm::raw_ostream& Out, DeclarationName Name, + EmitKeyDataLength(raw_ostream& Out, DeclarationName Name, data_type_ref Lookup) { unsigned KeyLen = 1; switch (Name.getNameKind()) { @@ -2514,7 +2514,7 @@ public: return std::make_pair(KeyLen, DataLen); } - void EmitKey(llvm::raw_ostream& Out, DeclarationName Name, unsigned) { + void EmitKey(raw_ostream& Out, DeclarationName Name, unsigned) { using namespace clang::io; assert(Name.getNameKind() < 0x100 && "Invalid name kind ?"); @@ -2545,7 +2545,7 @@ public: } } - void EmitData(llvm::raw_ostream& Out, key_type_ref, + void EmitData(raw_ostream& Out, key_type_ref, data_type Lookup, unsigned DataLen) { uint64_t Start = Out.tell(); (void)Start; clang::io::Emit16(Out, Lookup.second - Lookup.first); @@ -2705,7 +2705,7 @@ void ASTWriter::WriteAttributes(const AttrVec &Attrs, RecordDataImpl &Record) { } } -void ASTWriter::AddString(llvm::StringRef Str, RecordDataImpl &Record) { +void ASTWriter::AddString(StringRef Str, RecordDataImpl &Record) { Record.push_back(Str.size()); Record.insert(Record.end(), Str.begin(), Str.end()); } @@ -2799,7 +2799,7 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls, // declarations) for builtins. { IdentifierTable &Table = PP.getIdentifierTable(); - llvm::SmallVector<const char *, 32> BuiltinNames; + SmallVector<const char *, 32> BuiltinNames; Context.BuiltinInfo.GetBuiltinNames(BuiltinNames, Context.getLangOptions().NoBuiltin); for (unsigned I = 0, N = BuiltinNames.size(); I != N; ++I) @@ -3047,7 +3047,7 @@ void ASTWriter::WriteASTChain(Sema &SemaRef, MemorizeStatCalls *StatCalls, // We don't start with the translation unit, but with its decls that // don't come from the chained PCH. const TranslationUnitDecl *TU = Context.getTranslationUnitDecl(); - llvm::SmallVector<KindDeclIDPair, 64> NewGlobalDecls; + SmallVector<KindDeclIDPair, 64> NewGlobalDecls; for (DeclContext::decl_iterator I = TU->noload_decls_begin(), E = TU->noload_decls_end(); I != E; ++I) { @@ -3307,7 +3307,7 @@ void ASTWriter::WriteDeclReplacementsBlock() { return; RecordData Record; - for (llvm::SmallVector<std::pair<DeclID, uint64_t>, 16>::iterator + for (SmallVector<std::pair<DeclID, uint64_t>, 16>::iterator I = ReplacedDecls.begin(), E = ReplacedDecls.end(); I != E; ++I) { Record.push_back(I->first); Record.push_back(I->second); @@ -3617,7 +3617,7 @@ void ASTWriter::AddNestedNameSpecifier(NestedNameSpecifier *NNS, RecordDataImpl &Record) { // Nested name specifiers usually aren't too long. I think that 8 would // typically accommodate the vast majority. - llvm::SmallVector<NestedNameSpecifier *, 8> NestedNames; + SmallVector<NestedNameSpecifier *, 8> NestedNames; // Push each of the NNS's onto a stack for serialization in reverse order. while (NNS) { @@ -3660,7 +3660,7 @@ void ASTWriter::AddNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, RecordDataImpl &Record) { // Nested name specifiers usually aren't too long. I think that 8 would // typically accommodate the vast majority. - llvm::SmallVector<NestedNameSpecifierLoc , 8> NestedNames; + SmallVector<NestedNameSpecifierLoc , 8> NestedNames; // Push each of the nested-name-specifiers's onto a stack for // serialization in reverse order. diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp index 2b83494957..45f8a32df0 100644 --- a/lib/Serialization/ASTWriterDecl.cpp +++ b/lib/Serialization/ASTWriterDecl.cpp @@ -1648,7 +1648,7 @@ void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) { if (DC) W.VisitDeclContext(DC, LexicalOffset, VisibleOffset); if (!W.Code) - llvm::report_fatal_error(llvm::StringRef("unexpected declaration kind '") + + llvm::report_fatal_error(StringRef("unexpected declaration kind '") + D->getDeclKindName() + "'"); Stream.EmitRecord(W.Code, Record, W.AbbrevToUse); diff --git a/lib/Serialization/ASTWriterStmt.cpp b/lib/Serialization/ASTWriterStmt.cpp index 1d73ed447b..0b5bc1fcfe 100644 --- a/lib/Serialization/ASTWriterStmt.cpp +++ b/lib/Serialization/ASTWriterStmt.cpp @@ -1428,7 +1428,7 @@ void ASTWriter::WriteSubStmt(Stmt *S) { } // Redirect ASTWriter::AddStmt to collect sub stmts. - llvm::SmallVector<Stmt *, 16> SubStmts; + SmallVector<Stmt *, 16> SubStmts; CollectedStmts = &SubStmts; Writer.Code = serialization::STMT_NULL_PTR; diff --git a/lib/Serialization/ChainedIncludesSource.cpp b/lib/Serialization/ChainedIncludesSource.cpp index a356dd6085..a4a9f08f99 100644 --- a/lib/Serialization/ChainedIncludesSource.cpp +++ b/lib/Serialization/ChainedIncludesSource.cpp @@ -26,7 +26,7 @@ using namespace clang; static ASTReader *createASTReader(CompilerInstance &CI, - llvm::StringRef pchFile, + StringRef pchFile, llvm::MemoryBuffer **memBufs, unsigned numBufs, ASTDeserializationListener *deserialListener = 0) { @@ -62,7 +62,7 @@ ChainedIncludesSource *ChainedIncludesSource::create(CompilerInstance &CI) { llvm::OwningPtr<ChainedIncludesSource> source(new ChainedIncludesSource()); InputKind IK = CI.getFrontendOpts().Inputs[0].first; - llvm::SmallVector<llvm::MemoryBuffer *, 4> serialBufs; + SmallVector<llvm::MemoryBuffer *, 4> serialBufs; for (unsigned i = 0, e = includes.size(); i != e; ++i) { bool firstInclude = (i == 0); @@ -98,7 +98,7 @@ ChainedIncludesSource *ChainedIncludesSource::create(CompilerInstance &CI) { &Clang->getPreprocessor()); Clang->createASTContext(); - llvm::SmallVector<char, 256> serialAST; + SmallVector<char, 256> serialAST; llvm::raw_svector_ostream OS(serialAST); llvm::OwningPtr<ASTConsumer> consumer; consumer.reset(new PCHGenerator(Clang->getPreprocessor(), "-", @@ -115,10 +115,10 @@ ChainedIncludesSource *ChainedIncludesSource::create(CompilerInstance &CI) { PP.getLangOptions()); } else { assert(!serialBufs.empty()); - llvm::SmallVector<llvm::MemoryBuffer *, 4> bufs; + SmallVector<llvm::MemoryBuffer *, 4> bufs; for (unsigned si = 0, se = serialBufs.size(); si != se; ++si) { bufs.push_back(llvm::MemoryBuffer::getMemBufferCopy( - llvm::StringRef(serialBufs[si]->getBufferStart(), + StringRef(serialBufs[si]->getBufferStart(), serialBufs[si]->getBufferSize()))); } std::string pchName = includes[i-1]; @@ -140,7 +140,7 @@ ChainedIncludesSource *ChainedIncludesSource::create(CompilerInstance &CI) { OS.flush(); Clang->getDiagnosticClient().EndSourceFile(); serialBufs.push_back( - llvm::MemoryBuffer::getMemBufferCopy(llvm::StringRef(serialAST.data(), + llvm::MemoryBuffer::getMemBufferCopy(StringRef(serialAST.data(), serialAST.size()))); source->CIs.push_back(Clang.take()); } @@ -188,7 +188,7 @@ void ChainedIncludesSource::MaterializeVisibleDecls(const DeclContext *DC) { ExternalLoadResult ChainedIncludesSource::FindExternalLexicalDecls(const DeclContext *DC, bool (*isKindWeWant)(Decl::Kind), - llvm::SmallVectorImpl<Decl*> &Result) { + SmallVectorImpl<Decl*> &Result) { return getFinalReader().FindExternalLexicalDecls(DC, isKindWeWant, Result); } void ChainedIncludesSource::CompleteType(TagDecl *Tag) { diff --git a/lib/Serialization/GeneratePCH.cpp b/lib/Serialization/GeneratePCH.cpp index 16352c8e13..3f3674e616 100644 --- a/lib/Serialization/GeneratePCH.cpp +++ b/lib/Serialization/GeneratePCH.cpp @@ -30,7 +30,7 @@ PCHGenerator::PCHGenerator(const Preprocessor &PP, const std::string &OutputFile, bool Chaining, StringRef isysroot, - llvm::raw_ostream *OS) + raw_ostream *OS) : PP(PP), OutputFile(OutputFile), isysroot(isysroot.str()), Out(OS), SemaPtr(0), StatCalls(0), Stream(Buffer), Writer(Stream), Chaining(Chaining) { // Install a stat() listener to keep track of all of the stat() diff --git a/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp b/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp index 65a6e633dc..c723ffd6ff 100644 --- a/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp +++ b/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp @@ -58,7 +58,7 @@ public: SVal location); void dump() const; - void dumpToStream(llvm::raw_ostream& os) const; + void dumpToStream(raw_ostream& os) const; }; } @@ -194,7 +194,7 @@ void RegionRawOffsetV2::dump() const { dumpToStream(llvm::errs()); } -void RegionRawOffsetV2::dumpToStream(llvm::raw_ostream& os) const { +void RegionRawOffsetV2::dumpToStream(raw_ostream& os) const { os << "raw_offset_v2{" << getRegion() << ',' << getByteOffset() << '}'; } diff --git a/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp b/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp index 9fc8163ab8..85d74ac06c 100644 --- a/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp +++ b/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp @@ -49,7 +49,7 @@ static const char* GetReceiverNameType(const ObjCMessage &msg) { } static bool isReceiverClassOrSuperclass(const ObjCInterfaceDecl *ID, - llvm::StringRef ClassName) { + StringRef ClassName) { if (ID->getIdentifier()->getName() == ClassName) return true; @@ -114,7 +114,7 @@ void NilArgChecker::checkPreObjCMessage(ObjCMessage msg, // lexical comparisons. std::string NameStr = S.getAsString(); - llvm::StringRef Name(NameStr); + StringRef Name(NameStr); assert(!Name.empty()); // FIXME: Checking for initWithFormat: will not work in most cases diff --git a/lib/StaticAnalyzer/Checkers/CStringChecker.cpp b/lib/StaticAnalyzer/Checkers/CStringChecker.cpp index c5dac5d216..ca15a74dc9 100644 --- a/lib/StaticAnalyzer/Checkers/CStringChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/CStringChecker.cpp @@ -109,7 +109,7 @@ public: const GRState *state, const Expr *Ex, SVal V); - static bool SummarizeRegion(llvm::raw_ostream& os, ASTContext& Ctx, + static bool SummarizeRegion(raw_ostream& os, ASTContext& Ctx, const MemRegion *MR); // Re-usable checks @@ -767,7 +767,7 @@ const GRState *CStringChecker::InvalidateBuffer(CheckerContext &C, return state->unbindLoc(*L); } -bool CStringChecker::SummarizeRegion(llvm::raw_ostream& os, ASTContext& Ctx, +bool CStringChecker::SummarizeRegion(raw_ostream& os, ASTContext& Ctx, const MemRegion *MR) { const TypedRegion *TR = dyn_cast<TypedRegion>(MR); if (!TR) @@ -1575,8 +1575,8 @@ void CStringChecker::evalStrcmpCommon(CheckerContext &C, const CallExpr *CE, bool canComputeResult = false; if (s1StrLiteral && s2StrLiteral) { - llvm::StringRef s1StrRef = s1StrLiteral->getString(); - llvm::StringRef s2StrRef = s2StrLiteral->getString(); + StringRef s1StrRef = s1StrLiteral->getString(); + StringRef s2StrRef = s2StrLiteral->getString(); if (isBounded) { // Get the max number of characters to compare. @@ -1598,11 +1598,11 @@ void CStringChecker::evalStrcmpCommon(CheckerContext &C, const CallExpr *CE, if (canComputeResult) { // Real strcmp stops at null characters. size_t s1Term = s1StrRef.find('\0'); - if (s1Term != llvm::StringRef::npos) + if (s1Term != StringRef::npos) s1StrRef = s1StrRef.substr(0, s1Term); size_t s2Term = s2StrRef.find('\0'); - if (s2Term != llvm::StringRef::npos) + if (s2Term != StringRef::npos) s2StrRef = s2StrRef.substr(0, s2Term); // Use StringRef's comparison methods to compute the actual result. @@ -1651,7 +1651,7 @@ bool CStringChecker::evalCall(const CallExpr *CE, CheckerContext &C) const { IdentifierInfo *II = FD->getIdentifier(); if (!II) // if no identifier, not a simple C function return false; - llvm::StringRef Name = II->getName(); + StringRef Name = II->getName(); if (Name.startswith("__builtin_")) Name = Name.substr(10); diff --git a/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp b/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp index 6c3dfacec3..67db2d24c0 100644 --- a/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp @@ -105,7 +105,7 @@ bool CallAndMessageChecker::PreVisitProcessArg(CheckerContext &C, class FindUninitializedField { public: - llvm::SmallVector<const FieldDecl *, 10> FieldChain; + SmallVector<const FieldDecl *, 10> FieldChain; private: ASTContext &C; StoreManager &StoreMgr; @@ -161,7 +161,7 @@ bool CallAndMessageChecker::PreVisitProcessArg(CheckerContext &C, else { os << " (e.g., via the field chain: '"; bool first = true; - for (llvm::SmallVectorImpl<const FieldDecl *>::iterator + for (SmallVectorImpl<const FieldDecl *>::iterator DI = F.FieldChain.begin(), DE = F.FieldChain.end(); DI!=DE;++DI){ if (first) first = false; diff --git a/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp b/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp index 53810eed12..b69c1a3366 100644 --- a/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp +++ b/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp @@ -103,7 +103,7 @@ void WalkAST::VisitCallExpr(CallExpr *CE) { IdentifierInfo *II = FD->getIdentifier(); if (!II) // if no identifier, not a simple C function return; - llvm::StringRef Name = II->getName(); + StringRef Name = II->getName(); if (Name.startswith("__builtin_")) Name = Name.substr(10); @@ -247,7 +247,7 @@ void WalkAST::checkLoopConditionForFloat(const ForStmt *FS) { // referenced the compared variable. const DeclRefExpr *drCond = vdLHS == drInc->getDecl() ? drLHS : drRHS; - llvm::SmallVector<SourceRange, 2> ranges; + SmallVector<SourceRange, 2> ranges; llvm::SmallString<256> sbuf; llvm::raw_svector_ostream os(sbuf); diff --git a/lib/StaticAnalyzer/Checkers/ClangSACheckerProvider.cpp b/lib/StaticAnalyzer/Checkers/ClangSACheckerProvider.cpp index 291f8e01f4..a6286cbd7b 100644 --- a/lib/StaticAnalyzer/Checkers/ClangSACheckerProvider.cpp +++ b/lib/StaticAnalyzer/Checkers/ClangSACheckerProvider.cpp @@ -30,7 +30,7 @@ class ClangSACheckerProvider : public CheckerProvider { public: virtual void registerCheckers(CheckerManager &checkerMgr, CheckerOptInfo *checkOpts, unsigned numCheckOpts); - virtual void printHelp(llvm::raw_ostream &OS); + virtual void printHelp(raw_ostream &OS); }; } @@ -186,7 +186,7 @@ void ClangSACheckerProvider::registerCheckers(CheckerManager &checkerMgr, // Printing Help. //===----------------------------------------------------------------------===// -static void printPackageOption(llvm::raw_ostream &OS) { +static void printPackageOption(raw_ostream &OS) { // Find the maximum option length. unsigned OptionFieldWidth = 0; for (unsigned i = 0; i != NumPackages; ++i) { @@ -226,7 +226,7 @@ static void printPackageOption(llvm::raw_ostream &OS) { typedef std::map<std::string, const StaticCheckerInfoRec *> SortedCheckers; -static void printCheckerOption(llvm::raw_ostream &OS,SortedCheckers &checkers) { +static void printCheckerOption(raw_ostream &OS,SortedCheckers &checkers) { // Find the maximum option length. unsigned OptionFieldWidth = 0; for (SortedCheckers::iterator @@ -268,7 +268,7 @@ static void printCheckerOption(llvm::raw_ostream &OS,SortedCheckers &checkers) { } } -void ClangSACheckerProvider::printHelp(llvm::raw_ostream &OS) { +void ClangSACheckerProvider::printHelp(raw_ostream &OS) { OS << "USAGE: -analyzer-checker <CHECKER or PACKAGE or GROUP,...>\n"; OS << "\nGROUPS:\n"; diff --git a/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp b/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp index ec2a88a556..2c5a1a255d 100644 --- a/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp @@ -50,7 +50,7 @@ void ReachableCode::computeReachableBlocks() { if (!cfg.getNumBlockIDs()) return; - llvm::SmallVector<const CFGBlock*, 10> worklist; + SmallVector<const CFGBlock*, 10> worklist; worklist.push_back(&cfg.getEntry()); while (!worklist.empty()) { diff --git a/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp b/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp index baaf8b3aff..3f3cacc8b5 100644 --- a/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp @@ -31,14 +31,14 @@ class DereferenceChecker public: void checkLocation(SVal location, bool isLoad, CheckerContext &C) const; - static void AddDerefSource(llvm::raw_ostream &os, - llvm::SmallVectorImpl<SourceRange> &Ranges, + static void AddDerefSource(raw_ostream &os, + SmallVectorImpl<SourceRange> &Ranges, const Expr *Ex, bool loadedFrom = false); }; } // end anonymous namespace -void DereferenceChecker::AddDerefSource(llvm::raw_ostream &os, - llvm::SmallVectorImpl<SourceRange> &Ranges, +void DereferenceChecker::AddDerefSource(raw_ostream &os, + SmallVectorImpl<SourceRange> &Ranges, const Expr *Ex, bool loadedFrom) { Ex = Ex->IgnoreParenLValueCasts(); @@ -107,7 +107,7 @@ void DereferenceChecker::checkLocation(SVal l, bool isLoad, BT_null.reset(new BuiltinBug("Dereference of null pointer")); llvm::SmallString<100> buf; - llvm::SmallVector<SourceRange, 2> Ranges; + SmallVector<SourceRange, 2> Ranges; // Walk through lvalue casts to get the original expression // that syntactically caused the load. @@ -165,7 +165,7 @@ void DereferenceChecker::checkLocation(SVal l, bool isLoad, report->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue, bugreporter::GetDerefExpr(N)); - for (llvm::SmallVectorImpl<SourceRange>::iterator + for (SmallVectorImpl<SourceRange>::iterator I = Ranges.begin(), E = Ranges.end(); I!=E; ++I) report->addRange(*I); diff --git a/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp b/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp index de6da4f8c3..4c3961faf0 100644 --- a/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp @@ -162,7 +162,7 @@ static RefKind getTemplateKind(const NamedDecl *td) { || nameSpace->getName() != "std") return NoKind; - llvm::StringRef name = td->getName(); + StringRef name = td->getName(); return llvm::StringSwitch<RefKind>(name) .Cases("vector", "deque", VectorKind) .Default(NoKind); @@ -287,7 +287,7 @@ const GRState *IteratorsChecker::handleAssign(const GRState *state, return state; // Finally, see if it is one of the calls that will create // a valid iterator and mark it if so, else mark as Unknown. - llvm::StringRef mName = ME->getMemberDecl()->getName(); + StringRef mName = ME->getMemberDecl()->getName(); if (llvm::StringSwitch<bool>(mName) .Cases("begin", "insert", "erase", true).Default(false)) { @@ -572,7 +572,7 @@ void IteratorsChecker::checkPreStmt(const CXXMemberCallExpr *MCE, // If we are calling a function that invalidates iterators, mark them // appropriately by finding matching instances. const GRState *state = C.getState(); - llvm::StringRef mName = ME->getMemberDecl()->getName(); + StringRef mName = ME->getMemberDecl()->getName(); if (llvm::StringSwitch<bool>(mName) .Cases("insert", "reserve", "push_back", true) .Cases("erase", "pop_back", "clear", "resize", true) diff --git a/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp b/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp index 3d1b5e2d10..fd8222e3ec 100644 --- a/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp @@ -32,13 +32,13 @@ static bool IsLLVMStringRef(QualType T) { if (!RT) return false; - return llvm::StringRef(QualType(RT, 0).getAsString()) == - "class llvm::StringRef"; + return StringRef(QualType(RT, 0).getAsString()) == + "class StringRef"; } /// Check whether the declaration is semantically inside the top-level /// namespace named by ns. -static bool InNamespace(const Decl *D, llvm::StringRef NS) { +static bool InNamespace(const Decl *D, StringRef NS) { const NamespaceDecl *ND = dyn_cast<NamespaceDecl>(D->getDeclContext()); if (!ND) return false; @@ -109,7 +109,7 @@ static bool IsSmallVector(QualType T) { } //===----------------------------------------------------------------------===// -// CHECK: a llvm::StringRef should not be bound to a temporary std::string whose +// CHECK: a StringRef should not be bound to a temporary std::string whose // lifetime is shorter than the StringRef's. //===----------------------------------------------------------------------===// @@ -150,7 +150,7 @@ void StringRefCheckerVisitor::VisitVarDecl(VarDecl *VD) { return; // Pattern match for: - // llvm::StringRef x = call() (where call returns std::string) + // StringRef x = call() (where call returns std::string) if (!IsLLVMStringRef(VD->getType())) return; ExprWithCleanups *Ex1 = dyn_cast<ExprWithCleanups>(Init); @@ -210,7 +210,7 @@ static bool IsPartOfAST(const CXXRecordDecl *R) { namespace { class ASTFieldVisitor { - llvm::SmallVector<FieldDecl*, 10> FieldChain; + SmallVector<FieldDecl*, 10> FieldChain; const CXXRecordDecl *Root; BugReporter &BR; public: @@ -260,7 +260,7 @@ void ASTFieldVisitor::ReportError(QualType T) { if (FieldChain.size() > 1) { os << " via the following chain: "; bool isFirst = true; - for (llvm::SmallVectorImpl<FieldDecl*>::iterator I=FieldChain.begin(), + for (SmallVectorImpl<FieldDecl*>::iterator I=FieldChain.begin(), E=FieldChain.end(); I!=E; ++I) { if (!isFirst) os << '.'; diff --git a/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/lib/StaticAnalyzer/Checkers/MallocChecker.cpp index 91002158c5..e49ff9f581 100644 --- a/lib/StaticAnalyzer/Checkers/MallocChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/MallocChecker.cpp @@ -107,8 +107,8 @@ private: void ReallocMem(CheckerContext &C, const CallExpr *CE) const; static void CallocMem(CheckerContext &C, const CallExpr *CE); - static bool SummarizeValue(llvm::raw_ostream& os, SVal V); - static bool SummarizeRegion(llvm::raw_ostream& os, const MemRegion *MR); + static bool SummarizeValue(raw_ostream& os, SVal V); + static bool SummarizeRegion(raw_ostream& os, const MemRegion *MR); void ReportBadFree(CheckerContext &C, SVal ArgVal, SourceRange range) const; }; } // end anonymous namespace @@ -364,7 +364,7 @@ const GRState *MallocChecker::FreeMemAux(CheckerContext &C, const CallExpr *CE, return notNullState->set<RegionState>(Sym, RefState::getReleased(CE)); } -bool MallocChecker::SummarizeValue(llvm::raw_ostream& os, SVal V) { +bool MallocChecker::SummarizeValue(raw_ostream& os, SVal V) { if (nonloc::ConcreteInt *IntVal = dyn_cast<nonloc::ConcreteInt>(&V)) os << "an integer (" << IntVal->getValue() << ")"; else if (loc::ConcreteInt *ConstAddr = dyn_cast<loc::ConcreteInt>(&V)) @@ -377,7 +377,7 @@ bool MallocChecker::SummarizeValue(llvm::raw_ostream& os, SVal V) { return true; } -bool MallocChecker::SummarizeRegion(llvm::raw_ostream& os, +bool MallocChecker::SummarizeRegion(raw_ostream& os, const MemRegion *MR) { switch (MR->getKind()) { case MemRegion::FunctionTextRegionKind: { diff --git a/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp b/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp index 2d0af9c978..2669b32a97 100644 --- a/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp @@ -50,7 +50,7 @@ void NoReturnFunctionChecker::checkPostStmt(const CallExpr *CE, // Here are a few hardwired ones. If this takes too long, we can // potentially cache these results. BuildSinks - = llvm::StringSwitch<bool>(llvm::StringRef(II->getName())) + = llvm::StringSwitch<bool>(StringRef(II->getName())) .Case("exit", true) .Case("panic", true) .Case("error", true) diff --git a/lib/StaticAnalyzer/Checkers/OSAtomicChecker.cpp b/lib/StaticAnalyzer/Checkers/OSAtomicChecker.cpp index 7262bc3640..b518ab42ab 100644 --- a/lib/StaticAnalyzer/Checkers/OSAtomicChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/OSAtomicChecker.cpp @@ -45,7 +45,7 @@ bool OSAtomicChecker::evalCall(const CallExpr *CE, CheckerContext &C) const { if (!II) return false; - llvm::StringRef FName(II->getName()); + StringRef FName(II->getName()); // Check for compare and swap. if (FName.startswith("OSAtomicCompareAndSwap") || diff --git a/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp b/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp index a722c49385..961600a6e3 100644 --- a/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp @@ -67,7 +67,7 @@ void PthreadLockChecker::checkPostStmt(const CallExpr *CE, IdentifierInfo *II = FD->getIdentifier(); if (!II) // if no identifier, not a simple C function return; - llvm::StringRef FName = II->getName(); + StringRef FName = II->getName(); if (CE->getNumArgs() != 1) return; diff --git a/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp b/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp index 73ce359edc..bb889c8972 100644 --- a/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp @@ -35,12 +35,12 @@ public: private: void EmitStackError(CheckerContext &C, const MemRegion *R, const Expr *RetE) const; - static SourceRange GenName(llvm::raw_ostream &os, const MemRegion *R, + static SourceRange GenName(raw_ostream &os, const MemRegion *R, SourceManager &SM); }; } -SourceRange StackAddrEscapeChecker::GenName(llvm::raw_ostream &os, +SourceRange StackAddrEscapeChecker::GenName(raw_ostream &os, const MemRegion *R, SourceManager &SM) { // Get the base region, stripping away fields and elements. @@ -143,7 +143,7 @@ void StackAddrEscapeChecker::checkEndPath(EndOfFunctionNodeBuilder &B, ExprEngine &Eng; const StackFrameContext *CurSFC; public: - llvm::SmallVector<std::pair<const MemRegion*, const MemRegion*>, 10> V; + SmallVector<std::pair<const MemRegion*, const MemRegion*>, 10> V; CallBack(ExprEngine &Eng, const LocationContext *LCtx) : Eng(Eng), CurSFC(LCtx->getCurrentStackFrame()) {} diff --git a/lib/StaticAnalyzer/Core/BasicConstraintManager.cpp b/lib/StaticAnalyzer/Core/BasicConstraintManager.cpp index 3050ca3ce3..0518740dad 100644 --- a/lib/StaticAnalyzer/Core/BasicConstraintManager.cpp +++ b/lib/StaticAnalyzer/Core/BasicConstraintManager.cpp @@ -92,7 +92,7 @@ public: const GRState* removeDeadBindings(const GRState* state, SymbolReaper& SymReaper); - void print(const GRState* state, llvm::raw_ostream& Out, + void print(const GRState* state, raw_ostream& Out, const char* nl, const char *sep); }; @@ -301,7 +301,7 @@ BasicConstraintManager::removeDeadBindings(const GRState* state, return state->set<ConstNotEq>(CNE); } -void BasicConstraintManager::print(const GRState* state, llvm::raw_ostream& Out, +void BasicConstraintManager::print(const GRState* state, raw_ostream& Out, const char* nl, const char *sep) { // Print equality constraints. diff --git a/lib/StaticAnalyzer/Core/BasicStore.cpp b/lib/StaticAnalyzer/Core/BasicStore.cpp index 7c9f45a474..c8ac7220c6 100644 --- a/lib/StaticAnalyzer/Core/BasicStore.cpp +++ b/lib/StaticAnalyzer/Core/BasicStore.cpp @@ -77,7 +77,7 @@ public: /// It updatees the GRState object in place with the values removed. StoreRef removeDeadBindings(Store store, const StackFrameContext *LCtx, SymbolReaper& SymReaper, - llvm::SmallVectorImpl<const MemRegion*>& RegionRoots); + SmallVectorImpl<const MemRegion*>& RegionRoots); void iterBindings(Store store, BindingsHandler& f); @@ -95,7 +95,7 @@ public: return BindingsTy(static_cast<const BindingsTy::TreeTy*>(store)); } - void print(Store store, llvm::raw_ostream& Out, const char* nl, + void print(Store store, raw_ostream& Out, const char* nl, const char *sep); private: @@ -283,7 +283,7 @@ StoreRef BasicStoreManager::Remove(Store store, Loc loc) { StoreRef BasicStoreManager::removeDeadBindings(Store store, const StackFrameContext *LCtx, SymbolReaper& SymReaper, - llvm::SmallVectorImpl<const MemRegion*>& RegionRoots) + SmallVectorImpl<const MemRegion*>& RegionRoots) { BindingsTy B = GetBindings(store); typedef SVal::symbol_iterator symbol_iterator; @@ -499,7 +499,7 @@ StoreRef BasicStoreManager::BindDeclInternal(Store store, const VarRegion* VR, return newStore; } -void BasicStoreManager::print(Store store, llvm::raw_ostream& Out, +void BasicStoreManager::print(Store store, raw_ostream& Out, const char* nl, const char *sep) { BindingsTy B = GetBindings(store); diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp index 8b5d383ed0..2f7b67aa06 100644 --- a/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -1312,10 +1312,10 @@ void BugReporter::FlushReports() { // warnings and new BugTypes. // FIXME: Only NSErrorChecker needs BugType's FlushReports. // Turn NSErrorChecker into a proper checker and remove this. - llvm::SmallVector<const BugType*, 16> bugTypes; + SmallVector<const BugType*, 16> bugTypes; for (BugTypesTy::iterator I=BugTypes.begin(), E=BugTypes.end(); I!=E; ++I) bugTypes.push_back(*I); - for (llvm::SmallVector<const BugType*, 16>::iterator + for (SmallVector<const BugType*, 16>::iterator I = bugTypes.begin(), E = bugTypes.end(); I != E; ++I) const_cast<BugType*>(*I)->FlushReports(*this); @@ -1344,7 +1344,7 @@ void BugReporter::FlushReports() { static std::pair<std::pair<ExplodedGraph*, NodeBackMap*>, std::pair<ExplodedNode*, unsigned> > MakeReportGraph(const ExplodedGraph* G, - llvm::SmallVectorImpl<const ExplodedNode*> &nodes) { + SmallVectorImpl<const ExplodedNode*> &nodes) { // Create the trimmed graph. It will contain the shortest paths from the // error nodes to the root. In the new graph we should only have one @@ -1569,11 +1569,11 @@ static void CompactPathDiagnostic(PathDiagnostic &PD, const SourceManager& SM) { } void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, - llvm::SmallVectorImpl<BugReport *> &bugReports) { + SmallVectorImpl<BugReport *> &bugReports) { assert(!bugReports.empty()); - llvm::SmallVector<const ExplodedNode *, 10> errorNodes; - for (llvm::SmallVectorImpl<BugReport*>::iterator I = bugReports.begin(), + SmallVector<const ExplodedNode *, 10> errorNodes; + for (SmallVectorImpl<BugReport*>::iterator I = bugReports.begin(), E = bugReports.end(); I != E; ++I) { errorNodes.push_back((*I)->getErrorNode()); } @@ -1655,7 +1655,7 @@ struct FRIEC_WLItem { static BugReport * FindReportInEquivalenceClass(BugReportEquivClass& EQ, - llvm::SmallVectorImpl<BugReport*> &bugReports) { + SmallVectorImpl<BugReport*> &bugReports) { BugReportEquivClass::iterator I = EQ.begin(), E = EQ.end(); assert(I != E); @@ -1706,7 +1706,7 @@ FindReportInEquivalenceClass(BugReportEquivClass& EQ, // At this point we know that 'N' is not a sink and it has at least one // successor. Use a DFS worklist to find a non-sink end-of-path node. typedef FRIEC_WLItem WLItem; - typedef llvm::SmallVector<WLItem, 10> DFSWorkList; + typedef SmallVector<WLItem, 10> DFSWorkList; llvm::DenseMap<const ExplodedNode *, unsigned> Visited; DFSWorkList WL; @@ -1798,7 +1798,7 @@ static bool IsCachedDiagnostic(BugReport *R, PathDiagnostic *PD) { } void BugReporter::FlushReport(BugReportEquivClass& EQ) { - llvm::SmallVector<BugReport*, 10> bugReports; + SmallVector<BugReport*, 10> bugReports; BugReport *exampleReport = FindReportInEquivalenceClass(EQ, bugReports); if (!exampleReport) return; @@ -1836,12 +1836,12 @@ void BugReporter::FlushReport(BugReportEquivClass& EQ) { // Search the description for '%', as that will be interpretted as a // format character by FormatDiagnostics. - llvm::StringRef desc = exampleReport->getShortDescription(); + StringRef desc = exampleReport->getShortDescription(); unsigned ErrorDiag; { llvm::SmallString<512> TmpStr; llvm::raw_svector_ostream Out(TmpStr); - for (llvm::StringRef::iterator I=desc.begin(), E=desc.end(); I!=E; ++I) + for (StringRef::iterator I=desc.begin(), E=desc.end(); I!=E; ++I) if (*I == '%') Out << "%%"; else @@ -1872,15 +1872,15 @@ void BugReporter::FlushReport(BugReportEquivClass& EQ) { PD->HandlePathDiagnostic(D.take()); } -void BugReporter::EmitBasicReport(llvm::StringRef name, llvm::StringRef str, +void BugReporter::EmitBasicReport(StringRef name, StringRef str, SourceLocation Loc, SourceRange* RBeg, unsigned NumRanges) { EmitBasicReport(name, "", str, Loc, RBeg, NumRanges); } -void BugReporter::EmitBasicReport(llvm::StringRef name, - llvm::StringRef category, - llvm::StringRef str, SourceLocation Loc, +void BugReporter::EmitBasicReport(StringRef name, + StringRef category, + StringRef str, SourceLocation Loc, SourceRange* RBeg, unsigned NumRanges) { // 'BT' is owned by BugReporter. @@ -1891,8 +1891,8 @@ void BugReporter::EmitBasicReport(llvm::StringRef name, EmitReport(R); } -BugType *BugReporter::getBugTypeForName(llvm::StringRef name, - llvm::StringRef category) { +BugType *BugReporter::getBugTypeForName(StringRef name, + StringRef category) { llvm::SmallString<136> fullDesc; llvm::raw_svector_ostream(fullDesc) << name << ":" << category; llvm::StringMapEntry<BugType *> & diff --git a/lib/StaticAnalyzer/Core/CFRefCount.cpp b/lib/StaticAnalyzer/Core/CFRefCount.cpp index 7eb65cef19..80e1102411 100644 --- a/lib/StaticAnalyzer/Core/CFRefCount.cpp +++ b/lib/StaticAnalyzer/Core/CFRefCount.cpp @@ -34,11 +34,10 @@ #include "llvm/ADT/ImmutableMap.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" -#include <stdarg.h> +#include <cstdarg> using namespace clang; using namespace ento; -using llvm::StringRef; using llvm::StrInStrNoCase; namespace { @@ -305,10 +304,10 @@ public: ID.Add(T); } - void print(llvm::raw_ostream& Out) const; + void print(raw_ostream& Out) const; }; -void RefVal::print(llvm::raw_ostream& Out) const { +void RefVal::print(raw_ostream& Out) const { if (!T.isNull()) Out << "Tracked Type:" << T.getAsString() << '\n'; @@ -739,7 +738,7 @@ private: } Selector generateSelector(va_list argp) { - llvm::SmallVector<IdentifierInfo*, 10> II; + SmallVector<IdentifierInfo*, 10> II; while (const char* s = va_arg(argp, const char*)) II.push_back(&Ctx.Idents.get(s)); @@ -1654,7 +1653,7 @@ class CFRefCount : public TransferFuncs { public: class BindingsPrinter : public GRState::Printer { public: - virtual void Print(llvm::raw_ostream& Out, const GRState* state, + virtual void Print(raw_ostream& Out, const GRState* state, const char* nl, const char* sep); }; @@ -1684,10 +1683,10 @@ public: RefVal::Kind hasErr, SymbolRef Sym); const GRState * HandleSymbolDeath(const GRState * state, SymbolRef sid, RefVal V, - llvm::SmallVectorImpl<SymbolRef> &Leaked); + SmallVectorImpl<SymbolRef> &Leaked); ExplodedNode* ProcessLeaks(const GRState * state, - llvm::SmallVectorImpl<SymbolRef> &Leaked, + SmallVectorImpl<SymbolRef> &Leaked, GenericNodeBuilderRefCount &Builder, ExprEngine &Eng, ExplodedNode *Pred = 0); @@ -1787,7 +1786,7 @@ public: } // end anonymous namespace -static void PrintPool(llvm::raw_ostream &Out, SymbolRef Sym, +static void PrintPool(raw_ostream &Out, SymbolRef Sym, const GRState *state) { Out << ' '; if (Sym) @@ -1804,7 +1803,7 @@ static void PrintPool(llvm::raw_ostream &Out, SymbolRef Sym, Out << '}'; } -void CFRefCount::BindingsPrinter::Print(llvm::raw_ostream& Out, +void CFRefCount::BindingsPrinter::Print(raw_ostream& Out, const GRState* state, const char* nl, const char* sep) { @@ -1844,7 +1843,7 @@ namespace { protected: CFRefCount& TF; - CFRefBug(CFRefCount* tf, llvm::StringRef name) + CFRefBug(CFRefCount* tf, StringRef name) : BugType(name, "Memory (Core Foundation/Objective-C)"), TF(*tf) {} public: @@ -1920,7 +1919,7 @@ namespace { class Leak : public CFRefBug { const bool isReturn; protected: - Leak(CFRefCount* tf, llvm::StringRef name, bool isRet) + Leak(CFRefCount* tf, StringRef name, bool isRet) : CFRefBug(tf, name), isReturn(isRet) {} public: @@ -1931,13 +1930,13 @@ namespace { class LeakAtReturn : public Leak { public: - LeakAtReturn(CFRefCount* tf, llvm::StringRef name) + LeakAtReturn(CFRefCount* tf, StringRef name) : Leak(tf, name, true) {} }; class LeakWithinFunction : public Leak { public: - LeakWithinFunction(CFRefCount* tf, llvm::StringRef name) + LeakWithinFunction(CFRefCount* tf, StringRef name) : Leak(tf, name, false) {} }; @@ -1955,7 +1954,7 @@ namespace { : RangedBugReport(D, D.getDescription(), n), Sym(sym), TF(tf) {} CFRefReport(CFRefBug& D, const CFRefCount &tf, - ExplodedNode *n, SymbolRef sym, llvm::StringRef endText) + ExplodedNode *n, SymbolRef sym, StringRef endText) : RangedBugReport(D, D.getDescription(), endText, n), Sym(sym), TF(tf) {} virtual ~CFRefReport() {} @@ -2036,9 +2035,9 @@ std::pair<const char**,const char**> CFRefReport::getExtraDescriptiveText() { } } -static inline bool contains(const llvm::SmallVectorImpl<ArgEffect>& V, +static inline bool contains(const SmallVectorImpl<ArgEffect>& V, ArgEffect X) { - for (llvm::SmallVectorImpl<ArgEffect>::const_iterator I=V.begin(), E=V.end(); + for (SmallVectorImpl<ArgEffect>::const_iterator I=V.begin(), E=V.end(); I!=E; ++I) if (*I == X) return true; @@ -2114,7 +2113,7 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode* N, // Gather up the effects that were performed on the object at this // program point - llvm::SmallVector<ArgEffect, 2> AEffects; + SmallVector<ArgEffect, 2> AEffects; if (const RetainSummary *Summ = TF.getSummaryOfNode(BRC.getNodeResolver().getOriginalNode(N))) { @@ -2249,7 +2248,7 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode* N, } // Emit any remaining diagnostics for the argument effects (if any). - for (llvm::SmallVectorImpl<ArgEffect>::iterator I=AEffects.begin(), + for (SmallVectorImpl<ArgEffect>::iterator I=AEffects.begin(), E=AEffects.end(); I != E; ++I) { // A bunch of things have alternate behavior under GC. @@ -2555,7 +2554,7 @@ void CFRefCount::evalSummary(ExplodedNodeSet& Dst, SourceRange ErrorRange; SymbolRef ErrorSym = 0; - llvm::SmallVector<const MemRegion*, 10> RegionsToInvalidate; + SmallVector<const MemRegion*, 10> RegionsToInvalidate; // Use RAII to make sure the whitelist is properly cleared. ResetWhiteList resetWhiteList; @@ -3309,7 +3308,7 @@ CFRefCount::HandleAutoreleaseCounts(const GRState * state, const GRState * CFRefCount::HandleSymbolDeath(const GRState * state, SymbolRef sid, RefVal V, - llvm::SmallVectorImpl<SymbolRef> &Leaked) { + SmallVectorImpl<SymbolRef> &Leaked) { bool hasLeak = V.isOwned() || ((V.isNotOwned() || V.isReturnedOwned()) && V.getCount() > 0); @@ -3323,7 +3322,7 @@ CFRefCount::HandleSymbolDeath(const GRState * state, SymbolRef sid, RefVal V, ExplodedNode* CFRefCount::ProcessLeaks(const GRState * state, - llvm::SmallVectorImpl<SymbolRef> &Leaked, + SmallVectorImpl<SymbolRef> &Leaked, GenericNodeBuilderRefCount &Builder, ExprEngine& Eng, ExplodedNode *Pred) { @@ -3335,7 +3334,7 @@ CFRefCount::ProcessLeaks(const GRState * state, ExplodedNode *N = Builder.MakeNode(state, Pred); if (N) { - for (llvm::SmallVectorImpl<SymbolRef>::iterator + for (SmallVectorImpl<SymbolRef>::iterator I = Leaked.begin(), E = Leaked.end(); I != E; ++I) { CFRefBug *BT = static_cast<CFRefBug*>(Pred ? leakWithinFunction @@ -3368,7 +3367,7 @@ void CFRefCount::evalEndPath(ExprEngine& Eng, } B = state->get<RefBindings>(); - llvm::SmallVector<SymbolRef, 10> Leaked; + SmallVector<SymbolRef, 10> Leaked; for (RefBindings::iterator I = B.begin(), E = B.end(); I != E; ++I) state = HandleSymbolDeath(state, (*I).first, (*I).second, Leaked); @@ -3402,7 +3401,7 @@ void CFRefCount::evalDeadSymbols(ExplodedNodeSet& Dst, } B = state->get<RefBindings>(); - llvm::SmallVector<SymbolRef, 10> Leaked; + SmallVector<SymbolRef, 10> Leaked; for (SymbolReaper::dead_iterator I = SymReaper.dead_begin(), E = SymReaper.dead_end(); I != E; ++I) { @@ -3540,7 +3539,7 @@ void RetainReleaseChecker::checkPostStmt(const BlockExpr *BE, // FIXME: For now we invalidate the tracking of all symbols passed to blocks // via captured variables, even though captured variables result in a copy // and in implicit increment/decrement of a retain count. - llvm::SmallVector<const MemRegion*, 10> Regions; + SmallVector<const MemRegion*, 10> Regions; const LocationContext *LC = C.getPredecessor()->getLocationContext(); MemRegionManager &MemMgr = C.getSValBuilder().getRegionManager(); diff --git a/lib/StaticAnalyzer/Core/CXXExprEngine.cpp b/lib/StaticAnalyzer/Core/CXXExprEngine.cpp index ef7bc2016c..137aa2ab64 100644 --- a/lib/StaticAnalyzer/Core/CXXExprEngine.cpp +++ b/lib/StaticAnalyzer/Core/CXXExprEngine.cpp @@ -36,7 +36,7 @@ void ExprEngine::evalArguments(ConstExprIterator AI, ConstExprIterator AE, bool FstArgAsLValue) { - llvm::SmallVector<CallExprWLItem, 20> WorkList; + SmallVector<CallExprWLItem, 20> WorkList; WorkList.reserve(AE - AI); WorkList.push_back(CallExprWLItem(AI, Pred)); @@ -197,7 +197,7 @@ void ExprEngine::VisitCXXConstructExpr(const CXXConstructExpr *E, #endif // Default semantics: invalidate all regions passed as arguments. - llvm::SmallVector<const MemRegion*, 10> regionsToInvalidate; + SmallVector<const MemRegion*, 10> regionsToInvalidate; // FIXME: We can have collisions on the conjured symbol if the // expression *I also creates conjured symbols. We probably want @@ -303,7 +303,7 @@ void ExprEngine::VisitCXXNewExpr(const CXXNewExpr *CNE, ExplodedNode *Pred, // Accumulate list of regions that are invalidated. // FIXME: Eventually we should unify the logic for constructor // processing in one place. - llvm::SmallVector<const MemRegion*, 10> regionsToInvalidate; + SmallVector<const MemRegion*, 10> regionsToInvalidate; for (CXXNewExpr::const_arg_iterator ai = CNE->constructor_arg_begin(), ae = CNE->constructor_arg_end(); ai != ae; ++ai) diff --git a/lib/StaticAnalyzer/Core/CheckerManager.cpp b/lib/StaticAnalyzer/Core/CheckerManager.cpp index ba7c384e5c..6dae640b23 100644 --- a/lib/StaticAnalyzer/Core/CheckerManager.cpp +++ b/lib/StaticAnalyzer/Core/CheckerManager.cpp @@ -122,7 +122,7 @@ static void expandGraphWithCheckers(CHECK_CTX checkCtx, namespace { struct CheckStmtContext { - typedef llvm::SmallVectorImpl<CheckerManager::CheckStmtFunc> CheckersTy; + typedef SmallVectorImpl<CheckerManager::CheckStmtFunc> CheckersTy; bool IsPreVisit; const CheckersTy &Checkers; const Stmt *S; diff --git a/lib/StaticAnalyzer/Core/CoreEngine.cpp b/lib/StaticAnalyzer/Core/CoreEngine.cpp index 9fcc04e2e4..1103ac65de 100644 --- a/lib/StaticAnalyzer/Core/CoreEngine.cpp +++ b/lib/StaticAnalyzer/Core/CoreEngine.cpp @@ -19,9 +19,6 @@ #include "clang/AST/Expr.h" #include "llvm/Support/Casting.h" #include "llvm/ADT/DenseMap.h" - -using llvm::cast; -using llvm::isa; using namespace clang; using namespace ento; @@ -41,7 +38,7 @@ WorkList::Visitor::~Visitor() {} namespace { class DFS : public WorkList { - llvm::SmallVector<WorkListUnit,20> Stack; + SmallVector<WorkListUnit,20> Stack; public: virtual bool hasWork() const { return !Stack.empty(); @@ -59,7 +56,7 @@ public: } virtual bool visitItemsInWorkList(Visitor &V) { - for (llvm::SmallVectorImpl<WorkListUnit>::iterator + for (SmallVectorImpl<WorkListUnit>::iterator I = Stack.begin(), E = Stack.end(); I != E; ++I) { if (V.visit(*I)) return true; @@ -107,7 +104,7 @@ WorkList *WorkList::makeBFS() { return new BFS(); } namespace { class BFSBlockDFSContents : public WorkList { std::deque<WorkListUnit> Queue; - llvm::SmallVector<WorkListUnit,20> Stack; + SmallVector<WorkListUnit,20> Stack; public: virtual bool hasWork() const { return !Queue.empty() || !Stack.empty(); @@ -136,7 +133,7 @@ namespace { return U; } virtual bool visitItemsInWorkList(Visitor &V) { - for (llvm::SmallVectorImpl<WorkListUnit>::iterator + for (SmallVectorImpl<WorkListUnit>::iterator I = Stack.begin(), E = Stack.end(); I != E; ++I) { if (V.visit(*I)) return true; @@ -250,7 +247,7 @@ void CoreEngine::ExecuteWorkListWithInitialState(const LocationContext *L, const GRState *InitState, ExplodedNodeSet &Dst) { ExecuteWorkList(L, Steps, InitState); - for (llvm::SmallVectorImpl<ExplodedNode*>::iterator I = G->EndNodes.begin(), + for (SmallVectorImpl<ExplodedNode*>::iterator I = G->EndNodes.begin(), E = G->EndNodes.end(); I != E; ++I) { Dst.Add(*I); } @@ -305,7 +302,7 @@ void CoreEngine::HandleBlockEdge(const BlockEdge& L, ExplodedNode* Pred) { } } - for (llvm::SmallVectorImpl<ExplodedNode*>::const_iterator + for (SmallVectorImpl<ExplodedNode*>::const_iterator I = nodeBuilder.sinks().begin(), E = nodeBuilder.sinks().end(); I != E; ++I) { blocksExhausted.push_back(std::make_pair(L, *I)); diff --git a/lib/StaticAnalyzer/Core/Environment.cpp b/lib/StaticAnalyzer/Core/Environment.cpp index 3961c7b952..4af8bb07cc 100644 --- a/lib/StaticAnalyzer/Core/Environment.cpp +++ b/lib/StaticAnalyzer/Core/Environment.cpp @@ -159,7 +159,7 @@ Environment EnvironmentManager::removeDeadBindings(Environment Env, SymbolReaper &SymReaper, const GRState *ST, - llvm::SmallVectorImpl<const MemRegion*> &DRoots) { + SmallVectorImpl<const MemRegion*> &DRoots) { CFG &C = *SymReaper.getLocationContext()->getCFG(); @@ -168,7 +168,7 @@ EnvironmentManager::removeDeadBindings(Environment Env, // outnumber block-level expression bindings). Environment NewEnv = getInitialEnvironment(); - llvm::SmallVector<std::pair<const Stmt*, SVal>, 10> deferredLocations; + SmallVector<std::pair<const Stmt*, SVal>, 10> deferredLocations; // Iterate over the block-expr bindings. for (Environment::iterator I = Env.begin(), E = Env.end(); @@ -233,7 +233,7 @@ EnvironmentManager::removeDeadBindings(Environment Env, // Go through he deferred locations and add them to the new environment if // the correspond Stmt* is in the map as well. - for (llvm::SmallVectorImpl<std::pair<const Stmt*, SVal> >::iterator + for (SmallVectorImpl<std::pair<const Stmt*, SVal> >::iterator I = deferredLocations.begin(), E = deferredLocations.end(); I != E; ++I) { const Stmt *S = (Stmt*) (((uintptr_t) I->first) & (uintptr_t) ~0x1); if (NewEnv.ExprBindings.lookup(S)) diff --git a/lib/StaticAnalyzer/Core/ExplodedGraph.cpp b/lib/StaticAnalyzer/Core/ExplodedGraph.cpp index fa16fead9f..5cc0a97d93 100644 --- a/lib/StaticAnalyzer/Core/ExplodedGraph.cpp +++ b/lib/StaticAnalyzer/Core/ExplodedGraph.cpp @@ -285,7 +285,7 @@ ExplodedGraph::TrimInternal(const ExplodedNode* const* BeginSources, typedef llvm::DenseMap<const ExplodedNode*, ExplodedNode*> Pass2Ty; Pass2Ty& Pass2 = M->M; - llvm::SmallVector<const ExplodedNode*, 10> WL1, WL2; + SmallVector<const ExplodedNode*, 10> WL1, WL2; // ===- Pass 1 (reverse DFS) -=== for (const ExplodedNode* const* I = BeginSources; I != EndSources; ++I) { diff --git a/lib/StaticAnalyzer/Core/ExprEngine.cpp b/lib/StaticAnalyzer/Core/ExprEngine.cpp index ffe5f0b6cd..79a6356552 100644 --- a/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -35,9 +35,6 @@ using namespace clang; using namespace ento; -using llvm::dyn_cast; -using llvm::dyn_cast_or_null; -using llvm::cast; using llvm::APSInt; namespace { @@ -162,11 +159,11 @@ ExprEngine::doesInvalidateGlobals(const CallOrObjCMessage &callOrMessage) const if (callOrMessage.isFunctionCall() && !callOrMessage.isCXXCall()) { SVal calleeV = callOrMessage.getFunctionCallee(); if (const FunctionTextRegion *codeR = - llvm::dyn_cast_or_null<FunctionTextRegion>(calleeV.getAsRegion())) { + dyn_cast_or_null<FunctionTextRegion>(calleeV.getAsRegion())) { const FunctionDecl *fd = codeR->getDecl(); if (const IdentifierInfo *ii = fd->getIdentifier()) { - llvm::StringRef fname = ii->getName(); + StringRef fname = ii->getName(); if (fname == "strlen") return false; } @@ -1627,7 +1624,7 @@ bool ExprEngine::InlineCall(ExplodedNodeSet &Dst, const CallExpr *CE, case Stmt::CXXOperatorCallExprClass: { const CXXOperatorCallExpr *opCall = cast<CXXOperatorCallExpr>(CE); methodDecl = - llvm::dyn_cast_or_null<CXXMethodDecl>(opCall->getCalleeDecl()); + dyn_cast_or_null<CXXMethodDecl>(opCall->getCalleeDecl()); break; } case Stmt::CXXMemberCallExprClass: { @@ -2000,7 +1997,7 @@ void ExprEngine::VisitObjCMessageExpr(const ObjCMessageExpr* ME, ExplodedNodeSet& Dst){ // Create a worklist to process both the arguments. - llvm::SmallVector<ObjCMsgWLItem, 20> WL; + SmallVector<ObjCMsgWLItem, 20> WL; // But first evaluate the receiver (if any). ObjCMessageExpr::const_arg_iterator AI = ME->arg_begin(), AE = ME->arg_end(); @@ -2112,7 +2109,7 @@ void ExprEngine::VisitObjCMessage(const ObjCMessage &msg, ASTContext& Ctx = getContext(); NSExceptionInstanceRaiseSelectors = new Selector[NUM_RAISE_SELECTORS]; - llvm::SmallVector<IdentifierInfo*, NUM_RAISE_SELECTORS> II; + SmallVector<IdentifierInfo*, NUM_RAISE_SELECTORS> II; unsigned idx = 0; // raise:format: @@ -2401,7 +2398,7 @@ void ExprEngine::VisitInitListExpr(const InitListExpr* E, ExplodedNode* Pred, } // Create a worklist to process the initializers. - llvm::SmallVector<InitListWLItem, 10> WorkList; + SmallVector<InitListWLItem, 10> WorkList; WorkList.reserve(NumInitElements); WorkList.push_back(InitListWLItem(Pred, StartVals, E->rbegin())); InitListExpr::const_reverse_iterator ItrEnd = E->rend(); diff --git a/lib/StaticAnalyzer/Core/FlatStore.cpp b/lib/StaticAnalyzer/Core/FlatStore.cpp index ca867aebde..b6515dab81 100644 --- a/lib/StaticAnalyzer/Core/FlatStore.cpp +++ b/lib/StaticAnalyzer/Core/FlatStore.cpp @@ -47,7 +47,7 @@ public: SVal ArrayToPointer(Loc Array); StoreRef removeDeadBindings(Store store, const StackFrameContext *LCtx, SymbolReaper& SymReaper, - llvm::SmallVectorImpl<const MemRegion*>& RegionRoots){ + SmallVectorImpl<const MemRegion*>& RegionRoots){ return StoreRef(store, *this); } @@ -63,7 +63,7 @@ public: bool invalidateGlobals, InvalidatedRegions *Regions); - void print(Store store, llvm::raw_ostream& Out, const char* nl, + void print(Store store, raw_ostream& Out, const char* nl, const char *sep); void iterBindings(Store store, BindingsHandler& f); @@ -182,7 +182,7 @@ StoreRef FlatStoreManager::invalidateRegions(Store store, return StoreRef(store, *this); } -void FlatStoreManager::print(Store store, llvm::raw_ostream& Out, +void FlatStoreManager::print(Store store, raw_ostream& Out, const char* nl, const char *sep) { } diff --git a/lib/StaticAnalyzer/Core/GRState.cpp b/lib/StaticAnalyzer/Core/GRState.cpp index 0f6ff1ef58..cbc4909490 100644 --- a/lib/StaticAnalyzer/Core/GRState.cpp +++ b/lib/StaticAnalyzer/Core/GRState.cpp @@ -71,7 +71,7 @@ GRStateManager::removeDeadBindings(const GRState* state, // those around. This code more than likely can be made faster, and the // frequency of which this method is called should be experimented with // for optimum performance. - llvm::SmallVector<const MemRegion*, 10> RegionRoots; + SmallVector<const MemRegion*, 10> RegionRoots; GRState NewState = *state; NewState.Env = EnvMgr.removeDeadBindings(NewState.Env, SymReaper, @@ -384,7 +384,7 @@ static bool IsEnvLoc(const Stmt *S) { return (bool) (((uintptr_t) S) & 0x1); } -void GRState::print(llvm::raw_ostream& Out, CFG &C, const char* nl, +void GRState::print(raw_ostream& Out, CFG &C, const char* nl, const char* sep) const { // Print the store. GRStateManager &Mgr = getStateManager(); @@ -459,7 +459,7 @@ void GRState::print(llvm::raw_ostream& Out, CFG &C, const char* nl, } } -void GRState::printDOT(llvm::raw_ostream& Out, CFG &C) const { +void GRState::printDOT(raw_ostream& Out, CFG &C) const { print(Out, C, "\\l", "\\|"); } diff --git a/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp b/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp index 1ebc28c044..56cdee6545 100644 --- a/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp +++ b/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp @@ -45,15 +45,15 @@ public: virtual ~HTMLDiagnostics() { FlushDiagnostics(NULL); } - virtual void FlushDiagnostics(llvm::SmallVectorImpl<std::string> *FilesMade); + virtual void FlushDiagnostics(SmallVectorImpl<std::string> *FilesMade); virtual void HandlePathDiagnostic(const PathDiagnostic* D); - virtual llvm::StringRef getName() const { + virtual StringRef getName() const { return "HTMLDiagnostics"; } - unsigned ProcessMacroPiece(llvm::raw_ostream& os, + unsigned ProcessMacroPiece(raw_ostream& os, const PathDiagnosticMacroPiece& P, unsigned num); @@ -65,7 +65,7 @@ public: const char *HighlightEnd = "</span>"); void ReportDiag(const PathDiagnostic& D, - llvm::SmallVectorImpl<std::string> *FilesMade); + SmallVectorImpl<std::string> *FilesMade); }; } // end anonymous namespace @@ -102,7 +102,7 @@ void HTMLDiagnostics::HandlePathDiagnostic(const PathDiagnostic* D) { } void -HTMLDiagnostics::FlushDiagnostics(llvm::SmallVectorImpl<std::string> *FilesMade) +HTMLDiagnostics::FlushDiagnostics(SmallVectorImpl<std::string> *FilesMade) { while (!BatchedDiags.empty()) { const PathDiagnostic* D = BatchedDiags.back(); @@ -115,7 +115,7 @@ HTMLDiagnostics::FlushDiagnostics(llvm::SmallVectorImpl<std::string> *FilesMade) } void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D, - llvm::SmallVectorImpl<std::string> *FilesMade){ + SmallVectorImpl<std::string> *FilesMade){ // Create the HTML directory if it is missing. if (!createdDir) { createdDir = true; @@ -443,7 +443,7 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID, { FullSourceLoc L = MP->getLocation().asLocation().getInstantiationLoc(); assert(L.isFileID()); - llvm::StringRef BufferInfo = L.getBufferData(); + StringRef BufferInfo = L.getBufferData(); const char* MacroName = L.getDecomposedLoc().second + BufferInfo.data(); Lexer rawLexer(L, PP.getLangOptions(), BufferInfo.begin(), MacroName, BufferInfo.end()); @@ -504,7 +504,7 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID, #endif } -static void EmitAlphaCounter(llvm::raw_ostream& os, unsigned n) { +static void EmitAlphaCounter(raw_ostream& os, unsigned n) { unsigned x = n % ('z' - 'a'); n /= 'z' - 'a'; @@ -514,7 +514,7 @@ static void EmitAlphaCounter(llvm::raw_ostream& os, unsigned n) { os << char('a' + x); } -unsigned HTMLDiagnostics::ProcessMacroPiece(llvm::raw_ostream& os, +unsigned HTMLDiagnostics::ProcessMacroPiece(raw_ostream& os, const PathDiagnosticMacroPiece& P, unsigned num) { diff --git a/lib/StaticAnalyzer/Core/MemRegion.cpp b/lib/StaticAnalyzer/Core/MemRegion.cpp index d9e884a4b2..420e486907 100644 --- a/lib/StaticAnalyzer/Core/MemRegion.cpp +++ b/lib/StaticAnalyzer/Core/MemRegion.cpp @@ -398,69 +398,69 @@ std::string MemRegion::getString() const { return os.str(); } -void MemRegion::dumpToStream(llvm::raw_ostream& os) const { +void MemRegion::dumpToStream(raw_ostream& os) const { os << "<Unknown Region>"; } -void AllocaRegion::dumpToStream(llvm::raw_ostream& os) const { +void AllocaRegion::dumpToStream(raw_ostream& os) const { os << "alloca{" << (void*) Ex << ',' << Cnt << '}'; } -void FunctionTextRegion::dumpToStream(llvm::raw_ostream& os) const { +void FunctionTextRegion::dumpToStream(raw_ostream& os) const { os << "code{" << getDecl()->getDeclName().getAsString() << '}'; } -void BlockTextRegion::dumpToStream(llvm::raw_ostream& os) const { +void BlockTextRegion::dumpToStream(raw_ostream& os) const { os << "block_code{" << (void*) this << '}'; } -void BlockDataRegion::dumpToStream(llvm::raw_ostream& os) const { +void BlockDataRegion::dumpToStream(raw_ostream& os) const { os << "block_data{" << BC << '}'; } -void CompoundLiteralRegion::dumpToStream(llvm::raw_ostream& os) const { +void CompoundLiteralRegion::dumpToStream(raw_ostream& os) const { // FIXME: More elaborate pretty-printing. os << "{ " << (void*) CL << " }"; } -void CXXTempObjectRegion::dumpToStream(llvm::raw_ostream &os) const { +void CXXTempObjectRegion::dumpToStream(raw_ostream &os) const { os << "temp_object"; } -void CXXBaseObjectRegion::dumpToStream(llvm::raw_ostream &os) const { +void CXXBaseObjectRegion::dumpToStream(raw_ostream &os) const { os << "base " << decl->getName(); } -void CXXThisRegion::dumpToStream(llvm::raw_ostream &os) const { +void CXXThisRegion::dumpToStream(raw_ostream &os) const { os << "this"; } -void ElementRegion::dumpToStream(llvm::raw_ostream& os) const { +void ElementRegion::dumpToStream(raw_ostream& os) const { os << "element{" << superRegion << ',' << Index << ',' << getElementType().getAsString() << '}'; } -void FieldRegion::dumpToStream(llvm::raw_ostream& os) const { +void FieldRegion::dumpToStream(raw_ostream& os) const { os << superRegion << "->" << getDecl(); } -void NonStaticGlobalSpaceRegion::dumpToStream(llvm::raw_ostream &os) const { +void NonStaticGlobalSpaceRegion::dumpToStream(raw_ostream &os) const { os << "NonStaticGlobalSpaceRegion"; } -void ObjCIvarRegion::dumpToStream(llvm::raw_ostream& os) const { +void ObjCIvarRegion::dumpToStream(raw_ostream& os) const { os << "ivar{" << superRegion << ',' << getDecl() << '}'; } -void StringRegion::dumpToStream(llvm::raw_ostream& os) const { +void StringRegion::dumpToStream(raw_ostream& os) const { Str->printPretty(os, 0, PrintingPolicy(getContext().getLangOptions())); } -void SymbolicRegion::dumpToStream(llvm::raw_ostream& os) const { +void SymbolicRegion::dumpToStream(raw_ostream& os) const { os << "SymRegion{" << sym << '}'; } -void VarRegion::dumpToStream(llvm::raw_ostream& os) const { +void VarRegion::dumpToStream(raw_ostream& os) const { os << cast<VarDecl>(D); } @@ -468,11 +468,11 @@ void RegionRawOffset::dump() const { dumpToStream(llvm::errs()); } -void RegionRawOffset::dumpToStream(llvm::raw_ostream& os) const { +void RegionRawOffset::dumpToStream(raw_ostream& os) const { os << "raw_offset{" << getRegion() << ',' << getOffset().getQuantity() << '}'; } -void StaticGlobalSpaceRegion::dumpToStream(llvm::raw_ostream &os) const { +void StaticGlobalSpaceRegion::dumpToStream(raw_ostream &os) const { os << "StaticGlobalsMemSpace{" << CR << '}'; } diff --git a/lib/StaticAnalyzer/Core/PathDiagnostic.cpp b/lib/StaticAnalyzer/Core/PathDiagnostic.cpp index 872bbfe9e1..7f95c950dd 100644 --- a/lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ b/lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -17,12 +17,9 @@ #include "clang/AST/DeclObjC.h" #include "clang/AST/StmtCXX.h" #include "llvm/ADT/SmallString.h" -#include "llvm/Support/Casting.h" using namespace clang; using namespace ento; -using llvm::dyn_cast; -using llvm::isa; bool PathDiagnosticMacroPiece::containsEvent() const { for (const_iterator I = begin(), E = end(); I!=E; ++I) { @@ -37,14 +34,14 @@ bool PathDiagnosticMacroPiece::containsEvent() const { return false; } -static llvm::StringRef StripTrailingDots(llvm::StringRef s) { - for (llvm::StringRef::size_type i = s.size(); i != 0; --i) +static StringRef StripTrailingDots(StringRef s) { + for (StringRef::size_type i = s.size(); i != 0; --i) if (s[i - 1] != '.') return s.substr(0, i); return ""; } -PathDiagnosticPiece::PathDiagnosticPiece(llvm::StringRef s, +PathDiagnosticPiece::PathDiagnosticPiece(StringRef s, Kind k, DisplayHint hint) : str(StripTrailingDots(s)), kind(k), Hint(hint) {} @@ -76,8 +73,8 @@ void PathDiagnostic::resetPath(bool deletePieces) { } -PathDiagnostic::PathDiagnostic(llvm::StringRef bugtype, llvm::StringRef desc, - llvm::StringRef category) +PathDiagnostic::PathDiagnostic(StringRef bugtype, StringRef desc, + StringRef category) : Size(0), BugType(StripTrailingDots(bugtype)), Desc(StripTrailingDots(desc)), diff --git a/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp b/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp index fbbbd46ac1..9ebc2562ed 100644 --- a/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp +++ b/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp @@ -22,14 +22,9 @@ #include "llvm/ADT/SmallVector.h" using namespace clang; using namespace ento; -using llvm::cast; typedef llvm::DenseMap<FileID, unsigned> FIDMap; -namespace clang { - class Preprocessor; -} - namespace { struct CompareDiagnostics { // Compare if 'X' is "<" than 'Y'. @@ -43,16 +38,16 @@ struct CompareDiagnostics { return false; // Next, compare by bug type. - llvm::StringRef XBugType = X->getBugType(); - llvm::StringRef YBugType = Y->getBugType(); + StringRef XBugType = X->getBugType(); + StringRef YBugType = Y->getBugType(); if (XBugType < YBugType) return true; if (XBugType != YBugType) return false; // Next, compare by bug description. - llvm::StringRef XDesc = X->getDescription(); - llvm::StringRef YDesc = Y->getDescription(); + StringRef XDesc = X->getDescription(); + StringRef YDesc = Y->getDescription(); if (XDesc < YDesc) return true; if (XDesc != YDesc) @@ -77,11 +72,11 @@ namespace { ~PlistDiagnostics() { FlushDiagnostics(NULL); } - void FlushDiagnostics(llvm::SmallVectorImpl<std::string> *FilesMade); + void FlushDiagnostics(SmallVectorImpl<std::string> *FilesMade); void HandlePathDiagnostic(const PathDiagnostic* D); - virtual llvm::StringRef getName() const { + virtual StringRef getName() const { return "PlistDiagnostics"; } @@ -111,7 +106,7 @@ PlistDiagnostics::getGenerationScheme() const { return Extensive; } -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)); @@ -129,12 +124,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) { @@ -155,14 +150,14 @@ static void EmitLocation(llvm::raw_ostream& o, const SourceManager &SM, Indent(o, indent) << "</dict>\n"; } -static void EmitLocation(llvm::raw_ostream& o, const SourceManager &SM, +static void EmitLocation(raw_ostream& o, const SourceManager &SM, const LangOptions &LangOpts, const PathDiagnosticLocation &L, const FIDMap& FM, unsigned indent, bool extend = false) { EmitLocation(o, SM, LangOpts, L.asLocation(), FM, indent, extend); } -static void EmitRange(llvm::raw_ostream& o, const SourceManager &SM, +static void EmitRange(raw_ostream& o, const SourceManager &SM, const LangOptions &LangOpts, PathDiagnosticRange R, const FIDMap &FM, unsigned indent) { @@ -172,7 +167,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, const std::string& s) { o << "<string>"; for (std::string::const_iterator I=s.begin(), E=s.end(); I!=E; ++I) { @@ -190,7 +185,7 @@ static llvm::raw_ostream& EmitString(llvm::raw_ostream& o, return o; } -static void ReportControlFlow(llvm::raw_ostream& o, +static void ReportControlFlow(raw_ostream& o, const PathDiagnosticControlFlowPiece& P, const FIDMap& FM, const SourceManager &SM, @@ -233,7 +228,7 @@ static void ReportControlFlow(llvm::raw_ostream& o, Indent(o, indent) << "</dict>\n"; } -static void ReportEvent(llvm::raw_ostream& o, const PathDiagnosticPiece& P, +static void ReportEvent(raw_ostream& o, const PathDiagnosticPiece& P, const FIDMap& FM, const SourceManager &SM, const LangOptions &LangOpts, @@ -280,7 +275,7 @@ static void ReportEvent(llvm::raw_ostream& o, const PathDiagnosticPiece& P, Indent(o, indent); o << "</dict>\n"; } -static void ReportMacro(llvm::raw_ostream& o, +static void ReportMacro(raw_ostream& o, const PathDiagnosticMacroPiece& P, const FIDMap& FM, const SourceManager &SM, const LangOptions &LangOpts, @@ -304,7 +299,7 @@ static void ReportMacro(llvm::raw_ostream& o, } } -static void ReportDiag(llvm::raw_ostream& o, const PathDiagnosticPiece& P, +static void ReportDiag(raw_ostream& o, const PathDiagnosticPiece& P, const FIDMap& FM, const SourceManager &SM, const LangOptions &LangOpts) { @@ -342,7 +337,7 @@ void PlistDiagnostics::HandlePathDiagnostic(const PathDiagnostic* D) { BatchedDiags.push_back(D); } -void PlistDiagnostics::FlushDiagnostics(llvm::SmallVectorImpl<std::string> +void PlistDiagnostics::FlushDiagnostics(SmallVectorImpl<std::string> *FilesMade) { if (flushed) @@ -358,7 +353,7 @@ void PlistDiagnostics::FlushDiagnostics(llvm::SmallVectorImpl<std::string> // 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; const SourceManager* SM = 0; if (!BatchedDiags.empty()) @@ -401,7 +396,7 @@ void PlistDiagnostics::FlushDiagnostics(llvm::SmallVectorImpl<std::string> " <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'; @@ -444,7 +439,7 @@ void PlistDiagnostics::FlushDiagnostics(llvm::SmallVectorImpl<std::string> // Output the diagnostic to the sub-diagnostic client, if any. if (SubPD) { SubPD->HandlePathDiagnostic(OwnedD.take()); - llvm::SmallVector<std::string, 1> SubFilesMade; + SmallVector<std::string, 1> SubFilesMade; SubPD->FlushDiagnostics(SubFilesMade); if (!SubFilesMade.empty()) { diff --git a/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp b/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp index 389fff5ed5..ecde983fb6 100644 --- a/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp +++ b/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp @@ -170,7 +170,7 @@ public: return newRanges; } - void print(llvm::raw_ostream &os) const { + void print(raw_ostream &os) const { bool isFirst = true; os << "{ "; for (iterator i = begin(), e = end(); i != e; ++i) { @@ -244,7 +244,7 @@ public: const GRState* removeDeadBindings(const GRState* St, SymbolReaper& SymReaper); - void print(const GRState* St, llvm::raw_ostream& Out, + void print(const GRState* St, raw_ostream& Out, const char* nl, const char *sep); private: @@ -424,7 +424,7 @@ RangeConstraintManager::assumeSymLE(const GRState* state, SymbolRef sym, // Pretty-printing. //===------------------------------------------------------------------------===/ -void RangeConstraintManager::print(const GRState* St, llvm::raw_ostream& Out, +void RangeConstraintManager::print(const GRState* St, raw_ostream& Out, const char* nl, const char *sep) { ConstraintRangeTy Ranges = St->get<ConstraintRange>(); diff --git a/lib/StaticAnalyzer/Core/RegionStore.cpp b/lib/StaticAnalyzer/Core/RegionStore.cpp index 23dd6416a8..0e3537c0ed 100644 --- a/lib/StaticAnalyzer/Core/RegionStore.cpp +++ b/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -94,7 +94,7 @@ BindingKey BindingKey::Make(const MemRegion *R, Kind k) { namespace llvm { static inline - llvm::raw_ostream& operator<<(llvm::raw_ostream& os, BindingKey K) { + raw_ostream& operator<<(raw_ostream& os, BindingKey K) { os << '(' << K.getRegion() << ',' << K.getOffset() << ',' << (K.isDirect() ? "direct" : "default") << ')'; @@ -157,7 +157,7 @@ public: return false; } - void process(llvm::SmallVectorImpl<const SubRegion*> &WL, const SubRegion *R); + void process(SmallVectorImpl<const SubRegion*> &WL, const SubRegion *R); ~RegionStoreSubRegionMap() {} @@ -183,7 +183,7 @@ public: }; void -RegionStoreSubRegionMap::process(llvm::SmallVectorImpl<const SubRegion*> &WL, +RegionStoreSubRegionMap::process(SmallVectorImpl<const SubRegion*> &WL, const SubRegion *R) { const MemRegion *superR = R->getSuperRegion(); if (add(superR, R)) @@ -372,7 +372,7 @@ public: // Part of public interface to class. /// It returns a new Store with these values removed. StoreRef removeDeadBindings(Store store, const StackFrameContext *LCtx, SymbolReaper& SymReaper, - llvm::SmallVectorImpl<const MemRegion*>& RegionRoots); + SmallVectorImpl<const MemRegion*>& RegionRoots); StoreRef enterStackFrame(const GRState *state, const StackFrameContext *frame); @@ -392,7 +392,7 @@ public: // Part of public interface to class. return RegionBindings(static_cast<const RegionBindings::TreeTy*>(store)); } - void print(Store store, llvm::raw_ostream& Out, const char* nl, + void print(Store store, raw_ostream& Out, const char* nl, const char *sep); void iterBindings(Store store, BindingsHandler& f) { @@ -433,7 +433,7 @@ RegionStoreManager::getRegionStoreSubRegionMap(Store store) { RegionBindings B = GetRegionBindings(store); RegionStoreSubRegionMap *M = new RegionStoreSubRegionMap(); - llvm::SmallVector<const SubRegion*, 10> WL; + SmallVector<const SubRegion*, 10> WL; for (RegionBindings::iterator I=B.begin(), E=B.end(); I!=E; ++I) if (const SubRegion *R = dyn_cast<SubRegion>(I.getKey().getRegion())) @@ -461,7 +461,7 @@ protected: typedef BumpVector<BindingKey> RegionCluster; typedef llvm::DenseMap<const MemRegion *, RegionCluster *> ClusterMap; llvm::DenseMap<const RegionCluster*, unsigned> Visited; - typedef llvm::SmallVector<std::pair<const MemRegion *, RegionCluster*>, 10> + typedef SmallVector<std::pair<const MemRegion *, RegionCluster*>, 10> WorkList; BumpVectorContext BVC; @@ -1611,7 +1611,7 @@ RegionBindings RegionStoreManager::removeBinding(RegionBindings B, namespace { class removeDeadBindingsWorker : public ClusterAnalysis<removeDeadBindingsWorker> { - llvm::SmallVector<const SymbolicRegion*, 12> Postponed; + SmallVector<const SymbolicRegion*, 12> Postponed; SymbolReaper &SymReaper; const StackFrameContext *CurrentLCtx; @@ -1736,7 +1736,7 @@ bool removeDeadBindingsWorker::UpdatePostponed() { // having done a scan. bool changed = false; - for (llvm::SmallVectorImpl<const SymbolicRegion*>::iterator + for (SmallVectorImpl<const SymbolicRegion*>::iterator I = Postponed.begin(), E = Postponed.end() ; I != E ; ++I) { if (const SymbolicRegion *SR = cast_or_null<SymbolicRegion>(*I)) { if (SymReaper.isLive(SR->getSymbol())) { @@ -1752,14 +1752,14 @@ bool removeDeadBindingsWorker::UpdatePostponed() { StoreRef RegionStoreManager::removeDeadBindings(Store store, const StackFrameContext *LCtx, SymbolReaper& SymReaper, - llvm::SmallVectorImpl<const MemRegion*>& RegionRoots) + SmallVectorImpl<const MemRegion*>& RegionRoots) { RegionBindings B = GetRegionBindings(store); removeDeadBindingsWorker W(*this, StateMgr, B, SymReaper, LCtx); W.GenerateClusters(); // Enqueue the region roots onto the worklist. - for (llvm::SmallVectorImpl<const MemRegion*>::iterator I=RegionRoots.begin(), + for (SmallVectorImpl<const MemRegion*>::iterator I=RegionRoots.begin(), E=RegionRoots.end(); I!=E; ++I) W.AddToWorkList(*I); @@ -1831,7 +1831,7 @@ StoreRef RegionStoreManager::enterStackFrame(const GRState *state, // Utility methods. //===----------------------------------------------------------------------===// -void RegionStoreManager::print(Store store, llvm::raw_ostream& OS, +void RegionStoreManager::print(Store store, raw_ostream& OS, const char* nl, const char *sep) { RegionBindings B = GetRegionBindings(store); OS << "Store (direct and default bindings):" << nl; diff --git a/lib/StaticAnalyzer/Core/SVals.cpp b/lib/StaticAnalyzer/Core/SVals.cpp index 4614e349de..b74ceb7ea6 100644 --- a/lib/StaticAnalyzer/Core/SVals.cpp +++ b/lib/StaticAnalyzer/Core/SVals.cpp @@ -15,11 +15,8 @@ #include "clang/StaticAnalyzer/Core/PathSensitive/GRState.h" #include "clang/AST/ExprObjC.h" #include "clang/Basic/IdentifierTable.h" - using namespace clang; using namespace ento; -using llvm::dyn_cast; -using llvm::cast; using llvm::APSInt; //===----------------------------------------------------------------------===// @@ -270,7 +267,7 @@ SVal loc::ConcreteInt::evalBinOp(BasicValueFactory& BasicVals, void SVal::dump() const { dumpToStream(llvm::errs()); } -void SVal::dumpToStream(llvm::raw_ostream& os) const { +void SVal::dumpToStream(raw_ostream& os) const { switch (getBaseKind()) { case UnknownKind: os << "Unknown"; @@ -289,7 +286,7 @@ void SVal::dumpToStream(llvm::raw_ostream& os) const { } } -void NonLoc::dumpToStream(llvm::raw_ostream& os) const { +void NonLoc::dumpToStream(raw_ostream& os) const { switch (getSubKind()) { case nonloc::ConcreteIntKind: { const nonloc::ConcreteInt& C = *cast<nonloc::ConcreteInt>(this); @@ -344,7 +341,7 @@ void NonLoc::dumpToStream(llvm::raw_ostream& os) const { } } -void Loc::dumpToStream(llvm::raw_ostream& os) const { +void Loc::dumpToStream(raw_ostream& os) const { switch (getSubKind()) { case loc::ConcreteIntKind: os << cast<loc::ConcreteInt>(this)->getValue().getZExtValue() << " (Loc)"; diff --git a/lib/StaticAnalyzer/Core/SymbolManager.cpp b/lib/StaticAnalyzer/Core/SymbolManager.cpp index c1ca1cfcdc..b55c96934e 100644 --- a/lib/StaticAnalyzer/Core/SymbolManager.cpp +++ b/lib/StaticAnalyzer/Core/SymbolManager.cpp @@ -24,7 +24,7 @@ void SymExpr::dump() const { dumpToStream(llvm::errs()); } -static void print(llvm::raw_ostream& os, BinaryOperator::Opcode Op) { +static void print(raw_ostream& os, BinaryOperator::Opcode Op) { switch (Op) { default: assert(false && "operator printing not implemented"); @@ -48,7 +48,7 @@ static void print(llvm::raw_ostream& os, BinaryOperator::Opcode Op) { } } -void SymIntExpr::dumpToStream(llvm::raw_ostream& os) const { +void SymIntExpr::dumpToStream(raw_ostream& os) const { os << '('; getLHS()->dumpToStream(os); os << ") "; @@ -57,7 +57,7 @@ void SymIntExpr::dumpToStream(llvm::raw_ostream& os) const { if (getRHS().isUnsigned()) os << 'U'; } -void SymSymExpr::dumpToStream(llvm::raw_ostream& os) const { +void SymSymExpr::dumpToStream(raw_ostream& os) const { os << '('; getLHS()->dumpToStream(os); os << ") "; @@ -66,25 +66,25 @@ void SymSymExpr::dumpToStream(llvm::raw_ostream& os) const { os << ')'; } -void SymbolConjured::dumpToStream(llvm::raw_ostream& os) const { +void SymbolConjured::dumpToStream(raw_ostream& os) const { os << "conj_$" << getSymbolID() << '{' << T.getAsString() << '}'; } -void SymbolDerived::dumpToStream(llvm::raw_ostream& os) const { +void SymbolDerived::dumpToStream(raw_ostream& os) const { os << "derived_$" << getSymbolID() << '{' << getParentSymbol() << ',' << getRegion() << '}'; } -void SymbolExtent::dumpToStream(llvm::raw_ostream& os) const { +void SymbolExtent::dumpToStream(raw_ostream& os) const { os << "extent_$" << getSymbolID() << '{' << getRegion() << '}'; } -void SymbolMetadata::dumpToStream(llvm::raw_ostream& os) const { +void SymbolMetadata::dumpToStream(raw_ostream& os) const { os << "meta_$" << getSymbolID() << '{' << getRegion() << ',' << T.getAsString() << '}'; } -void SymbolRegionValue::dumpToStream(llvm::raw_ostream& os) const { +void SymbolRegionValue::dumpToStream(raw_ostream& os) const { os << "reg_$" << getSymbolID() << "<" << R << ">"; } diff --git a/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp b/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp index 230b6a1087..c4665ef097 100644 --- a/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp +++ b/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp @@ -33,9 +33,9 @@ public: void HandlePathDiagnostic(const PathDiagnostic* D); - void FlushDiagnostics(llvm::SmallVectorImpl<std::string> *FilesMade) { } + void FlushDiagnostics(SmallVectorImpl<std::string> *FilesMade) { } - virtual llvm::StringRef getName() const { + virtual StringRef getName() const { return "TextPathDiagnostics"; } diff --git a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp index b8dbb54504..dd024f817e 100644 --- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -244,7 +244,7 @@ void AnalysisConsumer::HandleTranslationUnit(ASTContext &C) { Mgr.reset(NULL); } -static void FindBlocks(DeclContext *D, llvm::SmallVectorImpl<Decl*> &WL) { +static void FindBlocks(DeclContext *D, SmallVectorImpl<Decl*> &WL) { if (BlockDecl *BD = dyn_cast<BlockDecl>(D)) WL.push_back(BD); @@ -275,14 +275,14 @@ void AnalysisConsumer::HandleCode(Decl *D) { Mgr->ClearContexts(); // Dispatch on the actions. - llvm::SmallVector<Decl*, 10> WL; + SmallVector<Decl*, 10> WL; WL.push_back(D); if (D->hasBody() && Opts.AnalyzeNestedBlocks) FindBlocks(cast<DeclContext>(D), WL); BugReporter BR(*Mgr); - for (llvm::SmallVectorImpl<Decl*>::iterator WI=WL.begin(), WE=WL.end(); + for (SmallVectorImpl<Decl*>::iterator WI=WL.begin(), WE=WL.end(); WI != WE; ++WI) if ((*WI)->hasBody()) { checkerMgr->runCheckersOnASTBody(*WI, *Mgr, BR); @@ -383,7 +383,7 @@ ASTConsumer* ento::CreateAnalysisConsumer(const Preprocessor& pp, namespace { class UbigraphViz : public ExplodedNode::Auditor { - llvm::OwningPtr<llvm::raw_ostream> Out; + llvm::OwningPtr<raw_ostream> Out; llvm::sys::Path Dir, Filename; unsigned Cntr; @@ -391,7 +391,7 @@ class UbigraphViz : public ExplodedNode::Auditor { VMap M; public: - UbigraphViz(llvm::raw_ostream* out, llvm::sys::Path& dir, + UbigraphViz(raw_ostream* out, llvm::sys::Path& dir, llvm::sys::Path& filename); ~UbigraphViz(); @@ -460,7 +460,7 @@ void UbigraphViz::AddEdge(ExplodedNode* Src, ExplodedNode* Dst) { << ", ('arrow','true'), ('oriented', 'true'))\n"; } -UbigraphViz::UbigraphViz(llvm::raw_ostream* out, llvm::sys::Path& dir, +UbigraphViz::UbigraphViz(raw_ostream* out, llvm::sys::Path& dir, llvm::sys::Path& filename) : Out(out), Dir(dir), Filename(filename), Cntr(0) { diff --git a/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp b/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp index d7edc7e599..29c1cd1eda 100644 --- a/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp +++ b/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp @@ -31,7 +31,7 @@ CheckerManager *ento::registerCheckers(const AnalyzerOptions &opts, Diagnostic &diags) { llvm::OwningPtr<CheckerManager> checkerMgr(new CheckerManager(langOpts)); - llvm::SmallVector<CheckerOptInfo, 8> checkerOpts; + SmallVector<CheckerOptInfo, 8> checkerOpts; for (unsigned i = 0, e = opts.CheckersControlList.size(); i != e; ++i) { const std::pair<std::string, bool> &opt = opts.CheckersControlList[i]; checkerOpts.push_back(CheckerOptInfo(opt.first.c_str(), opt.second)); @@ -54,7 +54,7 @@ CheckerManager *ento::registerCheckers(const AnalyzerOptions &opts, return checkerMgr.take(); } -void ento::printCheckerHelp(llvm::raw_ostream &OS) { +void ento::printCheckerHelp(raw_ostream &OS) { OS << "OVERVIEW: Clang Static Analyzer Checkers List\n"; OS << '\n'; diff --git a/lib/StaticAnalyzer/Frontend/FrontendActions.cpp b/lib/StaticAnalyzer/Frontend/FrontendActions.cpp index a59cc6888f..eeb7800e48 100644 --- a/lib/StaticAnalyzer/Frontend/FrontendActions.cpp +++ b/lib/StaticAnalyzer/Frontend/FrontendActions.cpp @@ -14,7 +14,7 @@ using namespace clang; using namespace ento; ASTConsumer *AnalysisAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { return CreateAnalysisConsumer(CI.getPreprocessor(), CI.getFrontendOpts().OutputFile, CI.getAnalyzerOpts()); diff --git a/tools/arcmt-test/arcmt-test.cpp b/tools/arcmt-test/arcmt-test.cpp index eb0f56943f..edef415edb 100644 --- a/tools/arcmt-test/arcmt-test.cpp +++ b/tools/arcmt-test/arcmt-test.cpp @@ -69,24 +69,24 @@ llvm::sys::Path GetExecutablePath(const char *Argv0) { } static void printSourceLocation(SourceLocation loc, ASTContext &Ctx, - llvm::raw_ostream &OS); + raw_ostream &OS); static void printSourceRange(CharSourceRange range, ASTContext &Ctx, - llvm::raw_ostream &OS); + raw_ostream &OS); namespace { class PrintTransforms : public MigrationProcess::RewriteListener { ASTContext *Ctx; - llvm::raw_ostream &OS; + raw_ostream &OS; public: - PrintTransforms(llvm::raw_ostream &OS) + PrintTransforms(raw_ostream &OS) : Ctx(0), OS(OS) { } virtual void start(ASTContext &ctx) { Ctx = &ctx; } virtual void finish() { Ctx = 0; } - virtual void insert(SourceLocation loc, llvm::StringRef text) { + virtual void insert(SourceLocation loc, StringRef text) { assert(Ctx); OS << "Insert: "; printSourceLocation(loc, *Ctx, OS); @@ -103,7 +103,7 @@ public: } // anonymous namespace -static bool checkForMigration(llvm::StringRef resourcesPath, +static bool checkForMigration(StringRef resourcesPath, llvm::ArrayRef<const char *> Args) { DiagnosticClient *DiagClient = new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions()); @@ -134,7 +134,7 @@ static bool checkForMigration(llvm::StringRef resourcesPath, return Diags->getClient()->getNumErrors() > 0; } -static void printResult(FileRemapper &remapper, llvm::raw_ostream &OS) { +static void printResult(FileRemapper &remapper, raw_ostream &OS) { CompilerInvocation CI; remapper.applyMappings(CI); PreprocessorOptions &PPOpts = CI.getPreprocessorOpts(); @@ -145,7 +145,7 @@ static void printResult(FileRemapper &remapper, llvm::raw_ostream &OS) { } } -static bool performTransformations(llvm::StringRef resourcesPath, +static bool performTransformations(StringRef resourcesPath, llvm::ArrayRef<const char *> Args) { // Check first. if (checkForMigration(resourcesPath, Args)) @@ -199,7 +199,7 @@ static bool performTransformations(llvm::StringRef resourcesPath, return false; } -static bool filesCompareEqual(llvm::StringRef fname1, llvm::StringRef fname2) { +static bool filesCompareEqual(StringRef fname1, StringRef fname2) { using namespace llvm; OwningPtr<MemoryBuffer> file1; @@ -303,7 +303,7 @@ static bool verifyTransformedFiles(llvm::ArrayRef<std::string> resultFiles) { //===----------------------------------------------------------------------===// static void printSourceLocation(SourceLocation loc, ASTContext &Ctx, - llvm::raw_ostream &OS) { + raw_ostream &OS) { SourceManager &SM = Ctx.getSourceManager(); PresumedLoc PL = SM.getPresumedLoc(loc); @@ -313,7 +313,7 @@ static void printSourceLocation(SourceLocation loc, ASTContext &Ctx, } static void printSourceRange(CharSourceRange range, ASTContext &Ctx, - llvm::raw_ostream &OS) { + raw_ostream &OS) { SourceManager &SM = Ctx.getSourceManager(); const LangOptions &langOpts = Ctx.getLangOptions(); @@ -338,7 +338,6 @@ static void printSourceRange(CharSourceRange range, ASTContext &Ctx, //===----------------------------------------------------------------------===// int main(int argc, const char **argv) { - using llvm::StringRef; void *MainAddr = (void*) (intptr_t) GetExecutablePath; llvm::sys::PrintStackTraceOnErrorSignal(); diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp index 9bf72ff92f..4106d27c62 100644 --- a/tools/driver/cc1_main.cpp +++ b/tools/driver/cc1_main.cpp @@ -83,7 +83,7 @@ static int cc1_test(Diagnostic &Diags, Invocation.toArgs(InvocationArgs); // Dump the converted arguments. - llvm::SmallVector<const char*, 32> Invocation2Args; + SmallVector<const char*, 32> Invocation2Args; llvm::errs() << "invocation argv :"; for (unsigned i = 0, e = InvocationArgs.size(); i != e; ++i) { Invocation2Args.push_back(InvocationArgs[i].c_str()); @@ -118,7 +118,7 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd, llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs()); // Run clang -cc1 test. - if (ArgBegin != ArgEnd && llvm::StringRef(ArgBegin[0]) == "-cc1test") { + if (ArgBegin != ArgEnd && StringRef(ArgBegin[0]) == "-cc1test") { Diagnostic Diags(DiagID, new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions())); return cc1_test(Diags, ArgBegin + 1, ArgEnd); diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp index ca8982619e..096260c421 100644 --- a/tools/driver/driver.cpp +++ b/tools/driver/driver.cpp @@ -53,7 +53,7 @@ llvm::sys::Path GetExecutablePath(const char *Argv0, bool CanonicalPrefixes) { } static const char *SaveStringInSet(std::set<std::string> &SavedStrings, - llvm::StringRef S) { + StringRef S) { return SavedStrings.insert(S).first->c_str(); } @@ -84,9 +84,9 @@ static const char *SaveStringInSet(std::set<std::string> &SavedStrings, /// \param Args - The vector of command line arguments. /// \param Edit - The override command to perform. /// \param SavedStrings - Set to use for storing string representations. -static void ApplyOneQAOverride(llvm::raw_ostream &OS, - llvm::SmallVectorImpl<const char*> &Args, - llvm::StringRef Edit, +static void ApplyOneQAOverride(raw_ostream &OS, + SmallVectorImpl<const char*> &Args, + StringRef Edit, std::set<std::string> &SavedStrings) { // This does not need to be efficient. @@ -101,9 +101,9 @@ static void ApplyOneQAOverride(llvm::raw_ostream &OS, OS << "### Adding argument " << Str << " at end\n"; Args.push_back(Str); } else if (Edit[0] == 's' && Edit[1] == '/' && Edit.endswith("/") && - Edit.slice(2, Edit.size()-1).find('/') != llvm::StringRef::npos) { - llvm::StringRef MatchPattern = Edit.substr(2).split('/').first; - llvm::StringRef ReplPattern = Edit.substr(2).split('/').second; + Edit.slice(2, Edit.size()-1).find('/') != StringRef::npos) { + StringRef MatchPattern = Edit.substr(2).split('/').first; + StringRef ReplPattern = Edit.substr(2).split('/').second; ReplPattern = ReplPattern.slice(0, ReplPattern.size()-1); for (unsigned i = 1, e = Args.size(); i != e; ++i) { @@ -151,10 +151,10 @@ static void ApplyOneQAOverride(llvm::raw_ostream &OS, /// ApplyQAOverride - Apply a comma separate list of edits to the /// input argument lists. See ApplyOneQAOverride. -static void ApplyQAOverride(llvm::SmallVectorImpl<const char*> &Args, +static void ApplyQAOverride(SmallVectorImpl<const char*> &Args, const char *OverrideStr, std::set<std::string> &SavedStrings) { - llvm::raw_ostream *OS = &llvm::errs(); + raw_ostream *OS = &llvm::errs(); if (OverrideStr[0] == '#') { ++OverrideStr; @@ -184,7 +184,7 @@ extern int cc1as_main(const char **ArgBegin, const char **ArgEnd, const char *Argv0, void *MainAddr); static void ExpandArgsFromBuf(const char *Arg, - llvm::SmallVectorImpl<const char*> &ArgVector, + SmallVectorImpl<const char*> &ArgVector, std::set<std::string> &SavedStrings) { const char *FName = Arg + 1; llvm::OwningPtr<llvm::MemoryBuffer> MemBuf; @@ -242,7 +242,7 @@ static void ExpandArgsFromBuf(const char *Arg, } static void ExpandArgv(int argc, const char **argv, - llvm::SmallVectorImpl<const char*> &ArgVector, + SmallVectorImpl<const char*> &ArgVector, std::set<std::string> &SavedStrings) { for (int i = 0; i < argc; ++i) { const char *Arg = argv[i]; @@ -255,7 +255,7 @@ static void ExpandArgv(int argc, const char **argv, } } -static void ParseProgName(llvm::SmallVectorImpl<const char *> &ArgVector, +static void ParseProgName(SmallVectorImpl<const char *> &ArgVector, std::set<std::string> &SavedStrings, Driver &TheDriver) { @@ -290,8 +290,8 @@ static void ParseProgName(llvm::SmallVectorImpl<const char *> &ArgVector, { "++", true, false }, }; std::string ProgName(llvm::sys::path::stem(ArgVector[0])); - llvm::StringRef ProgNameRef(ProgName); - llvm::StringRef Prefix; + StringRef ProgNameRef(ProgName); + StringRef Prefix; for (int Components = 2; Components; --Components) { bool FoundMatch = false; @@ -309,15 +309,15 @@ static void ParseProgName(llvm::SmallVectorImpl<const char *> &ArgVector, } if (FoundMatch) { - llvm::StringRef::size_type LastComponent = ProgNameRef.rfind('-', + StringRef::size_type LastComponent = ProgNameRef.rfind('-', ProgNameRef.size() - strlen(suffixes[i].Suffix)); - if (LastComponent != llvm::StringRef::npos) + if (LastComponent != StringRef::npos) Prefix = ProgNameRef.slice(0, LastComponent); break; } - llvm::StringRef::size_type LastComponent = ProgNameRef.rfind('-'); - if (LastComponent == llvm::StringRef::npos) + StringRef::size_type LastComponent = ProgNameRef.rfind('-'); + if (LastComponent == StringRef::npos) break; ProgNameRef = ProgNameRef.slice(0, LastComponent); } @@ -327,7 +327,7 @@ static void ParseProgName(llvm::SmallVectorImpl<const char *> &ArgVector, std::string IgnoredError; if (llvm::TargetRegistry::lookupTarget(Prefix, IgnoredError)) { - llvm::SmallVectorImpl<const char *>::iterator it = ArgVector.begin(); + SmallVectorImpl<const char *>::iterator it = ArgVector.begin(); if (it != ArgVector.end()) ++it; ArgVector.insert(it, SaveStringInSet(SavedStrings, Prefix)); @@ -341,13 +341,13 @@ int main(int argc_, const char **argv_) { llvm::PrettyStackTraceProgram X(argc_, argv_); std::set<std::string> SavedStrings; - llvm::SmallVector<const char*, 256> argv; + SmallVector<const char*, 256> argv; ExpandArgv(argc_, argv_, argv, SavedStrings); // Handle -cc1 integrated tools. - if (argv.size() > 1 && llvm::StringRef(argv[1]).startswith("-cc1")) { - llvm::StringRef Tool = argv[1] + 4; + if (argv.size() > 1 && StringRef(argv[1]).startswith("-cc1")) { + StringRef Tool = argv[1] + 4; if (Tool == "") return cc1_main(argv.data()+2, argv.data()+argv.size(), argv[0], @@ -363,7 +363,7 @@ int main(int argc_, const char **argv_) { bool CanonicalPrefixes = true; for (int i = 1, size = argv.size(); i < size; ++i) { - if (llvm::StringRef(argv[i]) == "-no-canonical-prefixes") { + if (StringRef(argv[i]) == "-no-canonical-prefixes") { CanonicalPrefixes = false; break; } diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 81922a902d..97d41c010f 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -161,7 +161,7 @@ public: static bool classof(VisitorJob *VJ) { return true; } }; -typedef llvm::SmallVector<VisitorJob, 10> VisitorWorkList; +typedef SmallVector<VisitorJob, 10> VisitorWorkList; // Cursor visitor. class CursorVisitor : public DeclVisitor<CursorVisitor, bool>, @@ -203,8 +203,8 @@ class CursorVisitor : public DeclVisitor<CursorVisitor, bool>, DeclContext::decl_iterator DE_current; // Cache of pre-allocated worklists for data-recursion walk of Stmts. - llvm::SmallVector<VisitorWorkList*, 5> WorkListFreeList; - llvm::SmallVector<VisitorWorkList*, 5> WorkListCache; + SmallVector<VisitorWorkList*, 5> WorkListFreeList; + SmallVector<VisitorWorkList*, 5> WorkListCache; using DeclVisitor<CursorVisitor, bool>::Visit; using TypeLocVisitor<CursorVisitor, bool>::Visit; @@ -256,7 +256,7 @@ public: ~CursorVisitor() { // Free the pre-allocated worklists for data-recursion. - for (llvm::SmallVectorImpl<VisitorWorkList*>::iterator + for (SmallVectorImpl<VisitorWorkList*>::iterator I = WorkListCache.begin(), E = WorkListCache.end(); I != E; ++I) { delete *I; } @@ -806,7 +806,7 @@ bool CursorVisitor::VisitFunctionDecl(FunctionDecl *ND) { if (ND->doesThisDeclarationHaveABody() && !ND->isLateTemplateParsed()) { if (CXXConstructorDecl *Constructor = dyn_cast<CXXConstructorDecl>(ND)) { // Find the initializers that were written in the source. - llvm::SmallVector<CXXCtorInitializer *, 4> WrittenInits; + SmallVector<CXXCtorInitializer *, 4> WrittenInits; for (CXXConstructorDecl::init_iterator I = Constructor->init_begin(), IEnd = Constructor->init_end(); I != IEnd; ++I) { @@ -950,7 +950,7 @@ bool CursorVisitor::VisitObjCContainerDecl(ObjCContainerDecl *D) { // in the current DeclContext. If any fall within the // container's lexical region, stash them into a vector // for later processing. - llvm::SmallVector<Decl *, 24> DeclsInContainer; + SmallVector<Decl *, 24> DeclsInContainer; SourceLocation EndLoc = D->getSourceRange().getEnd(); SourceManager &SM = AU->getSourceManager(); if (EndLoc.isValid()) { @@ -991,7 +991,7 @@ bool CursorVisitor::VisitObjCContainerDecl(ObjCContainerDecl *D) { ContainerDeclsSort(SM)); // Now visit the decls. - for (llvm::SmallVectorImpl<Decl*>::iterator I = DeclsInContainer.begin(), + for (SmallVectorImpl<Decl*>::iterator I = DeclsInContainer.begin(), E = DeclsInContainer.end(); I != E; ++I) { CXCursor Cursor = MakeCXCursor(*I, TU); const llvm::Optional<bool> &V = shouldVisitCursor(Cursor); @@ -1266,7 +1266,7 @@ bool CursorVisitor::VisitNestedNameSpecifier(NestedNameSpecifier *NNS, bool CursorVisitor::VisitNestedNameSpecifierLoc(NestedNameSpecifierLoc Qualifier) { - llvm::SmallVector<NestedNameSpecifierLoc, 4> Qualifiers; + SmallVector<NestedNameSpecifierLoc, 4> Qualifiers; for (; Qualifier; Qualifier = Qualifier.getPrefix()) Qualifiers.push_back(Qualifier); @@ -2466,7 +2466,7 @@ static void clang_parseTranslationUnit_Impl(void *UserData) { std::vector<ASTUnit::RemappedFile> > RemappedCleanup(RemappedFiles.get()); for (unsigned I = 0; I != num_unsaved_files; ++I) { - llvm::StringRef Data(unsaved_files[I].Contents, unsaved_files[I].Length); + StringRef Data(unsaved_files[I].Contents, unsaved_files[I].Length); const llvm::MemoryBuffer *Buffer = llvm::MemoryBuffer::getMemBufferCopy(Data, unsaved_files[I].Filename); RemappedFiles->push_back(std::make_pair(unsaved_files[I].Filename, @@ -2663,7 +2663,7 @@ static void clang_reparseTranslationUnit_Impl(void *UserData) { std::vector<ASTUnit::RemappedFile> > RemappedCleanup(RemappedFiles.get()); for (unsigned I = 0; I != num_unsaved_files; ++I) { - llvm::StringRef Data(unsaved_files[I].Contents, unsaved_files[I].Length); + StringRef Data(unsaved_files[I].Contents, unsaved_files[I].Length); const llvm::MemoryBuffer *Buffer = llvm::MemoryBuffer::getMemBufferCopy(Data, unsaved_files[I].Filename); RemappedFiles->push_back(std::make_pair(unsaved_files[I].Filename, @@ -2955,7 +2955,7 @@ static Decl *getDeclFromExpr(Stmt *E) { if (CallExpr *CE = dyn_cast<CallExpr>(E)) return getDeclFromExpr(CE->getCallee()); - if (CXXConstructExpr *CE = llvm::dyn_cast<CXXConstructExpr>(E)) + if (CXXConstructExpr *CE = dyn_cast<CXXConstructExpr>(E)) if (!CE->isElidable()) return CE->getConstructor(); if (ObjCMessageExpr *OME = dyn_cast<ObjCMessageExpr>(E)) @@ -3042,7 +3042,7 @@ unsigned clang_visitChildrenWithBlock(CXCursor parent, static CXString getDeclSpelling(Decl *D) { NamedDecl *ND = dyn_cast_or_null<NamedDecl>(D); if (!ND) { - if (ObjCPropertyImplDecl *PropImpl =llvm::dyn_cast<ObjCPropertyImplDecl>(D)) + if (ObjCPropertyImplDecl *PropImpl =dyn_cast<ObjCPropertyImplDecl>(D)) if (ObjCPropertyDecl *Property = PropImpl->getPropertyDecl()) return createCXString(Property->getIdentifier()->getName()); @@ -3859,7 +3859,7 @@ CXCursor clang_getCursorReferenced(CXCursor C) { if (ObjCForwardProtocolDecl *Protocols = dyn_cast<ObjCForwardProtocolDecl>(D)) return MakeCursorOverloadedDeclRef(Protocols, D->getLocation(), tu); - if (ObjCPropertyImplDecl *PropImpl =llvm::dyn_cast<ObjCPropertyImplDecl>(D)) + if (ObjCPropertyImplDecl *PropImpl =dyn_cast<ObjCPropertyImplDecl>(D)) if (ObjCPropertyDecl *Property = PropImpl->getPropertyDecl()) return MakeCXCursor(Property, tu); @@ -4285,7 +4285,7 @@ CXString clang_getTokenSpelling(CXTranslationUnit TU, CXToken CXTok) { case CXToken_Literal: { // We have stashed the starting pointer in the ptr_data field. Use it. const char *Text = static_cast<const char *>(CXTok.ptr_data); - return createCXString(llvm::StringRef(Text, CXTok.int_data[2])); + return createCXString(StringRef(Text, CXTok.int_data[2])); } case CXToken_Punctuation: @@ -4303,7 +4303,7 @@ CXString clang_getTokenSpelling(CXTranslationUnit TU, CXToken CXTok) { std::pair<FileID, unsigned> LocInfo = CXXUnit->getSourceManager().getDecomposedLoc(Loc); bool Invalid = false; - llvm::StringRef Buffer + StringRef Buffer = CXXUnit->getSourceManager().getBufferData(LocInfo.first, &Invalid); if (Invalid) return createCXString(""); @@ -4358,7 +4358,7 @@ void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range, // Create a lexer bool Invalid = false; - llvm::StringRef Buffer + StringRef Buffer = SourceMgr.getBufferData(BeginLocInfo.first, &Invalid); if (Invalid) return; @@ -4370,7 +4370,7 @@ void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range, // Lex tokens until we hit the end of the range. const char *EffectiveBufferEnd = Buffer.data() + EndLocInfo.second; - llvm::SmallVector<CXToken, 32> CXTokens; + SmallVector<CXToken, 32> CXTokens; Token Tok; bool previousWasAt = false; do { @@ -4791,7 +4791,7 @@ static void clang_annotateTokensImpl(void *UserData) { std::pair<FileID, unsigned> EndLocInfo = SourceMgr.getDecomposedLoc(RegionOfInterest.getEnd()); - llvm::StringRef Buffer; + StringRef Buffer; bool Invalid = false; if (BeginLocInfo.first == EndLocInfo.first && ((Buffer = SourceMgr.getBufferData(BeginLocInfo.first, &Invalid)),true) && @@ -4817,7 +4817,7 @@ static void clang_annotateTokensImpl(void *UserData) { // // FIXME: Some simple tests here could identify macro definitions and // #undefs, to provide specific cursor kinds for those. - llvm::SmallVector<SourceLocation, 32> Locations; + SmallVector<SourceLocation, 32> Locations; do { Locations.push_back(Tok.getLocation()); Lex.LexFromRawLexer(Tok); @@ -5136,7 +5136,7 @@ CXCursor clang_getCursorLexicalParent(CXCursor cursor) { static void CollectOverriddenMethods(DeclContext *Ctx, ObjCMethodDecl *Method, - llvm::SmallVectorImpl<ObjCMethodDecl *> &Methods) { + SmallVectorImpl<ObjCMethodDecl *> &Methods) { if (!Ctx) return; @@ -5229,7 +5229,7 @@ void clang_getOverriddenCursors(CXCursor cursor, return; // Handle Objective-C methods. - llvm::SmallVector<ObjCMethodDecl *, 4> Methods; + SmallVector<ObjCMethodDecl *, 4> Methods; CollectOverriddenMethods(Method->getDeclContext(), Method, Methods); if (Methods.empty()) diff --git a/tools/libclang/CIndexCodeCompletion.cpp b/tools/libclang/CIndexCodeCompletion.cpp index 8695cb44b3..59636bf2d8 100644 --- a/tools/libclang/CIndexCodeCompletion.cpp +++ b/tools/libclang/CIndexCodeCompletion.cpp @@ -209,7 +209,7 @@ struct AllocatedCXCodeCompleteResults : public CXCodeCompleteResults { ~AllocatedCXCodeCompleteResults(); /// \brief Diagnostics produced while performing code completion. - llvm::SmallVector<StoredDiagnostic, 8> Diagnostics; + SmallVector<StoredDiagnostic, 8> Diagnostics; /// \brief Diag object llvm::IntrusiveRefCntPtr<Diagnostic> Diag; @@ -231,7 +231,7 @@ struct AllocatedCXCodeCompleteResults : public CXCodeCompleteResults { /// \brief Temporary buffers that will be deleted once we have finished with /// the code-completion results. - llvm::SmallVector<const llvm::MemoryBuffer *, 1> TemporaryBuffers; + SmallVector<const llvm::MemoryBuffer *, 1> TemporaryBuffers; /// \brief Allocator used to store globally cached code-completion results. llvm::IntrusiveRefCntPtr<clang::GlobalCodeCompletionAllocator> @@ -465,7 +465,7 @@ static unsigned long long getContextsForContextKind( namespace { class CaptureCompletionResults : public CodeCompleteConsumer { AllocatedCXCodeCompleteResults &AllocatedResults; - llvm::SmallVector<CXCompletionResult, 16> StoredResults; + SmallVector<CXCompletionResult, 16> StoredResults; CXTranslationUnit *TU; public: CaptureCompletionResults(AllocatedCXCodeCompleteResults &Results, @@ -607,9 +607,9 @@ void clang_codeCompleteAt_Impl(void *UserData) { ASTUnit::ConcurrencyCheck Check(*AST); // Perform the remapping of source files. - llvm::SmallVector<ASTUnit::RemappedFile, 4> RemappedFiles; + SmallVector<ASTUnit::RemappedFile, 4> RemappedFiles; for (unsigned I = 0; I != num_unsaved_files; ++I) { - llvm::StringRef Data(unsaved_files[I].Contents, unsaved_files[I].Length); + StringRef Data(unsaved_files[I].Contents, unsaved_files[I].Length); const llvm::MemoryBuffer *Buffer = llvm::MemoryBuffer::getMemBufferCopy(Data, unsaved_files[I].Filename); RemappedFiles.push_back(std::make_pair(unsaved_files[I].Filename, @@ -695,7 +695,7 @@ void clang_codeCompleteAt_Impl(void *UserData) { os << ", \"clangVer\": \"" << getClangFullVersion() << '"'; os << " }"; - llvm::StringRef res = os.str(); + StringRef res = os.str(); if (res.size() > 0) { do { // Setup the UDP socket. @@ -824,7 +824,7 @@ CXString clang_codeCompleteGetContainerUSR(CXCodeCompleteResults *ResultsIn) { /// /// \param Buffer A buffer that stores the actual, concatenated string. It will /// be used if the old string is already-non-empty. -static void AppendToString(llvm::StringRef &Old, llvm::StringRef New, +static void AppendToString(StringRef &Old, StringRef New, llvm::SmallString<256> &Buffer) { if (Old.empty()) { Old = New; @@ -844,9 +844,9 @@ static void AppendToString(llvm::StringRef &Old, llvm::StringRef New, /// concatenated. /// /// \param Buffer A buffer used for storage of the completed name. -static llvm::StringRef GetTypedName(CodeCompletionString *String, +static StringRef GetTypedName(CodeCompletionString *String, llvm::SmallString<256> &Buffer) { - llvm::StringRef Result; + StringRef Result; for (CodeCompletionString::iterator C = String->begin(), CEnd = String->end(); C != CEnd; ++C) { if (C->Kind == CodeCompletionString::CK_TypedText) @@ -866,9 +866,9 @@ namespace { = (CodeCompletionString *)YR.CompletionString; llvm::SmallString<256> XBuffer; - llvm::StringRef XText = GetTypedName(X, XBuffer); + StringRef XText = GetTypedName(X, XBuffer); llvm::SmallString<256> YBuffer; - llvm::StringRef YText = GetTypedName(Y, YBuffer); + StringRef YText = GetTypedName(Y, YBuffer); if (XText.empty() || YText.empty()) return !XText.empty(); diff --git a/tools/libclang/CIndexDiagnostic.cpp b/tools/libclang/CIndexDiagnostic.cpp index 0fcdab70be..d9b515b146 100644 --- a/tools/libclang/CIndexDiagnostic.cpp +++ b/tools/libclang/CIndexDiagnostic.cpp @@ -220,11 +220,11 @@ CXString clang_getDiagnosticOption(CXDiagnostic Diag, CXString *Disable) { return createCXString(""); unsigned ID = StoredDiag->Diag.getID(); - llvm::StringRef Option = DiagnosticIDs::getWarningOptionForDiag(ID); + StringRef Option = DiagnosticIDs::getWarningOptionForDiag(ID); if (!Option.empty()) { if (Disable) - *Disable = createCXString((llvm::Twine("-Wno-") + Option).str()); - return createCXString((llvm::Twine("-W") + Option).str()); + *Disable = createCXString((Twine("-Wno-") + Option).str()); + return createCXString((Twine("-W") + Option).str()); } if (ID == diag::fatal_too_many_errors) { diff --git a/tools/libclang/CIndexInclusionStack.cpp b/tools/libclang/CIndexInclusionStack.cpp index b78a0a061a..848ca31a5e 100644 --- a/tools/libclang/CIndexInclusionStack.cpp +++ b/tools/libclang/CIndexInclusionStack.cpp @@ -29,7 +29,7 @@ void clang_getInclusions(CXTranslationUnit TU, CXInclusionVisitor CB, SourceManager &SM = CXXUnit->getSourceManager(); ASTContext &Ctx = CXXUnit->getASTContext(); - llvm::SmallVector<CXSourceLocation, 10> InclusionStack; + SmallVector<CXSourceLocation, 10> InclusionStack; unsigned n = SM.local_sloc_entry_size(); // In the case where all the SLocEntries are in an external source, traverse diff --git a/tools/libclang/CIndexUSRs.cpp b/tools/libclang/CIndexUSRs.cpp index 4f1f071c1d..7026f99227 100644 --- a/tools/libclang/CIndexUSRs.cpp +++ b/tools/libclang/CIndexUSRs.cpp @@ -31,7 +31,7 @@ using namespace clang::cxstring; namespace { class USRGenerator : public DeclVisitor<USRGenerator> { llvm::OwningPtr<llvm::SmallString<128> > OwnedBuf; - llvm::SmallVectorImpl<char> &Buf; + SmallVectorImpl<char> &Buf; llvm::raw_svector_ostream Out; bool IgnoreResults; ASTUnit *AU; @@ -40,7 +40,7 @@ class USRGenerator : public DeclVisitor<USRGenerator> { llvm::DenseMap<const Type *, unsigned> TypeSubstitutions; public: - USRGenerator(const CXCursor *C = 0, llvm::SmallVectorImpl<char> *extBuf = 0) + USRGenerator(const CXCursor *C = 0, SmallVectorImpl<char> *extBuf = 0) : OwnedBuf(extBuf ? 0 : new llvm::SmallString<128>()), Buf(extBuf ? *extBuf : *OwnedBuf.get()), Out(Buf), @@ -52,7 +52,7 @@ public: Out << "c:"; } - llvm::StringRef str() { + StringRef str() { return Out.str(); } @@ -114,19 +114,19 @@ public: /// itself. /// Generate a USR for an Objective-C class. - void GenObjCClass(llvm::StringRef cls); + void GenObjCClass(StringRef cls); /// Generate a USR for an Objective-C class category. - void GenObjCCategory(llvm::StringRef cls, llvm::StringRef cat); + void GenObjCCategory(StringRef cls, StringRef cat); /// Generate a USR fragment for an Objective-C instance variable. The /// complete USR can be created by concatenating the USR for the /// encompassing class with this USR fragment. - void GenObjCIvar(llvm::StringRef ivar); + void GenObjCIvar(StringRef ivar); /// Generate a USR fragment for an Objective-C method. - void GenObjCMethod(llvm::StringRef sel, bool isInstanceMethod); + void GenObjCMethod(StringRef sel, bool isInstanceMethod); /// Generate a USR fragment for an Objective-C property. - void GenObjCProperty(llvm::StringRef prop); + void GenObjCProperty(StringRef prop); /// Generate a USR for an Objective-C protocol. - void GenObjCProtocol(llvm::StringRef prot); + void GenObjCProtocol(StringRef prot); void VisitType(QualType T); void VisitTemplateParameterList(const TemplateParameterList *Params); @@ -235,7 +235,7 @@ void USRGenerator::VisitVarDecl(VarDecl *D) { VisitDeclContext(D->getDeclContext()); // Variables always have simple names. - llvm::StringRef s = D->getName(); + StringRef s = D->getName(); // The string can be empty if the declaration has no name; e.g., it is // the ParmDecl with no name for declaration of a function pointer type, e.g.: @@ -755,27 +755,27 @@ void USRGenerator::VisitTemplateArgument(const TemplateArgument &Arg) { // General purpose USR generation methods. //===----------------------------------------------------------------------===// -void USRGenerator::GenObjCClass(llvm::StringRef cls) { +void USRGenerator::GenObjCClass(StringRef cls) { Out << "objc(cs)" << cls; } -void USRGenerator::GenObjCCategory(llvm::StringRef cls, llvm::StringRef cat) { +void USRGenerator::GenObjCCategory(StringRef cls, StringRef cat) { Out << "objc(cy)" << cls << '@' << cat; } -void USRGenerator::GenObjCIvar(llvm::StringRef ivar) { +void USRGenerator::GenObjCIvar(StringRef ivar) { Out << '@' << ivar; } -void USRGenerator::GenObjCMethod(llvm::StringRef meth, bool isInstanceMethod) { +void USRGenerator::GenObjCMethod(StringRef meth, bool isInstanceMethod) { Out << (isInstanceMethod ? "(im)" : "(cm)") << meth; } -void USRGenerator::GenObjCProperty(llvm::StringRef prop) { +void USRGenerator::GenObjCProperty(StringRef prop) { Out << "(py)" << prop; } -void USRGenerator::GenObjCProtocol(llvm::StringRef prot) { +void USRGenerator::GenObjCProtocol(StringRef prot) { Out << "objc(pl)" << prot; } @@ -783,7 +783,7 @@ void USRGenerator::GenObjCProtocol(llvm::StringRef prot) { // API hooks. //===----------------------------------------------------------------------===// -static inline llvm::StringRef extractUSRSuffix(llvm::StringRef s) { +static inline StringRef extractUSRSuffix(StringRef s) { return s.startswith("c:") ? s.substr(2) : ""; } diff --git a/tools/libclang/CXString.cpp b/tools/libclang/CXString.cpp index f2a6b091ec..268655ab8a 100644 --- a/tools/libclang/CXString.cpp +++ b/tools/libclang/CXString.cpp @@ -41,7 +41,7 @@ CXString cxstring::createCXString(const char *String, bool DupString){ return Str; } -CXString cxstring::createCXString(llvm::StringRef String, bool DupString) { +CXString cxstring::createCXString(StringRef String, bool DupString) { CXString Result; if (DupString || (!String.empty() && String.data()[String.size()] != 0)) { char *Spelling = (char *)malloc(String.size() + 1); |