diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2017-02-07 14:35:09 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2017-02-07 14:35:09 +0000 |
| commit | 81f91c1777341ce116ec5c219eb2315184ac9a21 (patch) | |
| tree | 04be231d5cee9b20ae507058594fc76c1cb39a24 /clang-tools-extra | |
| parent | 8c0f62d293059201667c7a3c6d201a18418e4361 (diff) | |
| download | bcm5719-llvm-81f91c1777341ce116ec5c219eb2315184ac9a21.tar.gz bcm5719-llvm-81f91c1777341ce116ec5c219eb2315184ac9a21.zip | |
[clangd] Fix subtle use after return.
I didn't find this because my main development machine still happens to
use libstdc++ with the broken C++11 ABI, which has a global empty
string.
llvm-svn: 294309
Diffstat (limited to 'clang-tools-extra')
| -rw-r--r-- | clang-tools-extra/clangd/DocumentStore.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang-tools-extra/clangd/DocumentStore.h b/clang-tools-extra/clangd/DocumentStore.h index dd4555c0131..dbe5687f85c 100644 --- a/clang-tools-extra/clangd/DocumentStore.h +++ b/clang-tools-extra/clangd/DocumentStore.h @@ -26,7 +26,10 @@ public: /// Delete a document from the store. void removeDocument(StringRef Uri) { Docs.erase(Uri); } /// Retrieve a document from the store. Empty string if it's unknown. - StringRef getDocument(StringRef Uri) const { return Docs.lookup(Uri); } + StringRef getDocument(StringRef Uri) const { + auto I = Docs.find(Uri); + return I == Docs.end() ? StringRef("") : StringRef(I->second); + } private: llvm::StringMap<std::string> Docs; |

