blob: a0c4889c1631e3bf9fc673a10a9314555bf11213 [file] [log] [blame]
Argyrios Kyrtzidis3a08ec12009-06-20 08:27:14 +00001//===--- ASTUnit.cpp - ASTUnit utility ------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// ASTUnit Implementation.
11//
12//===----------------------------------------------------------------------===//
13
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +000014#include "clang/Frontend/ASTUnit.h"
15#include "clang/Frontend/PCHReader.h"
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +000016#include "clang/AST/ASTContext.h"
Daniel Dunbar764c0822009-12-01 09:51:01 +000017#include "clang/AST/ASTConsumer.h"
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +000018#include "clang/AST/DeclVisitor.h"
19#include "clang/AST/StmtVisitor.h"
Daniel Dunbar55a17b62009-12-02 03:23:45 +000020#include "clang/Driver/Compilation.h"
21#include "clang/Driver/Driver.h"
22#include "clang/Driver/Job.h"
23#include "clang/Driver/Tool.h"
Daniel Dunbar764c0822009-12-01 09:51:01 +000024#include "clang/Frontend/CompilerInstance.h"
25#include "clang/Frontend/FrontendActions.h"
Daniel Dunbar55a17b62009-12-02 03:23:45 +000026#include "clang/Frontend/FrontendDiagnostic.h"
Daniel Dunbar764c0822009-12-01 09:51:01 +000027#include "clang/Frontend/FrontendOptions.h"
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +000028#include "clang/Lex/HeaderSearch.h"
29#include "clang/Lex/Preprocessor.h"
Daniel Dunbarb9bbd542009-11-15 06:48:46 +000030#include "clang/Basic/TargetOptions.h"
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +000031#include "clang/Basic/TargetInfo.h"
32#include "clang/Basic/Diagnostic.h"
Douglas Gregoraa98ed92010-01-23 00:14:00 +000033#include "llvm/Support/MemoryBuffer.h"
Daniel Dunbar55a17b62009-12-02 03:23:45 +000034#include "llvm/System/Host.h"
Benjamin Kramer6c839f82009-10-18 11:34:14 +000035#include "llvm/System/Path.h"
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +000036using namespace clang;
37
Daniel Dunbar59203002009-12-03 01:45:44 +000038ASTUnit::ASTUnit(bool _MainFileIsAST)
39 : tempFile(false), MainFileIsAST(_MainFileIsAST) {
Steve Naroff505fb842009-10-19 14:34:22 +000040}
Daniel Dunbar764c0822009-12-01 09:51:01 +000041ASTUnit::~ASTUnit() {
Steve Naroff44cd60e2009-10-15 22:23:48 +000042 if (tempFile)
Benjamin Kramer6c839f82009-10-18 11:34:14 +000043 llvm::sys::Path(getPCHFileName()).eraseFromDisk();
Steve Naroff44cd60e2009-10-15 22:23:48 +000044}
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +000045
46namespace {
47
48/// \brief Gathers information from PCHReader that will be used to initialize
49/// a Preprocessor.
Benjamin Kramer16634c22009-11-28 10:07:24 +000050class PCHInfoCollector : public PCHReaderListener {
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +000051 LangOptions &LangOpt;
52 HeaderSearch &HSI;
53 std::string &TargetTriple;
54 std::string &Predefines;
55 unsigned &Counter;
Mike Stump11289f42009-09-09 15:08:12 +000056
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +000057 unsigned NumHeaderInfos;
Mike Stump11289f42009-09-09 15:08:12 +000058
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +000059public:
60 PCHInfoCollector(LangOptions &LangOpt, HeaderSearch &HSI,
61 std::string &TargetTriple, std::string &Predefines,
62 unsigned &Counter)
63 : LangOpt(LangOpt), HSI(HSI), TargetTriple(TargetTriple),
64 Predefines(Predefines), Counter(Counter), NumHeaderInfos(0) {}
Mike Stump11289f42009-09-09 15:08:12 +000065
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +000066 virtual bool ReadLanguageOptions(const LangOptions &LangOpts) {
67 LangOpt = LangOpts;
68 return false;
69 }
Mike Stump11289f42009-09-09 15:08:12 +000070
Daniel Dunbar20a682d2009-11-11 00:52:11 +000071 virtual bool ReadTargetTriple(llvm::StringRef Triple) {
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +000072 TargetTriple = Triple;
73 return false;
74 }
Mike Stump11289f42009-09-09 15:08:12 +000075
Daniel Dunbar20a682d2009-11-11 00:52:11 +000076 virtual bool ReadPredefinesBuffer(llvm::StringRef PCHPredef,
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +000077 FileID PCHBufferID,
Daniel Dunbar000c4ff2009-11-11 05:29:04 +000078 llvm::StringRef OriginalFileName,
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +000079 std::string &SuggestedPredefines) {
80 Predefines = PCHPredef;
81 return false;
82 }
Mike Stump11289f42009-09-09 15:08:12 +000083
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +000084 virtual void ReadHeaderFileInfo(const HeaderFileInfo &HFI) {
85 HSI.setHeaderFileInfoForUID(HFI, NumHeaderInfos++);
86 }
Mike Stump11289f42009-09-09 15:08:12 +000087
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +000088 virtual void ReadCounter(unsigned Value) {
89 Counter = Value;
90 }
91};
92
93} // anonymous namespace
94
Steve Naroffc0683b92009-09-03 18:19:54 +000095const std::string &ASTUnit::getOriginalSourceFileName() {
Daniel Dunbara8a50932009-12-02 08:44:16 +000096 return OriginalSourceFile;
Steve Naroffc0683b92009-09-03 18:19:54 +000097}
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +000098
Steve Naroff44cd60e2009-10-15 22:23:48 +000099const std::string &ASTUnit::getPCHFileName() {
Daniel Dunbara18f9582009-12-02 21:47:43 +0000100 assert(isMainFileAST() && "Not an ASTUnit from a PCH file!");
Benjamin Kramer2ecf8eb2010-01-30 16:23:25 +0000101 return static_cast<PCHReader *>(Ctx->getExternalSource())->getFileName();
Steve Naroff44cd60e2009-10-15 22:23:48 +0000102}
103
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +0000104ASTUnit *ASTUnit::LoadFromPCHFile(const std::string &Filename,
Daniel Dunbar59203002009-12-03 01:45:44 +0000105 Diagnostic &Diags,
Ted Kremenek8bcb1c62009-10-17 00:34:24 +0000106 bool OnlyLocalDecls,
Douglas Gregoraa98ed92010-01-23 00:14:00 +0000107 RemappedFile *RemappedFiles,
108 unsigned NumRemappedFiles) {
Daniel Dunbar59203002009-12-03 01:45:44 +0000109 llvm::OwningPtr<ASTUnit> AST(new ASTUnit(true));
Douglas Gregor16bef852009-10-16 20:01:17 +0000110 AST->OnlyLocalDecls = OnlyLocalDecls;
Steve Naroff505fb842009-10-19 14:34:22 +0000111 AST->HeaderInfo.reset(new HeaderSearch(AST->getFileManager()));
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +0000112
Douglas Gregoraa98ed92010-01-23 00:14:00 +0000113 for (unsigned I = 0; I != NumRemappedFiles; ++I) {
114 // Create the file entry for the file that we're mapping from.
115 const FileEntry *FromFile
116 = AST->getFileManager().getVirtualFile(RemappedFiles[I].first,
117 RemappedFiles[I].second->getBufferSize(),
118 0);
119 if (!FromFile) {
120 Diags.Report(diag::err_fe_remap_missing_from_file)
121 << RemappedFiles[I].first;
122 continue;
123 }
124
125 // Override the contents of the "from" file with the contents of
126 // the "to" file.
127 AST->getSourceManager().overrideFileContents(FromFile,
128 RemappedFiles[I].second);
129 }
130
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +0000131 // Gather Info for preprocessor construction later on.
Mike Stump11289f42009-09-09 15:08:12 +0000132
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +0000133 LangOptions LangInfo;
134 HeaderSearch &HeaderInfo = *AST->HeaderInfo.get();
135 std::string TargetTriple;
136 std::string Predefines;
137 unsigned Counter;
138
Daniel Dunbar3a0637b2009-09-03 05:59:50 +0000139 llvm::OwningPtr<PCHReader> Reader;
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +0000140 llvm::OwningPtr<ExternalASTSource> Source;
141
Ted Kremenek428c6372009-10-19 21:44:57 +0000142 Reader.reset(new PCHReader(AST->getSourceManager(), AST->getFileManager(),
Daniel Dunbar59203002009-12-03 01:45:44 +0000143 Diags));
Daniel Dunbar2d9c7402009-09-03 05:59:35 +0000144 Reader->setListener(new PCHInfoCollector(LangInfo, HeaderInfo, TargetTriple,
145 Predefines, Counter));
146
147 switch (Reader->ReadPCH(Filename)) {
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +0000148 case PCHReader::Success:
149 break;
Mike Stump11289f42009-09-09 15:08:12 +0000150
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +0000151 case PCHReader::Failure:
Argyrios Kyrtzidis55c34112009-06-25 18:22:30 +0000152 case PCHReader::IgnorePCH:
Daniel Dunbar59203002009-12-03 01:45:44 +0000153 Diags.Report(diag::err_fe_unable_to_load_pch);
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +0000154 return NULL;
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +0000155 }
Mike Stump11289f42009-09-09 15:08:12 +0000156
Daniel Dunbara8a50932009-12-02 08:44:16 +0000157 AST->OriginalSourceFile = Reader->getOriginalSourceFile();
158
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +0000159 // PCH loaded successfully. Now create the preprocessor.
Mike Stump11289f42009-09-09 15:08:12 +0000160
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +0000161 // Get information about the target being compiled for.
Daniel Dunbarb9bbd542009-11-15 06:48:46 +0000162 //
163 // FIXME: This is broken, we should store the TargetOptions in the PCH.
164 TargetOptions TargetOpts;
165 TargetOpts.ABI = "";
166 TargetOpts.CPU = "";
167 TargetOpts.Features.clear();
168 TargetOpts.Triple = TargetTriple;
Daniel Dunbar59203002009-12-03 01:45:44 +0000169 AST->Target.reset(TargetInfo::CreateTargetInfo(Diags, TargetOpts));
170 AST->PP.reset(new Preprocessor(Diags, LangInfo, *AST->Target.get(),
Daniel Dunbar7cd285f2009-09-21 03:03:39 +0000171 AST->getSourceManager(), HeaderInfo));
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +0000172 Preprocessor &PP = *AST->PP.get();
173
Daniel Dunbarb7bbfdd2009-09-21 03:03:47 +0000174 PP.setPredefines(Reader->getSuggestedPredefines());
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +0000175 PP.setCounterValue(Counter);
Daniel Dunbar2d9c7402009-09-03 05:59:35 +0000176 Reader->setPreprocessor(PP);
Mike Stump11289f42009-09-09 15:08:12 +0000177
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +0000178 // Create and initialize the ASTContext.
179
180 AST->Ctx.reset(new ASTContext(LangInfo,
Daniel Dunbar7cd285f2009-09-21 03:03:39 +0000181 AST->getSourceManager(),
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +0000182 *AST->Target.get(),
183 PP.getIdentifierTable(),
184 PP.getSelectorTable(),
185 PP.getBuiltinInfo(),
Daniel Dunbar19511922010-02-16 01:55:04 +0000186 /* FreeMemory = */ false,
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +0000187 /* size_reserve = */0));
188 ASTContext &Context = *AST->Ctx.get();
Mike Stump11289f42009-09-09 15:08:12 +0000189
Daniel Dunbar2d9c7402009-09-03 05:59:35 +0000190 Reader->InitializeContext(Context);
Mike Stump11289f42009-09-09 15:08:12 +0000191
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +0000192 // Attach the PCH reader to the AST context as an external AST
193 // source, so that declarations will be deserialized from the
194 // PCH file as needed.
Daniel Dunbar2d9c7402009-09-03 05:59:35 +0000195 Source.reset(Reader.take());
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +0000196 Context.setExternalSource(Source);
197
Mike Stump11289f42009-09-09 15:08:12 +0000198 return AST.take();
Argyrios Kyrtzidisce379752009-06-20 08:08:23 +0000199}
Daniel Dunbar764c0822009-12-01 09:51:01 +0000200
201namespace {
202
Daniel Dunbar644dca02009-12-04 08:17:33 +0000203class TopLevelDeclTrackerConsumer : public ASTConsumer {
204 ASTUnit &Unit;
205
206public:
207 TopLevelDeclTrackerConsumer(ASTUnit &_Unit) : Unit(_Unit) {}
208
209 void HandleTopLevelDecl(DeclGroupRef D) {
210 for (DeclGroupRef::iterator it = D.begin(), ie = D.end(); it != ie; ++it)
211 Unit.getTopLevelDecls().push_back(*it);
212 }
213};
214
215class TopLevelDeclTrackerAction : public ASTFrontendAction {
216public:
217 ASTUnit &Unit;
218
Daniel Dunbar764c0822009-12-01 09:51:01 +0000219 virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
220 llvm::StringRef InFile) {
Daniel Dunbar644dca02009-12-04 08:17:33 +0000221 return new TopLevelDeclTrackerConsumer(Unit);
Daniel Dunbar764c0822009-12-01 09:51:01 +0000222 }
223
224public:
Daniel Dunbar644dca02009-12-04 08:17:33 +0000225 TopLevelDeclTrackerAction(ASTUnit &_Unit) : Unit(_Unit) {}
226
Daniel Dunbar764c0822009-12-01 09:51:01 +0000227 virtual bool hasCodeCompletionSupport() const { return false; }
228};
229
230}
231
Daniel Dunbar7f21a7f2010-02-16 01:54:54 +0000232ASTUnit *ASTUnit::LoadFromCompilerInvocation(CompilerInvocation *CI,
Daniel Dunbar764c0822009-12-01 09:51:01 +0000233 Diagnostic &Diags,
Daniel Dunbar48973492009-12-02 21:47:32 +0000234 bool OnlyLocalDecls) {
Daniel Dunbar764c0822009-12-01 09:51:01 +0000235 // Create the compiler instance to use for building the AST.
Daniel Dunbar7afbb8c2009-12-02 08:43:56 +0000236 CompilerInstance Clang;
Daniel Dunbar764c0822009-12-01 09:51:01 +0000237 llvm::OwningPtr<ASTUnit> AST;
Daniel Dunbar644dca02009-12-04 08:17:33 +0000238 llvm::OwningPtr<TopLevelDeclTrackerAction> Act;
Daniel Dunbar764c0822009-12-01 09:51:01 +0000239
Daniel Dunbar7f21a7f2010-02-16 01:54:54 +0000240 Clang.setInvocation(CI);
Daniel Dunbar764c0822009-12-01 09:51:01 +0000241
242 Clang.setDiagnostics(&Diags);
243 Clang.setDiagnosticClient(Diags.getClient());
244
245 // Create the target instance.
246 Clang.setTarget(TargetInfo::CreateTargetInfo(Clang.getDiagnostics(),
247 Clang.getTargetOpts()));
248 if (!Clang.hasTarget())
249 goto error;
250
251 // Inform the target of the language options.
252 //
253 // FIXME: We shouldn't need to do this, the target should be immutable once
254 // created. This complexity should be lifted elsewhere.
255 Clang.getTarget().setForcedLangOptions(Clang.getLangOpts());
256
257 assert(Clang.getFrontendOpts().Inputs.size() == 1 &&
258 "Invocation must have exactly one source file!");
259 assert(Clang.getFrontendOpts().Inputs[0].first != FrontendOptions::IK_AST &&
260 "FIXME: AST inputs not yet supported here!");
261
262 // Create the AST unit.
Daniel Dunbara18f9582009-12-02 21:47:43 +0000263 AST.reset(new ASTUnit(false));
Daniel Dunbar764c0822009-12-01 09:51:01 +0000264
Daniel Dunbar48973492009-12-02 21:47:32 +0000265 AST->OnlyLocalDecls = OnlyLocalDecls;
Daniel Dunbara8a50932009-12-02 08:44:16 +0000266 AST->OriginalSourceFile = Clang.getFrontendOpts().Inputs[0].second;
267
Daniel Dunbar764c0822009-12-01 09:51:01 +0000268 // Create a file manager object to provide access to and cache the filesystem.
269 Clang.setFileManager(&AST->getFileManager());
270
271 // Create the source manager.
272 Clang.setSourceManager(&AST->getSourceManager());
273
274 // Create the preprocessor.
275 Clang.createPreprocessor();
276
Daniel Dunbar644dca02009-12-04 08:17:33 +0000277 Act.reset(new TopLevelDeclTrackerAction(*AST));
278 if (!Act->BeginSourceFile(Clang, Clang.getFrontendOpts().Inputs[0].second,
Daniel Dunbar764c0822009-12-01 09:51:01 +0000279 /*IsAST=*/false))
280 goto error;
281
Daniel Dunbar644dca02009-12-04 08:17:33 +0000282 Act->Execute();
Daniel Dunbar764c0822009-12-01 09:51:01 +0000283
Daniel Dunbard2f8be32009-12-01 21:57:33 +0000284 // Steal the created target, context, and preprocessor, and take back the
285 // source and file managers.
Daniel Dunbar764c0822009-12-01 09:51:01 +0000286 AST->Ctx.reset(Clang.takeASTContext());
287 AST->PP.reset(Clang.takePreprocessor());
288 Clang.takeSourceManager();
289 Clang.takeFileManager();
Daniel Dunbard2f8be32009-12-01 21:57:33 +0000290 AST->Target.reset(Clang.takeTarget());
Daniel Dunbar764c0822009-12-01 09:51:01 +0000291
Daniel Dunbar644dca02009-12-04 08:17:33 +0000292 Act->EndSourceFile();
Daniel Dunbar764c0822009-12-01 09:51:01 +0000293
294 Clang.takeDiagnosticClient();
295 Clang.takeDiagnostics();
Daniel Dunbar6b03ece2010-01-30 21:47:16 +0000296 Clang.takeInvocation();
Daniel Dunbar764c0822009-12-01 09:51:01 +0000297
Daniel Dunbar7f21a7f2010-02-16 01:54:54 +0000298 AST->Invocation.reset(Clang.takeInvocation());
Daniel Dunbar764c0822009-12-01 09:51:01 +0000299 return AST.take();
300
301error:
302 Clang.takeSourceManager();
303 Clang.takeFileManager();
304 Clang.takeDiagnosticClient();
305 Clang.takeDiagnostics();
306 return 0;
307}
Daniel Dunbar55a17b62009-12-02 03:23:45 +0000308
309ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin,
310 const char **ArgEnd,
311 Diagnostic &Diags,
Daniel Dunbar8d4a2022009-12-13 03:46:13 +0000312 llvm::StringRef ResourceFilesPath,
Daniel Dunbar55a17b62009-12-02 03:23:45 +0000313 bool OnlyLocalDecls,
Douglas Gregoraa98ed92010-01-23 00:14:00 +0000314 RemappedFile *RemappedFiles,
315 unsigned NumRemappedFiles) {
Daniel Dunbar55a17b62009-12-02 03:23:45 +0000316 llvm::SmallVector<const char *, 16> Args;
317 Args.push_back("<clang>"); // FIXME: Remove dummy argument.
318 Args.insert(Args.end(), ArgBegin, ArgEnd);
319
320 // FIXME: Find a cleaner way to force the driver into restricted modes. We
321 // also want to force it to use clang.
322 Args.push_back("-fsyntax-only");
323
Daniel Dunbar8d4a2022009-12-13 03:46:13 +0000324 // FIXME: We shouldn't have to pass in the path info.
325 driver::Driver TheDriver("clang", "/", llvm::sys::getHostTriple(),
Daniel Dunbar55a17b62009-12-02 03:23:45 +0000326 "a.out", false, Diags);
Daniel Dunbarfcf2d422010-01-25 00:44:02 +0000327
328 // Don't check that inputs exist, they have been remapped.
329 TheDriver.setCheckInputsExist(false);
330
Daniel Dunbar55a17b62009-12-02 03:23:45 +0000331 llvm::OwningPtr<driver::Compilation> C(
332 TheDriver.BuildCompilation(Args.size(), Args.data()));
333
334 // We expect to get back exactly one command job, if we didn't something
335 // failed.
336 const driver::JobList &Jobs = C->getJobs();
337 if (Jobs.size() != 1 || !isa<driver::Command>(Jobs.begin())) {
338 llvm::SmallString<256> Msg;
339 llvm::raw_svector_ostream OS(Msg);
340 C->PrintJob(OS, C->getJobs(), "; ", true);
341 Diags.Report(diag::err_fe_expected_compiler_job) << OS.str();
342 return 0;
343 }
344
345 const driver::Command *Cmd = cast<driver::Command>(*Jobs.begin());
346 if (llvm::StringRef(Cmd->getCreator().getName()) != "clang") {
347 Diags.Report(diag::err_fe_expected_clang_command);
348 return 0;
349 }
350
351 const driver::ArgStringList &CCArgs = Cmd->getArguments();
Daniel Dunbar6b03ece2010-01-30 21:47:16 +0000352 llvm::OwningPtr<CompilerInvocation> CI(new CompilerInvocation);
353 CompilerInvocation::CreateFromArgs(*CI, (const char**) CCArgs.data(),
Daniel Dunbar55a17b62009-12-02 03:23:45 +0000354 (const char**) CCArgs.data()+CCArgs.size(),
Daniel Dunbard6136772009-12-13 03:45:58 +0000355 Diags);
356
Douglas Gregoraa98ed92010-01-23 00:14:00 +0000357 // Override any files that need remapping
358 for (unsigned I = 0; I != NumRemappedFiles; ++I)
Daniel Dunbar6b03ece2010-01-30 21:47:16 +0000359 CI->getPreprocessorOpts().addRemappedFile(RemappedFiles[I].first,
Daniel Dunbar19511922010-02-16 01:55:04 +0000360 RemappedFiles[I].second);
Douglas Gregoraa98ed92010-01-23 00:14:00 +0000361
Daniel Dunbara5a166d2009-12-15 00:06:45 +0000362 // Override the resources path.
Daniel Dunbar6b03ece2010-01-30 21:47:16 +0000363 CI->getHeaderSearchOpts().ResourceDir = ResourceFilesPath;
Daniel Dunbar55a17b62009-12-02 03:23:45 +0000364
Daniel Dunbar19511922010-02-16 01:55:04 +0000365 CI->getFrontendOpts().DisableFree = true;
Daniel Dunbar7f21a7f2010-02-16 01:54:54 +0000366 return LoadFromCompilerInvocation(CI.take(), Diags, OnlyLocalDecls);
Daniel Dunbar55a17b62009-12-02 03:23:45 +0000367}