This revision was automatically updated to reflect the committed changes.
Closed by commit rL325805: [docs] Fix duplicate arguments for JoinedAndSeparate 
(authored by Hahnfeld, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D42840?vs=132559&id=135438#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D42840

Files:
  cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp


Index: cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp
===================================================================
--- cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp
+++ cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp
@@ -245,19 +245,27 @@
 void emitOptionName(StringRef Prefix, const Record *Option, raw_ostream &OS) {
   // Find the arguments to list after the option.
   unsigned NumArgs = getNumArgsForKind(Option->getValueAsDef("Kind"), Option);
+  bool HasMetaVarName = !Option->isValueUnset("MetaVarName");
 
   std::vector<std::string> Args;
-  if (!Option->isValueUnset("MetaVarName"))
+  if (HasMetaVarName)
     Args.push_back(Option->getValueAsString("MetaVarName"));
   else if (NumArgs == 1)
     Args.push_back("<arg>");
 
-  while (Args.size() < NumArgs) {
-    Args.push_back(("<arg" + Twine(Args.size() + 1) + ">").str());
-    // Use '--args <arg1> <arg2>...' if any number of args are allowed.
-    if (Args.size() == 2 && NumArgs == UnlimitedArgs) {
-      Args.back() += "...";
-      break;
+  // Fill up arguments if this option didn't provide a meta var name or it
+  // supports an unlimited number of arguments. We can't see how many arguments
+  // already are in a meta var name, so assume it has right number. This is
+  // needed for JoinedAndSeparate options so that there arent't too many
+  // arguments.
+  if (!HasMetaVarName || NumArgs == UnlimitedArgs) {
+    while (Args.size() < NumArgs) {
+      Args.push_back(("<arg" + Twine(Args.size() + 1) + ">").str());
+      // Use '--args <arg1> <arg2>...' if any number of args are allowed.
+      if (Args.size() == 2 && NumArgs == UnlimitedArgs) {
+        Args.back() += "...";
+        break;
+      }
     }
   }
 


Index: cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp
===================================================================
--- cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp
+++ cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp
@@ -245,19 +245,27 @@
 void emitOptionName(StringRef Prefix, const Record *Option, raw_ostream &OS) {
   // Find the arguments to list after the option.
   unsigned NumArgs = getNumArgsForKind(Option->getValueAsDef("Kind"), Option);
+  bool HasMetaVarName = !Option->isValueUnset("MetaVarName");
 
   std::vector<std::string> Args;
-  if (!Option->isValueUnset("MetaVarName"))
+  if (HasMetaVarName)
     Args.push_back(Option->getValueAsString("MetaVarName"));
   else if (NumArgs == 1)
     Args.push_back("<arg>");
 
-  while (Args.size() < NumArgs) {
-    Args.push_back(("<arg" + Twine(Args.size() + 1) + ">").str());
-    // Use '--args <arg1> <arg2>...' if any number of args are allowed.
-    if (Args.size() == 2 && NumArgs == UnlimitedArgs) {
-      Args.back() += "...";
-      break;
+  // Fill up arguments if this option didn't provide a meta var name or it
+  // supports an unlimited number of arguments. We can't see how many arguments
+  // already are in a meta var name, so assume it has right number. This is
+  // needed for JoinedAndSeparate options so that there arent't too many
+  // arguments.
+  if (!HasMetaVarName || NumArgs == UnlimitedArgs) {
+    while (Args.size() < NumArgs) {
+      Args.push_back(("<arg" + Twine(Args.size() + 1) + ">").str());
+      // Use '--args <arg1> <arg2>...' if any number of args are allowed.
+      if (Args.size() == 2 && NumArgs == UnlimitedArgs) {
+        Args.back() += "...";
+        break;
+      }
     }
   }
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to