Use Doxygen-style comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50833 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/LLVMCConfigurationEmitter.cpp b/utils/TableGen/LLVMCConfigurationEmitter.cpp
index d9d9fda..d126e99 100644
--- a/utils/TableGen/LLVMCConfigurationEmitter.cpp
+++ b/utils/TableGen/LLVMCConfigurationEmitter.cpp
@@ -38,16 +38,16 @@
 //===----------------------------------------------------------------------===//
 /// Constants
 
-// Indentation strings
+// Indentation strings.
 const char * Indent1 = "    ";
 const char * Indent2 = "        ";
 const char * Indent3 = "            ";
 const char * Indent4 = "                ";
 
-// Default help string
+// Default help string.
 const char * DefaultHelpString = "NO HELP MESSAGE PROVIDED";
 
-// Name for the "sink" option
+// Name for the "sink" option.
 const char * SinkOptionName = "AutoGeneratedSinkOption";
 
 //===----------------------------------------------------------------------===//
@@ -69,8 +69,8 @@
 }
 
 
-// Ensure that the number of args in d is <= min_arguments,
-// throw exception otherwise
+// checkNumberOfArguments - Ensure that the number of args in d is
+// less than or equal to min_arguments, otherwise throw an exception .
 void checkNumberOfArguments (const DagInit* d, unsigned min_arguments) {
   if (d->getNumArgs() < min_arguments)
     throw "Property " + d->getOperator()->getAsString()
@@ -111,8 +111,7 @@
 // the option registration code, while ToolOptionDescriptions are used
 // to generate tool-specific code.
 
-// Base class for option descriptions
-
+/// OptionDescription - Base class for option descriptions.
 struct OptionDescription {
   OptionType::OptionType Type;
   std::string Name;
@@ -154,7 +153,7 @@
 
 };
 
-// Global option description
+// Global option description.
 
 namespace GlobalOptionDescriptionFlags {
   enum GlobalOptionDescriptionFlags { Required = 0x1 };
@@ -180,7 +179,7 @@
     Flags |= GlobalOptionDescriptionFlags::Required;
   }
 
-  // Merge two option descriptions
+  /// Merge - Merge two option descriptions.
   void Merge (const GlobalOptionDescription& other)
   {
     if (other.Type != Type)
@@ -197,15 +196,16 @@
   }
 };
 
-// A GlobalOptionDescription array
-// + some flags affecting generation of option declarations
+/// GlobalOptionDescriptions - A GlobalOptionDescription array
+/// together with some flags affecting generation of option
+/// declarations.
 struct GlobalOptionDescriptions {
   typedef StringMap<GlobalOptionDescription> container_type;
   typedef container_type::const_iterator const_iterator;
 
-  // A list of GlobalOptionDescriptions
+  /// Descriptions - A list of GlobalOptionDescriptions.
   container_type Descriptions;
-  // Should the emitter generate a "cl::sink" option?
+  /// HasSink - Should the emitter generate a "cl::sink" option?
   bool HasSink;
 
   const GlobalOptionDescription& FindOption(const std::string& OptName) const {
@@ -307,31 +307,34 @@
 };
 
 
-// A list of Tool information records
-// IntrusiveRefCntPtrs are used because StringMap has no copy constructor
-// (and we want to avoid copying ToolProperties anyway)
+/// ToolPropertiesList - A list of Tool information records
+/// IntrusiveRefCntPtrs are used here because StringMap has no copy
+/// constructor (and we want to avoid copying ToolProperties anyway).
 typedef std::vector<IntrusiveRefCntPtr<ToolProperties> > ToolPropertiesList;
 
 
-// Function object for iterating over a list of tool property records
+/// CollectProperties - Function object for iterating over a list of
+/// tool property records
 class CollectProperties {
 private:
 
   /// Implementation details
 
-  // "Property handler" - a function that extracts information
-  // about a given tool property from its DAG representation
+  /// PropertyHandler - a function that extracts information
+  /// about a given tool property from its DAG representation
   typedef void (CollectProperties::*PropertyHandler)(const DagInit*);
 
-  // Map from property names -> property handlers
+  /// PropertyHandlerMap - A map from property names to property
+  /// handlers.
   typedef StringMap<PropertyHandler> PropertyHandlerMap;
 
-  // "Option property handler" - a function that extracts information
-  // about a given option property from its DAG representation
+  /// OptionPropertyHandler - a function that extracts information
+  /// about a given option property from its DAG representation.
   typedef void (CollectProperties::* OptionPropertyHandler)
   (const DagInit*, GlobalOptionDescription &);
 
-  // Map from option property names -> option property handlers
+  /// OptionPropertyHandlerMap - A map from option property names to
+  /// option property handlers
   typedef StringMap<OptionPropertyHandler> OptionPropertyHandlerMap;
 
   // Static maps from strings to CollectProperties methods("handlers")
@@ -342,9 +345,10 @@
 
   /// This is where the information is stored
 
-  // Current Tool properties
+  /// toolProps_ -  Properties of the current Tool.
   ToolProperties& toolProps_;
-  // OptionDescriptions table(used to register options globally)
+  /// optDescs_ - OptionDescriptions table (used to register options
+  /// globally).
   GlobalOptionDescriptions& optDescs_;
 
 public:
@@ -383,8 +387,8 @@
     }
   }
 
