diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-09-14 20:24:53 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-09-14 20:24:53 +0000 |
commit | 9e1fb5632a07300c59a2d92021a19f446dc2dd9f (patch) | |
tree | 03d0b6b829532c20a210e7b2aba460b2f0c658d9 /clang/lib/Frontend/ASTUnit.cpp | |
parent | 06fb5f0cc24c4abb9266a04d8efd343a5cb43d47 (diff) | |
download | llvm-9e1fb5632a07300c59a2d92021a19f446dc2dd9f.zip llvm-9e1fb5632a07300c59a2d92021a19f446dc2dd9f.tar.gz llvm-9e1fb5632a07300c59a2d92021a19f446dc2dd9f.tar.bz2 |
[libclang] When loading an AST file, make sure to apply the language options
to the target info.
Related to rdar://12069503.
llvm-svn: 163931
Diffstat (limited to 'clang/lib/Frontend/ASTUnit.cpp')
-rw-r--r-- | clang/lib/Frontend/ASTUnit.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index 42a6772..d0aadfd 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/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 { |