diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/arcmt-test/arcmt-test.cpp | 23 | ||||
-rw-r--r-- | tools/driver/cc1_main.cpp | 4 | ||||
-rw-r--r-- | tools/driver/driver.cpp | 46 | ||||
-rw-r--r-- | tools/libclang/CIndex.cpp | 42 | ||||
-rw-r--r-- | tools/libclang/CIndexCodeCompletion.cpp | 22 | ||||
-rw-r--r-- | tools/libclang/CIndexDiagnostic.cpp | 6 | ||||
-rw-r--r-- | tools/libclang/CIndexInclusionStack.cpp | 2 | ||||
-rw-r--r-- | tools/libclang/CIndexUSRs.cpp | 34 | ||||
-rw-r--r-- | tools/libclang/CXString.cpp | 2 |
9 files changed, 90 insertions, 91 deletions
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); |