[llvm] Fix assert for [CGData] Outlined Hash Tree #89792 (PR #98383)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 10 13:55:57 PDT 2024


================
@@ -119,8 +119,8 @@ void OutlinedHashTreeRecord::convertToStableData(
       [&NodeIdMap](const HashNode *Current) {
         size_t Index = NodeIdMap.size();
         NodeIdMap[Current] = Index;
-        assert(Index = NodeIdMap.size() + 1 &&
-                       "Expected size of NodeMap to increment by 1");
+        assert(Index + 1 == NodeIdMap.size() &&
+               "Expected size of NodeMap to increment by 1");
----------------
alx32 wrote:

Nit: Parens and perhaps a message something like below would give clearer hint on the intent of the assert.
```
        assert((Index + 1 == NodeIdMap.size()) &&
               "Expected 'Current' to not already exist in 'NodeIdMap'");
```

https://github.com/llvm/llvm-project/pull/98383


More information about the llvm-commits mailing list