[PATCH] D18419: Handle section vs global name conflict.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 24 13:47:31 PDT 2016
pcc added inline comments.
================
Comment at: lib/MC/ELFObjectWriter.cpp:390
@@ +389,3 @@
+
+ Renames.insert(
+ std::make_pair(cast<MCSymbolELF>(Alias), cast<MCSymbolELF>(Begin)));
----------------
This problem affects the other object formats as well. Can't you do this in the generic object format lowering code with `setVariableValue`?
================
Comment at: lib/MC/MCContext.cpp:189-190
@@ -198,5 +188,4 @@
}
auto NameEntry = UsedNames.insert(std::make_pair(NewName, true));
- if (NameEntry.second) {
- // Ok, we found a name. Have the MCSymbol object itself refer to the copy
- // of the string that is embedded in the UsedNames entry.
+ if (NameEntry.second || !NameEntry.first->second) {
+ // Ok, we found a name.
----------------
You can simplify this to:
```
bool &Used = UsedNames[NewName];
if (!Used) {
Used = true;
...
```
Repository:
rL LLVM
http://reviews.llvm.org/D18419
More information about the llvm-commits
mailing list