aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/MC/MCSymbol.h
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-03-18 00:59:02 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-03-18 00:59:02 +0000
commitdaf97333697e1d243e531f4be648b1640d6a58bb (patch)
tree7fd8a4d34ffbe133a8cd338dbcb3056d80d54c5f /include/llvm/MC/MCSymbol.h
parent0682951b4f569b9a162ddfcffaa90a3ba5adb231 (diff)
downloadexternal_llvm-daf97333697e1d243e531f4be648b1640d6a58bb.zip
external_llvm-daf97333697e1d243e531f4be648b1640d6a58bb.tar.gz
external_llvm-daf97333697e1d243e531f4be648b1640d6a58bb.tar.bz2
Add MCSymbol::isInSection.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98790 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/MC/MCSymbol.h')
-rw-r--r--include/llvm/MC/MCSymbol.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/include/llvm/MC/MCSymbol.h b/include/llvm/MC/MCSymbol.h
index e41eb2a..fb96506 100644
--- a/include/llvm/MC/MCSymbol.h
+++ b/include/llvm/MC/MCSymbol.h
@@ -28,8 +28,7 @@ namespace llvm {
///
/// If the symbol is defined/emitted into the current translation unit, the
/// Section member is set to indicate what section it lives in. Otherwise, if
- /// it is a reference to an external entity, it has a null section.
- ///
+ /// it is a reference to an external entity, it has a null section.
class MCSymbol {
// Special sentinal value for the absolute pseudo section.
//
@@ -52,7 +51,7 @@ namespace llvm {
/// typically does not survive in the .o file's symbol table. Usually
/// "Lfoo" or ".foo".
unsigned IsTemporary : 1;
-
+
private: // MCContext creates and uniques these.
friend class MCContext;
MCSymbol(StringRef name, bool isTemporary)
@@ -83,6 +82,12 @@ namespace llvm {
return Section != 0;
}
+ /// isInSection - Check if this symbol is defined in some section (i.e., it
+ /// is defined but not absolute).
+ bool isInSection() const {
+ return isDefined() && !isAbsolute();
+ }
+
/// isUndefined - Check if this symbol undefined (i.e., implicitly defined).
bool isUndefined() const {
return !isDefined();
@@ -96,7 +101,7 @@ namespace llvm {
/// getSection - Get the section associated with a defined, non-absolute
/// symbol.
const MCSection &getSection() const {
- assert(!isUndefined() && !isAbsolute() && "Invalid accessor!");
+ assert(isInSection() && "Invalid accessor!");
return *Section;
}