diff options
Diffstat (limited to 'lib/Frontend/ASTUnit.cpp')
-rw-r--r-- | lib/Frontend/ASTUnit.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 42a67720c3..d0aadfd29e 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -525,6 +525,8 @@ public: Context.InitBuiltinTypes(*Target); InitializedLanguage = true; + + applyLangOptsToTarget(); return false; } @@ -541,6 +543,8 @@ public: TargetOpts.Features.clear(); TargetOpts.Triple = Triple; Target = TargetInfo::CreateTargetInfo(PP.getDiagnostics(), TargetOpts); + + applyLangOptsToTarget(); return false; } @@ -562,6 +566,17 @@ public: virtual void ReadCounter(unsigned Value) { Counter = Value; } + +private: + void applyLangOptsToTarget() { + if (Target && InitializedLanguage) { + // Inform the target of the language options. + // + // FIXME: We shouldn't need to do this, the target should be immutable once + // created. This complexity should be lifted elsewhere. + Target->setForcedLangOptions(LangOpt); + } + } }; class StoredDiagnosticConsumer : public DiagnosticConsumer { |