[clang-tools-extra] 244dd29 - Don't pass uninitialized QueryKind
Vitaly Buka via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 7 17:14:21 PST 2022
Author: Vitaly Buka
Date: 2022-01-07T17:14:08-08:00
New Revision: 244dd2913a43a200f5a6544d424cdc37b771028b
URL: https://github.com/llvm/llvm-project/commit/244dd2913a43a200f5a6544d424cdc37b771028b
DIFF: https://github.com/llvm/llvm-project/commit/244dd2913a43a200f5a6544d424cdc37b771028b.diff
LOG: Don't pass uninitialized QueryKind
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
Differential Revision: https://reviews.llvm.org/D116827
Added:
Modified:
clang-tools-extra/clangd/XRefs.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/XRefs.cpp b/clang-tools-extra/clangd/XRefs.cpp
index 36aa251717bd..28ee2096f3fb 100644
--- a/clang-tools-extra/clangd/XRefs.cpp
+++ b/clang-tools-extra/clangd/XRefs.cpp
@@ -1298,7 +1298,7 @@ std::vector<LocatedSymbol> findImplementations(ParsedAST &AST, Position Pos,
DeclRelationSet Relations =
DeclRelation::TemplatePattern | DeclRelation::Alias;
llvm::DenseSet<SymbolID> IDs;
- RelationKind QueryKind;
+ RelationKind QueryKind = RelationKind::OverriddenBy;
for (const NamedDecl *ND : getDeclAtPosition(AST, *CurLoc, Relations)) {
if (const auto *CXXMD = llvm::dyn_cast<CXXMethodDecl>(ND)) {
if (CXXMD->isVirtual()) {
More information about the cfe-commits
mailing list