diff --git a/clang-tools-extra/change-namespace/tool/ClangChangeNamespace.cpp b/clang-tools-extra/change-namespace/tool/ClangChangeNamespace.cpp index 02a97839f151..6a17f1927767 100644 --- a/clang-tools-extra/change-namespace/tool/ClangChangeNamespace.cpp +++ b/clang-tools-extra/change-namespace/tool/ClangChangeNamespace.cpp @@ -80,15 +80,16 @@ cl::opt WhiteListFile( cl::init(""), cl::cat(ChangeNamespaceCategory)); llvm::ErrorOr> GetWhiteListedSymbolPatterns() { + if (WhiteListFile.empty()) + return std::vector(); + llvm::SmallVector Lines; - if (!WhiteListFile.empty()) { - llvm::ErrorOr> File = - llvm::MemoryBuffer::getFile(WhiteListFile); - if (!File) - return File.getError(); - llvm::StringRef Content = File.get()->getBuffer(); - Content.split(Lines, '\n', /*MaxSplit=*/-1, /*KeepEmpty=*/false); - } + llvm::ErrorOr> File = + llvm::MemoryBuffer::getFile(WhiteListFile); + if (!File) + return File.getError(); + llvm::StringRef Content = File.get()->getBuffer(); + Content.split(Lines, '\n', /*MaxSplit=*/-1, /*KeepEmpty=*/false); return std::vector(Lines.begin(), Lines.end()); }