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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user