[clang] [Tooling/Inclusion] Update std symbols mapping (PR #113612)

kadir çetinkaya via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 30 04:11:13 PDT 2024


================
@@ -115,15 +115,17 @@ static int initialize(Lang Language) {
       NSLen = 0;
     }
 
-    if (SymIndex >= 0 &&
-        Mapping->SymbolNames[SymIndex].qualifiedName() == QName) {
-      // Not a new symbol, use the same index.
+    if (SymIndex > 0) {
       assert(llvm::none_of(llvm::ArrayRef(Mapping->SymbolNames, SymIndex),
                            [&QName](const SymbolHeaderMapping::SymbolName &S) {
                              return S.qualifiedName() == QName;
                            }) &&
              "The symbol has been added before, make sure entries in the .inc "
              "file are grouped by symbol name!");
+    }
+    if (SymIndex >= 0 &&
+        Mapping->SymbolNames[SymIndex].qualifiedName() == QName) {
+      // Not a new symbol, use the same index.
----------------
kadircet wrote:

nit: revert the mapping and get rid of the branch:
```
if (SymIndex < 0 || Mapping->SymbolNames[SymIndex].qualifiedName() != QName) {
  ...
  ++SymIndex
}
```

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


More information about the cfe-commits mailing list