Basic: thread CodeGenOptions into TargetInfo
This threads CodeGenOptions into the TargetInfo hierarchy. This is motivated by
ARM which can change some target information based on the EABI selected
(-meabi). Similar options exist for other platforms (e.g. MIPS) and thus is
generally useful. NFC.
llvm-svn: 265640
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 61e80d5..c7f6365 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -1058,7 +1058,8 @@
// Create the target instance.
Clang->setTarget(TargetInfo::CreateTargetInfo(
- Clang->getDiagnostics(), Clang->getInvocation().TargetOpts));
+ Clang->getDiagnostics(), Clang->getInvocation().TargetOpts,
+ Clang->getInvocation().getCodeGenOpts()));
if (!Clang->hasTarget())
return true;
@@ -1518,7 +1519,8 @@
// Create the target instance.
Clang->setTarget(TargetInfo::CreateTargetInfo(
- Clang->getDiagnostics(), Clang->getInvocation().TargetOpts));
+ Clang->getDiagnostics(), Clang->getInvocation().TargetOpts,
+ Clang->getInvocation().getCodeGenOpts()));
if (!Clang->hasTarget()) {
llvm::sys::fs::remove(FrontendOpts.OutputFile);
Preamble.clear();
@@ -1781,7 +1783,8 @@
// Create the target instance.
Clang->setTarget(TargetInfo::CreateTargetInfo(
- Clang->getDiagnostics(), Clang->getInvocation().TargetOpts));
+ Clang->getDiagnostics(), Clang->getInvocation().TargetOpts,
+ Clang->getInvocation().getCodeGenOpts()));
if (!Clang->hasTarget())
return nullptr;
@@ -2364,7 +2367,8 @@
// Create the target instance.
Clang->setTarget(TargetInfo::CreateTargetInfo(
- Clang->getDiagnostics(), Clang->getInvocation().TargetOpts));
+ Clang->getDiagnostics(), Clang->getInvocation().TargetOpts,
+ Clang->getInvocation().getCodeGenOpts()));
if (!Clang->hasTarget()) {
Clang->setInvocation(nullptr);
return;
diff --git a/clang/lib/Frontend/ChainedIncludesSource.cpp b/clang/lib/Frontend/ChainedIncludesSource.cpp
index 1c1081f..3707976 100644
--- a/clang/lib/Frontend/ChainedIncludesSource.cpp
+++ b/clang/lib/Frontend/ChainedIncludesSource.cpp
@@ -152,7 +152,8 @@
Clang->setInvocation(CInvok.release());
Clang->setDiagnostics(Diags.get());
Clang->setTarget(TargetInfo::CreateTargetInfo(
- Clang->getDiagnostics(), Clang->getInvocation().TargetOpts));
+ Clang->getDiagnostics(), Clang->getInvocation().TargetOpts,
+ Clang->getCodeGenOpts()));
Clang->createFileManager();
Clang->createSourceManager(Clang->getFileManager());
Clang->createPreprocessor(TU_Prefix);
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index cac73be..76f2f9b 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -830,7 +830,8 @@
// Create the target instance.
setTarget(TargetInfo::CreateTargetInfo(getDiagnostics(),
- getInvocation().TargetOpts));
+ getInvocation().TargetOpts,
+ getInvocation().getCodeGenOpts()));
if (!hasTarget())
return false;
@@ -838,7 +839,8 @@
if (getLangOpts().CUDA && !getFrontendOpts().AuxTriple.empty()) {
std::shared_ptr<TargetOptions> TO(new TargetOptions);
TO->Triple = getFrontendOpts().AuxTriple;
- setAuxTarget(TargetInfo::CreateTargetInfo(getDiagnostics(), TO));
+ setAuxTarget(TargetInfo::CreateTargetInfo(getDiagnostics(), TO,
+ getInvocation().getCodeGenOpts()));
}
// Inform the target of the language options.