瀏覽代碼

Add comments about converting directives into PluginName

Jisi Liu 9 年之前
父節點
當前提交
2e314a697a
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/google/protobuf/compiler/command_line_interface.cc

+ 2 - 1
src/google/protobuf/compiler/command_line_interface.cc

@@ -264,6 +264,8 @@ void AddDefaultProtoPaths(vector<pair<string, string> >* paths) {
 }
 }
 
 
 string PluginName(const string& plugin_prefix, const string& directive) {
 string PluginName(const string& plugin_prefix, const string& directive) {
+  // Assuming the directive starts with "--" and ends with "_out" or "_opt",
+  // strip the "--" and "_out/_opt" and add the plugin prefix.
   return plugin_prefix + "gen-" + directive.substr(2, directive.size() - 6);
   return plugin_prefix + "gen-" + directive.substr(2, directive.size() - 6);
 }
 }
 }  // namespace
 }  // namespace
@@ -1485,7 +1487,6 @@ bool CommandLineInterface::GenerateOutput(
           HasSuffixString(output_directive.name, "_out"))
           HasSuffixString(output_directive.name, "_out"))
         << "Bad name for plugin generator: " << output_directive.name;
         << "Bad name for plugin generator: " << output_directive.name;
 
 
-    // Strip the "--" and "_out" and add the plugin prefix.
     string plugin_name = PluginName(plugin_prefix_ , output_directive.name);
     string plugin_name = PluginName(plugin_prefix_ , output_directive.name);
     string parameters = output_directive.parameter;
     string parameters = output_directive.parameter;
     if (!plugin_parameters_[plugin_name].empty()) {
     if (!plugin_parameters_[plugin_name].empty()) {