diff options
| author | Sam McCall <sam.mccall@gmail.com> | 2019-11-11 19:00:44 +0100 |
|---|---|---|
| committer | Sam McCall <sam.mccall@gmail.com> | 2019-11-11 19:01:06 +0100 |
| commit | b9213dfec4d8ce42d90507c25545564f4a0bbfb8 (patch) | |
| tree | 583c104217aee534dae725443b4110d0b700c272 | |
| parent | eb8710cb93a5c21c168ffd97ac2b6872127cb60b (diff) | |
| download | bcm5719-llvm-b9213dfec4d8ce42d90507c25545564f4a0bbfb8.tar.gz bcm5719-llvm-b9213dfec4d8ce42d90507c25545564f4a0bbfb8.zip | |
[clangd] Fix crash in DefineInline::prepare()
| -rw-r--r-- | clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp | 2 | ||||
| -rw-r--r-- | clang-tools-extra/clangd/unittests/TweakTests.cpp | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp b/clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp index f6966f619ad..6d0599e8821 100644 --- a/clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp +++ b/clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp @@ -388,7 +388,7 @@ public: if (!SelNode) return false; Source = getSelectedFunction(SelNode); - if (!Source || !Source->isThisDeclarationADefinition()) + if (!Source || !Source->hasBody()) return false; // Only the last level of template parameter locations are not kept in AST, // so if we are inlining a method that is in a templated class, there is no diff --git a/clang-tools-extra/clangd/unittests/TweakTests.cpp b/clang-tools-extra/clangd/unittests/TweakTests.cpp index 5a6df2e03e6..ab280883583 100644 --- a/clang-tools-extra/clangd/unittests/TweakTests.cpp +++ b/clang-tools-extra/clangd/unittests/TweakTests.cpp @@ -920,6 +920,9 @@ TEST_F(DefineInlineTest, TriggersOnFunctionDecl) { [[(void)(5+3); return;]] }]] + + // Definition with no body. + class Bar { Bar() = def^ault; } )cpp"); } |

