2009-11-13 11:51:44 +08:00
|
|
|
//===--- CompilerInstance.cpp ---------------------------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "clang/Frontend/CompilerInstance.h"
|
|
|
|
#include "clang/Basic/Diagnostic.h"
|
2009-11-13 12:12:06 +08:00
|
|
|
#include "clang/Basic/FileManager.h"
|
|
|
|
#include "clang/Basic/SourceManager.h"
|
2009-11-13 11:51:44 +08:00
|
|
|
#include "clang/Basic/TargetInfo.h"
|
|
|
|
#include "llvm/LLVMContext.h"
|
|
|
|
using namespace clang;
|
|
|
|
|
|
|
|
CompilerInstance::CompilerInstance(llvm::LLVMContext *_LLVMContext,
|
|
|
|
bool _OwnsLLVMContext)
|
|
|
|
: LLVMContext(_LLVMContext),
|
|
|
|
OwnsLLVMContext(_OwnsLLVMContext) {
|
|
|
|
}
|
|
|
|
|
|
|
|
CompilerInstance::~CompilerInstance() {
|
|
|
|
if (OwnsLLVMContext)
|
|
|
|
delete LLVMContext;
|
|
|
|
}
|
2009-11-13 12:12:06 +08:00
|
|
|
|
|
|
|
void CompilerInstance::createFileManager() {
|
|
|
|
FileMgr.reset(new FileManager());
|
|
|
|
}
|
|
|
|
|
|
|
|
void CompilerInstance::createSourceManager() {
|
|
|
|
SourceMgr.reset(new SourceManager());
|
|
|
|
}
|