obj2yaml: Use the correct relocation type for different machine types
[oota-llvm.git] / lib / Option / ArgList.cpp
index 39b22d776ed9cf93a8699857f128c6ea4ead2897..fecd2371735922e6fb73016f9121b65dea9ed2a4 100644 (file)
@@ -206,6 +206,13 @@ bool ArgList::hasFlag(OptSpecifier Pos, OptSpecifier Neg, bool Default) const {
   return Default;
 }
 
+bool ArgList::hasFlag(OptSpecifier Pos, OptSpecifier PosAlias, OptSpecifier Neg,
+                      bool Default) const {
+  if (Arg *A = getLastArg(Pos, PosAlias, Neg))
+    return A->getOption().matches(Pos) || A->getOption().matches(PosAlias);
+  return Default;
+}
+
 StringRef ArgList::getLastArgValue(OptSpecifier Id,
                                          StringRef Default) const {
   if (Arg *A = getLastArg(Id))
@@ -226,6 +233,14 @@ void ArgList::AddLastArg(ArgStringList &Output, OptSpecifier Id) const {
   }
 }
 
+void ArgList::AddLastArg(ArgStringList &Output, OptSpecifier Id0,
+                         OptSpecifier Id1) const {
+  if (Arg *A = getLastArg(Id0, Id1)) {
+    A->claim();
+    A->render(*this, Output);
+  }
+}
+
 void ArgList::AddAllArgs(ArgStringList &Output, OptSpecifier Id0,
                          OptSpecifier Id1, OptSpecifier Id2) const {
   for (arg_iterator it = filtered_begin(Id0, Id1, Id2),
@@ -276,8 +291,7 @@ void ArgList::ClaimAllArgs() const {
 
 const char *ArgList::MakeArgString(const Twine &T) const {
   SmallString<256> Str;
-  T.toVector(Str);
-  return MakeArgString(Str.str());
+  return MakeArgString(T.toStringRef(Str));
 }
 
 const char *ArgList::GetOrMakeJoinedArgString(unsigned Index,