Removed the SubsectionsViaSymbols MCStreamer API and replaced it with a generic
authorKevin Enderby <enderby@apple.com>
Thu, 16 Jul 2009 17:56:39 +0000 (17:56 +0000)
committerKevin Enderby <enderby@apple.com>
Thu, 16 Jul 2009 17:56:39 +0000 (17:56 +0000)
EmitAssemblerFlag API which takes a value from the added AssemblerFlag
enumerated constants.

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

include/llvm/MC/MCStreamer.h
lib/MC/MCAsmStreamer.cpp
tools/llvm-mc/AsmParser.cpp

index b8f1b2659d8430f5e3dee79a0537b12e1adff5db..7d92a16507ef7a46e0594976a9103271d929dd71 100644 (file)
@@ -53,6 +53,10 @@ namespace llvm {
       SymbolAttrLast = WeakReference
     };
 
+    enum AssemblerFlag {
+      SubsectionsViaSymbols  /// .subsections_via_symbols (Apple)
+    };
+
   private:
     MCContext &Context;
 
@@ -89,10 +93,8 @@ namespace llvm {
     // symbol section in the constructor and initialize it here?
     virtual void EmitLabel(MCSymbol *Symbol) = 0;
 
-    /// SubsectionsViaSymbols - Note in the output that the conventions used in
-    /// in the assembly file allows the bytes of a section to be divided up at
-    /// the boundaries of the symbols by a link editor for processing as atoms.
-    virtual void SubsectionsViaSymbols(void) = 0;
+    /// EmitAssemblerFlag - Note in the output the specified @param Flag
+    virtual void EmitAssemblerFlag(AssemblerFlag Flag) = 0;
 
     /// EmitAssignment - Emit an assignment of @param Value to @param Symbol.
     ///
index 691694978d418a5e7d81ded8abc26f5871d9e45f..e1812cee59ff77df47b9fb7d988a3a19b01d2ef4 100644 (file)
@@ -38,7 +38,7 @@ namespace {
 
     virtual void EmitLabel(MCSymbol *Symbol);
 
-    virtual void SubsectionsViaSymbols(void);
+    virtual void EmitAssemblerFlag(AssemblerFlag Flag);
 
     virtual void EmitAssignment(MCSymbol *Symbol, const MCValue &Value,
                                 bool MakeAbsolute = false);
@@ -129,8 +129,11 @@ void MCAsmStreamer::EmitLabel(MCSymbol *Symbol) {
   Symbol->setExternal(false);
 }
 
-void MCAsmStreamer::SubsectionsViaSymbols(void) {
-  OS << ".subsections_via_symbols\n";
+void MCAsmStreamer::EmitAssemblerFlag(AssemblerFlag Flag) {
+  switch (Flag) {
+  case SubsectionsViaSymbols: OS << ".subsections_via_symbols"; break;
+  }
+  OS << '\n';
 }
 
 void MCAsmStreamer::AbortAssembly(const char *AbortReason) {
index 5a6db1c9c02d7313bcb7c478a03c9eb1ad3c6abd..4629cfc34b9f3620dd0aa56abdc6b1c2035b96ba 100644 (file)
@@ -1107,7 +1107,7 @@ bool AsmParser::ParseDirectiveDarwinSubsectionsViaSymbols() {
   
   Lexer.Lex();
 
-  Out.SubsectionsViaSymbols();
+  Out.EmitAssemblerFlag(MCStreamer::SubsectionsViaSymbols);
 
   return false;
 }