Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/Option/ArgList.h
Line
Count
Source (jump to first uncovered line)
1
//===- ArgList.h - Argument List Management ---------------------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#ifndef LLVM_OPTION_ARGLIST_H
10
#define LLVM_OPTION_ARGLIST_H
11
12
#include "llvm/ADT/ArrayRef.h"
13
#include "llvm/ADT/DenseMap.h"
14
#include "llvm/ADT/iterator_range.h"
15
#include "llvm/ADT/SmallString.h"
16
#include "llvm/ADT/SmallVector.h"
17
#include "llvm/ADT/StringRef.h"
18
#include "llvm/ADT/Twine.h"
19
#include "llvm/Option/Arg.h"
20
#include "llvm/Option/OptSpecifier.h"
21
#include "llvm/Option/Option.h"
22
#include <algorithm>
23
#include <cstddef>
24
#include <initializer_list>
25
#include <iterator>
26
#include <list>
27
#include <memory>
28
#include <string>
29
#include <utility>
30
#include <vector>
31
32
namespace llvm {
33
34
class raw_ostream;
35
36
namespace opt {
37
38
/// arg_iterator - Iterates through arguments stored inside an ArgList.
39
template<typename BaseIter, unsigned NumOptSpecifiers = 0>
40
class arg_iterator {
41
  /// The current argument and the end of the sequence we're iterating.
42
  BaseIter Current, End;
43
44
  /// Optional filters on the arguments which will be match. To avoid a
45
  /// zero-sized array, we store one specifier even if we're asked for none.
46
  OptSpecifier Ids[NumOptSpecifiers ? NumOptSpecifiers : 1];
47
48
118M
  void SkipToNextArg() {
49
119M
    for (; Current != End; 
++Current1.19M
) {
50
24.1M
      // Skip erased elements.
51
24.1M
      if (!*Current)
52
5.88k
        continue;
53
24.1M
54
24.1M
      // Done if there are no filters.
55
24.1M
      if (!NumOptSpecifiers)
56
19.9M
        return;
57
4.19M
58
4.19M
      // Otherwise require a match.
59
4.19M
      const Option &O = (*Current)->getOption();
60
4.80M
      for (auto Id : Ids) {
61
4.80M
        if (!Id.isValid())
62
52.8k
          break;
63
4.74M
        if (O.matches(Id))
64
3.00M
          return;
65
4.74M
      }
66
4.19M
    }
67
118M
  }
llvm::opt::arg_iterator<llvm::opt::Arg**, 0u>::SkipToNextArg()
Line
Count
Source
48
9.88M
  void SkipToNextArg() {
49
9.88M
    for (; Current != End; 
++Current25
) {
50
9.01M
      // Skip erased elements.
51
9.01M
      if (!*Current)
52
28
        continue;
53
9.01M
54
9.01M
      // Done if there are no filters.
55
9.01M
      if (!NumOptSpecifiers)
56
9.01M
        return;
57
18.4E
58
18.4E
      // Otherwise require a match.
59
18.4E
      const Option &O = (*Current)->getOption();
60
18.4E
      for (auto Id : Ids) {
61
0
        if (!Id.isValid())
62
0
          break;
63
0
        if (O.matches(Id))
64
0
          return;
65
0
      }
66
18.4E
    }
67
9.88M
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 0u>::SkipToNextArg()
Line
Count
Source
48
10.2M
  void SkipToNextArg() {
49
10.2M
    for (; Current != End; 
++Current3.53k
) {
50
9.51M
      // Skip erased elements.
51
9.51M
      if (!*Current)
52
3.53k
        continue;
53
9.51M
54
9.51M
      // Done if there are no filters.
55
9.51M
      if (!NumOptSpecifiers)
56
9.51M
        return;
57
18.4E
58
18.4E
      // Otherwise require a match.
59
18.4E
      const Option &O = (*Current)->getOption();
60
18.4E
      for (auto Id : Ids) {
61
0
        if (!Id.isValid())
62
0
          break;
63
0
        if (O.matches(Id))
64
0
          return;
65
0
      }
66
18.4E
    }
67
10.2M
  }
llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 0u>::SkipToNextArg()
Line
Count
Source
48
1.50M
  void SkipToNextArg() {
49
1.50M
    for (; Current != End; 
++Current0
) {
50
1.38M
      // Skip erased elements.
51
1.38M
      if (!*Current)
52
0
        continue;
53
1.38M
54
1.38M
      // Done if there are no filters.
55
1.38M
      if (!NumOptSpecifiers)
56
1.38M
        return;
57
0
58
0
      // Otherwise require a match.
59
0
      const Option &O = (*Current)->getOption();
60
0
      for (auto Id : Ids) {
61
0
        if (!Id.isValid())
62
0
          break;
63
0
        if (O.matches(Id))
64
0
          return;
65
0
      }
66
0
    }
67
1.50M
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 1u>::SkipToNextArg()
Line
Count
Source
48
73.3M
  void SkipToNextArg() {
49
74.2M
    for (; Current != End; 
++Current914k
) {
50
3.07M
      // Skip erased elements.
51
3.07M
      if (!*Current)
52
2.32k
        continue;
53
3.07M
54
3.07M
      // Done if there are no filters.
55
3.07M
      if (!NumOptSpecifiers)
56
0
        return;
57
3.07M
58
3.07M
      // Otherwise require a match.
59
3.07M
      const Option &O = (*Current)->getOption();
60
3.07M
      for (auto Id : Ids) {
61
3.07M
        if (!Id.isValid())
62
0
          break;
63
3.07M
        if (O.matches(Id))
64
2.16M
          return;
65
3.07M
      }
66
3.07M
    }
67
73.3M
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 2u>::SkipToNextArg()
Line
Count
Source
48
16.3M
  void SkipToNextArg() {
49
16.4M
    for (; Current != End; 
++Current79.3k
) {
50
616k
      // Skip erased elements.
51
616k
      if (!*Current)
52
0
        continue;
53
616k
54
616k
      // Done if there are no filters.
55
616k
      if (!NumOptSpecifiers)
56
0
        return;
57
616k
58
616k
      // Otherwise require a match.
59
616k
      const Option &O = (*Current)->getOption();
60
749k
      for (auto Id : Ids) {
61
749k
        if (!Id.isValid())
62
0
          break;
63
749k
        if (O.matches(Id))
64
537k
          return;
65
749k
      }
66
616k
    }
67
16.3M
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 3u>::SkipToNextArg()
Line
Count
Source
48
5.73M
  void SkipToNextArg() {
49
5.93M
    for (; Current != End; 
++Current195k
) {
50
466k
      // Skip erased elements.
51
466k
      if (!*Current)
52
0
        continue;
53
466k
54
466k
      // Done if there are no filters.
55
466k
      if (!NumOptSpecifiers)
56
0
        return;
57
466k
58
466k
      // Otherwise require a match.
59
466k
      const Option &O = (*Current)->getOption();
60
877k
      for (auto Id : Ids) {
61
877k
        if (!Id.isValid())
62
52.8k
          break;
63
824k
        if (O.matches(Id))
64
270k
          return;
65
824k
      }
66
466k
    }
67
5.73M
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 4u>::SkipToNextArg()
Line
Count
Source
48
635k
  void SkipToNextArg() {
49
635k
    for (; Current != End; 
++Current591
) {
50
23.3k
      // Skip erased elements.
51
23.3k
      if (!*Current)
52
0
        continue;
53
23.3k
54
23.3k
      // Done if there are no filters.
55
23.3k
      if (!NumOptSpecifiers)
56
0
        return;
57
23.3k
58
23.3k
      // Otherwise require a match.
59
23.3k
      const Option &O = (*Current)->getOption();
60
52.9k
      for (auto Id : Ids) {
61
52.9k
        if (!Id.isValid())
62
0
          break;
63
52.9k
        if (O.matches(Id))
64
22.7k
          return;
65
52.9k
      }
66
23.3k
    }
67
635k
  }
llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 2u>::SkipToNextArg()
Line
Count
Source
48
100k
  void SkipToNextArg() {
49
100k
    for (; Current != End; 
++Current0
) {
50
21
      // Skip erased elements.
51
21
      if (!*Current)
52
0
        continue;
53
21
54
21
      // Done if there are no filters.
55
21
      if (!NumOptSpecifiers)
56
0
        return;
57
21
58
21
      // Otherwise require a match.
59
21
      const Option &O = (*Current)->getOption();
60
36
      for (auto Id : Ids) {
61
36
        if (!Id.isValid())
62
0
          break;
63
36
        if (O.matches(Id))
64
21
          return;
65
36
      }
66
21
    }
67
100k
  }
llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 1u>::SkipToNextArg()
Line
Count
Source
48
186k
  void SkipToNextArg() {
49
186k
    for (; Current != End; 
++Current0
) {
50
1.22k
      // Skip erased elements.
51
1.22k
      if (!*Current)
52
0
        continue;
53
1.22k
54
1.22k
      // Done if there are no filters.
55
1.22k
      if (!NumOptSpecifiers)
56
0
        return;
57
1.22k
58
1.22k
      // Otherwise require a match.
59
1.22k
      const Option &O = (*Current)->getOption();
60
1.22k
      for (auto Id : Ids) {
61
1.22k
        if (!Id.isValid())
62
0
          break;
63
1.22k
        if (O.matches(Id))
64
1.22k
          return;
65
1.22k
      }
66
1.22k
    }
67
186k
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 6u>::SkipToNextArg()
Line
Count
Source
48
59.6k
  void SkipToNextArg() {
49
59.6k
    for (; Current != End; 
++Current0
) {
50
34
      // Skip erased elements.
51
34
      if (!*Current)
52
0
        continue;
53
34
54
34
      // Done if there are no filters.
55
34
      if (!NumOptSpecifiers)
56
0
        return;
57
34
58
34
      // Otherwise require a match.
59
34
      const Option &O = (*Current)->getOption();
60
114
      for (auto Id : Ids) {
61
114
        if (!Id.isValid())
62
0
          break;
63
114
        if (O.matches(Id))
64
34
          return;
65
114
      }
66
34
    }
67
59.6k
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 8u>::SkipToNextArg()
Line
Count
Source
48
71.4k
  void SkipToNextArg() {
49
76.1k
    for (; Current != End; 
++Current4.63k
) {
50
11.2k
      // Skip erased elements.
51
11.2k
      if (!*Current)
52
0
        continue;
53
11.2k
54
11.2k
      // Done if there are no filters.
55
11.2k
      if (!NumOptSpecifiers)
56
0
        return;
57
11.2k
58
11.2k
      // Otherwise require a match.
59
11.2k
      const Option &O = (*Current)->getOption();
60
45.9k
      for (auto Id : Ids) {
61
45.9k
        if (!Id.isValid())
62
0
          break;
63
45.9k
        if (O.matches(Id))
64
6.65k
          return;
65
45.9k
      }
66
11.2k
    }
67
71.4k
  }
llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 4u>::SkipToNextArg()
Line
Count
Source
48
30.3k
  void SkipToNextArg() {
49
30.3k
    for (; Current != End; 
++Current0
) {
50
10
      // Skip erased elements.
51
10
      if (!*Current)
52
0
        continue;
53
10
54
10
      // Done if there are no filters.
55
10
      if (!NumOptSpecifiers)
56
0
        return;
57
10
58
10
      // Otherwise require a match.
59
10
      const Option &O = (*Current)->getOption();
60
27
      for (auto Id : Ids) {
61
27
        if (!Id.isValid())
62
0
          break;
63
27
        if (O.matches(Id))
64
10
          return;
65
27
      }
66
10
    }
67
30.3k
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 5u>::SkipToNextArg()
Line
Count
Source
48
60.4k
  void SkipToNextArg() {
49
60.4k
    for (; Current != End; 
++Current23
) {
50
253
      // Skip erased elements.
51
253
      if (!*Current)
52
0
        continue;
53
253
54
253
      // Done if there are no filters.
55
253
      if (!NumOptSpecifiers)
56
0
        return;
57
253
58
253
      // Otherwise require a match.
59
253
      const Option &O = (*Current)->getOption();
60
572
      for (auto Id : Ids) {
61
572
        if (!Id.isValid())
62
0
          break;
63
572
        if (O.matches(Id))
64
230
          return;
65
572
      }
66
253
    }
67
60.4k
  }
68
69
  using Traits = std::iterator_traits<BaseIter>;
70
71
public:
72
  using value_type = typename Traits::value_type;
73
  using reference = typename Traits::reference;
74
  using pointer = typename Traits::pointer;
75
  using iterator_category = std::forward_iterator_tag;
76
  using difference_type = std::ptrdiff_t;
77
78
  arg_iterator(
79
      BaseIter Current, BaseIter End,
80
      const OptSpecifier (&Ids)[NumOptSpecifiers ? NumOptSpecifiers : 1] = {})
81
95.2M
      : Current(Current), End(End) {
82
218M
    for (unsigned I = 0; I != NumOptSpecifiers; 
++I123M
)
83
123M
      this->Ids[I] = Ids[I];
84
95.2M
    SkipToNextArg();
85
95.2M
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 1u>::arg_iterator(llvm::opt::Arg* const*, llvm::opt::Arg* const*, llvm::opt::OptSpecifier const (&) [1])
Line
Count
Source
81
71.1M
      : Current(Current), End(End) {
82
142M
    for (unsigned I = 0; I != NumOptSpecifiers; 
++I71.1M
)
83
71.1M
      this->Ids[I] = Ids[I];
84
71.1M
    SkipToNextArg();
85
71.1M
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 2u>::arg_iterator(llvm::opt::Arg* const*, llvm::opt::Arg* const*, llvm::opt::OptSpecifier const (&) [2])
Line
Count
Source
81
15.7M
      : Current(Current), End(End) {
82
47.3M
    for (unsigned I = 0; I != NumOptSpecifiers; 
++I31.5M
)
83
31.5M
      this->Ids[I] = Ids[I];
84
15.7M
    SkipToNextArg();
85
15.7M
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 0u>::arg_iterator(llvm::opt::Arg* const*, llvm::opt::Arg* const*, llvm::opt::OptSpecifier const (&) [1])
Line
Count
Source
81
740k
      : Current(Current), End(End) {
82
740k
    for (unsigned I = 0; I != NumOptSpecifiers; 
++I0
)
83
0
      this->Ids[I] = Ids[I];
84
740k
    SkipToNextArg();
85
740k
  }
llvm::opt::arg_iterator<llvm::opt::Arg**, 0u>::arg_iterator(llvm::opt::Arg**, llvm::opt::Arg**, llvm::opt::OptSpecifier const (&) [1])
Line
Count
Source
81
872k
      : Current(Current), End(End) {
82
872k
    for (unsigned I = 0; I != NumOptSpecifiers; 
++I0
)
83
0
      this->Ids[I] = Ids[I];
84
872k
    SkipToNextArg();
85
872k
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 3u>::arg_iterator(llvm::opt::Arg* const*, llvm::opt::Arg* const*, llvm::opt::OptSpecifier const (&) [3])
Line
Count
Source
81
5.46M
      : Current(Current), End(End) {
82
21.8M
    for (unsigned I = 0; I != NumOptSpecifiers; 
++I16.4M
)
83
16.4M
      this->Ids[I] = Ids[I];
84
5.46M
    SkipToNextArg();
85
5.46M
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 4u>::arg_iterator(llvm::opt::Arg* const*, llvm::opt::Arg* const*, llvm::opt::OptSpecifier const (&) [4])
Line
Count
Source
81
612k
      : Current(Current), End(End) {
82
3.06M
    for (unsigned I = 0; I != NumOptSpecifiers; 
++I2.44M
)
83
2.44M
      this->Ids[I] = Ids[I];
84
612k
    SkipToNextArg();
85
612k
  }
llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 2u>::arg_iterator(std::__1::reverse_iterator<llvm::opt::Arg* const*>, std::__1::reverse_iterator<llvm::opt::Arg* const*>, llvm::opt::OptSpecifier const (&) [2])
Line
Count
Source
81
100k
      : Current(Current), End(End) {
82
302k
    for (unsigned I = 0; I != NumOptSpecifiers; 
++I201k
)
83
201k
      this->Ids[I] = Ids[I];
84
100k
    SkipToNextArg();
85
100k
  }
llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 1u>::arg_iterator(std::__1::reverse_iterator<llvm::opt::Arg* const*>, std::__1::reverse_iterator<llvm::opt::Arg* const*>, llvm::opt::OptSpecifier const (&) [1])
Line
Count
Source
81
185k
      : Current(Current), End(End) {
82
370k
    for (unsigned I = 0; I != NumOptSpecifiers; 
++I185k
)
83
185k
      this->Ids[I] = Ids[I];
84
185k
    SkipToNextArg();
85
185k
  }
llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 0u>::arg_iterator(std::__1::reverse_iterator<llvm::opt::Arg* const*>, std::__1::reverse_iterator<llvm::opt::Arg* const*>, llvm::opt::OptSpecifier const (&) [1])
Line
Count
Source
81
124k
      : Current(Current), End(End) {
82
124k
    for (unsigned I = 0; I != NumOptSpecifiers; 
++I0
)
83
0
      this->Ids[I] = Ids[I];
84
124k
    SkipToNextArg();
85
124k
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 6u>::arg_iterator(llvm::opt::Arg* const*, llvm::opt::Arg* const*, llvm::opt::OptSpecifier const (&) [6])
Line
Count
Source
81
59.6k
      : Current(Current), End(End) {
82
417k
    for (unsigned I = 0; I != NumOptSpecifiers; 
++I357k
)
83
357k
      this->Ids[I] = Ids[I];
84
59.6k
    SkipToNextArg();
85
59.6k
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 8u>::arg_iterator(llvm::opt::Arg* const*, llvm::opt::Arg* const*, llvm::opt::OptSpecifier const (&) [8])
Line
Count
Source
81
64.8k
      : Current(Current), End(End) {
82
583k
    for (unsigned I = 0; I != NumOptSpecifiers; 
++I518k
)
83
518k
      this->Ids[I] = Ids[I];
84
64.8k
    SkipToNextArg();
85
64.8k
  }
llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 4u>::arg_iterator(std::__1::reverse_iterator<llvm::opt::Arg* const*>, std::__1::reverse_iterator<llvm::opt::Arg* const*>, llvm::opt::OptSpecifier const (&) [4])
Line
Count
Source
81
30.3k
      : Current(Current), End(End) {
82
151k
    for (unsigned I = 0; I != NumOptSpecifiers; 
++I121k
)
83
121k
      this->Ids[I] = Ids[I];
84
30.3k
    SkipToNextArg();
85
30.3k
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 5u>::arg_iterator(llvm::opt::Arg* const*, llvm::opt::Arg* const*, llvm::opt::OptSpecifier const (&) [5])
Line
Count
Source
81
60.1k
      : Current(Current), End(End) {
82
361k
    for (unsigned I = 0; I != NumOptSpecifiers; 
++I300k
)
83
300k
      this->Ids[I] = Ids[I];
84
60.1k
    SkipToNextArg();
85
60.1k
  }
86
87
22.9M
  reference operator*() const { return *Current; }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 1u>::operator*() const
Line
Count
Source
87
2.16M
  reference operator*() const { return *Current; }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 2u>::operator*() const
Line
Count
Source
87
537k
  reference operator*() const { return *Current; }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 0u>::operator*() const
Line
Count
Source
87
9.51M
  reference operator*() const { return *Current; }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 3u>::operator*() const
Line
Count
Source
87
270k
  reference operator*() const { return *Current; }
llvm::opt::arg_iterator<llvm::opt::Arg**, 0u>::operator*() const
Line
Count
Source
87
9.01M
  reference operator*() const { return *Current; }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 4u>::operator*() const
Line
Count
Source
87
22.7k
  reference operator*() const { return *Current; }
llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 2u>::operator*() const
Line
Count
Source
87
21
  reference operator*() const { return *Current; }
llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 1u>::operator*() const
Line
Count
Source
87
1.22k
  reference operator*() const { return *Current; }
llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 0u>::operator*() const
Line
Count
Source
87
1.38M
  reference operator*() const { return *Current; }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 6u>::operator*() const
Line
Count
Source
87
34
  reference operator*() const { return *Current; }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 8u>::operator*() const
Line
Count
Source
87
6.65k
  reference operator*() const { return *Current; }
llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 4u>::operator*() const
Line
Count
Source
87
10
  reference operator*() const { return *Current; }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 5u>::operator*() const
Line
Count
Source
87
230
  reference operator*() const { return *Current; }
88
  pointer operator->() const { return Current; }
89
90
22.9M
  arg_iterator &operator++() {
91
22.9M
    ++Current;
92
22.9M
    SkipToNextArg();
93
22.9M
    return *this;
94
22.9M
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 1u>::operator++()
Line
Count
Source
90
2.16M
  arg_iterator &operator++() {
91
2.16M
    ++Current;
92
2.16M
    SkipToNextArg();
93
2.16M
    return *this;
94
2.16M
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 2u>::operator++()
Line
Count
Source
90
537k
  arg_iterator &operator++() {
91
537k
    ++Current;
92
537k
    SkipToNextArg();
93
537k
    return *this;
94
537k
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 0u>::operator++()
Line
Count
Source
90
9.51M
  arg_iterator &operator++() {
91
9.51M
    ++Current;
92
9.51M
    SkipToNextArg();
93
9.51M
    return *this;
94
9.51M
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 3u>::operator++()
Line
Count
Source
90
270k
  arg_iterator &operator++() {
91
270k
    ++Current;
92
270k
    SkipToNextArg();
93
270k
    return *this;
94
270k
  }
llvm::opt::arg_iterator<llvm::opt::Arg**, 0u>::operator++()
Line
Count
Source
90
9.01M
  arg_iterator &operator++() {
91
9.01M
    ++Current;
92
9.01M
    SkipToNextArg();
93
9.01M
    return *this;
94
9.01M
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 4u>::operator++()
Line
Count
Source
90
22.7k
  arg_iterator &operator++() {
91
22.7k
    ++Current;
92
22.7k
    SkipToNextArg();
93
22.7k
    return *this;
94
22.7k
  }
Unexecuted instantiation: llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 2u>::operator++()
llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 1u>::operator++()
Line
Count
Source
90
1.06k
  arg_iterator &operator++() {
91
1.06k
    ++Current;
92
1.06k
    SkipToNextArg();
93
1.06k
    return *this;
94
1.06k
  }
llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 0u>::operator++()
Line
Count
Source
90
1.38M
  arg_iterator &operator++() {
91
1.38M
    ++Current;
92
1.38M
    SkipToNextArg();
93
1.38M
    return *this;
94
1.38M
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 6u>::operator++()
Line
Count
Source
90
34
  arg_iterator &operator++() {
91
34
    ++Current;
92
34
    SkipToNextArg();
93
34
    return *this;
94
34
  }
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 8u>::operator++()
Line
Count
Source
90
6.65k
  arg_iterator &operator++() {
91
6.65k
    ++Current;
92
6.65k
    SkipToNextArg();
93
6.65k
    return *this;
94
6.65k
  }
Unexecuted instantiation: llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 4u>::operator++()
llvm::opt::arg_iterator<llvm::opt::Arg* const*, 5u>::operator++()
Line
Count
Source
90
230
  arg_iterator &operator++() {
91
230
    ++Current;
92
230
    SkipToNextArg();
93
230
    return *this;
94
230
  }
95
96
  arg_iterator operator++(int) {
97
    arg_iterator tmp(*this);
98
    ++(*this);
99
    return tmp;
100
  }
101
102
70.5M
  friend bool operator==(arg_iterator LHS, arg_iterator RHS) {
103
70.5M
    return LHS.Current == RHS.Current;
104
70.5M
  }
llvm::opt::operator==(llvm::opt::arg_iterator<llvm::opt::Arg* const*, 1u>, llvm::opt::arg_iterator<llvm::opt::Arg* const*, 1u>)
Line
Count
Source
102
37.7M
  friend bool operator==(arg_iterator LHS, arg_iterator RHS) {
103
37.7M
    return LHS.Current == RHS.Current;
104
37.7M
  }
llvm::opt::operator==(llvm::opt::arg_iterator<llvm::opt::Arg* const*, 2u>, llvm::opt::arg_iterator<llvm::opt::Arg* const*, 2u>)
Line
Count
Source
102
8.43M
  friend bool operator==(arg_iterator LHS, arg_iterator RHS) {
103
8.43M
    return LHS.Current == RHS.Current;
104
8.43M
  }
llvm::opt::operator==(llvm::opt::arg_iterator<llvm::opt::Arg* const*, 0u>, llvm::opt::arg_iterator<llvm::opt::Arg* const*, 0u>)
Line
Count
Source
102
9.88M
  friend bool operator==(arg_iterator LHS, arg_iterator RHS) {
103
9.88M
    return LHS.Current == RHS.Current;
104
9.88M
  }
llvm::opt::operator==(llvm::opt::arg_iterator<llvm::opt::Arg* const*, 3u>, llvm::opt::arg_iterator<llvm::opt::Arg* const*, 3u>)
Line
Count
Source
102
3.00M
  friend bool operator==(arg_iterator LHS, arg_iterator RHS) {
103
3.00M
    return LHS.Current == RHS.Current;
104
3.00M
  }
llvm::opt::operator==(llvm::opt::arg_iterator<llvm::opt::Arg**, 0u>, llvm::opt::arg_iterator<llvm::opt::Arg**, 0u>)
Line
Count
Source
102
9.44M
  friend bool operator==(arg_iterator LHS, arg_iterator RHS) {
103
9.44M
    return LHS.Current == RHS.Current;
104
9.44M
  }
llvm::opt::operator==(llvm::opt::arg_iterator<llvm::opt::Arg* const*, 4u>, llvm::opt::arg_iterator<llvm::opt::Arg* const*, 4u>)
Line
Count
Source
102
329k
  friend bool operator==(arg_iterator LHS, arg_iterator RHS) {
103
329k
    return LHS.Current == RHS.Current;
104
329k
  }
llvm::opt::operator==(llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 2u>, llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 2u>)
Line
Count
Source
102
50.4k
  friend bool operator==(arg_iterator LHS, arg_iterator RHS) {
103
50.4k
    return LHS.Current == RHS.Current;
104
50.4k
  }
llvm::opt::operator==(llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 1u>, llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 1u>)
Line
Count
Source
102
93.7k
  friend bool operator==(arg_iterator LHS, arg_iterator RHS) {
103
93.7k
    return LHS.Current == RHS.Current;
104
93.7k
  }
llvm::opt::operator==(llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 0u>, llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 0u>)
Line
Count
Source
102
1.44M
  friend bool operator==(arg_iterator LHS, arg_iterator RHS) {
103
1.44M
    return LHS.Current == RHS.Current;
104
1.44M
  }
llvm::opt::operator==(llvm::opt::arg_iterator<llvm::opt::Arg* const*, 6u>, llvm::opt::arg_iterator<llvm::opt::Arg* const*, 6u>)
Line
Count
Source
102
29.8k
  friend bool operator==(arg_iterator LHS, arg_iterator RHS) {
103
29.8k
    return LHS.Current == RHS.Current;
104
29.8k
  }
llvm::opt::operator==(llvm::opt::arg_iterator<llvm::opt::Arg* const*, 8u>, llvm::opt::arg_iterator<llvm::opt::Arg* const*, 8u>)
Line
Count
Source
102
39.0k
  friend bool operator==(arg_iterator LHS, arg_iterator RHS) {
103
39.0k
    return LHS.Current == RHS.Current;
104
39.0k
  }
llvm::opt::operator==(llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 4u>, llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 4u>)
Line
Count
Source
102
15.1k
  friend bool operator==(arg_iterator LHS, arg_iterator RHS) {
103
15.1k
    return LHS.Current == RHS.Current;
104
15.1k
  }
llvm::opt::operator==(llvm::opt::arg_iterator<llvm::opt::Arg* const*, 5u>, llvm::opt::arg_iterator<llvm::opt::Arg* const*, 5u>)
Line
Count
Source
102
30.3k
  friend bool operator==(arg_iterator LHS, arg_iterator RHS) {
103
30.3k
    return LHS.Current == RHS.Current;
104
30.3k
  }
105
70.5M
  friend bool operator!=(arg_iterator LHS, arg_iterator RHS) {
106
70.5M
    return !(LHS == RHS);
107
70.5M
  }
llvm::opt::operator!=(llvm::opt::arg_iterator<llvm::opt::Arg* const*, 1u>, llvm::opt::arg_iterator<llvm::opt::Arg* const*, 1u>)
Line
Count
Source
105
37.7M
  friend bool operator!=(arg_iterator LHS, arg_iterator RHS) {
106
37.7M
    return !(LHS == RHS);
107
37.7M
  }
llvm::opt::operator!=(llvm::opt::arg_iterator<llvm::opt::Arg* const*, 2u>, llvm::opt::arg_iterator<llvm::opt::Arg* const*, 2u>)
Line
Count
Source
105
8.43M
  friend bool operator!=(arg_iterator LHS, arg_iterator RHS) {
106
8.43M
    return !(LHS == RHS);
107
8.43M
  }
llvm::opt::operator!=(llvm::opt::arg_iterator<llvm::opt::Arg* const*, 0u>, llvm::opt::arg_iterator<llvm::opt::Arg* const*, 0u>)
Line
Count
Source
105
9.88M
  friend bool operator!=(arg_iterator LHS, arg_iterator RHS) {
106
9.88M
    return !(LHS == RHS);
107
9.88M
  }
llvm::opt::operator!=(llvm::opt::arg_iterator<llvm::opt::Arg* const*, 3u>, llvm::opt::arg_iterator<llvm::opt::Arg* const*, 3u>)
Line
Count
Source
105
3.00M
  friend bool operator!=(arg_iterator LHS, arg_iterator RHS) {
106
3.00M
    return !(LHS == RHS);
107
3.00M
  }
llvm::opt::operator!=(llvm::opt::arg_iterator<llvm::opt::Arg**, 0u>, llvm::opt::arg_iterator<llvm::opt::Arg**, 0u>)
Line
Count
Source
105
9.44M
  friend bool operator!=(arg_iterator LHS, arg_iterator RHS) {
106
9.44M
    return !(LHS == RHS);
107
9.44M
  }
llvm::opt::operator!=(llvm::opt::arg_iterator<llvm::opt::Arg* const*, 4u>, llvm::opt::arg_iterator<llvm::opt::Arg* const*, 4u>)
Line
Count
Source
105
329k
  friend bool operator!=(arg_iterator LHS, arg_iterator RHS) {
106
329k
    return !(LHS == RHS);
107
329k
  }
llvm::opt::operator!=(llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 2u>, llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 2u>)
Line
Count
Source
105
50.4k
  friend bool operator!=(arg_iterator LHS, arg_iterator RHS) {
106
50.4k
    return !(LHS == RHS);
107
50.4k
  }
llvm::opt::operator!=(llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 1u>, llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 1u>)
Line
Count
Source
105
93.7k
  friend bool operator!=(arg_iterator LHS, arg_iterator RHS) {
106
93.7k
    return !(LHS == RHS);
107
93.7k
  }
llvm::opt::operator!=(llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 0u>, llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 0u>)
Line
Count
Source
105
1.44M
  friend bool operator!=(arg_iterator LHS, arg_iterator RHS) {
106
1.44M
    return !(LHS == RHS);
107
1.44M
  }
llvm::opt::operator!=(llvm::opt::arg_iterator<llvm::opt::Arg* const*, 6u>, llvm::opt::arg_iterator<llvm::opt::Arg* const*, 6u>)
Line
Count
Source
105
29.8k
  friend bool operator!=(arg_iterator LHS, arg_iterator RHS) {
106
29.8k
    return !(LHS == RHS);
107
29.8k
  }
llvm::opt::operator!=(llvm::opt::arg_iterator<llvm::opt::Arg* const*, 8u>, llvm::opt::arg_iterator<llvm::opt::Arg* const*, 8u>)
Line
Count
Source
105
39.0k
  friend bool operator!=(arg_iterator LHS, arg_iterator RHS) {
106
39.0k
    return !(LHS == RHS);
107
39.0k
  }
llvm::opt::operator!=(llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 4u>, llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, 4u>)
Line
Count
Source
105
15.1k
  friend bool operator!=(arg_iterator LHS, arg_iterator RHS) {
106
15.1k
    return !(LHS == RHS);
107
15.1k
  }
llvm::opt::operator!=(llvm::opt::arg_iterator<llvm::opt::Arg* const*, 5u>, llvm::opt::arg_iterator<llvm::opt::Arg* const*, 5u>)
Line
Count
Source
105
30.3k
  friend bool operator!=(arg_iterator LHS, arg_iterator RHS) {
106
30.3k
    return !(LHS == RHS);
107
30.3k
  }
108
};
109
110
/// ArgList - Ordered collection of driver arguments.
111
///
112
/// The ArgList class manages a list of Arg instances as well as
113
/// auxiliary data and convenience methods to allow Tools to quickly
114
/// check for the presence of Arg instances for a particular Option
115
/// and to iterate over groups of arguments.
116
class ArgList {
117
public:
118
  using arglist_type = SmallVector<Arg *, 16>;
119
  using iterator = arg_iterator<arglist_type::iterator>;
120
  using const_iterator = arg_iterator<arglist_type::const_iterator>;
121
  using reverse_iterator = arg_iterator<arglist_type::reverse_iterator>;
122
  using const_reverse_iterator =
123
      arg_iterator<arglist_type::const_reverse_iterator>;
124
125
  template<unsigned N> using filtered_iterator =
126
      arg_iterator<arglist_type::const_iterator, N>;
127
  template<unsigned N> using filtered_reverse_iterator =
128
      arg_iterator<arglist_type::const_reverse_iterator, N>;
129
130
private:
131
  /// The internal list of arguments.
132
  arglist_type Args;
133
134
  using OptRange = std::pair<unsigned, unsigned>;
135
57.6M
  static OptRange emptyRange() { return {-1u, 0u}; }
136
137
  /// The first and last index of each different OptSpecifier ID.
138
  DenseMap<unsigned, OptRange> OptRanges;
139
140
  /// Get the range of indexes in which options with the specified IDs might
141
  /// reside, or (0, 0) if there are no such options.
142
  OptRange getRange(std::initializer_list<OptSpecifier> Ids) const;
143
144
protected:
145
  // Make the default special members protected so they won't be used to slice
146
  // derived objects, but can still be used by derived objects to implement
147
  // their own special members.
148
170k
  ArgList() = default;
149
150
  // Explicit move operations to ensure the container is cleared post-move
151
  // otherwise it could lead to a double-delete in the case of moving of an
152
  // InputArgList which deletes the contents of the container. If we could fix
153
  // up the ownership here (delegate storage/ownership to the derived class so
154
  // it can be a container of unique_ptr) this would be simpler.
155
  ArgList(ArgList &&RHS)
156
91.1k
      : Args(std::move(RHS.Args)), OptRanges(std::move(RHS.OptRanges)) {
157
91.1k
    RHS.Args.clear();
158
91.1k
    RHS.OptRanges.clear();
159
91.1k
  }
160
161
  ArgList &operator=(ArgList &&RHS) {
162
    Args = std::move(RHS.Args);
163
    RHS.Args.clear();
164
    OptRanges = std::move(RHS.OptRanges);
165
    RHS.OptRanges.clear();
166
    return *this;
167
  }
168
169
  // Protect the dtor to ensure this type is never destroyed polymorphically.
170
261k
  ~ArgList() = default;
171
172
  // Implicitly convert a value to an OptSpecifier. Used to work around a bug
173
  // in MSVC's implementation of narrowing conversion checking.
174
184M
  static OptSpecifier toOptSpecifier(OptSpecifier S) { return S; }
175
176
public:
177
  /// @name Arg Access
178
  /// @{
179
180
  /// append - Append \p A to the arg list.
181
  void append(Arg *A);
182
183
0
  const arglist_type &getArgs() const { return Args; }
184
185
  unsigned size() const { return Args.size(); }
186
187
  /// @}
188
  /// @name Arg Iteration
189
  /// @{
190
191
436k
  iterator begin() { return {Args.begin(), Args.end()}; }
192
436k
  iterator end() { return {Args.end(), Args.end()}; }
193
194
  reverse_iterator rbegin() { return {Args.rbegin(), Args.rend()}; }
195
  reverse_iterator rend() { return {Args.rend(), Args.rend()}; }
196
197
370k
  const_iterator begin() const { return {Args.begin(), Args.end()}; }
198
370k
  const_iterator end() const { return {Args.end(), Args.end()}; }
199
200
62.1k
  const_reverse_iterator rbegin() const { return {Args.rbegin(), Args.rend()}; }
201
62.1k
  const_reverse_iterator rend() const { return {Args.rend(), Args.rend()}; }
202
203
  template<typename ...OptSpecifiers>
204
  iterator_range<filtered_iterator<sizeof...(OptSpecifiers)>>
205
46.2M
  filtered(OptSpecifiers ...Ids) const {
206
46.2M
    OptRange Range = getRange({toOptSpecifier(Ids)...});
207
46.2M
    auto B = Args.begin() + Range.first;
208
46.2M
    auto E = Args.begin() + Range.second;
209
46.2M
    using Iterator = filtered_iterator<sizeof...(OptSpecifiers)>;
210
46.2M
    return make_range(Iterator(B, E, {toOptSpecifier(Ids)...}),
211
46.2M
                      Iterator(E, E, {toOptSpecifier(Ids)...}));
212
46.2M
  }
llvm::iterator_range<llvm::opt::arg_iterator<llvm::opt::Arg* const*, sizeof...(clang::driver::options::ID)> > llvm::opt::ArgList::filtered<clang::driver::options::ID>(clang::driver::options::ID) const
Line
Count
Source
205
29.7M
  filtered(OptSpecifiers ...Ids) const {
206
29.7M
    OptRange Range = getRange({toOptSpecifier(Ids)...});
207
29.7M
    auto B = Args.begin() + Range.first;
208
29.7M
    auto E = Args.begin() + Range.second;
209
29.7M
    using Iterator = filtered_iterator<sizeof...(OptSpecifiers)>;
210
29.7M
    return make_range(Iterator(B, E, {toOptSpecifier(Ids)...}),
211
29.7M
                      Iterator(E, E, {toOptSpecifier(Ids)...}));
212
29.7M
  }
llvm::iterator_range<llvm::opt::arg_iterator<llvm::opt::Arg* const*, sizeof...(clang::driver::options::ID, clang::driver::options::ID)> > llvm::opt::ArgList::filtered<clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
205
2.45M
  filtered(OptSpecifiers ...Ids) const {
206
2.45M
    OptRange Range = getRange({toOptSpecifier(Ids)...});
207
2.45M
    auto B = Args.begin() + Range.first;
208
2.45M
    auto E = Args.begin() + Range.second;
209
2.45M
    using Iterator = filtered_iterator<sizeof...(OptSpecifiers)>;
210
2.45M
    return make_range(Iterator(B, E, {toOptSpecifier(Ids)...}),
211
2.45M
                      Iterator(E, E, {toOptSpecifier(Ids)...}));
212
2.45M
  }
llvm::iterator_range<llvm::opt::arg_iterator<llvm::opt::Arg* const*, sizeof...(llvm::opt::OptSpecifier)> > llvm::opt::ArgList::filtered<llvm::opt::OptSpecifier>(llvm::opt::OptSpecifier) const
Line
Count
Source
205
5.12M
  filtered(OptSpecifiers ...Ids) const {
206
5.12M
    OptRange Range = getRange({toOptSpecifier(Ids)...});
207
5.12M
    auto B = Args.begin() + Range.first;
208
5.12M
    auto E = Args.begin() + Range.second;
209
5.12M
    using Iterator = filtered_iterator<sizeof...(OptSpecifiers)>;
210
5.12M
    return make_range(Iterator(B, E, {toOptSpecifier(Ids)...}),
211
5.12M
                      Iterator(E, E, {toOptSpecifier(Ids)...}));
212
5.12M
  }
llvm::iterator_range<llvm::opt::arg_iterator<llvm::opt::Arg* const*, sizeof...(llvm::opt::OptSpecifier, llvm::opt::OptSpecifier)> > llvm::opt::ArgList::filtered<llvm::opt::OptSpecifier, llvm::opt::OptSpecifier>(llvm::opt::OptSpecifier, llvm::opt::OptSpecifier) const
Line
Count
Source
205
5.41M
  filtered(OptSpecifiers ...Ids) const {
206
5.41M
    OptRange Range = getRange({toOptSpecifier(Ids)...});
207
5.41M
    auto B = Args.begin() + Range.first;
208
5.41M
    auto E = Args.begin() + Range.second;
209
5.41M
    using Iterator = filtered_iterator<sizeof...(OptSpecifiers)>;
210
5.41M
    return make_range(Iterator(B, E, {toOptSpecifier(Ids)...}),
211
5.41M
                      Iterator(E, E, {toOptSpecifier(Ids)...}));
212
5.41M
  }
llvm::iterator_range<llvm::opt::arg_iterator<llvm::opt::Arg* const*, sizeof...(llvm::opt::OptSpecifier, llvm::opt::OptSpecifier, llvm::opt::OptSpecifier)> > llvm::opt::ArgList::filtered<llvm::opt::OptSpecifier, llvm::opt::OptSpecifier, llvm::opt::OptSpecifier>(llvm::opt::OptSpecifier, llvm::opt::OptSpecifier, llvm::opt::OptSpecifier) const
Line
Count
Source
205
2.15M
  filtered(OptSpecifiers ...Ids) const {
206
2.15M
    OptRange Range = getRange({toOptSpecifier(Ids)...});
207
2.15M
    auto B = Args.begin() + Range.first;
208
2.15M
    auto E = Args.begin() + Range.second;
209
2.15M
    using Iterator = filtered_iterator<sizeof...(OptSpecifiers)>;
210
2.15M
    return make_range(Iterator(B, E, {toOptSpecifier(Ids)...}),
211
2.15M
                      Iterator(E, E, {toOptSpecifier(Ids)...}));
212
2.15M
  }
llvm::iterator_range<llvm::opt::arg_iterator<llvm::opt::Arg* const*, sizeof...(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID)> > llvm::opt::ArgList::filtered<clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
205
306k
  filtered(OptSpecifiers ...Ids) const {
206
306k
    OptRange Range = getRange({toOptSpecifier(Ids)...});
207
306k
    auto B = Args.begin() + Range.first;
208
306k
    auto E = Args.begin() + Range.second;
209
306k
    using Iterator = filtered_iterator<sizeof...(OptSpecifiers)>;
210
306k
    return make_range(Iterator(B, E, {toOptSpecifier(Ids)...}),
211
306k
                      Iterator(E, E, {toOptSpecifier(Ids)...}));
212
306k
  }
llvm::iterator_range<llvm::opt::arg_iterator<llvm::opt::Arg* const*, sizeof...(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID)> > llvm::opt::ArgList::filtered<clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
205
568k
  filtered(OptSpecifiers ...Ids) const {
206
568k
    OptRange Range = getRange({toOptSpecifier(Ids)...});
207
568k
    auto B = Args.begin() + Range.first;
208
568k
    auto E = Args.begin() + Range.second;
209
568k
    using Iterator = filtered_iterator<sizeof...(OptSpecifiers)>;
210
568k
    return make_range(Iterator(B, E, {toOptSpecifier(Ids)...}),
211
568k
                      Iterator(E, E, {toOptSpecifier(Ids)...}));
212
568k
  }
llvm::iterator_range<llvm::opt::arg_iterator<llvm::opt::Arg* const*, sizeof...(llvm::opt::Option const*)> > llvm::opt::ArgList::filtered<llvm::opt::Option const*>(llvm::opt::Option const*) const
Line
Count
Source
205
4.24k
  filtered(OptSpecifiers ...Ids) const {
206
4.24k
    OptRange Range = getRange({toOptSpecifier(Ids)...});
207
4.24k
    auto B = Args.begin() + Range.first;
208
4.24k
    auto E = Args.begin() + Range.second;
209
4.24k
    using Iterator = filtered_iterator<sizeof...(OptSpecifiers)>;
210
4.24k
    return make_range(Iterator(B, E, {toOptSpecifier(Ids)...}),
211
4.24k
                      Iterator(E, E, {toOptSpecifier(Ids)...}));
212
4.24k
  }
llvm::iterator_range<llvm::opt::arg_iterator<llvm::opt::Arg* const*, sizeof...(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID)> > llvm::opt::ArgList::filtered<clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
205
29.8k
  filtered(OptSpecifiers ...Ids) const {
206
29.8k
    OptRange Range = getRange({toOptSpecifier(Ids)...});
207
29.8k
    auto B = Args.begin() + Range.first;
208
29.8k
    auto E = Args.begin() + Range.second;
209
29.8k
    using Iterator = filtered_iterator<sizeof...(OptSpecifiers)>;
210
29.8k
    return make_range(Iterator(B, E, {toOptSpecifier(Ids)...}),
211
29.8k
                      Iterator(E, E, {toOptSpecifier(Ids)...}));
212
29.8k
  }
llvm::iterator_range<llvm::opt::arg_iterator<llvm::opt::Arg* const*, sizeof...(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID)> > llvm::opt::ArgList::filtered<clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
205
32.4k
  filtered(OptSpecifiers ...Ids) const {
206
32.4k
    OptRange Range = getRange({toOptSpecifier(Ids)...});
207
32.4k
    auto B = Args.begin() + Range.first;
208
32.4k
    auto E = Args.begin() + Range.second;
209
32.4k
    using Iterator = filtered_iterator<sizeof...(OptSpecifiers)>;
210
32.4k
    return make_range(Iterator(B, E, {toOptSpecifier(Ids)...}),
211
32.4k
                      Iterator(E, E, {toOptSpecifier(Ids)...}));
212
32.4k
  }
llvm::iterator_range<llvm::opt::arg_iterator<llvm::opt::Arg* const*, sizeof...(unsigned int)> > llvm::opt::ArgList::filtered<unsigned int>(unsigned int) const
Line
Count
Source
205
385k
  filtered(OptSpecifiers ...Ids) const {
206
385k
    OptRange Range = getRange({toOptSpecifier(Ids)...});
207
385k
    auto B = Args.begin() + Range.first;
208
385k
    auto E = Args.begin() + Range.second;
209
385k
    using Iterator = filtered_iterator<sizeof...(OptSpecifiers)>;
210
385k
    return make_range(Iterator(B, E, {toOptSpecifier(Ids)...}),
211
385k
                      Iterator(E, E, {toOptSpecifier(Ids)...}));
212
385k
  }
llvm::iterator_range<llvm::opt::arg_iterator<llvm::opt::Arg* const*, sizeof...(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID)> > llvm::opt::ArgList::filtered<clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
205
29.8k
  filtered(OptSpecifiers ...Ids) const {
206
29.8k
    OptRange Range = getRange({toOptSpecifier(Ids)...});
207
29.8k
    auto B = Args.begin() + Range.first;
208
29.8k
    auto E = Args.begin() + Range.second;
209
29.8k
    using Iterator = filtered_iterator<sizeof...(OptSpecifiers)>;
210
29.8k
    return make_range(Iterator(B, E, {toOptSpecifier(Ids)...}),
211
29.8k
                      Iterator(E, E, {toOptSpecifier(Ids)...}));
212
29.8k
  }
213
214
  template<typename ...OptSpecifiers>
215
  iterator_range<filtered_reverse_iterator<sizeof...(OptSpecifiers)>>
216
128k
  filtered_reverse(OptSpecifiers ...Ids) const {
217
128k
    OptRange Range = getRange({toOptSpecifier(Ids)...});
218
128k
    auto B = Args.rend() - Range.second;
219
128k
    auto E = Args.rend() - Range.first;
220
128k
    using Iterator = filtered_reverse_iterator<sizeof...(OptSpecifiers)>;
221
128k
    return make_range(Iterator(B, E, {toOptSpecifier(Ids)...}),
222
128k
                      Iterator(E, E, {toOptSpecifier(Ids)...}));
223
128k
  }
llvm::iterator_range<llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, sizeof...(clang::driver::options::ID, clang::driver::options::ID)> > llvm::opt::ArgList::filtered_reverse<clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
216
50.4k
  filtered_reverse(OptSpecifiers ...Ids) const {
217
50.4k
    OptRange Range = getRange({toOptSpecifier(Ids)...});
218
50.4k
    auto B = Args.rend() - Range.second;
219
50.4k
    auto E = Args.rend() - Range.first;
220
50.4k
    using Iterator = filtered_reverse_iterator<sizeof...(OptSpecifiers)>;
221
50.4k
    return make_range(Iterator(B, E, {toOptSpecifier(Ids)...}),
222
50.4k
                      Iterator(E, E, {toOptSpecifier(Ids)...}));
223
50.4k
  }
llvm::iterator_range<llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, sizeof...(clang::driver::options::ID)> > llvm::opt::ArgList::filtered_reverse<clang::driver::options::ID>(clang::driver::options::ID) const
Line
Count
Source
216
62.6k
  filtered_reverse(OptSpecifiers ...Ids) const {
217
62.6k
    OptRange Range = getRange({toOptSpecifier(Ids)...});
218
62.6k
    auto B = Args.rend() - Range.second;
219
62.6k
    auto E = Args.rend() - Range.first;
220
62.6k
    using Iterator = filtered_reverse_iterator<sizeof...(OptSpecifiers)>;
221
62.6k
    return make_range(Iterator(B, E, {toOptSpecifier(Ids)...}),
222
62.6k
                      Iterator(E, E, {toOptSpecifier(Ids)...}));
223
62.6k
  }
llvm::iterator_range<llvm::opt::arg_iterator<std::__1::reverse_iterator<llvm::opt::Arg* const*>, sizeof...(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID)> > llvm::opt::ArgList::filtered_reverse<clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
216
15.1k
  filtered_reverse(OptSpecifiers ...Ids) const {
217
15.1k
    OptRange Range = getRange({toOptSpecifier(Ids)...});
218
15.1k
    auto B = Args.rend() - Range.second;
219
15.1k
    auto E = Args.rend() - Range.first;
220
15.1k
    using Iterator = filtered_reverse_iterator<sizeof...(OptSpecifiers)>;
221
15.1k
    return make_range(Iterator(B, E, {toOptSpecifier(Ids)...}),
222
15.1k
                      Iterator(E, E, {toOptSpecifier(Ids)...}));
223
15.1k
  }
224
225
  /// @}
226
  /// @name Arg Removal
227
  /// @{
228
229
  /// eraseArg - Remove any option matching \p Id.
230
  void eraseArg(OptSpecifier Id);
231
232
  /// @}
233
  /// @name Arg Access
234
  /// @{
235
236
  /// hasArg - Does the arg list contain any option matching \p Id.
237
  ///
238
  /// \p Claim Whether the argument should be claimed, if it exists.
239
  template<typename ...OptSpecifiers>
240
83.2k
  bool hasArgNoClaim(OptSpecifiers ...Ids) const {
241
83.2k
    return getLastArgNoClaim(Ids...) != nullptr;
242
83.2k
  }
bool llvm::opt::ArgList::hasArgNoClaim<clang::driver::options::ID>(clang::driver::options::ID) const
Line
Count
Source
240
47.9k
  bool hasArgNoClaim(OptSpecifiers ...Ids) const {
241
47.9k
    return getLastArgNoClaim(Ids...) != nullptr;
242
47.9k
  }
bool llvm::opt::ArgList::hasArgNoClaim<clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
240
15.1k
  bool hasArgNoClaim(OptSpecifiers ...Ids) const {
241
15.1k
    return getLastArgNoClaim(Ids...) != nullptr;
242
15.1k
  }
bool llvm::opt::ArgList::hasArgNoClaim<clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
240
20.1k
  bool hasArgNoClaim(OptSpecifiers ...Ids) const {
241
20.1k
    return getLastArgNoClaim(Ids...) != nullptr;
242
20.1k
  }
243
  template<typename ...OptSpecifiers>
244
20.4M
  bool hasArg(OptSpecifiers ...Ids) const {
245
20.4M
    return getLastArg(Ids...) != nullptr;
246
20.4M
  }
bool llvm::opt::ArgList::hasArg<clang::driver::options::ID>(clang::driver::options::ID) const
Line
Count
Source
244
20.1M
  bool hasArg(OptSpecifiers ...Ids) const {
245
20.1M
    return getLastArg(Ids...) != nullptr;
246
20.1M
  }
bool llvm::opt::ArgList::hasArg<llvm::opt::OptSpecifier>(llvm::opt::OptSpecifier) const
Line
Count
Source
244
69
  bool hasArg(OptSpecifiers ...Ids) const {
245
69
    return getLastArg(Ids...) != nullptr;
246
69
  }
bool llvm::opt::ArgList::hasArg<clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
244
298k
  bool hasArg(OptSpecifiers ...Ids) const {
245
298k
    return getLastArg(Ids...) != nullptr;
246
298k
  }
bool llvm::opt::ArgList::hasArg<clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
244
2.46k
  bool hasArg(OptSpecifiers ...Ids) const {
245
2.46k
    return getLastArg(Ids...) != nullptr;
246
2.46k
  }
bool llvm::opt::ArgList::hasArg<clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
244
12
  bool hasArg(OptSpecifiers ...Ids) const {
245
12
    return getLastArg(Ids...) != nullptr;
246
12
  }
247
248
  /// Return the last argument matching \p Id, or null.
249
  template<typename ...OptSpecifiers>
250
41.8M
  Arg *getLastArg(OptSpecifiers ...Ids) const {
251
41.8M
    Arg *Res = nullptr;
252
41.8M
    for (Arg *A : filtered(Ids...)) {
253
1.86M
      Res = A;
254
1.86M
      Res->claim();
255
1.86M
    }
256
41.8M
    return Res;
257
41.8M
  }
llvm::opt::Arg* llvm::opt::ArgList::getLastArg<clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
250
2.13M
  Arg *getLastArg(OptSpecifiers ...Ids) const {
251
2.13M
    Arg *Res = nullptr;
252
2.13M
    for (Arg *A : filtered(Ids...)) {
253
26.3k
      Res = A;
254
26.3k
      Res->claim();
255
26.3k
    }
256
2.13M
    return Res;
257
2.13M
  }
llvm::opt::Arg* llvm::opt::ArgList::getLastArg<clang::driver::options::ID>(clang::driver::options::ID) const
Line
Count
Source
250
28.4M
  Arg *getLastArg(OptSpecifiers ...Ids) const {
251
28.4M
    Arg *Res = nullptr;
252
28.4M
    for (Arg *A : filtered(Ids...)) {
253
1.27M
      Res = A;
254
1.27M
      Res->claim();
255
1.27M
    }
256
28.4M
    return Res;
257
28.4M
  }
llvm::opt::Arg* llvm::opt::ArgList::getLastArg<llvm::opt::OptSpecifier, llvm::opt::OptSpecifier>(llvm::opt::OptSpecifier, llvm::opt::OptSpecifier) const
Line
Count
Source
250
5.41M
  Arg *getLastArg(OptSpecifiers ...Ids) const {
251
5.41M
    Arg *Res = nullptr;
252
5.41M
    for (Arg *A : filtered(Ids...)) {
253
83.7k
      Res = A;
254
83.7k
      Res->claim();
255
83.7k
    }
256
5.41M
    return Res;
257
5.41M
  }
llvm::opt::Arg* llvm::opt::ArgList::getLastArg<llvm::opt::OptSpecifier, llvm::opt::OptSpecifier, llvm::opt::OptSpecifier>(llvm::opt::OptSpecifier, llvm::opt::OptSpecifier, llvm::opt::OptSpecifier) const
Line
Count
Source
250
185k
  Arg *getLastArg(OptSpecifiers ...Ids) const {
251
185k
    Arg *Res = nullptr;
252
185k
    for (Arg *A : filtered(Ids...)) {
253
49.7k
      Res = A;
254
49.7k
      Res->claim();
255
49.7k
    }
256
185k
    return Res;
257
185k
  }
llvm::opt::Arg* llvm::opt::ArgList::getLastArg<llvm::opt::OptSpecifier>(llvm::opt::OptSpecifier) const
Line
Count
Source
250
4.42M
  Arg *getLastArg(OptSpecifiers ...Ids) const {
251
4.42M
    Arg *Res = nullptr;
252
4.42M
    for (Arg *A : filtered(Ids...)) {
253
382k
      Res = A;
254
382k
      Res->claim();
255
382k
    }
256
4.42M
    return Res;
257
4.42M
  }
llvm::opt::Arg* llvm::opt::ArgList::getLastArg<clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
250
306k
  Arg *getLastArg(OptSpecifiers ...Ids) const {
251
306k
    Arg *Res = nullptr;
252
306k
    for (Arg *A : filtered(Ids...)) {
253
22.7k
      Res = A;
254
22.7k
      Res->claim();
255
22.7k
    }
256
306k
    return Res;
257
306k
  }
llvm::opt::Arg* llvm::opt::ArgList::getLastArg<clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
250
477k
  Arg *getLastArg(OptSpecifiers ...Ids) const {
251
477k
    Arg *Res = nullptr;
252
477k
    for (Arg *A : filtered(Ids...)) {
253
14.7k
      Res = A;
254
14.7k
      Res->claim();
255
14.7k
    }
256
477k
    return Res;
257
477k
  }
llvm::opt::Arg* llvm::opt::ArgList::getLastArg<clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
250
29.8k
  Arg *getLastArg(OptSpecifiers ...Ids) const {
251
29.8k
    Arg *Res = nullptr;
252
29.8k
    for (Arg *A : filtered(Ids...)) {
253
34
      Res = A;
254
34
      Res->claim();
255
34
    }
256
29.8k
    return Res;
257
29.8k
  }
llvm::opt::Arg* llvm::opt::ArgList::getLastArg<clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
250
32.4k
  Arg *getLastArg(OptSpecifiers ...Ids) const {
251
32.4k
    Arg *Res = nullptr;
252
32.4k
    for (Arg *A : filtered(Ids...)) {
253
6.65k
      Res = A;
254
6.65k
      Res->claim();
255
6.65k
    }
256
32.4k
    return Res;
257
32.4k
  }
llvm::opt::Arg* llvm::opt::ArgList::getLastArg<unsigned int>(unsigned int) const
Line
Count
Source
250
385k
  Arg *getLastArg(OptSpecifiers ...Ids) const {
251
385k
    Arg *Res = nullptr;
252
385k
    for (Arg *A : filtered(Ids...)) {
253
107
      Res = A;
254
107
      Res->claim();
255
107
    }
256
385k
    return Res;
257
385k
  }
llvm::opt::Arg* llvm::opt::ArgList::getLastArg<clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
250
29.8k
  Arg *getLastArg(OptSpecifiers ...Ids) const {
251
29.8k
    Arg *Res = nullptr;
252
29.8k
    for (Arg *A : filtered(Ids...)) {
253
56
      Res = A;
254
56
      Res->claim();
255
56
    }
256
29.8k
    return Res;
257
29.8k
  }
258
259
  /// Return the last argument matching \p Id, or null. Do not "claim" the
260
  /// option (don't mark it as having been used).
261
  template<typename ...OptSpecifiers>
262
128k
  Arg *getLastArgNoClaim(OptSpecifiers ...Ids) const {
263
128k
    for (Arg *A : filtered_reverse(Ids...))
264
75
      return A;
265
128k
    
return nullptr128k
;
266
128k
  }
llvm::opt::Arg* llvm::opt::ArgList::getLastArgNoClaim<clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
262
50.4k
  Arg *getLastArgNoClaim(OptSpecifiers ...Ids) const {
263
50.4k
    for (Arg *A : filtered_reverse(Ids...))
264
21
      return A;
265
50.4k
    
return nullptr50.3k
;
266
50.4k
  }
llvm::opt::Arg* llvm::opt::ArgList::getLastArgNoClaim<clang::driver::options::ID>(clang::driver::options::ID) const
Line
Count
Source
262
62.6k
  Arg *getLastArgNoClaim(OptSpecifiers ...Ids) const {
263
62.6k
    for (Arg *A : filtered_reverse(Ids...))
264
44
      return A;
265
62.6k
    
return nullptr62.6k
;
266
62.6k
  }
llvm::opt::Arg* llvm::opt::ArgList::getLastArgNoClaim<clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID>(clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
262
15.1k
  Arg *getLastArgNoClaim(OptSpecifiers ...Ids) const {
263
15.1k
    for (Arg *A : filtered_reverse(Ids...))
264
10
      return A;
265
15.1k
    
return nullptr15.1k
;
266
15.1k
  }
267
268
  /// getArgString - Return the input argument string at \p Index.
269
  virtual const char *getArgString(unsigned Index) const = 0;
270
271
  /// getNumInputArgStrings - Return the number of original argument strings,
272
  /// which are guaranteed to be the first strings in the argument string
273
  /// list.
274
  virtual unsigned getNumInputArgStrings() const = 0;
275
276
  /// @}
277
  /// @name Argument Lookup Utilities
278
  /// @{
279
280
  /// getLastArgValue - Return the value of the last argument, or a default.
281
  StringRef getLastArgValue(OptSpecifier Id, StringRef Default = "") const;
282
283
  /// getAllArgValues - Get the values of all instances of the given argument
284
  /// as strings.
285
  std::vector<std::string> getAllArgValues(OptSpecifier Id) const;
286
287
  /// @}
288
  /// @name Translation Utilities
289
  /// @{
290
291
  /// hasFlag - Given an option \p Pos and its negative form \p Neg, return
292
  /// true if the option is present, false if the negation is present, and
293
  /// \p Default if neither option is given. If both the option and its
294
  /// negation are present, the last one wins.
295
  bool hasFlag(OptSpecifier Pos, OptSpecifier Neg, bool Default=true) const;
296
297
  /// hasFlag - Given an option \p Pos, an alias \p PosAlias and its negative
298
  /// form \p Neg, return true if the option or its alias is present, false if
299
  /// the negation is present, and \p Default if none of the options are
300
  /// given. If multiple options are present, the last one wins.
301
  bool hasFlag(OptSpecifier Pos, OptSpecifier PosAlias, OptSpecifier Neg,
302
               bool Default = true) const;
303
304
  /// Render only the last argument match \p Id0, if present.
305
  template<typename ...OptSpecifiers>
306
2.21M
  void AddLastArg(ArgStringList &Output, OptSpecifiers ...Ids) const {
307
2.21M
    if (Arg *A = getLastArg(Ids...)) // Calls claim() on all Ids's Args.
308
8.64k
      A->render(*this, Output);
309
2.21M
  }
void llvm::opt::ArgList::AddLastArg<clang::driver::options::ID>(llvm::SmallVector<char const*, 16u>&, clang::driver::options::ID) const
Line
Count
Source
306
1.87M
  void AddLastArg(ArgStringList &Output, OptSpecifiers ...Ids) const {
307
1.87M
    if (Arg *A = getLastArg(Ids...)) // Calls claim() on all Ids's Args.
308
8.43k
      A->render(*this, Output);
309
1.87M
  }
void llvm::opt::ArgList::AddLastArg<clang::driver::options::ID, clang::driver::options::ID>(llvm::SmallVector<char const*, 16u>&, clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
306
287k
  void AddLastArg(ArgStringList &Output, OptSpecifiers ...Ids) const {
307
287k
    if (Arg *A = getLastArg(Ids...)) // Calls claim() on all Ids's Args.
308
203
      A->render(*this, Output);
309
287k
  }
void llvm::opt::ArgList::AddLastArg<clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID>(llvm::SmallVector<char const*, 16u>&, clang::driver::options::ID, clang::driver::options::ID, clang::driver::options::ID) const
Line
Count
Source
306
59.1k
  void AddLastArg(ArgStringList &Output, OptSpecifiers ...Ids) const {
307
59.1k
    if (Arg *A = getLastArg(Ids...)) // Calls claim() on all Ids's Args.
308
6
      A->render(*this, Output);
309
59.1k
  }
310
311
  /// AddAllArgsExcept - Render all arguments matching any of the given ids
312
  /// and not matching any of the excluded ids.
313
  void AddAllArgsExcept(ArgStringList &Output, ArrayRef<OptSpecifier> Ids,
314
                        ArrayRef<OptSpecifier> ExcludeIds) const;
315
  /// AddAllArgs - Render all arguments matching any of the given ids.
316
  void AddAllArgs(ArgStringList &Output, ArrayRef<OptSpecifier> Ids) const;
317
318
  /// AddAllArgs - Render all arguments matching the given ids.
319
  void AddAllArgs(ArgStringList &Output, OptSpecifier Id0,
320
                  OptSpecifier Id1 = 0U, OptSpecifier Id2 = 0U) const;
321
322
  /// AddAllArgValues - Render the argument values of all arguments
323
  /// matching the given ids.
324
  void AddAllArgValues(ArgStringList &Output, OptSpecifier Id0,
325
                       OptSpecifier Id1 = 0U, OptSpecifier Id2 = 0U) const;
326
327
  /// AddAllArgsTranslated - Render all the arguments matching the
328
  /// given ids, but forced to separate args and using the provided
329
  /// name instead of the first option value.
330
  ///
331
  /// \param Joined - If true, render the argument as joined with
332
  /// the option specifier.
333
  void AddAllArgsTranslated(ArgStringList &Output, OptSpecifier Id0,
334
                            const char *Translation,
335
                            bool Joined = false) const;
336
337
  /// ClaimAllArgs - Claim all arguments which match the given
338
  /// option id.
339
  void ClaimAllArgs(OptSpecifier Id0) const;
340
341
  /// ClaimAllArgs - Claim all arguments.
342
  ///
343
  void ClaimAllArgs() const;
344
345
  /// @}
346
  /// @name Arg Synthesis
347
  /// @{
348
349
  /// Construct a constant string pointer whose
350
  /// lifetime will match that of the ArgList.
351
  virtual const char *MakeArgStringRef(StringRef Str) const = 0;
352
1.98M
  const char *MakeArgString(const Twine &Str) const {
353
1.98M
    SmallString<256> Buf;
354
1.98M
    return MakeArgStringRef(Str.toStringRef(Buf));
355
1.98M
  }
356
357
  /// Create an arg string for (\p LHS + \p RHS), reusing the
358
  /// string at \p Index if possible.
359
  const char *GetOrMakeJoinedArgString(unsigned Index, StringRef LHS,
360
                                        StringRef RHS) const;
361
362
  void print(raw_ostream &O) const;
363
  void dump() const;
364
365
  /// @}
366
};
367
368
class InputArgList final : public ArgList {
369
private:
370
  /// List of argument strings used by the contained Args.
371
  ///
372
  /// This is mutable since we treat the ArgList as being the list
373
  /// of Args, and allow routines to add new strings (to have a
374
  /// convenient place to store the memory) via MakeIndex.
375
  mutable ArgStringList ArgStrings;
376
377
  /// Strings for synthesized arguments.
378
  ///
379
  /// This is mutable since we treat the ArgList as being the list
380
  /// of Args, and allow routines to add new strings (to have a
381
  /// convenient place to store the memory) via MakeIndex.
382
  mutable std::list<std::string> SynthesizedStrings;
383
384
  /// The number of original input argument strings.
385
  unsigned NumInputArgStrings;
386
387
  /// Release allocated arguments.
388
  void releaseMemory();
389
390
public:
391
  InputArgList() : NumInputArgStrings(0) {}
392
393
  InputArgList(const char* const *ArgBegin, const char* const *ArgEnd);
394
395
  InputArgList(InputArgList &&RHS)
396
      : ArgList(std::move(RHS)), ArgStrings(std::move(RHS.ArgStrings)),
397
        SynthesizedStrings(std::move(RHS.SynthesizedStrings)),
398
91.1k
        NumInputArgStrings(RHS.NumInputArgStrings) {}
399
400
  InputArgList &operator=(InputArgList &&RHS) {
401
    releaseMemory();
402
    ArgList::operator=(std::move(RHS));
403
    ArgStrings = std::move(RHS.ArgStrings);
404
    SynthesizedStrings = std::move(RHS.SynthesizedStrings);
405
    NumInputArgStrings = RHS.NumInputArgStrings;
406
    return *this;
407
  }
408
409
206k
  ~InputArgList() { releaseMemory(); }
410
411
21.5M
  const char *getArgString(unsigned Index) const override {
412
21.5M
    return ArgStrings[Index];
413
21.5M
  }
414
415
3.75M
  unsigned getNumInputArgStrings() const override {
416
3.75M
    return NumInputArgStrings;
417
3.75M
  }
418
419
  /// @name Arg Synthesis
420
  /// @{
421
422
public:
423
  /// MakeIndex - Get an index for the given string(s).
424
  unsigned MakeIndex(StringRef String0) const;
425
  unsigned MakeIndex(StringRef String0, StringRef String1) const;
426
427
  using ArgList::MakeArgString;
428
  const char *MakeArgStringRef(StringRef Str) const override;
429
430
  /// @}
431
};
432
433
/// DerivedArgList - An ordered collection of driver arguments,
434
/// whose storage may be in another argument list.
435
class DerivedArgList final : public ArgList {
436
  const InputArgList &BaseArgs;
437
438
  /// The list of arguments we synthesized.
439
  mutable SmallVector<std::unique_ptr<Arg>, 16> SynthesizedArgs;
440
441
public:
442
  /// Construct a new derived arg list from \p BaseArgs.
443
  DerivedArgList(const InputArgList &BaseArgs);
444
445
52.9k
  const char *getArgString(unsigned Index) const override {
446
52.9k
    return BaseArgs.getArgString(Index);
447
52.9k
  }
448
449
3
  unsigned getNumInputArgStrings() const override {
450
3
    return BaseArgs.getNumInputArgStrings();
451
3
  }
452
453
25.7k
  const InputArgList &getBaseArgs() const {
454
25.7k
    return BaseArgs;
455
25.7k
  }
456
457
  /// @name Arg Synthesis
458
  /// @{
459
460
  /// AddSynthesizedArg - Add a argument to the list of synthesized arguments
461
  /// (to be freed).
462
  void AddSynthesizedArg(Arg *A);
463
464
  using ArgList::MakeArgString;
465
  const char *MakeArgStringRef(StringRef Str) const override;
466
467
  /// AddFlagArg - Construct a new FlagArg for the given option \p Id and
468
  /// append it to the argument list.
469
11.3k
  void AddFlagArg(const Arg *BaseArg, const Option Opt) {
470
11.3k
    append(MakeFlagArg(BaseArg, Opt));
471
11.3k
  }
472
473
  /// AddPositionalArg - Construct a new Positional arg for the given option
474
  /// \p Id, with the provided \p Value and append it to the argument
475
  /// list.
476
  void AddPositionalArg(const Arg *BaseArg, const Option Opt,
477
0
                        StringRef Value) {
478
0
    append(MakePositionalArg(BaseArg, Opt, Value));
479
0
  }
480
481
  /// AddSeparateArg - Construct a new Positional arg for the given option
482
  /// \p Id, with the provided \p Value and append it to the argument
483
  /// list.
484
  void AddSeparateArg(const Arg *BaseArg, const Option Opt,
485
7
                      StringRef Value) {
486
7
    append(MakeSeparateArg(BaseArg, Opt, Value));
487
7
  }
488
489
  /// AddJoinedArg - Construct a new Positional arg for the given option
490
  /// \p Id, with the provided \p Value and append it to the argument list.
491
  void AddJoinedArg(const Arg *BaseArg, const Option Opt,
492
62.1k
                    StringRef Value) {
493
62.1k
    append(MakeJoinedArg(BaseArg, Opt, Value));
494
62.1k
  }
495
496
  /// MakeFlagArg - Construct a new FlagArg for the given option \p Id.
497
  Arg *MakeFlagArg(const Arg *BaseArg, const Option Opt) const;
498
499
  /// MakePositionalArg - Construct a new Positional arg for the
500
  /// given option \p Id, with the provided \p Value.
501
  Arg *MakePositionalArg(const Arg *BaseArg, const Option Opt,
502
                          StringRef Value) const;
503
504
  /// MakeSeparateArg - Construct a new Positional arg for the
505
  /// given option \p Id, with the provided \p Value.
506
  Arg *MakeSeparateArg(const Arg *BaseArg, const Option Opt,
507
                        StringRef Value) const;
508
509
  /// MakeJoinedArg - Construct a new Positional arg for the
510
  /// given option \p Id, with the provided \p Value.
511
  Arg *MakeJoinedArg(const Arg *BaseArg, const Option Opt,
512
                      StringRef Value) const;
513
514
  /// @}
515
};
516
517
} // end namespace opt
518
519
} // end namespace llvm
520
521
#endif // LLVM_OPTION_ARGLIST_H