diff options
Diffstat (limited to 'clang-tools-extra/clang-modernize/Core/IncludeExcludeInfo.cpp')
-rw-r--r-- | clang-tools-extra/clang-modernize/Core/IncludeExcludeInfo.cpp | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/clang-tools-extra/clang-modernize/Core/IncludeExcludeInfo.cpp b/clang-tools-extra/clang-modernize/Core/IncludeExcludeInfo.cpp index 2e4f1c21a57..b5cf5bbeafb 100644 --- a/clang-tools-extra/clang-modernize/Core/IncludeExcludeInfo.cpp +++ b/clang-tools-extra/clang-modernize/Core/IncludeExcludeInfo.cpp @@ -21,7 +21,6 @@ #include "llvm/Support/raw_ostream.h" using namespace llvm; -using std::error_code; /// A string type to represent paths. typedef SmallString<64> PathString; @@ -83,8 +82,8 @@ std::string removeRelativeOperators(StringRef Path) { /// \brief Helper function to tokenize a string of paths and populate /// the vector. -error_code parseCLInput(StringRef Line, std::vector<std::string> &List, - StringRef Separator) { +std::error_code parseCLInput(StringRef Line, std::vector<std::string> &List, + StringRef Separator) { SmallVector<StringRef, 32> Tokens; Line.split(Tokens, Separator, /*MaxSplit=*/ -1, /*KeepEmpty=*/ false); for (SmallVectorImpl<StringRef>::iterator I = Tokens.begin(), @@ -92,7 +91,7 @@ error_code parseCLInput(StringRef Line, std::vector<std::string> &List, I != E; ++I) { // Convert each path to its absolute path. PathString Path = I->rtrim(); - if (error_code Err = sys::fs::make_absolute(Path)) + if (std::error_code Err = sys::fs::make_absolute(Path)) return Err; // Remove relative operators from the path. std::string AbsPath = removeRelativeOperators(Path); @@ -104,44 +103,46 @@ error_code parseCLInput(StringRef Line, std::vector<std::string> &List, llvm::errs() << "Parse: " <<List.back() << "\n"; } - return error_code(); + return std::error_code(); } } // end anonymous namespace -error_code IncludeExcludeInfo::readListFromString(StringRef IncludeString, - StringRef ExcludeString) { - if (error_code Err = parseCLInput(IncludeString, IncludeList, - /*Separator=*/ ",")) +std::error_code +IncludeExcludeInfo::readListFromString(StringRef IncludeString, + StringRef ExcludeString) { + if (std::error_code Err = parseCLInput(IncludeString, IncludeList, + /*Separator=*/",")) return Err; - if (error_code Err = parseCLInput(ExcludeString, ExcludeList, - /*Separator=*/ ",")) + if (std::error_code Err = parseCLInput(ExcludeString, ExcludeList, + /*Separator=*/",")) return Err; - return error_code(); + return std::error_code(); } -error_code IncludeExcludeInfo::readListFromFile(StringRef IncludeListFile, - StringRef ExcludeListFile) { +std::error_code +IncludeExcludeInfo::readListFromFile(StringRef IncludeListFile, + StringRef ExcludeListFile) { if (!IncludeListFile.empty()) { std::unique_ptr<MemoryBuffer> FileBuf; - if (error_code Err = MemoryBuffer::getFile(IncludeListFile, FileBuf)) { + if (std::error_code Err = MemoryBuffer::getFile(IncludeListFile, FileBuf)) { errs() << "Unable to read from include file.\n"; return Err; } - if (error_code Err = parseCLInput(FileBuf->getBuffer(), IncludeList, - /*Separator=*/ "\n")) + if (std::error_code Err = parseCLInput(FileBuf->getBuffer(), IncludeList, + /*Separator=*/"\n")) return Err; } if (!ExcludeListFile.empty()) { std::unique_ptr<MemoryBuffer> FileBuf; - if (error_code Err = MemoryBuffer::getFile(ExcludeListFile, FileBuf)) { + if (std::error_code Err = MemoryBuffer::getFile(ExcludeListFile, FileBuf)) { errs() << "Unable to read from exclude file.\n"; return Err; } - if (error_code Err = parseCLInput(FileBuf->getBuffer(), ExcludeList, - /*Separator=*/ "\n")) + if (std::error_code Err = parseCLInput(FileBuf->getBuffer(), ExcludeList, + /*Separator=*/"\n")) return Err; } - return error_code(); + return std::error_code(); } bool IncludeExcludeInfo::isFileIncluded(StringRef FilePath) const { |