-  // Gets called for every tool property;
-  // Just forwards to the corresponding property handler.
+  /// operator() - Gets called for every tool property; Just forwards
+  /// to the corresponding property handler.
   void operator() (Init* i) {
     const DagInit& d = InitPtrToDagInitRef(i);
     const std::string& property_name = d.getOperator()->getAsString();
@@ -525,12 +529,12 @@
     }
   }
 
-  // Go through the list of option properties and call a corresponding
-  // handler for each.
-  //
-  // Parameters:
-  // name - option name
-  // d - option property list
+  /// processOptionProperties - Go through the list of option
+  /// properties and call a corresponding handler for each.
+  ///
+  /// Parameters:
+  /// name - option name
+  /// d - option property list
   void processOptionProperties (const DagInit* d, GlobalOptionDescription& o) {
     // First argument is option name
     checkNumberOfArguments(d, 2);
@@ -564,8 +568,8 @@
 bool CollectProperties::staticMembersInitialized_ = false;
 
 
-// Gather information from the parsed TableGen data
-// (Basically a wrapper for CollectProperties)
+/// CollectToolProperties - Gather information from the parsed
+/// TableGen data (basically a wrapper for CollectProperties).
 void CollectToolProperties (RecordVector::const_iterator B,
                             RecordVector::const_iterator E,
                             ToolPropertiesList& TPList,
@@ -585,7 +589,7 @@
   }
 }
 
-// Used by EmitGenerateActionMethod
+/// EmitOptionPropertyHandlingCode - Used by EmitGenerateActionMethod.
 void EmitOptionPropertyHandlingCode (const ToolProperties& P,
                                      const ToolOptionDescription& D,
                                      std::ostream& O)
@@ -673,7 +677,8 @@
   O << Indent2 << "}\n";
 }
 
-// Emite one of two versions of GenerateAction method
+// EmitGenerateActionMethod - Emit one of two versions of
+// GenerateAction method.
 void EmitGenerateActionMethod (const ToolProperties& P, int V, std::ostream& O)
 {
   assert(V==1 || V==2);
@@ -731,7 +736,8 @@
     << Indent1 << "}\n\n";
 }
 
-// Emit GenerateAction methods for Tool classes
+/// EmitGenerateActionMethods - Emit two GenerateAction methods for a given
+/// Tool class.
 void EmitGenerateActionMethods (const ToolProperties& P, std::ostream& O) {
 
   if (!P.isJoin())
@@ -747,7 +753,7 @@
   EmitGenerateActionMethod(P, 2, O);
 }
 
