OSDN Git Service

document SectionFlags::Named better and make it more easily greppable by
authorChris Lattner <sabre@nondot.org>
Fri, 24 Jul 2009 04:26:19 +0000 (04:26 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 24 Jul 2009 04:26:19 +0000 (04:26 +0000)
eliminating isNamed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76946 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetAsmInfo.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp

index cd0fcf8..112f105 100644 (file)
@@ -79,6 +79,9 @@ namespace llvm {
     const unsigned Linkonce   = 1 << 7;  ///< Section is linkonce
     const unsigned TypeFlags  = 0xFF;
     // Some gap for future flags
+    
+    /// Named - True if this section should be printed with ".section <name>",
+    /// false if the section name is something like ".const".
     const unsigned Named      = 1 << 23; ///< Section is named
     const unsigned EntitySize = 0xFF << 24; ///< Entity size for mergeable stuff
 
@@ -114,14 +117,13 @@ namespace llvm {
 
     std::string Name;
     unsigned Flags;
-    explicit Section(unsigned F = SectionFlags::Invalid):Flags(F) { }
+    explicit Section(unsigned F = SectionFlags::Invalid) : Flags(F) { }
 
   public:
     
-    bool isNamed() const { return Flags & SectionFlags::Named; }
     unsigned getEntitySize() const { return (Flags >> 24) & 0xFF; }
 
-    const std::stringgetName() const { return Name; }
+    const std::string &getName() const { return Name; }
     unsigned getFlags() const { return Flags; }
     
     bool hasFlag(unsigned F) const { return (Flags & F) != 0; }
index fe03705..44d1636 100644 (file)
@@ -135,7 +135,7 @@ void AsmPrinter::SwitchToSection(const Section* NS) {
     // If section is named we need to switch into it via special '.section'
     // directive and also append funky flags. Otherwise - section name is just
     // some magic assembler directive.
-    if (NS->isNamed())
+    if (NS->hasFlag(SectionFlags::Named))
       O << TAI->getSwitchToSectionDirective()
         << CurrentSection
         << TAI->getSectionFlags(NS->getFlags());