Symbol.cpp revision 351278
1270096Strasz//===- Symbol.cpp ---------------------------------------------------------===// 2270096Strasz// 3270096Strasz// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4270096Strasz// See https://llvm.org/LICENSE.txt for license information. 5270096Strasz// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6270096Strasz// 7270096Strasz//===----------------------------------------------------------------------===// 8270096Strasz// 9270096Strasz// Implements the Symbol. 10270096Strasz// 11270096Strasz//===----------------------------------------------------------------------===// 12270096Strasz 13270096Strasz#include "llvm/TextAPI/MachO/Symbol.h" 14270096Strasz#include <string> 15270096Strasz 16270096Strasznamespace llvm { 17270096Strasznamespace MachO { 18270096Strasz 19270096Strasz#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 20270096StraszLLVM_DUMP_METHOD void Symbol::dump(raw_ostream &OS) const { 21270096Strasz std::string Result; 22270096Strasz if (isUndefined()) 23270096Strasz Result += "(undef) "; 24270096Strasz if (isWeakDefined()) 25270096Strasz Result += "(weak-def) "; 26270096Strasz if (isWeakReferenced()) 27270096Strasz Result += "(weak-ref) "; 28270096Strasz if (isThreadLocalValue()) 29270096Strasz Result += "(tlv) "; 30270096Strasz switch (Kind) { 31270096Strasz case SymbolKind::GlobalSymbol: 32270096Strasz Result += Name.str(); 33270096Strasz break; 34270096Strasz case SymbolKind::ObjectiveCClass: 35270096Strasz Result += "(ObjC Class) " + Name.str(); 36270897Strasz break; 37270897Strasz case SymbolKind::ObjectiveCClassEHType: 38270897Strasz Result += "(ObjC Class EH) " + Name.str(); 39270096Strasz break; 40270096Strasz case SymbolKind::ObjectiveCInstanceVariable: 41270096Strasz Result += "(ObjC IVar) " + Name.str(); 42270096Strasz break; 43270096Strasz } 44270096Strasz OS << Result; 45270096Strasz} 46270096Strasz#endif 47270096Strasz 48270096Strasz} // end namespace MachO. 49270096Strasz} // end namespace llvm. 50270096Strasz