[PATCH] D116827: Don't pass uninitialized QueryKind
Vitaly Buka via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 7 11:01:08 PST 2022
vitalybuka created this revision.
vitalybuka added reviewers: kda, eugenis.
Herald added subscribers: usaxena95, kadircet, arphaman.
vitalybuka requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.
Even if findImplementors does not use
uninitialized parameter it's still UB and
it's going to be detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D116827
Files:
clang-tools-extra/clangd/XRefs.cpp
Index: clang-tools-extra/clangd/XRefs.cpp
===================================================================
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -1310,6 +1310,8 @@
QueryKind = RelationKind::BaseOf;
}
}
+ if (IDs.empty())
+ return {};
return findImplementors(std::move(IDs), QueryKind, Index, *MainFilePath);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116827.398198.patch
Type: text/x-patch
Size: 381 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220107/62414c11/attachment-0001.bin>
More information about the cfe-commits
mailing list