--i;
}
}
+
+ // Get information about the target being compiled for.
+ std::string Triple = CreateTargetTriple();
+ TargetInfo *Target = TargetInfo::CreateTargetInfo(Triple);
+ if (Target == 0) {
+ fprintf(stderr, "Sorry, I don't know what target this is: %s\n",
+ Triple.c_str());
+ fprintf(stderr, "Please use -triple or -arch.\n");
+ exit(1);
+ }
for (unsigned i = 0, e = InputFilenames.size(); i != e; ++i) {
const std::string &InFile = InputFilenames[i];
DiagClient->setHeaderSearch(HeaderInfo);
InitializeIncludePaths(argv[0], HeaderInfo, FileMgr, LangInfo);
- // Get information about the targets being compiled for. Note that this
- // pointer and the TargetInfoImpl objects are never deleted by this toy
- // driver.
- std::string Triple = CreateTargetTriple();
- TargetInfo *Target = TargetInfo::CreateTargetInfo(Triple);
-
- if (Target == 0) {
- fprintf(stderr, "Sorry, I don't know what target this is: %s\n",
- Triple.c_str());
- fprintf(stderr, "Please use -triple or -arch.\n");
- exit(1);
- }
-
// Set up the preprocessor with these options.
Preprocessor PP(Diags, LangInfo, *Target, SourceMgr, HeaderInfo);
}
}
+ delete Target;
+
unsigned NumDiagnostics = Diags.getNumDiagnostics();
if (NumDiagnostics)