[clang] 314a5d7 - Simplify a conditional in order to avoid a warning under MSVC

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 16 16:21:29 PDT 2023


Author: Justin Bogner
Date: 2023-08-16T16:19:57-07:00
New Revision: 314a5d707fe70369e3e1a6ac561d64884896dbd7

URL: https://github.com/llvm/llvm-project/commit/314a5d707fe70369e3e1a6ac561d64884896dbd7
DIFF: https://github.com/llvm/llvm-project/commit/314a5d707fe70369e3e1a6ac561d64884896dbd7.diff

LOG: Simplify a conditional in order to avoid a warning under MSVC

We were using some convoluted logic here to check if the result of a
`bool` returning function was false, causing MSVC to give a warning
about "'>': unsafe use of type 'bool' in operation". This just removes
the greater-than comparison of the bool against zero.

Added: 
    

Modified: 
    clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
index 7783035ba1ec36..af52abe9f2e144 100644
--- a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
+++ b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
@@ -839,7 +839,7 @@ void SymbolGraphSerializer::visitObjCCategoryRecord(
     return;
 
   // Check if the current Category' parent has been visited before, if so skip.
-  if (!(visitedCategories.contains(Record.Interface.Name) > 0)) {
+  if (!visitedCategories.contains(Record.Interface.Name)) {
     visitedCategories.insert(Record.Interface.Name);
     Object Obj;
     serializeObject(Obj, "identifier",


        


More information about the cfe-commits mailing list