summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2017-08-31 19:36:26 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2017-08-31 19:36:26 +0000
commit3aefe872c518ce56b01f8dd32c7d8107a86cf874 (patch)
tree9573f27943508cc3c9ce9ce53695ad92d6510412 /llvm/tools
parent91635e0ceff86caf99c6dcf4f15ee7fc5e3191b8 (diff)
downloadbcm5719-llvm-3aefe872c518ce56b01f8dd32c7d8107a86cf874.tar.gz
bcm5719-llvm-3aefe872c518ce56b01f8dd32c7d8107a86cf874.zip
Revert "[dsymutil] Don't mark forward declarations as canonical."
This reverts commit r312264. llvm-svn: 312271
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/dsymutil/DwarfLinker.cpp62
1 files changed, 17 insertions, 45 deletions
diff --git a/llvm/tools/dsymutil/DwarfLinker.cpp b/llvm/tools/dsymutil/DwarfLinker.cpp
index 7d2eba48642..6b5415a0795 100644
--- a/llvm/tools/dsymutil/DwarfLinker.cpp
+++ b/llvm/tools/dsymutil/DwarfLinker.cpp
@@ -185,14 +185,13 @@ class CompileUnit {
public:
/// Information gathered about a DIE in the object file.
struct DIEInfo {
- int64_t AddrAdjust; ///< Address offset to apply to the described entity.
- DeclContext *Ctxt; ///< ODR Declaration context.
- DIE *Clone; ///< Cloned version of that DIE.
- uint32_t ParentIdx; ///< The index of this DIE's parent.
- bool Keep : 1; ///< Is the DIE part of the linked output?
- bool InDebugMap : 1; ///< Was this DIE's entity found in the map?
- bool Prune : 1; ///< Is this a pure forward declaration we can strip?
- bool Incomplete : 1; ///< Does DIE transitively refer an incomplete decl?
+ int64_t AddrAdjust; ///< Address offset to apply to the described entity.
+ DeclContext *Ctxt; ///< ODR Declaration context.
+ DIE *Clone; ///< Cloned version of that DIE.
+ uint32_t ParentIdx; ///< The index of this DIE's parent.
+ bool Keep : 1; ///< Is the DIE part of the linked output?
+ bool InDebugMap : 1;///< Was this DIE's entity found in the map?
+ bool Prune : 1; ///< Is this a pure forward declaration we can strip?
};
CompileUnit(DWARFUnit &OrigUnit, unsigned ID, bool CanUseODR,
@@ -1199,9 +1198,8 @@ private:
/// @{
/// Recursively walk the \p DIE tree and look for DIEs to
/// keep. Store that information in \p CU's DIEInfo.
- ///
- /// The return value indicates whether the DIE is incomplete.
- bool lookForDIEsToKeep(RelocationManager &RelocMgr, const DWARFDie &DIE,
+ void lookForDIEsToKeep(RelocationManager &RelocMgr,
+ const DWARFDie &DIE,
const DebugMapObject &DMO, CompileUnit &CU,
unsigned Flags);
@@ -2198,11 +2196,6 @@ void DwarfLinker::keepDIEAndDependencies(RelocationManager &RelocMgr,
DWARFUnit &Unit = CU.getOrigUnit();
MyInfo.Keep = true;
- // We're looking for incomplete types.
- MyInfo.Incomplete = Die.getTag() != dwarf::DW_TAG_subprogram &&
- Die.getTag() != dwarf::DW_TAG_member &&
- dwarf::toUnsigned(Die.find(dwarf::DW_AT_declaration), 0);
-
// First mark all the parent chain as kept.
unsigned AncestorIdx = MyInfo.ParentIdx;
while (!CU.getInfo(AncestorIdx).Keep) {
@@ -2218,7 +2211,7 @@ void DwarfLinker::keepDIEAndDependencies(RelocationManager &RelocMgr,
const auto *Abbrev = Die.getAbbreviationDeclarationPtr();
uint32_t Offset = Die.getOffset() + getULEB128Size(Abbrev->getCode());
- // Mark all DIEs referenced through attributes as kept.
+ // Mark all DIEs referenced through atttributes as kept.
for (const auto &AttrSpec : Abbrev->attributes()) {
DWARFFormValue Val(AttrSpec.Form);
@@ -2258,16 +2251,6 @@ void DwarfLinker::keepDIEAndDependencies(RelocationManager &RelocMgr,
unsigned ODRFlag = UseODR ? TF_ODR : 0;
lookForDIEsToKeep(RelocMgr, RefDie, DMO, *ReferencedCU,
TF_Keep | TF_DependencyWalk | ODRFlag);
-
- // The incomplete property is propagated if the current DIE is complete
- // but references an incomplete DIE.
- if (Info.Incomplete && !MyInfo.Incomplete &&
- (Die.getTag() == dwarf::DW_TAG_typedef ||
- Die.getTag() == dwarf::DW_TAG_member ||
- Die.getTag() == dwarf::DW_TAG_reference_type ||
- Die.getTag() == dwarf::DW_TAG_ptr_to_member_type ||
- Die.getTag() == dwarf::DW_TAG_pointer_type))
- MyInfo.Incomplete = true;
}
}
}
@@ -2284,9 +2267,7 @@ void DwarfLinker::keepDIEAndDependencies(RelocationManager &RelocMgr,
/// also called, but during these dependency walks the file order is
/// not respected. The TF_DependencyWalk flag tells us which kind of
/// traversal we are currently doing.
-///
-/// The return value indicates whether the DIE is incomplete.
-bool DwarfLinker::lookForDIEsToKeep(RelocationManager &RelocMgr,
+void DwarfLinker::lookForDIEsToKeep(RelocationManager &RelocMgr,
const DWARFDie &Die,
const DebugMapObject &DMO, CompileUnit &CU,
unsigned Flags) {
@@ -2294,13 +2275,13 @@ bool DwarfLinker::lookForDIEsToKeep(RelocationManager &RelocMgr,
CompileUnit::DIEInfo &MyInfo = CU.getInfo(Idx);
bool AlreadyKept = MyInfo.Keep;
if (MyInfo.Prune)
- return true;
+ return;
// If the Keep flag is set, we are marking a required DIE's
// dependencies. If our target is already marked as kept, we're all
// set.
if ((Flags & TF_DependencyWalk) && AlreadyKept)
- return MyInfo.Incomplete;
+ return;
// We must not call shouldKeepDIE while called from keepDIEAndDependencies,
// because it would screw up the relocation finding logic.
@@ -2322,19 +2303,10 @@ bool DwarfLinker::lookForDIEsToKeep(RelocationManager &RelocMgr,
Flags &= ~TF_ParentWalk;
if (!Die.hasChildren() || (Flags & TF_ParentWalk))
- return MyInfo.Incomplete;
-
- bool Incomplete = false;
- for (auto Child : Die.children()) {
- Incomplete |= lookForDIEsToKeep(RelocMgr, Child, DMO, CU, Flags);
+ return;
- // If any of the members are incomplete we propagate the incompleteness.
- if (!MyInfo.Incomplete && Incomplete &&
- (Die.getTag() == dwarf::DW_TAG_structure_type ||
- Die.getTag() == dwarf::DW_TAG_class_type))
- MyInfo.Incomplete = true;
- }
- return MyInfo.Incomplete;
+ for (auto Child: Die.children())
+ lookForDIEsToKeep(RelocMgr, Child, DMO, CU, Flags);
}
/// Assign an abbreviation numer to \p Abbrev.
@@ -2744,7 +2716,7 @@ DIE *DwarfLinker::DIECloner::cloneDIE(
assert(Die->getTag() == InputDIE.getTag());
Die->setOffset(OutOffset);
- if ((Unit.hasODR() || Unit.isClangModule()) && !Info.Incomplete &&
+ if ((Unit.hasODR() || Unit.isClangModule()) &&
Die->getTag() != dwarf::DW_TAG_namespace && Info.Ctxt &&
Info.Ctxt != Unit.getInfo(Info.ParentIdx).Ctxt &&
!Info.Ctxt->getCanonicalDIEOffset()) {
OpenPOWER on IntegriCloud