diff options
author | George Burgess IV <george.burgess.iv@gmail.com> | 2018-01-17 04:46:04 +0000 |
---|---|---|
committer | George Burgess IV <george.burgess.iv@gmail.com> | 2018-01-17 04:46:04 +0000 |
commit | 1913115204027ad779949094c454d704462e77d0 (patch) | |
tree | 92d6f7c9f79f9451b18c077c29417701278e8726 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 4bdb80faf2dda9818ee98456f90ae356c201ee05 (diff) | |
download | bcm5719-llvm-1913115204027ad779949094c454d704462e77d0.tar.gz bcm5719-llvm-1913115204027ad779949094c454d704462e77d0.zip |
[CodeGen] Fix a crash on mangling multiversioned functions
`multiVersionSortPriority` expects features to have no prefix. We
currently carry them around in the format "+${feature}".
llvm-svn: 322618
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index fb16c8f2607..68c82870846 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -753,8 +753,12 @@ static void AppendTargetMangling(const CodeGenModule &CGM, const auto &Target = CGM.getTarget(); TargetAttr::ParsedTargetAttr Info = Attr->parse([&Target](StringRef LHS, StringRef RHS) { - return Target.multiVersionSortPriority(LHS) > - Target.multiVersionSortPriority(RHS); + // Multiversioning doesn't allow "no-${feature}", so we can + // only have "+" prefixes here. + assert(LHS.startswith("+") && RHS.startswith("+") && + "Features should always have a prefix."); + return Target.multiVersionSortPriority(LHS.substr(1)) > + Target.multiVersionSortPriority(RHS.substr(1)); }); bool IsFirst = true; |