-// Emit IsLast() method for Tool classes
+/// EmitIsLastMethod - Emit IsLast() method for a given Tool class
 void EmitIsLastMethod (const ToolProperties& P, std::ostream& O) {
   O << Indent1 << "bool IsLast() const {\n"
     << Indent2 << "bool last = false;\n";
@@ -766,7 +772,8 @@
     << Indent1 <<  "}\n\n";
 }
 
-// Emit static [Input,Output]Language() methods for Tool classes
+/// EmitInOutLanguageMethods - Emit the [Input,Output]Language()
+/// methods for a given Tool class.
 void EmitInOutLanguageMethods (const ToolProperties& P, std::ostream& O) {
   O << Indent1 << "const char* InputLanguage() const {\n"
     << Indent2 << "return \"" << P.InLanguage << "\";\n"
@@ -777,21 +784,23 @@
     << Indent1 << "}\n\n";
 }
 
-// Emit static [Input,Output]Language() methods for Tool classes
+/// EmitOutputSuffixMethod - Emit the OutputSuffix() method for a
+/// given Tool class.
 void EmitOutputSuffixMethod (const ToolProperties& P, std::ostream& O) {
   O << Indent1 << "const char* OutputSuffix() const {\n"
     << Indent2 << "return \"" << P.OutputSuffix << "\";\n"
     << Indent1 << "}\n\n";
 }
 
-// Emit static Name() method for Tool classes
+/// EmitNameMethod - Emit the Name() method for a given Tool class.
 void EmitNameMethod (const ToolProperties& P, std::ostream& O) {
   O << Indent1 << "const char* Name() const {\n"
     << Indent2 << "return \"" << P.Name << "\";\n"
     << Indent1 << "}\n\n";
 }
 
-// Emit static Name() method for Tool classes
+/// EmitIsJoinMethod - Emit the IsJoin() method for a given Tool
+/// class.
 void EmitIsJoinMethod (const ToolProperties& P, std::ostream& O) {
   O << Indent1 << "bool IsJoin() const {\n";
   if (P.isJoin())
@@ -801,7 +810,7 @@
   O << Indent1 << "}\n\n";
 }
 
-// Emit a Tool class definition
+/// EmitToolClassDefinition - Emit a Tool class definition.
 void EmitToolClassDefinition (const ToolProperties& P, std::ostream& O) {
 
   if(P.Name == "root")
@@ -826,7 +835,8 @@
   O << "};\n\n";
 }
 
-// Iterate over a list of option descriptions and emit registration code
+/// EmitOptionDescriptions - Iterate over a list of option
+/// descriptions and emit registration code.
 void EmitOptionDescriptions (const GlobalOptionDescriptions& descs,
                              std::ostream& O)
 {
@@ -862,6 +872,7 @@
   O << '\n';
 }
 
+/// EmitPopulateLanguageMap - Emit the PopulateLanguageMap() function.
 void EmitPopulateLanguageMap (const RecordKeeper& Records, std::ostream& O)
 {
   // Get the relevant field out of RecordKeeper
@@ -891,8 +902,8 @@
   O << "}\n\n";
 }
 
-// Fills in two tables that map tool names to (input, output) languages.
-// Used by the typechecker.
+/// FillInToolToLang - Fills in two tables that map tool names to
+/// (input, output) languages.  Used by the typechecker.
 void FillInToolToLang (const ToolPropertiesList& TPList,
                        StringMap<std::string>& ToolToInLang,
                        StringMap<std::string>& ToolToOutLang) {
@@ -904,7 +915,8 @@
   }
 }
 
-// Check that all output and input language names match.
+/// TypecheckGraph - Check that names for output and input languages
+/// on all edges do match.
 // TOFIX: check for cycles.
 // TOFIX: check for multiple default edges.
 void TypecheckGraph (Record* CompilationGraph,
@@ -935,7 +947,8 @@
   }
 }
 
