[llvm] b91c267 - [FIX] Remove warnings and UB after 1228d42ddab8

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 14 23:16:36 PST 2020


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"))                                       \
     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();


        


More information about the llvm-commits mailing list