Author: ioeric Date: Fri Feb 24 06:56:51 2017 New Revision: 296113 URL: http://llvm.org/viewvc/llvm-project?rev=296113&view=rev Log: [change-namespace] fix asan failure in r296110.
Modified: clang-tools-extra/trunk/change-namespace/tool/ClangChangeNamespace.cpp Modified: clang-tools-extra/trunk/change-namespace/tool/ClangChangeNamespace.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/change-namespace/tool/ClangChangeNamespace.cpp?rev=296113&r1=296112&r2=296113&view=diff ============================================================================== --- clang-tools-extra/trunk/change-namespace/tool/ClangChangeNamespace.cpp (original) +++ clang-tools-extra/trunk/change-namespace/tool/ClangChangeNamespace.cpp Fri Feb 24 06:56:51 2017 @@ -80,15 +80,16 @@ cl::opt<std::string> WhiteListFile( cl::init(""), cl::cat(ChangeNamespaceCategory)); llvm::ErrorOr<std::vector<std::string>> GetWhiteListedSymbolPatterns() { + if (WhiteListFile.empty()) + return std::vector<std::string>(); + llvm::SmallVector<StringRef, 8> Lines; - if (!WhiteListFile.empty()) { - llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> 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<std::unique_ptr<llvm::MemoryBuffer>> 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<std::string>(Lines.begin(), Lines.end()); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits