[PATCH] D63344: lld/elf: Deduplicate undefined symbol diagnostics

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 18 01:10:56 PDT 2019


grimar added inline comments.


================
Comment at: lld/ELF/Relocations.cpp:718
+  std::vector<Loc> Locs;
+  bool IsWarning;
+};
----------------
Seems this field can be calculated at any time, does it worth to keep the precalculated value?


================
Comment at: lld/ELF/Relocations.cpp:778
+  // collect all "referenced from" lines at the first diagnostic.
+  std::map<Symbol*, size_t> FirstRef;
+  for (size_t i = 0; i < Undefs.size(); ++i) {
----------------
I'd use llvm::DenseMap. It is probably a bit more consistent with the rest LLD ELF code,
and allows then to use its `lookup` method below:

```
if (Symbol *S = FirstRef.lookup(Undef.Sym)) {
...
}
```


================
Comment at: lld/ELF/Relocations.cpp:790
 
-  error(Msg);
-  return true;
+  for (const UndefinedDiag& Undef : Undefs) {
+    if (!Undef.Locs.empty())
----------------
It is not clang formatted.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63344/new/

https://reviews.llvm.org/D63344





More information about the llvm-commits mailing list