[cfe-dev] why does clang re-evaluate the target info for each input file?

Sam Bishop sam at bishop.dhs.org
Fri Feb 29 10:50:45 PST 2008


The subject line says it all, I suppose.  It seems to me that the target
would be a per-invocation constant.  Is state modified that needs to be
refreshed?

clang.cpp:main():
  for (unsigned i = 0, e = InputFilenames.size(); i != e; ++i) {
    const std::string &InFile = InputFilenames[i];
    ...
    <if not a serialized file> {
      Target = TargetInfo::CreateTargetInfo(&triples[0],
                                            &triples[0]+triples.size(),
                                            &Diags);
    }
    ...
  }

If we want to optimize for the serialized case, perhaps we could allocate
the target information lazily?

Thanks,
Sam




More information about the cfe-dev mailing list