summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam McCall <sam.mccall@gmail.com>2017-11-07 14:45:31 +0000
committerSam McCall <sam.mccall@gmail.com>2017-11-07 14:45:31 +0000
commit94362c61c6e895d852b3a8aeb153a1009406c846 (patch)
tree48260da449d4460990c2581565fee8201954333c
parente2a585dddc9402f96350f61991bdc76aa0600aca (diff)
downloadbcm5719-llvm-94362c61c6e895d852b3a8aeb153a1009406c846.tar.gz
bcm5719-llvm-94362c61c6e895d852b3a8aeb153a1009406c846.zip
[clangd] don't crash on invalid JSON-RPC ID
llvm-svn: 317580
-rw-r--r--clang-tools-extra/clangd/JSONRPCDispatcher.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang-tools-extra/clangd/JSONRPCDispatcher.cpp b/clang-tools-extra/clangd/JSONRPCDispatcher.cpp
index 52493b23840..557fadbac06 100644
--- a/clang-tools-extra/clangd/JSONRPCDispatcher.cpp
+++ b/clang-tools-extra/clangd/JSONRPCDispatcher.cpp
@@ -12,6 +12,7 @@
#include "ProtocolHandlers.h"
#include "Trace.h"
#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/YAMLParser.h"
#include <istream>
@@ -149,7 +150,8 @@ bool JSONRPCDispatcher::call(StringRef Content, JSONOutput &Out) const {
ID.emplace(V.str());
} else {
double D;
- if (!V.getAsDouble(D))
+ // FIXME: this is locale-sensitive.
+ if (llvm::to_float(V, D))
ID.emplace(D);
}
}
OpenPOWER on IntegriCloud