[clang-tools-extra] edba286 - [clangd] Fix stack-use-after-scope
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 5 08:09:43 PDT 2020
Author: Benjamin Kramer
Date: 2020-07-05T17:09:08+02:00
New Revision: edba2864a7a86a97276c555d02276712e45d60fc
URL: https://github.com/llvm/llvm-project/commit/edba2864a7a86a97276c555d02276712e45d60fc
DIFF: https://github.com/llvm/llvm-project/commit/edba2864a7a86a97276c555d02276712e45d60fc.diff
LOG: [clangd] Fix stack-use-after-scope
Found by asan.
Added:
Modified:
clang-tools-extra/clangd/ClangdServer.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp
index 6ac2f67d55b3..5d99104dadaf 100644
--- a/clang-tools-extra/clangd/ClangdServer.cpp
+++ b/clang-tools-extra/clangd/ClangdServer.cpp
@@ -750,10 +750,10 @@ Context ClangdServer::createProcessingContext(PathRef File) const {
return Context::current().clone();
config::Params Params;
+ llvm::SmallString<256> PosixPath;
if (!File.empty()) {
assert(llvm::sys::path::is_absolute(File));
- llvm::SmallString<256> PosixPath = File;
- llvm::sys::path::native(PosixPath, llvm::sys::path::Style::posix);
+ llvm::sys::path::native(File, PosixPath, llvm::sys::path::Style::posix);
Params.Path = PosixPath.str();
}
More information about the cfe-commits
mailing list