r216695 - Don't load ill-formed AmbiguityKind in Sema::Lookup.
Alexey Samsonov
vonosmas at gmail.com
Thu Aug 28 16:17:55 PDT 2014
Author: samsonov
Date: Thu Aug 28 18:17:55 2014
New Revision: 216695
URL: http://llvm.org/viewvc/llvm-project?rev=216695&view=rev
Log:
Don't load ill-formed AmbiguityKind in Sema::Lookup.
This bug was reported by UBSan.
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=216695&r1=216694&r2=216695&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Lookup.h (original)
+++ cfe/trunk/include/clang/Sema/Lookup.h Thu Aug 28 18:17:55 2014
@@ -424,13 +424,19 @@ public:
Paths = nullptr;
}
} else {
- AmbiguityKind SavedAK = Ambiguity;
+ AmbiguityKind SavedAK;
+ bool WasAmbiguous = false;
+ if (ResultKind == Ambiguous) {
+ SavedAK = Ambiguity;
+ WasAmbiguous = true;
+ }
ResultKind = Found;
resolveKind();
// If we didn't make the lookup unambiguous, restore the old
// ambiguity kind.
if (ResultKind == Ambiguous) {
+ assert(WasAmbiguous);
Ambiguity = SavedAK;
} else if (Paths) {
deletePaths(Paths);
More information about the cfe-commits
mailing list