diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2013-01-12 19:30:44 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2013-01-12 19:30:44 +0000 |
commit | cfa88f893915ceb8ae4ce2f17c46c24a4d67502f (patch) | |
tree | 483833afb997605d25c29455d4aaed40bd95f1da /lib/Tooling | |
parent | 9cd506b7c983829a33ae7ac1297228d146c58a69 (diff) |
Remove useless 'llvm::' qualifier from names like StringRef and others that are
brought into 'clang' namespace by clang/Basic/LLVM.h
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172323 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Tooling')
-rw-r--r-- | lib/Tooling/CompilationDatabase.cpp | 4 | ||||
-rw-r--r-- | lib/Tooling/FileMatchTrie.cpp | 2 | ||||
-rw-r--r-- | lib/Tooling/JSONCompilationDatabase.cpp | 40 | ||||
-rw-r--r-- | lib/Tooling/Refactoring.cpp | 14 | ||||
-rw-r--r-- | lib/Tooling/Tooling.cpp | 18 |
5 files changed, 38 insertions, 40 deletions
diff --git a/lib/Tooling/CompilationDatabase.cpp b/lib/Tooling/CompilationDatabase.cpp index e62a6f73af..b5b99cb7c6 100644 --- a/lib/Tooling/CompilationDatabase.cpp +++ b/lib/Tooling/CompilationDatabase.cpp @@ -72,7 +72,7 @@ findCompilationDatabaseFromDirectory(StringRef Directory, CompilationDatabase * CompilationDatabase::autoDetectFromSource(StringRef SourceFile, std::string &ErrorMessage) { - llvm::SmallString<1024> AbsolutePath(getAbsolutePath(SourceFile)); + SmallString<1024> AbsolutePath(getAbsolutePath(SourceFile)); StringRef Directory = llvm::sys::path::parent_path(AbsolutePath); CompilationDatabase *DB = findCompilationDatabaseFromDirectory(Directory, @@ -87,7 +87,7 @@ CompilationDatabase::autoDetectFromSource(StringRef SourceFile, CompilationDatabase * CompilationDatabase::autoDetectFromDirectory(StringRef SourceDir, std::string &ErrorMessage) { - llvm::SmallString<1024> AbsolutePath(getAbsolutePath(SourceDir)); + SmallString<1024> AbsolutePath(getAbsolutePath(SourceDir)); CompilationDatabase *DB = findCompilationDatabaseFromDirectory(AbsolutePath, ErrorMessage); diff --git a/lib/Tooling/FileMatchTrie.cpp b/lib/Tooling/FileMatchTrie.cpp index 9bd72f222a..5eb4bb9e49 100644 --- a/lib/Tooling/FileMatchTrie.cpp +++ b/lib/Tooling/FileMatchTrie.cpp @@ -172,7 +172,7 @@ void FileMatchTrie::insert(StringRef NewPath) { } StringRef FileMatchTrie::findEquivalent(StringRef FileName, - llvm::raw_ostream &Error) const { + raw_ostream &Error) const { if (llvm::sys::path::is_relative(FileName)) { Error << "Cannot resolve relative paths"; return StringRef(); diff --git a/lib/Tooling/JSONCompilationDatabase.cpp b/lib/Tooling/JSONCompilationDatabase.cpp index 197b7e76f0..9013f2143f 100644 --- a/lib/Tooling/JSONCompilationDatabase.cpp +++ b/lib/Tooling/JSONCompilationDatabase.cpp @@ -111,9 +111,9 @@ std::vector<std::string> unescapeCommandLine( class JSONCompilationDatabasePlugin : public CompilationDatabasePlugin { virtual CompilationDatabase *loadFromDirectory( StringRef Directory, std::string &ErrorMessage) { - llvm::SmallString<1024> JSONDatabasePath(Directory); + SmallString<1024> JSONDatabasePath(Directory); llvm::sys::path::append(JSONDatabasePath, "compile_commands.json"); - llvm::OwningPtr<CompilationDatabase> Database( + OwningPtr<CompilationDatabase> Database( JSONCompilationDatabase::loadFromFile(JSONDatabasePath, ErrorMessage)); if (!Database) return NULL; @@ -133,14 +133,14 @@ volatile int JSONAnchorSource = 0; JSONCompilationDatabase * JSONCompilationDatabase::loadFromFile(StringRef FilePath, std::string &ErrorMessage) { - llvm::OwningPtr<llvm::MemoryBuffer> DatabaseBuffer; + OwningPtr<llvm::MemoryBuffer> DatabaseBuffer; llvm::error_code Result = llvm::MemoryBuffer::getFile(FilePath, DatabaseBuffer); if (Result != 0) { ErrorMessage = "Error while opening JSON database: " + Result.message(); return NULL; } - llvm::OwningPtr<JSONCompilationDatabase> Database( + OwningPtr<JSONCompilationDatabase> Database( new JSONCompilationDatabase(DatabaseBuffer.take())); if (!Database->parse(ErrorMessage)) return NULL; @@ -150,10 +150,10 @@ JSONCompilationDatabase::loadFromFile(StringRef FilePath, JSONCompilationDatabase * JSONCompilationDatabase::loadFromBuffer(StringRef DatabaseString, std::string &ErrorMessage) { - llvm::OwningPtr<llvm::MemoryBuffer> DatabaseBuffer( + OwningPtr<llvm::MemoryBuffer> DatabaseBuffer( llvm::MemoryBuffer::getMemBuffer(DatabaseString)); - llvm::OwningPtr<JSONCompilationDatabase> Database( - new JSONCompilationDatabase(DatabaseBuffer.take())); + OwningPtr<JSONCompilationDatabase> Database( + new JSONCompilationDatabase(DatabaseBuffer.take())); if (!Database->parse(ErrorMessage)) return NULL; return Database.take(); @@ -161,7 +161,7 @@ JSONCompilationDatabase::loadFromBuffer(StringRef DatabaseString, std::vector<CompileCommand> JSONCompilationDatabase::getCompileCommands(StringRef FilePath) const { - llvm::SmallString<128> NativeFilePath; + SmallString<128> NativeFilePath; llvm::sys::path::native(FilePath, NativeFilePath); std::vector<StringRef> PossibleMatches; std::string Error; @@ -208,8 +208,8 @@ void JSONCompilationDatabase::getCommands( ArrayRef<CompileCommandRef> CommandsRef, std::vector<CompileCommand> &Commands) const { for (int I = 0, E = CommandsRef.size(); I != E; ++I) { - llvm::SmallString<8> DirectoryStorage; - llvm::SmallString<1024> CommandStorage; + SmallString<8> DirectoryStorage; + SmallString<1024> CommandStorage; Commands.push_back(CompileCommand( // FIXME: Escape correctly: CommandsRef[I].first->getValue(DirectoryStorage), @@ -228,8 +228,7 @@ bool JSONCompilationDatabase::parse(std::string &ErrorMessage) { ErrorMessage = "Error while parsing YAML."; return false; } - llvm::yaml::SequenceNode *Array = - llvm::dyn_cast<llvm::yaml::SequenceNode>(Root); + llvm::yaml::SequenceNode *Array = dyn_cast<llvm::yaml::SequenceNode>(Root); if (Array == NULL) { ErrorMessage = "Expected array."; return false; @@ -237,8 +236,7 @@ bool JSONCompilationDatabase::parse(std::string &ErrorMessage) { for (llvm::yaml::SequenceNode::iterator AI = Array->begin(), AE = Array->end(); AI != AE; ++AI) { - llvm::yaml::MappingNode *Object = - llvm::dyn_cast<llvm::yaml::MappingNode>(&*AI); + llvm::yaml::MappingNode *Object = dyn_cast<llvm::yaml::MappingNode>(&*AI); if (Object == NULL) { ErrorMessage = "Expected object."; return false; @@ -255,18 +253,18 @@ bool JSONCompilationDatabase::parse(std::string &ErrorMessage) { return false; } llvm::yaml::ScalarNode *ValueString = - llvm::dyn_cast<llvm::yaml::ScalarNode>(Value); + dyn_cast<llvm::yaml::ScalarNode>(Value); if (ValueString == NULL) { ErrorMessage = "Expected string as value."; return false; } llvm::yaml::ScalarNode *KeyString = - llvm::dyn_cast<llvm::yaml::ScalarNode>((*KVI).getKey()); + dyn_cast<llvm::yaml::ScalarNode>((*KVI).getKey()); if (KeyString == NULL) { ErrorMessage = "Expected strings as key."; return false; } - llvm::SmallString<8> KeyStorage; + SmallString<8> KeyStorage; if (KeyString->getValue(KeyStorage) == "directory") { Directory = ValueString; } else if (KeyString->getValue(KeyStorage) == "command") { @@ -291,12 +289,12 @@ bool JSONCompilationDatabase::parse(std::string &ErrorMessage) { ErrorMessage = "Missing key: \"directory\"."; return false; } - llvm::SmallString<8> FileStorage; + SmallString<8> FileStorage; StringRef FileName = File->getValue(FileStorage); - llvm::SmallString<128> NativeFilePath; + SmallString<128> NativeFilePath; if (llvm::sys::path::is_relative(FileName)) { - llvm::SmallString<8> DirectoryStorage; - llvm::SmallString<128> AbsolutePath( + SmallString<8> DirectoryStorage; + SmallString<128> AbsolutePath( Directory->getValue(DirectoryStorage)); llvm::sys::path::append(AbsolutePath, FileName); llvm::sys::path::native(AbsolutePath.str(), NativeFilePath); diff --git a/lib/Tooling/Refactoring.cpp b/lib/Tooling/Refactoring.cpp index 9ed0999140..d8440d639d 100644 --- a/lib/Tooling/Refactoring.cpp +++ b/lib/Tooling/Refactoring.cpp @@ -28,18 +28,18 @@ static const char * const InvalidLocation = ""; Replacement::Replacement() : FilePath(InvalidLocation), Offset(0), Length(0) {} -Replacement::Replacement(llvm::StringRef FilePath, unsigned Offset, - unsigned Length, llvm::StringRef ReplacementText) +Replacement::Replacement(StringRef FilePath, unsigned Offset, + unsigned Length, StringRef ReplacementText) : FilePath(FilePath), Offset(Offset), Length(Length), ReplacementText(ReplacementText) {} Replacement::Replacement(SourceManager &Sources, SourceLocation Start, - unsigned Length, llvm::StringRef ReplacementText) { + unsigned Length, StringRef ReplacementText) { setFromSourceLocation(Sources, Start, Length, ReplacementText); } Replacement::Replacement(SourceManager &Sources, const CharSourceRange &Range, - llvm::StringRef ReplacementText) { + StringRef ReplacementText) { setFromSourceRange(Sources, Range, ReplacementText); } @@ -89,7 +89,7 @@ bool Replacement::Less::operator()(const Replacement &R1, void Replacement::setFromSourceLocation(SourceManager &Sources, SourceLocation Start, unsigned Length, - llvm::StringRef ReplacementText) { + StringRef ReplacementText) { const std::pair<FileID, unsigned> DecomposedLocation = Sources.getDecomposedLoc(Start); const FileEntry *Entry = Sources.getFileEntryForID(DecomposedLocation.first); @@ -116,7 +116,7 @@ static int getRangeSize(SourceManager &Sources, const CharSourceRange &Range) { void Replacement::setFromSourceRange(SourceManager &Sources, const CharSourceRange &Range, - llvm::StringRef ReplacementText) { + StringRef ReplacementText) { setFromSourceLocation(Sources, Sources.getSpellingLoc(Range.getBegin()), getRangeSize(Sources, Range), ReplacementText); } @@ -150,7 +150,7 @@ int RefactoringTool::runAndSave(FrontendActionFactory *ActionFactory) { IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions(); TextDiagnosticPrinter DiagnosticPrinter(llvm::errs(), &*DiagOpts); DiagnosticsEngine Diagnostics( - llvm::IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), + IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), &*DiagOpts, &DiagnosticPrinter, false); SourceManager Sources(Diagnostics, getFiles()); Rewriter Rewrite(Sources, DefaultLangOptions); diff --git a/lib/Tooling/Tooling.cpp b/lib/Tooling/Tooling.cpp index 2e1ea99901..ac378a9984 100644 --- a/lib/Tooling/Tooling.cpp +++ b/lib/Tooling/Tooling.cpp @@ -63,7 +63,7 @@ static const clang::driver::ArgStringList *getCC1Arguments( // failed. Extract that job from the Compilation. const clang::driver::JobList &Jobs = Compilation->getJobs(); if (Jobs.size() != 1 || !isa<clang::driver::Command>(*Jobs.begin())) { - llvm::SmallString<256> error_msg; + SmallString<256> error_msg; llvm::raw_svector_ostream error_stream(error_msg); Compilation->PrintJob(error_stream, Compilation->getJobs(), "; ", true); Diagnostics->Report(clang::diag::err_fe_expected_compiler_job) @@ -121,7 +121,7 @@ bool runToolOnCodeWithArgs(clang::FrontendAction *ToolAction, const Twine &Code, } std::string getAbsolutePath(StringRef File) { - llvm::SmallString<1024> BaseDirectory; + SmallString<1024> BaseDirectory; if (const char *PWD = ::getenv("PWD")) BaseDirectory = PWD; else @@ -136,7 +136,7 @@ std::string getAbsolutePath(StringRef File) { if (RelativePath.startswith("./")) { RelativePath = RelativePath.substr(strlen("./")); } - llvm::SmallString<1024> AbsolutePath(BaseDirectory); + SmallString<1024> AbsolutePath(BaseDirectory); llvm::sys::path::append(AbsolutePath, RelativePath); llvm::sys::path::native(Twine(AbsolutePath), PathStorage); return PathStorage.str(); @@ -163,21 +163,21 @@ bool ToolInvocation::run() { TextDiagnosticPrinter DiagnosticPrinter( llvm::errs(), &*DiagOpts); DiagnosticsEngine Diagnostics( - llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>(new DiagnosticIDs()), + IntrusiveRefCntPtr<clang::DiagnosticIDs>(new DiagnosticIDs()), &*DiagOpts, &DiagnosticPrinter, false); - const llvm::OwningPtr<clang::driver::Driver> Driver( + const OwningPtr<clang::driver::Driver> Driver( newDriver(&Diagnostics, BinaryName)); // Since the input might only be virtual, don't check whether it exists. Driver->setCheckInputsExist(false); - const llvm::OwningPtr<clang::driver::Compilation> Compilation( + const OwningPtr<clang::driver::Compilation> Compilation( Driver->BuildCompilation(llvm::makeArrayRef(Argv))); const clang::driver::ArgStringList *const CC1Args = getCC1Arguments( &Diagnostics, Compilation.get()); if (CC1Args == NULL) { return false; } - llvm::OwningPtr<clang::CompilerInvocation> Invocation( + OwningPtr<clang::CompilerInvocation> Invocation( newInvocation(&Diagnostics, *CC1Args)); return runInvocation(BinaryName, Compilation.get(), Invocation.take(), *CC1Args); @@ -204,7 +204,7 @@ bool ToolInvocation::runInvocation( // ToolAction can have lifetime requirements for Compiler or its members, and // we need to ensure it's deleted earlier than Compiler. So we pass it to an // OwningPtr declared after the Compiler variable. - llvm::OwningPtr<FrontendAction> ScopedToolAction(ToolAction.take()); + OwningPtr<FrontendAction> ScopedToolAction(ToolAction.take()); // Create the compilers actual diagnostics engine. Compiler.createDiagnostics(CC1Args.size(), @@ -241,7 +241,7 @@ ClangTool::ClangTool(const CompilationDatabase &Compilations, : Files((FileSystemOptions())), ArgsAdjuster(new ClangSyntaxOnlyAdjuster()) { for (unsigned I = 0, E = SourcePaths.size(); I != E; ++I) { - llvm::SmallString<1024> File(getAbsolutePath(SourcePaths[I])); + SmallString<1024> File(getAbsolutePath(SourcePaths[I])); std::vector<CompileCommand> CompileCommandsForFile = Compilations.getCompileCommands(File.str()); |