summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-11-18 04:32:13 +0000
committerTed Kremenek <kremenek@apple.com>2011-11-18 04:32:13 +0000
commit2acedbd41714c0de691496239006af6351b061a9 (patch)
treefe65012d70483d6f23e90350fde80bd5b6aa5074 /clang/lib/Frontend/CompilerInvocation.cpp
parentf22fa9eaef8b1f09b28be6aa52b7814bd4a273ad (diff)
downloadbcm5719-llvm-2acedbd41714c0de691496239006af6351b061a9.tar.gz
bcm5719-llvm-2acedbd41714c0de691496239006af6351b061a9.zip
Refine placement of LangOptions object in CompilerInvocation by adding a new baseclass CompilerInvocationBase with a custom copy constructor. This ensures that whenever the CompilerInvocation object's copy constructor is used we always clone the LangOptions object.
llvm-svn: 144973
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 13be408141c..738facf0695 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -34,12 +34,11 @@ using namespace clang;
// Initialization.
//===----------------------------------------------------------------------===//
-CompilerInvocation::CompilerInvocation()
+CompilerInvocationBase::CompilerInvocationBase()
: LangOpts(new LangOptions()) {}
-void CompilerInvocation::setLangOpts(LangOptions *LOpts) {
- LangOpts = LOpts;
-}
+CompilerInvocationBase::CompilerInvocationBase(const CompilerInvocationBase &X)
+ : LangOpts(new LangOptions(*X.getLangOpts())) {}
//===----------------------------------------------------------------------===//
// Utility functions.
OpenPOWER on IntegriCloud