[llvm-commits] [llvm] r98790 - /llvm/trunk/include/llvm/MC/MCSymbol.h
Daniel Dunbar
daniel at zuster.org
Wed Mar 17 17:59:03 PDT 2010
Author: ddunbar
Date: Wed Mar 17 19:59:02 2010
New Revision: 98790
URL: http://llvm.org/viewvc/llvm-project?rev=98790&view=rev
Log:
Add MCSymbol::isInSection.
Modified:
llvm/trunk/include/llvm/MC/MCSymbol.h
Modified: llvm/trunk/include/llvm/MC/MCSymbol.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbol.h?rev=98790&r1=98789&r2=98790&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSymbol.h (original)
+++ llvm/trunk/include/llvm/MC/MCSymbol.h Wed Mar 17 19:59:02 2010
@@ -28,8 +28,7 @@
///
/// 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 @@
/// 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 @@
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 @@
/// 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;
}
More information about the llvm-commits
mailing list