-// Helper function used by EmitEdgePropertyTest.
+/// EmitEdgePropertyTest1Arg - Helper function used by
+/// EmitEdgePropertyTest.
 bool EmitEdgePropertyTest1Arg(const std::string& PropName,
                               const DagInit& Prop,
                               const GlobalOptionDescriptions& OptDescs,
@@ -956,7 +969,8 @@
   return false;
 }
 
-// Helper function used by EmitEdgePropertyTest.
+/// EmitEdgePropertyTest2Args - Helper function used by
+/// EmitEdgePropertyTest.
 bool EmitEdgePropertyTest2Args(const std::string& PropName,
                                const DagInit& Prop,
                                const GlobalOptionDescriptions& OptDescs,
@@ -992,7 +1006,8 @@
                           const GlobalOptionDescriptions& OptDescs,
                           std::ostream& O);
 
-// Helper function used by EmitEdgeClass.
+/// EmitLogicalOperationTest - Helper function used by
+/// EmitEdgePropertyTest.
 void EmitLogicalOperationTest(const DagInit& Prop, const char* LogicOp,
                               const GlobalOptionDescriptions& OptDescs,
                               std::ostream& O) {
@@ -1007,7 +1022,7 @@
   }
 }
 
-// Helper function used by EmitEdgeClass.
+/// EmitEdgePropertyTest - Helper function used by EmitEdgeClass.
 void EmitEdgePropertyTest(const DagInit& Prop,
                           const GlobalOptionDescriptions& OptDescs,
                           std::ostream& O) {
@@ -1025,7 +1040,7 @@
     throw PropName + ": unknown edge property!";
 }
 
-// Emit a single Edge* class.
+/// EmitEdgeClass - Emit a single Edge# class.
 void EmitEdgeClass(unsigned N, const std::string& Target,
                    ListInit* Props, const GlobalOptionDescriptions& OptDescs,
                    std::ostream& O) {
@@ -1083,6 +1098,8 @@
   }
 }
 
+/// EmitPopulateCompilationGraph - Emit the PopulateCompilationGraph()
+/// function.
 void EmitPopulateCompilationGraph (Record* CompilationGraph,
                                    std::ostream& O)
 {
@@ -1131,29 +1148,30 @@
 // End of anonymous namespace
 }
 
-// Back-end entry point
+/// run - The back-end entry point.
 void LLVMCConfigurationEmitter::run (std::ostream &O) {
-  // Emit file header
+
+  // Emit file header.
   EmitSourceFileHeader("LLVMC Configuration Library", O);
 
-  // Get a list of all defined Tools
+  // Get a list of all defined Tools.
   RecordVector Tools = Records.getAllDerivedDefinitions("Tool");
   if (Tools.empty())
     throw std::string("No tool definitions found!");
 
-  // Gather information from the Tool descriptions
+  // Gather information from the Tool description dags.
   ToolPropertiesList tool_props;
   GlobalOptionDescriptions opt_descs;
   CollectToolProperties(Tools.begin(), Tools.end(), tool_props, opt_descs);
 
-  // Emit global option registration code
+  // Emit global option registration code.
   EmitOptionDescriptions(opt_descs, O);
 
-  // Emit PopulateLanguageMap function
-  // (a language map maps from file extensions to language names)
+  // Emit PopulateLanguageMap() function
+  // (a language map maps from file extensions to language names).
   EmitPopulateLanguageMap(Records, O);
 
-  // Emit Tool classes
+  // Emit Tool classes.
   for (ToolPropertiesList::const_iterator B = tool_props.begin(),
          E = tool_props.end(); B!=E; ++B)
     EmitToolClassDefinition(*(*B), O);
@@ -1165,10 +1183,10 @@
   // Typecheck the compilation graph.
   TypecheckGraph(CompilationGraphRecord, tool_props);
 
-  // Emit Edge* classes.
+  // Emit Edge# classes.
   EmitEdgeClasses(CompilationGraphRecord, opt_descs, O);
 
-  // Emit PopulateCompilationGraph function
+  // Emit PopulateCompilationGraph() function.
   EmitPopulateCompilationGraph(CompilationGraphRecord, O);
 
   // EOF