[PowerPC][XCOFF][MC] Explicitly set containing csect on symbols. [NFC]
Previously we would get the csect a symbol was contained in through its
fragment. This works only if we are writing an object file, and only for
defined symbols. To fix this we set the contating csect explicitly on the
MCSymbolXCOFF object.
Differential Revision: https://reviews.llvm.org/D66032
llvm-svn: 369657
diff --git a/llvm/lib/MC/XCOFFObjectWriter.cpp b/llvm/lib/MC/XCOFFObjectWriter.cpp
index 94c9527..d4dfd46 100644
--- a/llvm/lib/MC/XCOFFObjectWriter.cpp
+++ b/llvm/lib/MC/XCOFFObjectWriter.cpp
@@ -247,8 +247,7 @@
const MCSymbolXCOFF *XSym = cast<MCSymbolXCOFF>(&S);
// Map the symbol into its containing csect.
- MCSectionXCOFF *ContainingCsect =
- dyn_cast<MCSectionXCOFF>(XSym->getFragment(false)->getParent());
+ const MCSectionXCOFF *ContainingCsect = XSym->getContainingCsect();
assert(WrapperMap.find(ContainingCsect) != WrapperMap.end() &&
"Expected containing csect to exist in map");