From 2acedbd41714c0de691496239006af6351b061a9 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 18 Nov 2011 04:32:13 +0000 Subject: 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 --- clang/lib/Frontend/CompilerInvocation.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 13be408..738facf 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. -- cgit v1.1