Skip to content

Commit

Permalink
[clangd] Fix stack-use-after-scope
Browse files Browse the repository at this point in the history
Found by asan.
  • Loading branch information
d0k committed Jul 5, 2020
1 parent 2247f72 commit edba286
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clang-tools-extra/clangd/ClangdServer.cpp
Expand Up @@ -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();
}

Expand Down

1 comment on commit edba286

@sam-mccall
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@d0k doh, thanks. I wasn't even subtle about it.

(Maybe SmallString::str() -> StringRef confused me into thinking I had a real string)

Please sign in to comment.