[llvm] b91c267 - [FIX] Remove warnings and UB after 1228d42ddab8
Aaron Ballman via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 14 23:37:28 PST 2020
On Sat, Feb 15, 2020 at 2:36 AM Johannes Doerfert <jdoerfert at anl.gov> wrote:
>
> On 02/15, Aaron Ballman wrote:
> > On Sat, Feb 15, 2020 at 2:16 AM Johannes Doerfert via llvm-commits
> > <llvm-commits at lists.llvm.org> wrote:
> > >
> > >
> > > Author: Johannes Doerfert
> > > Date: 2020-02-15T01:15:45-06:00
> > > New Revision: b91c267380ff2e940a6d37a14cfb0b5057555b60
> > >
> > > URL: https://github.com/llvm/llvm-project/commit/b91c267380ff2e940a6d37a14cfb0b5057555b60
> > > DIFF: https://github.com/llvm/llvm-project/commit/b91c267380ff2e940a6d37a14cfb0b5057555b60.diff
> > >
> > > LOG: [FIX] Remove warnings and UB after 1228d42ddab8
> > >
> > > Added:
> > >
> > >
> > > Modified:
> > > llvm/lib/Frontend/OpenMP/OMPContext.cpp
> > >
> > > Removed:
> > >
> > >
> > >
> > > ################################################################################
> > > diff --git a/llvm/lib/Frontend/OpenMP/OMPContext.cpp b/llvm/lib/Frontend/OpenMP/OMPContext.cpp
> > > index 244448c41012..d9db6318f9f5 100644
> > > --- a/llvm/lib/Frontend/OpenMP/OMPContext.cpp
> > > +++ b/llvm/lib/Frontend/OpenMP/OMPContext.cpp
> > > @@ -295,6 +295,7 @@ llvm::omp::getOpenMPContextTraitSetForSelector(TraitSelector Selector) {
> > > return TraitSet::TraitSetEnum;
> > > #include "llvm/Frontend/OpenMP/OMPKinds.def"
> > > }
> > > + llvm_unreachable("Unknown trait selector!");
> > > }
> > > TraitSet
> > > llvm::omp::getOpenMPContextTraitSetForProperty(TraitProperty Property) {
> > > @@ -411,7 +412,7 @@ bool llvm::omp::isValidTraitPropertyForTraitSetAndSelector(
> > > std::string llvm::omp::listOpenMPContextTraitSets() {
> > > std::string S;
> > > #define OMP_TRAIT_SET(Enum, Str) \
> > > - if (StringRef(Str) != "invalid") \
> > > + if (!StringRef(Str).equals("invalid")) \
> >
> > Can you explain what was wrong with the original code? It looks like
> > the more obvious solution, of the two.
>
> I was trying to resolve the warnings Reid already removed in
> 1a93285c686a. So I was looking at old warnings but new code.
> I'll revert it.
Ah, that makes sense, thanks for the revert!
~Aaron
>
>
> > ~Aaron
> >
> > > S.append("'").append(Str).append("'").append(" ");
> > > #include "llvm/Frontend/OpenMP/OMPKinds.def"
> > > S.pop_back();
> > > @@ -421,7 +422,7 @@ std::string llvm::omp::listOpenMPContextTraitSets() {
> > > std::string llvm::omp::listOpenMPContextTraitSelectors(TraitSet Set) {
> > > std::string S;
> > > #define OMP_TRAIT_SELECTOR(Enum, TraitSetEnum, Str, ReqProp) \
> > > - if (TraitSet::TraitSetEnum == Set && StringRef(Str) != "Invalid") \
> > > + if (TraitSet::TraitSetEnum == Set && !StringRef(Str).equals("invalid")) \
> > > S.append("'").append(Str).append("'").append(" ");
> > > #include "llvm/Frontend/OpenMP/OMPKinds.def"
> > > S.pop_back();
> > > @@ -435,7 +436,7 @@ llvm::omp::listOpenMPContextTraitProperties(TraitSet Set,
> > > #define OMP_TRAIT_PROPERTY(Enum, TraitSetEnum, TraitSelectorEnum, Str) \
> > > if (TraitSet::TraitSetEnum == Set && \
> > > TraitSelector::TraitSelectorEnum == Selector && \
> > > - StringRef(Str) != "invalid") \
> > > + !StringRef(Str).equals("invalid")) \
> > > S.append("'").append(Str).append("'").append(" ");
> > > #include "llvm/Frontend/OpenMP/OMPKinds.def"
> > > S.pop_back();
> > >
> > >
> > >
> > > _______________________________________________
> > > llvm-commits mailing list
> > > llvm-commits at lists.llvm.org
> > > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
> --
>
> Johannes Doerfert
> Researcher
>
> Argonne National Laboratory
> Lemont, IL 60439, USA
>
> jdoerfert at anl.gov
More information about the llvm-commits
mailing list