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
This commit is contained in:
Ted Kremenek
2011-11-18 04:32:13 +00:00
parent f22fa9eaef
commit 2acedbd417
3 changed files with 20 additions and 16 deletions

View File

@@ -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.