[frontend] Expose via a LangOption whether or not the compiler is compiling for a triple that supports AArch64 TBI.

Just breaking down layers of a larger patch to make it easier to review.
This commit is contained in:
Michael Gottesman
2025-08-06 16:17:57 -07:00
parent 99462a67b5
commit bfecaa357f
5 changed files with 19 additions and 0 deletions

View File

@@ -371,6 +371,13 @@ setBridgingHeaderFromFrontendOptions(ClangImporterOptions &ImporterOpts,
FrontendOpts.InputsAndOutputs.getFilenameOfFirstInput();
}
void CompilerInvocation::computeAArch64TBIOptions() {
auto &LLVMArgs = getFrontendOptions().LLVMArgs;
auto aarch64_use_tbi =
std::find(LLVMArgs.begin(), LLVMArgs.end(), "-aarch64-use-tbi");
LangOpts.HasAArch64TBI = aarch64_use_tbi != LLVMArgs.end();
}
void CompilerInvocation::computeCXXStdlibOptions() {
// The MSVC driver in Clang is not aware of the C++ stdlib, and currently
// always assumes libstdc++, which is incorrect: the Microsoft stdlib is
@@ -4099,6 +4106,8 @@ bool CompilerInvocation::parseArgs(
setIRGenOutputOptsFromFrontendOptions(IRGenOpts, FrontendOpts);
setBridgingHeaderFromFrontendOptions(ClangImporterOpts, FrontendOpts);
computeCXXStdlibOptions();
computeAArch64TBIOptions();
if (LangOpts.hasFeature(Feature::Embedded)) {
IRGenOpts.InternalizeAtLink = true;
IRGenOpts.DisableLegacyTypeInfo = true;