comparison lib/Option/ArgList.cpp @ 148:63bd29f05246

merged
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 14 Aug 2019 19:46:37 +0900
parents c2174574ed3a
children
comparison
equal deleted inserted replaced
146:3fc4d5c3e21e 148:63bd29f05246
1 //===- ArgList.cpp - Argument List Management -----------------------------===// 1 //===- ArgList.cpp - Argument List Management -----------------------------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // 4 // See https://llvm.org/LICENSE.txt for license information.
5 // This file is distributed under the University of Illinois Open Source 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 // License. See LICENSE.TXT for details.
7 // 6 //
8 //===----------------------------------------------------------------------===// 7 //===----------------------------------------------------------------------===//
9 8
10 #include "llvm/ADT/ArrayRef.h" 9 #include "llvm/ADT/ArrayRef.h"
11 #include "llvm/ADT/None.h" 10 #include "llvm/ADT/None.h"
12 #include "llvm/ADT/SmallVector.h" 11 #include "llvm/ADT/SmallVector.h"
13 #include "llvm/ADT/STLExtras.h" 12 #include "llvm/ADT/STLExtras.h"
14 #include "llvm/ADT/StringRef.h" 13 #include "llvm/ADT/StringRef.h"
15 #include "llvm/ADT/Twine.h" 14 #include "llvm/ADT/Twine.h"
15 #include "llvm/Config/llvm-config.h"
16 #include "llvm/Option/Arg.h" 16 #include "llvm/Option/Arg.h"
17 #include "llvm/Option/ArgList.h" 17 #include "llvm/Option/ArgList.h"
18 #include "llvm/Option/Option.h" 18 #include "llvm/Option/Option.h"
19 #include "llvm/Option/OptSpecifier.h" 19 #include "llvm/Option/OptSpecifier.h"
20 #include "llvm/Support/Compiler.h" 20 #include "llvm/Support/Compiler.h"
93 SmallVector<const char *, 16> Values; 93 SmallVector<const char *, 16> Values;
94 AddAllArgValues(Values, Id); 94 AddAllArgValues(Values, Id);
95 return std::vector<std::string>(Values.begin(), Values.end()); 95 return std::vector<std::string>(Values.begin(), Values.end());
96 } 96 }
97 97
98 void ArgList::AddLastArg(ArgStringList &Output, OptSpecifier Id) const {
99 if (Arg *A = getLastArg(Id)) {
100 A->claim();
101 A->render(*this, Output);
102 }
103 }
104
105 void ArgList::AddLastArg(ArgStringList &Output, OptSpecifier Id0,
106 OptSpecifier Id1) const {
107 if (Arg *A = getLastArg(Id0, Id1)) {
108 A->claim();
109 A->render(*this, Output);
110 }
111 }
112
113 void ArgList::AddAllArgsExcept(ArgStringList &Output, 98 void ArgList::AddAllArgsExcept(ArgStringList &Output,
114 ArrayRef<OptSpecifier> Ids, 99 ArrayRef<OptSpecifier> Ids,
115 ArrayRef<OptSpecifier> ExcludeIds) const { 100 ArrayRef<OptSpecifier> ExcludeIds) const {
116 for (const Arg *Arg : *this) { 101 for (const Arg *Arg : *this) {
117 bool Excluded = false; 102 bool Excluded = false;