CompilerInstance.h revision 39b49bcaaddb1049234fca9500c0ac02c088e23d
12a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar//===-- CompilerInstance.h - Clang Compiler Instance ------------*- C++ -*-===//
22a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar//
32a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar//                     The LLVM Compiler Infrastructure
42a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar//
52a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar// This file is distributed under the University of Illinois Open Source
62a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar// License. See LICENSE.TXT for details.
72a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar//
82a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar//===----------------------------------------------------------------------===//
92a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
102a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar#ifndef LLVM_CLANG_FRONTEND_COMPILERINSTANCE_H_
112a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar#define LLVM_CLANG_FRONTEND_COMPILERINSTANCE_H_
122a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
132a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar#include "clang/Frontend/CompilerInvocation.h"
1428019772db70d4547be05a042eb950bc910f134fDouglas Gregor#include "llvm/ADT/IntrusiveRefCntPtr.h"
150f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar#include "llvm/ADT/StringRef.h"
162a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar#include "llvm/ADT/OwningPtr.h"
1722dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar#include <cassert>
18a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar#include <list>
19a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar#include <string>
202a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
212a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbarnamespace llvm {
222a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbarclass LLVMContext;
23c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbarclass raw_ostream;
24f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbarclass raw_fd_ostream;
25f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnamclass Timer;
262a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar}
272a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
282a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbarnamespace clang {
295eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbarclass ASTContext;
3012ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbarclass ASTConsumer;
31c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbarclass CodeCompleteConsumer;
322a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbarclass Diagnostic;
332a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbarclass DiagnosticClient;
340f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbarclass ExternalASTSource;
3516b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbarclass FileManager;
360397af277e3bba16da1fd125ddba07415686b429Daniel Dunbarclass FrontendAction;
37c43b54cbc10654ed59de797898042e1a05265246Sebastian Redlclass ASTReader;
380f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbarclass Preprocessor;
39f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregorclass Sema;
4016b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbarclass SourceManager;
412a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbarclass TargetInfo;
422a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
432a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// CompilerInstance - Helper class for managing a single instance of the Clang
442a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// compiler.
452a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///
462a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// The CompilerInstance serves two purposes:
472a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///  (1) It manages the various objects which are necessary to run the compiler,
482a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///      for example the preprocessor, the target information, and the AST
492a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///      context.
502a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///  (2) It provides utility routines for constructing and manipulating the
512a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///      common Clang objects.
522a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///
532a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// The compiler instance generally owns the instance of all the objects that it
542a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// manages. However, clients can still share objects by manually setting the
552a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// object and retaking ownership prior to destroying the CompilerInstance.
562a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///
572a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// The compiler instance is intended to simplify clients, but not to lock them
582a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// in to the compiler instance for everything. When possible, utility functions
592a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// come in two forms; a short form that reuses the CompilerInstance objects,
602a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// and a long form that takes explicit instances of any required objects.
612a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbarclass CompilerInstance {
622a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// The LLVM context used for this instance.
6342e9f8e4983d50f896ec716207817b9d96e7e79cDaniel Dunbar  llvm::OwningPtr<llvm::LLVMContext> LLVMContext;
642a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
652a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// The options used in this compiler instance.
666228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar  llvm::OwningPtr<CompilerInvocation> Invocation;
672a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
682a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// The diagnostics engine instance.
6928019772db70d4547be05a042eb950bc910f134fDouglas Gregor  llvm::IntrusiveRefCntPtr<Diagnostic> Diagnostics;
702a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
712a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// The target being compiled for.
722a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  llvm::OwningPtr<TargetInfo> Target;
732a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
7416b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// The file manager.
7516b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  llvm::OwningPtr<FileManager> FileMgr;
7616b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
7716b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// The source manager.
7816b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  llvm::OwningPtr<SourceManager> SourceMgr;
7916b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
8022dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// The preprocessor.
8122dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  llvm::OwningPtr<Preprocessor> PP;
8222dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar
835eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  /// The AST context.
845eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  llvm::OwningPtr<ASTContext> Context;
855eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar
8612ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// The AST consumer.
8712ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  llvm::OwningPtr<ASTConsumer> Consumer;
8812ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar
89c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// The code completion consumer.
90c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  llvm::OwningPtr<CodeCompleteConsumer> CompletionConsumer;
91c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
92f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// \brief The semantic analysis object.
93f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  llvm::OwningPtr<Sema> TheSema;
94f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor
95f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  /// The frontend timer
96f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  llvm::OwningPtr<llvm::Timer> FrontendTimer;
97f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam
98dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// \brief Holds information about the output file.
99dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  ///
100dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// If TempFilename is not empty we must rename it to Filename at the end.
101dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// TempFilename may be empty and Filename non empty if creating the temporary
102dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// failed.
103dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  struct OutputFile {
104dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis    std::string Filename;
105dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis    std::string TempFilename;
106dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis    llvm::raw_ostream *OS;
107dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis
108dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis    OutputFile(const std::string &filename, const std::string &tempFilename,
109dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis               llvm::raw_ostream *os)
110dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis      : Filename(filename), TempFilename(tempFilename), OS(os) { }
111dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  };
112dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis
113a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// The list of active output files.
114dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  std::list<OutputFile> OutputFiles;
115a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar
11642e9f8e4983d50f896ec716207817b9d96e7e79cDaniel Dunbar  void operator=(const CompilerInstance &);  // DO NOT IMPLEMENT
11742e9f8e4983d50f896ec716207817b9d96e7e79cDaniel Dunbar  CompilerInstance(const CompilerInstance&); // DO NOT IMPLEMENT
1182a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbarpublic:
11942e9f8e4983d50f896ec716207817b9d96e7e79cDaniel Dunbar  CompilerInstance();
1202a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  ~CompilerInstance();
1212a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
1220397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// @name High-Level Operations
1230397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// {
1240397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar
1250397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// ExecuteAction - Execute the provided action against the compiler's
1260397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// CompilerInvocation object.
1270397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1280397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// This function makes the following assumptions:
1290397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1300397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///  - The invocation options should be initialized. This function does not
1310397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///    handle the '-help' or '-version' options, clients should handle those
1320397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///    directly.
1330397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1340397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///  - The diagnostics engine should have already been created by the client.
1350397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1360397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///  - No other CompilerInstance state should have been initialized (this is
1370397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///    an unchecked error).
1380397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1390397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///  - Clients should have initialized any LLVM target features that may be
1400397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///    required.
1410397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1420397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///  - Clients should eventually call llvm_shutdown() upon the completion of
1430397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///    this routine to ensure that any managed objects are properly destroyed.
1440397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1450397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// Note that this routine may write output to 'stderr'.
1460397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1470397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// \param Act - The action to execute.
1480397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// \return - True on success.
1490397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  //
1500397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  // FIXME: This function should take the stream to write any debugging /
1510397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  // verbose output to as an argument.
1520397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  //
1530397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  // FIXME: Eliminate the llvm_shutdown requirement, that should either be part
1540397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  // of the context or else not CompilerInstance specific.
1550397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  bool ExecuteAction(FrontendAction &Act);
1560397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar
1570397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// }
1582a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// @name LLVM Context
1592a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// {
1602a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
161704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar  bool hasLLVMContext() const { return LLVMContext != 0; }
162704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar
163704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar  llvm::LLVMContext &getLLVMContext() const {
16422dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    assert(LLVMContext && "Compiler instance has no LLVM context!");
16522dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    return *LLVMContext;
16622dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  }
1672a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
16842e9f8e4983d50f896ec716207817b9d96e7e79cDaniel Dunbar  llvm::LLVMContext *takeLLVMContext() { return LLVMContext.take(); }
16942e9f8e4983d50f896ec716207817b9d96e7e79cDaniel Dunbar
1702a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// setLLVMContext - Replace the current LLVM context and take ownership of
1712a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// \arg Value.
17242e9f8e4983d50f896ec716207817b9d96e7e79cDaniel Dunbar  void setLLVMContext(llvm::LLVMContext *Value);
1732a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
1742a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// }
1752a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// @name Compiler Invocation and Options
1762a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// {
1772a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
1786228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar  bool hasInvocation() const { return Invocation != 0; }
1796228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar
1806228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar  CompilerInvocation &getInvocation() {
1816228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    assert(Invocation && "Compiler instance has no invocation!");
1826228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return *Invocation;
1836228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar  }
1846228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar
1856228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar  CompilerInvocation *takeInvocation() { return Invocation.take(); }
1866228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar
1876228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar  /// setInvocation - Replace the current invocation; the compiler instance
1886228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar  /// takes ownership of \arg Value.
1896228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar  void setInvocation(CompilerInvocation *Value);
1902a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
1912a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// }
1922a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// @name Forwarding Methods
1932a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// {
1942a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
1952a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  AnalyzerOptions &getAnalyzerOpts() {
1966228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getAnalyzerOpts();
1972a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
1982a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const AnalyzerOptions &getAnalyzerOpts() const {
1996228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getAnalyzerOpts();
2002a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2012a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2022a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  CodeGenOptions &getCodeGenOpts() {
2036228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getCodeGenOpts();
2042a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2052a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const CodeGenOptions &getCodeGenOpts() const {
2066228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getCodeGenOpts();
2072a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2082a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2092a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  DependencyOutputOptions &getDependencyOutputOpts() {
2106228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getDependencyOutputOpts();
2112a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2122a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const DependencyOutputOptions &getDependencyOutputOpts() const {
2136228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getDependencyOutputOpts();
2142a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2152a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2162a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  DiagnosticOptions &getDiagnosticOpts() {
2176228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getDiagnosticOpts();
2182a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2192a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const DiagnosticOptions &getDiagnosticOpts() const {
2206228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getDiagnosticOpts();
2212a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2222a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
223389db16c63eec6ecfa9b235155252d8da766e94eArgyrios Kyrtzidis  const FileSystemOptions &getFileSystemOpts() const {
224389db16c63eec6ecfa9b235155252d8da766e94eArgyrios Kyrtzidis    return Invocation->getFileSystemOpts();
225389db16c63eec6ecfa9b235155252d8da766e94eArgyrios Kyrtzidis  }
226389db16c63eec6ecfa9b235155252d8da766e94eArgyrios Kyrtzidis
2272a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  FrontendOptions &getFrontendOpts() {
2286228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getFrontendOpts();
2292a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2302a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const FrontendOptions &getFrontendOpts() const {
2316228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getFrontendOpts();
2322a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2332a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2342a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  HeaderSearchOptions &getHeaderSearchOpts() {
2356228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getHeaderSearchOpts();
2362a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2372a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const HeaderSearchOptions &getHeaderSearchOpts() const {
2386228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getHeaderSearchOpts();
2392a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2402a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2412a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  LangOptions &getLangOpts() {
2426228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getLangOpts();
2432a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2442a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const LangOptions &getLangOpts() const {
2456228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getLangOpts();
2462a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2472a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2482a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  PreprocessorOptions &getPreprocessorOpts() {
2496228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getPreprocessorOpts();
2502a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2512a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const PreprocessorOptions &getPreprocessorOpts() const {
2526228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getPreprocessorOpts();
2532a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2542a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2552a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  PreprocessorOutputOptions &getPreprocessorOutputOpts() {
2566228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getPreprocessorOutputOpts();
2572a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2582a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const PreprocessorOutputOptions &getPreprocessorOutputOpts() const {
2596228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getPreprocessorOutputOpts();
2602a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2612a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
262d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbar  TargetOptions &getTargetOpts() {
2636228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getTargetOpts();
264d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbar  }
265d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbar  const TargetOptions &getTargetOpts() const {
2666228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getTargetOpts();
267d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbar  }
268d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbar
2692a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// }
2702a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// @name Diagnostics Engine
2712a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// {
2722a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
273704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar  bool hasDiagnostics() const { return Diagnostics != 0; }
274704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar
27522dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  Diagnostic &getDiagnostics() const {
27622dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    assert(Diagnostics && "Compiler instance has no diagnostics!");
27722dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    return *Diagnostics;
27822dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  }
2792a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2802a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// setDiagnostics - Replace the current diagnostics engine; the compiler
2812a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// instance takes ownership of \arg Value.
2828a9f569262860b8d03203327afd6047be2a9b5a6Daniel Dunbar  void setDiagnostics(Diagnostic *Value);
2832a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
28481f5a1e699b2eefa4a5e50b5dfc06df600748f59Daniel Dunbar  DiagnosticClient &getDiagnosticClient() const {
285bdbb004f38978da0c4a75af3294d1c7b5ff84af1Douglas Gregor    assert(Diagnostics && Diagnostics->getClient() &&
286bdbb004f38978da0c4a75af3294d1c7b5ff84af1Douglas Gregor           "Compiler instance has no diagnostic client!");
287bdbb004f38978da0c4a75af3294d1c7b5ff84af1Douglas Gregor    return *Diagnostics->getClient();
28881f5a1e699b2eefa4a5e50b5dfc06df600748f59Daniel Dunbar  }
2892a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2902a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// }
2912a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// @name Target Info
2922a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// {
2932a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
294704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar  bool hasTarget() const { return Target != 0; }
295704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar
29622dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  TargetInfo &getTarget() const {
29722dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    assert(Target && "Compiler instance has no target!");
29822dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    return *Target;
29922dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  }
3002a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
3012a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// takeTarget - Remove the current diagnostics engine and give ownership
3022a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// to the caller.
3032a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  TargetInfo *takeTarget() { return Target.take(); }
3042a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
3052a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// setTarget - Replace the current diagnostics engine; the compiler
3062a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// instance takes ownership of \arg Value.
3078a9f569262860b8d03203327afd6047be2a9b5a6Daniel Dunbar  void setTarget(TargetInfo *Value);
3082a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
3092a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// }
31016b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// @name File Manager
31116b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// {
31216b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
313704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar  bool hasFileManager() const { return FileMgr != 0; }
314704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar
31522dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  FileManager &getFileManager() const {
31622dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    assert(FileMgr && "Compiler instance has no file manager!");
31722dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    return *FileMgr;
31822dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  }
31916b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
32016b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// takeFileManager - Remove the current file manager and give ownership to
32116b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// the caller.
32216b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  FileManager *takeFileManager() { return FileMgr.take(); }
32316b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
32416b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// setFileManager - Replace the current file manager; the compiler instance
32516b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// takes ownership of \arg Value.
3268a9f569262860b8d03203327afd6047be2a9b5a6Daniel Dunbar  void setFileManager(FileManager *Value);
32716b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
32816b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// }
32916b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// @name Source Manager
33016b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// {
33116b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
332704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar  bool hasSourceManager() const { return SourceMgr != 0; }
333704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar
33422dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  SourceManager &getSourceManager() const {
33522dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    assert(SourceMgr && "Compiler instance has no source manager!");
33622dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    return *SourceMgr;
33722dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  }
33816b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
33916b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// takeSourceManager - Remove the current source manager and give ownership
34016b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// to the caller.
34116b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  SourceManager *takeSourceManager() { return SourceMgr.take(); }
34216b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
34316b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// setSourceManager - Replace the current source manager; the compiler
34416b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// instance takes ownership of \arg Value.
3458a9f569262860b8d03203327afd6047be2a9b5a6Daniel Dunbar  void setSourceManager(SourceManager *Value);
34616b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
34716b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// }
34822dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// @name Preprocessor
34922dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// {
35022dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar
351704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar  bool hasPreprocessor() const { return PP != 0; }
352704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar
35322dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  Preprocessor &getPreprocessor() const {
35422dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    assert(PP && "Compiler instance has no preprocessor!");
35522dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    return *PP;
35622dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  }
35722dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar
35822dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// takePreprocessor - Remove the current preprocessor and give ownership to
35922dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// the caller.
36022dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  Preprocessor *takePreprocessor() { return PP.take(); }
36122dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar
36222dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// setPreprocessor - Replace the current preprocessor; the compiler instance
36322dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// takes ownership of \arg Value.
3648a9f569262860b8d03203327afd6047be2a9b5a6Daniel Dunbar  void setPreprocessor(Preprocessor *Value);
36522dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar
36622dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// }
3675eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  /// @name ASTContext
3685eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  /// {
3695eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar
370704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar  bool hasASTContext() const { return Context != 0; }
371704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar
3725eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  ASTContext &getASTContext() const {
3735eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar    assert(Context && "Compiler instance has no AST context!");
3745eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar    return *Context;
3755eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  }
3765eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar
3775eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  /// takeASTContext - Remove the current AST context and give ownership to the
3785eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  /// caller.
3795eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  ASTContext *takeASTContext() { return Context.take(); }
3805eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar
3815eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  /// setASTContext - Replace the current AST context; the compiler instance
3825eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  /// takes ownership of \arg Value.
3838a9f569262860b8d03203327afd6047be2a9b5a6Daniel Dunbar  void setASTContext(ASTContext *Value);
3845eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar
385f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// \brief Replace the current Sema; the compiler instance takes ownership
386f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// of S.
387f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  void setSema(Sema *S);
388f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor
3895eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  /// }
39012ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// @name ASTConsumer
39112ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// {
39212ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar
39312ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  bool hasASTConsumer() const { return Consumer != 0; }
39412ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar
39512ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  ASTConsumer &getASTConsumer() const {
39612ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar    assert(Consumer && "Compiler instance has no AST consumer!");
39712ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar    return *Consumer;
39812ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  }
39912ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar
40012ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// takeASTConsumer - Remove the current AST consumer and give ownership to
40112ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// the caller.
40212ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  ASTConsumer *takeASTConsumer() { return Consumer.take(); }
40312ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar
40412ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// setASTConsumer - Replace the current AST consumer; the compiler instance
40512ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// takes ownership of \arg Value.
40612ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  void setASTConsumer(ASTConsumer *Value);
40712ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar
40812ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// }
409f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// @name Semantic analysis
410f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// {
411f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  bool hasSema() const { return TheSema != 0; }
412f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor
413f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  Sema &getSema() const {
414f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor    assert(TheSema && "Compiler instance has no Sema object!");
415f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor    return *TheSema;
416f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  }
417f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor
418f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  Sema *takeSema() { return TheSema.take(); }
419f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor
420f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// }
421c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// @name Code Completion
422c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// {
423c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
424c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  bool hasCodeCompletionConsumer() const { return CompletionConsumer != 0; }
425c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
426c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  CodeCompleteConsumer &getCodeCompletionConsumer() const {
427c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar    assert(CompletionConsumer &&
428c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar           "Compiler instance has no code completion consumer!");
429c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar    return *CompletionConsumer;
430c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  }
431c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
432c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// takeCodeCompletionConsumer - Remove the current code completion consumer
433c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// and give ownership to the caller.
434c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  CodeCompleteConsumer *takeCodeCompletionConsumer() {
435c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar    return CompletionConsumer.take();
436c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  }
437c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
438c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// setCodeCompletionConsumer - Replace the current code completion consumer;
439c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// the compiler instance takes ownership of \arg Value.
4408a9f569262860b8d03203327afd6047be2a9b5a6Daniel Dunbar  void setCodeCompletionConsumer(CodeCompleteConsumer *Value);
441c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
442c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// }
443f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  /// @name Frontend timer
444f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  /// {
445f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam
446f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  bool hasFrontendTimer() const { return FrontendTimer != 0; }
447f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam
448f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  llvm::Timer &getFrontendTimer() const {
449f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam    assert(FrontendTimer && "Compiler instance has no frontend timer!");
450f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam    return *FrontendTimer;
451f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  }
452f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam
453f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  /// }
454a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// @name Output Files
455a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// {
456a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar
457a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// getOutputFileList - Get the list of (path, output stream) pairs of output
458a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// files; the path may be empty but the stream will always be non-null.
459a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  const std::list< std::pair<std::string,
460a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar                             llvm::raw_ostream*> > &getOutputFileList() const;
461a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar
462a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// addOutputFile - Add an output file onto the list of tracked output files.
463a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  ///
464dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// \param OutFile - The output file info.
465dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  void addOutputFile(const OutputFile &OutFile);
466a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar
467e51dd7be67808d52c80c09b832d875e9655ce6e0Kovarththanan Rajaratnam  /// clearOutputFiles - Clear the output file list, destroying the contained
468a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// output streams.
469a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  ///
470a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// \param EraseFiles - If true, attempt to erase the files from disk.
471e51dd7be67808d52c80c09b832d875e9655ce6e0Kovarththanan Rajaratnam  void clearOutputFiles(bool EraseFiles);
472a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar
473a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// }
47416b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// @name Construction Utility Methods
47516b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// {
47616b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
4770fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  /// Create the diagnostics engine using the invocation's diagnostic options
4780fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  /// and replace any existing one with it.
4790fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  ///
480e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// Note that this routine also replaces the diagnostic client,
481e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// allocating one if one is not provided.
482e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  ///
483e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// \param Client If non-NULL, a diagnostic client that will be
484e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// attached to (and, then, owned by) the Diagnostic inside this AST
485e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// unit.
486e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  void createDiagnostics(int Argc, const char* const *Argv,
487e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor                         DiagnosticClient *Client = 0);
4880fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar
4890fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  /// Create a Diagnostic object with a the TextDiagnosticPrinter.
4900fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  ///
4910fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  /// The \arg Argc and \arg Argv arguments are used only for logging purposes,
4920fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  /// when the diagnostic options indicate that the compiler should output
4930fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  /// logging information.
4940fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  ///
495e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// If no diagnostic client is provided, this creates a
496e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// DiagnosticClient that is owned by the returned diagnostic
497e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// object, if using directly the caller is responsible for
498e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// releasing the returned Diagnostic's client eventually.
4995eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  ///
500bb3503a146f5eee6393a8b7542f38d9f5fce6583Daniel Dunbar  /// \param Opts - The diagnostic options; note that the created text
501bb3503a146f5eee6393a8b7542f38d9f5fce6583Daniel Dunbar  /// diagnostic object contains a reference to these options and its lifetime
502bb3503a146f5eee6393a8b7542f38d9f5fce6583Daniel Dunbar  /// must extend past that of the diagnostic engine.
503bb3503a146f5eee6393a8b7542f38d9f5fce6583Daniel Dunbar  ///
504e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// \param Client If non-NULL, a diagnostic client that will be
505e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// attached to (and, then, owned by) the returned Diagnostic
506e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// object.
507e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  ///
5080fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  /// \return The new object on success, or null on failure.
50928019772db70d4547be05a042eb950bc910f134fDouglas Gregor  static llvm::IntrusiveRefCntPtr<Diagnostic>
5107d0c4ccd65b4549283c55e4923602e234f3811c5Axel Naumann  createDiagnostics(const DiagnosticOptions &Opts, int Argc,
511e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor                    const char* const *Argv,
512e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor                    DiagnosticClient *Client = 0);
5130fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar
51416b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// Create the file manager and replace any existing one with it.
51516b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  void createFileManager();
51616b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
51716b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// Create the source manager and replace any existing one with it.
51839b49bcaaddb1049234fca9500c0ac02c088e23dChris Lattner  void createSourceManager(FileManager &FileMgr);
51916b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
52022dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// Create the preprocessor, using the invocation, file, and source managers,
52122dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// and replace any existing one with it.
52222dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  void createPreprocessor();
52322dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar
52422dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// Create a Preprocessor object.
52522dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  ///
52622dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// Note that this also creates a new HeaderSearch object which will be owned
52722dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// by the resulting Preprocessor.
52822dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  ///
52922dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// \return The new object on success, or null on failure.
53022dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  static Preprocessor *createPreprocessor(Diagnostic &, const LangOptions &,
53122dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar                                          const PreprocessorOptions &,
53222dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar                                          const HeaderSearchOptions &,
53322dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar                                          const DependencyOutputOptions &,
53422dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar                                          const TargetInfo &,
5357d957472ef9a09048c03d8a11028536f908c18b9Fariborz Jahanian                                          const FrontendOptions &,
53622dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar                                          SourceManager &, FileManager &);
53722dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar
5385eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  /// Create the AST context.
5395eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  void createASTContext();
5405eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar
5410f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar  /// Create an external AST source to read a PCH file and attach it to the AST
5420f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar  /// context.
543fae3b2f4743dad616623c4df2fdb0f5128bd36d9Douglas Gregor  void createPCHExternalASTSource(llvm::StringRef Path,
544ffaab3e2bb13991bb3357e80f14bcae3745b2347Sebastian Redl                                  bool DisablePCHValidation,
545ffaab3e2bb13991bb3357e80f14bcae3745b2347Sebastian Redl                                  void *DeserializationListener);
5460f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar
5470f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar  /// Create an external AST source to read a PCH file.
5480f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar  ///
5490f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar  /// \return - The new object on success, or null on failure.
5500f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar  static ExternalASTSource *
5510f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar  createPCHExternalASTSource(llvm::StringRef Path, const std::string &Sysroot,
552fae3b2f4743dad616623c4df2fdb0f5128bd36d9Douglas Gregor                             bool DisablePCHValidation,
553ffaab3e2bb13991bb3357e80f14bcae3745b2347Sebastian Redl                             Preprocessor &PP, ASTContext &Context,
5541d9f1fe7173e3084325f43c78af812a36d8a2a7cSebastian Redl                             void *DeserializationListener, bool Preamble);
555a93e3b5bde9f0a7b59215f19f176f7d69881b81cSebastian Redl
556c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// Create a code completion consumer using the invocation; note that this
557c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// will cause the source manager to truncate the input source file at the
558c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// completion point.
559c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  void createCodeCompletionConsumer();
560c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
561c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// Create a code completion consumer to print code completion results, at
562c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// \arg Filename, \arg Line, and \arg Column, to the given output stream \arg
563c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// OS.
564c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  static CodeCompleteConsumer *
565c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  createCodeCompletionConsumer(Preprocessor &PP, const std::string &Filename,
566c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar                               unsigned Line, unsigned Column,
567a9f4f620daf073805b89e893afcdc5eb7a9bdc50Douglas Gregor                               bool ShowMacros,
5688071e4212ae08f8014e0c3ae6d18b7388003a5ccDouglas Gregor                               bool ShowCodePatterns, bool ShowGlobals,
5698071e4212ae08f8014e0c3ae6d18b7388003a5ccDouglas Gregor                               llvm::raw_ostream &OS);
570c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
571f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// \brief Create the Sema object to be used for parsing.
572f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  void createSema(bool CompleteTranslationUnit,
573f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor                  CodeCompleteConsumer *CompletionConsumer);
574f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor
575f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  /// Create the frontend timer and replace any existing one with it.
576f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  void createFrontendTimer();
577f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam
578f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// Create the default output file (from the invocation's options) and add it
579f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// to the list of tracked output files.
580360435908c9b90429cfe192fab22854af1d4497cDaniel Dunbar  ///
581360435908c9b90429cfe192fab22854af1d4497cDaniel Dunbar  /// \return - Null on error.
582f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  llvm::raw_fd_ostream *
583f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  createDefaultOutputFile(bool Binary = true, llvm::StringRef BaseInput = "",
584f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar                          llvm::StringRef Extension = "");
585f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar
586f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// Create a new output file and add it to the list of tracked output files,
587f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// optionally deriving the output path name.
588360435908c9b90429cfe192fab22854af1d4497cDaniel Dunbar  ///
589360435908c9b90429cfe192fab22854af1d4497cDaniel Dunbar  /// \return - Null on error.
590f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  llvm::raw_fd_ostream *
591f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  createOutputFile(llvm::StringRef OutputPath, bool Binary = true,
592f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar                   llvm::StringRef BaseInput = "",
593f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar                   llvm::StringRef Extension = "");
594f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar
595f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// Create a new output file, optionally deriving the output path name.
596f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  ///
597f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// If \arg OutputPath is empty, then createOutputFile will derive an output
598f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// path location as \arg BaseInput, with any suffix removed, and \arg
599dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// Extension appended. If OutputPath is not stdout createOutputFile will
600dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// create a new temporary file that must be renamed to OutputPath in the end.
601f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  ///
602f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// \param OutputPath - If given, the path to the output file.
603f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// \param Error [out] - On failure, the error message.
604f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// \param BaseInput - If \arg OutputPath is empty, the input path name to use
605f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// for deriving the output path.
606f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// \param Extension - The extension to use for derived output names.
607f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// \param Binary - The mode to open the file in.
608f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// \param ResultPathName [out] - If given, the result path name will be
609f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// stored here on success.
610dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// \param TempPathName [out] - If given, the temporary file path name
611dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// will be stored here on success.
612f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  static llvm::raw_fd_ostream *
613f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  createOutputFile(llvm::StringRef OutputPath, std::string &Error,
614f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar                   bool Binary = true, llvm::StringRef BaseInput = "",
615f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar                   llvm::StringRef Extension = "",
616dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis                   std::string *ResultPathName = 0,
617dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis                   std::string *TempPathName = 0);
618f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar
61916b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// }
620ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// @name Initialization Utility Methods
621ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// {
622ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar
623ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// InitializeSourceManager - Initialize the source manager to set InputFile
624ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// as the main file.
625ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  ///
626ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// \return True on success.
627ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  bool InitializeSourceManager(llvm::StringRef InputFile);
628ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar
629ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// InitializeSourceManager - Initialize the source manager to set InputFile
630ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// as the main file.
631ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  ///
632ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// \return True on success.
633ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  static bool InitializeSourceManager(llvm::StringRef InputFile,
634ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar                                      Diagnostic &Diags,
635ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar                                      FileManager &FileMgr,
636ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar                                      SourceManager &SourceMgr,
637ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar                                      const FrontendOptions &Opts);
638ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar
639ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// }
6402a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar};
6412a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
6422a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar} // end namespace clang
6432a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
6442a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar#endif
645