Driver: ArgList::getLastArg was in fact returning the first matching arg.
- <rdar://problem/6715818> clang doesn't honor gcc semantic that last -O optimization option wins. llvm-svn: 67628
This commit is contained in:
parent
b57738b09c
commit
9ea0e77572
|
@ -32,6 +32,8 @@ namespace driver {
|
|||
typedef llvm::SmallVector<Arg*, 16> arglist_type;
|
||||
typedef arglist_type::iterator iterator;
|
||||
typedef arglist_type::const_iterator const_iterator;
|
||||
typedef arglist_type::reverse_iterator reverse_iterator;
|
||||
typedef arglist_type::const_reverse_iterator const_reverse_iterator;
|
||||
|
||||
private:
|
||||
/// List of argument strings used by the contained Args.
|
||||
|
@ -64,9 +66,15 @@ namespace driver {
|
|||
iterator begin() { return Args.begin(); }
|
||||
iterator end() { return Args.end(); }
|
||||
|
||||
reverse_iterator rbegin() { return Args.rbegin(); }
|
||||
reverse_iterator rend() { return Args.rend(); }
|
||||
|
||||
const_iterator begin() const { return Args.begin(); }
|
||||
const_iterator end() const { return Args.end(); }
|
||||
|
||||
const_reverse_iterator rbegin() const { return Args.rbegin(); }
|
||||
const_reverse_iterator rend() const { return Args.rend(); }
|
||||
|
||||
/// append - Append \arg A to the arg list, taking ownership.
|
||||
void append(Arg *A);
|
||||
|
||||
|
|
|
@ -34,9 +34,7 @@ void ArgList::append(Arg *A) {
|
|||
|
||||
Arg *ArgList::getLastArg(options::ID Id, bool Claim) const {
|
||||
// FIXME: Make search efficient?
|
||||
|
||||
// FIXME: This needs to not require loading of the option.
|
||||
for (const_iterator it = begin(), ie = end(); it != ie; ++it) {
|
||||
for (const_reverse_iterator it = rbegin(), ie = rend(); it != ie; ++it) {
|
||||
if ((*it)->getOption().matches(Id)) {
|
||||
if (Claim) (*it)->claim();
|
||||
return *it;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -ccc-host-triple i386-unknown-unknown -### -S -Os %s -o %t.s 2> %t.log
|
||||
// RUN: clang -ccc-host-triple i386-unknown-unknown -### -S -O0 -Os %s -o %t.s 2> %t.log
|
||||
// RUN: grep '"-S"' %t.log &&
|
||||
// RUN: grep '"-disable-free"' %t.log &&
|
||||
// RUN: grep '"--relocation-model" "static"' %t.log &&
|
||||
|
|
Loading…
Reference in New Issue