summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp')
-rw-r--r--clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp b/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
index ca3d74b8dca..1dd96c5c658 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
@@ -306,18 +306,16 @@ SourceRange getDeletionRange(const FunctionDecl *FD,
const syntax::TokenBuffer &TokBuf) {
auto DeletionRange = FD->getBody()->getSourceRange();
if (auto *CD = llvm::dyn_cast<CXXConstructorDecl>(FD)) {
- const auto &SM = TokBuf.sourceManager();
// AST doesn't contain the location for ":" in ctor initializers. Therefore
// we find it by finding the first ":" before the first ctor initializer.
SourceLocation InitStart;
// Find the first initializer.
for (const auto *CInit : CD->inits()) {
- // We don't care about in-class initializers.
- if (CInit->isInClassMemberInitializer())
+ // SourceOrder is -1 for implicit initializers.
+ if (CInit->getSourceOrder() != 0)
continue;
- if (InitStart.isInvalid() ||
- SM.isBeforeInTranslationUnit(CInit->getSourceLocation(), InitStart))
- InitStart = CInit->getSourceLocation();
+ InitStart = CInit->getSourceLocation();
+ break;
}
if (InitStart.isValid()) {
auto Toks = TokBuf.expandedTokens(CD->getSourceRange());
OpenPOWER on IntegriCloud