git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98263 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2010-03-11 18:04:58 +00:00
Родитель fd48cb31d4
Коммит 32c1a2ae8b
3 изменённых файлов: 17 добавлений и 6 удалений

Просмотреть файл

@ -66,17 +66,23 @@ private:
ActionList Inputs;
unsigned OwnsInputs : 1;
protected:
Action(ActionClass _Kind, types::ID _Type) : Kind(_Kind), Type(_Type) {}
Action(ActionClass _Kind, types::ID _Type)
: Kind(_Kind), Type(_Type), OwnsInputs(true) {}
Action(ActionClass _Kind, Action *Input, types::ID _Type)
: Kind(_Kind), Type(_Type), Inputs(&Input, &Input + 1) {}
: Kind(_Kind), Type(_Type), Inputs(&Input, &Input + 1), OwnsInputs(true) {}
Action(ActionClass _Kind, const ActionList &_Inputs, types::ID _Type)
: Kind(_Kind), Type(_Type), Inputs(_Inputs) {}
: Kind(_Kind), Type(_Type), Inputs(_Inputs), OwnsInputs(true) {}
public:
virtual ~Action();
const char *getClassName() const { return Action::getClassName(getKind()); }
bool getOwnsInputs() { return OwnsInputs; }
void setOwnsInputs(bool Value) { OwnsInputs = Value; }
ActionClass getKind() const { return Kind; }
types::ID getType() const { return Type; }

Просмотреть файл

@ -13,8 +13,10 @@
using namespace clang::driver;
Action::~Action() {
// FIXME: Free the inputs. The problem is that BindArchAction shares
// inputs; so we can't just walk the inputs.
if (OwnsInputs) {
for (iterator it = begin(), ie = end(); it != ie; ++it)
delete *it;
}
}
const char *Action::getClassName(ActionClass AC) {

Просмотреть файл

@ -503,8 +503,11 @@ void Driver::BuildUniversalActions(const ArgList &Args,
<< types::getTypeName(Act->getType());
ActionList Inputs;
for (unsigned i = 0, e = Archs.size(); i != e; ++i)
for (unsigned i = 0, e = Archs.size(); i != e; ++i) {
Inputs.push_back(new BindArchAction(Act, Archs[i]));
if (i != 0)
Inputs.back()->setOwnsInputs(false);
}
// Lipo if necessary, we do it this way because we need to set the arch flag
// so that -Xarch_ gets overwritten.