[all-commits] [llvm/llvm-project] 9c4a16: [clangd] Fix clangd crash when including a header
kadir çetinkaya via All-commits
all-commits at lists.llvm.org
Thu Sep 16 01:27:54 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 9c4a1686d7c487fff8e63fa67e64623eea8986d5
https://github.com/llvm/llvm-project/commit/9c4a1686d7c487fff8e63fa67e64623eea8986d5
Author: Queen Dela Cruz <qdelacru at cisco.com>
Date: 2021-09-16 (Thu, 16 Sep 2021)
Changed paths:
M clang-tools-extra/clangd/CodeComplete.cpp
M clang-tools-extra/clangd/ParsedAST.cpp
M clang-tools-extra/clangd/Preamble.cpp
M clang-tools-extra/clangd/Preamble.h
M clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
M clang-tools-extra/clangd/unittests/PreambleTests.cpp
Log Message:
-----------
[clangd] Fix clangd crash when including a header
Fixes https://github.com/clangd/clangd/issues/819
SourceLocation of macros change when a header file is included above it. This is not checked when creating a PreamblePatch, resulting in reusing previously built preamble with an incorrect source location for the macro in the example test case.
This patch stores the SourceLocation in the struct TextualPPDirective so that it gets checked when comparing old vs new preambles.
Also creates a preamble patch for code completion parsing so that clangd does not crash when following the example test case with a large file.
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D108045
More information about the All-commits
mailing list