r343150 - Init LookupResult::AmbiguityKind
Vitaly Buka via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 26 15:58:53 PDT 2018
Author: vitalybuka
Date: Wed Sep 26 15:58:53 2018
New Revision: 343150
URL: http://llvm.org/viewvc/llvm-project?rev=343150&view=rev
Log:
Init LookupResult::AmbiguityKind
We don't expect useful value there unless it's "ambiguous".
However we use read it for copying and moving, so we need either init the field
add login to avoid reading invalid values. Such reads trigger ubsan errors.
Modified:
cfe/trunk/include/clang/Sema/Lookup.h
Modified: cfe/trunk/include/clang/Sema/Lookup.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=343150&r1=343149&r2=343150&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Lookup.h (original)
+++ cfe/trunk/include/clang/Sema/Lookup.h Wed Sep 26 15:58:53 2018
@@ -709,7 +709,9 @@ private:
// Results.
LookupResultKind ResultKind = NotFound;
- AmbiguityKind Ambiguity; // ill-defined unless ambiguous
+ // ill-defined unless ambiguous. Still need to be initialized it will be
+ // copied/moved.
+ AmbiguityKind Ambiguity = {};
UnresolvedSet<8> Decls;
CXXBasePaths *Paths = nullptr;
CXXRecordDecl *NamingClass = nullptr;
More information about the cfe-commits
mailing list