[all-commits] [llvm/llvm-project] 0d1be9: [clang][USR] Prevent crashes on incomplete Functio...
kadir çetinkaya via All-commits
all-commits at lists.llvm.org
Mon May 15 09:12:22 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0d1be98a67e29b70ccfab23d86a2bea13de117d7
https://github.com/llvm/llvm-project/commit/0d1be98a67e29b70ccfab23d86a2bea13de117d7
Author: Kadir Cetinkaya <kadircet at google.com>
Date: 2023-05-15 (Mon, 15 May 2023)
Changed paths:
M clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
M clang/lib/Index/USRGeneration.cpp
Log Message:
-----------
[clang][USR] Prevent crashes on incomplete FunctionDecls
FunctionDecls can be created with null types (D124351 added such a new
code path), to be filled in later. But parsing can stop before
completing the Decl (e.g. if code completion
point is reached).
Unfortunately most of the methods in FunctionDecl and its derived
classes assume a complete decl and don't perform null-checks.
Since we're not encountring crashes in the wild along other code paths
today introducing extra checks into quite a lot of places didn't feel
right (due to extra complexity && run time checks).
I believe another alternative would be to change Parser & Sema to never
create decls with invalid types, but I can't really see an easy way of
doing that, as most of the pieces are structured around filling that
information as parsing proceeds.
Differential Revision: https://reviews.llvm.org/D149733
More information about the All-commits
mailing list