diff options
author | Erich Keane <erich.keane@intel.com> | 2019-01-04 15:24:06 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2019-01-04 15:24:06 +0000 |
commit | 4e3dd793d75b1710618a091fa8a037c5a75c2525 (patch) | |
tree | 98d9e0f981b2e619ca7d23575265855f5a08c392 /lib/Sema/SemaOverload.cpp | |
parent | dfe36d72bcb3226bc633eafaf7487612b2e75f0e (diff) | |
download | clang-4e3dd793d75b1710618a091fa8a037c5a75c2525.tar.gz |
Prevent unreachable when checking invalid multiversion decls.
CPUSpecifc/CPUDispatch call resolution assumed that all declarations
that would be passed are valid, however this was an invalid assumption.
This patch deals with those situations by making the valid version take
priority. Note that the checked ordering is arbitrary, since both are
replaced by calls to the resolver later.
Change-Id: I7ff2ec88c55a721d51bc1f39ea1a1fe242b4e45f
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350398 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 6f50dd9bcc..257eef435f 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -9023,6 +9023,11 @@ static bool isBetterMultiversionCandidate(const OverloadCandidate &Cand1, !Cand2.Function->isMultiVersion()) return false; + // If Cand1 is invalid, it cannot be a better match, if Cand2 is invalid, this + // is obviously better. + if (Cand1.Function->isInvalidDecl()) return false; + if (Cand2.Function->isInvalidDecl()) return true; + // If this is a cpu_dispatch/cpu_specific multiversion situation, prefer // cpu_dispatch, else arbitrarily based on the identifiers. bool Cand1CPUDisp = Cand1.Function->hasAttr<CPUDispatchAttr>(); |