[clang-tools-extra] r296113 - [change-namespace] fix asan failure in r296110.
Eric Liu via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 24 04:56:51 PST 2017
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());
}
More information about the cfe-commits
mailing list