diff options
| author | Eric Liu <ioeric@google.com> | 2017-02-24 12:56:51 +0000 |
|---|---|---|
| committer | Eric Liu <ioeric@google.com> | 2017-02-24 12:56:51 +0000 |
| commit | 2884ca9c64b3a314f82f0c230a834edc8308ca88 (patch) | |
| tree | 54596178dca9fa4a5476f9ec000d03f1a8678efa /change-namespace | |
| parent | b892e279efc6e1645c18411ad377d43019b078ae (diff) | |
[change-namespace] fix asan failure in r296110.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@296113 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'change-namespace')
| -rw-r--r-- | change-namespace/tool/ClangChangeNamespace.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/change-namespace/tool/ClangChangeNamespace.cpp b/change-namespace/tool/ClangChangeNamespace.cpp index 02a97839..6a17f192 100644 --- a/change-namespace/tool/ClangChangeNamespace.cpp +++ b/change-namespace/tool/ClangChangeNamespace.cpp @@ -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()); } |
