CompilerInstance.h revision b514c792821a8f053027d88444e13bfaa8efef76
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"
146aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor#include "clang/Lex/ModuleLoader.h"
1549009ec701feb3009450e57e40c656e2ad7c1f41Douglas Gregor#include "clang/Lex/ModuleMap.h"
163d3589db579f7695667b913c5043dd264ebe546fDouglas Gregor#include "llvm/ADT/ArrayRef.h"
1749009ec701feb3009450e57e40c656e2ad7c1f41Douglas Gregor#include "llvm/ADT/DenseMap.h"
1828019772db70d4547be05a042eb950bc910f134fDouglas Gregor#include "llvm/ADT/IntrusiveRefCntPtr.h"
190f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar#include "llvm/ADT/StringRef.h"
202a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar#include "llvm/ADT/OwningPtr.h"
2122dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar#include <cassert>
22a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar#include <list>
23a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar#include <string>
243d3589db579f7695667b913c5043dd264ebe546fDouglas Gregor#include <utility>
252a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
262a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbarnamespace llvm {
27f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbarclass raw_fd_ostream;
28f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnamclass Timer;
292a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar}
302a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
312a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbarnamespace clang {
325eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbarclass ASTContext;
3312ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbarclass ASTConsumer;
34f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregorclass ASTReader;
35c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbarclass CodeCompleteConsumer;
36d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikieclass DiagnosticsEngine;
3778ad0b98848c17a0a11847fa1d456e2dfec8aa2fDavid Blaikieclass DiagnosticConsumer;
380f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbarclass ExternalASTSource;
3949009ec701feb3009450e57e40c656e2ad7c1f41Douglas Gregorclass FileEntry;
4016b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbarclass FileManager;
410397af277e3bba16da1fd125ddba07415686b429Daniel Dunbarclass FrontendAction;
420f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbarclass Preprocessor;
43f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregorclass Sema;
4416b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbarclass SourceManager;
452a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbarclass TargetInfo;
462a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
472a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// CompilerInstance - Helper class for managing a single instance of the Clang
482a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// compiler.
492a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///
502a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// The CompilerInstance serves two purposes:
512a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///  (1) It manages the various objects which are necessary to run the compiler,
522a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///      for example the preprocessor, the target information, and the AST
532a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///      context.
542a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///  (2) It provides utility routines for constructing and manipulating the
552a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///      common Clang objects.
562a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///
572a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// The compiler instance generally owns the instance of all the objects that it
582a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// manages. However, clients can still share objects by manually setting the
592a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// object and retaking ownership prior to destroying the CompilerInstance.
602a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///
612a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// The compiler instance is intended to simplify clients, but not to lock them
622a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// in to the compiler instance for everything. When possible, utility functions
632a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// come in two forms; a short form that reuses the CompilerInstance objects,
642a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// and a long form that takes explicit instances of any required objects.
656aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregorclass CompilerInstance : public ModuleLoader {
662a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// The options used in this compiler instance.
674f32786ac45210143654390177105eb749b614e9Ted Kremenek  llvm::IntrusiveRefCntPtr<CompilerInvocation> Invocation;
682a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
692a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// The diagnostics engine instance.
70d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikie  llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics;
712a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
722a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// The target being compiled for.
734f32786ac45210143654390177105eb749b614e9Ted Kremenek  llvm::IntrusiveRefCntPtr<TargetInfo> Target;
742a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
7516b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// The file manager.
764f32786ac45210143654390177105eb749b614e9Ted Kremenek  llvm::IntrusiveRefCntPtr<FileManager> FileMgr;
7716b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
7816b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// The source manager.
794f32786ac45210143654390177105eb749b614e9Ted Kremenek  llvm::IntrusiveRefCntPtr<SourceManager> SourceMgr;
8016b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
8122dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// The preprocessor.
824f32786ac45210143654390177105eb749b614e9Ted Kremenek  llvm::IntrusiveRefCntPtr<Preprocessor> PP;
8322dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar
845eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  /// The AST context.
854f32786ac45210143654390177105eb749b614e9Ted Kremenek  llvm::IntrusiveRefCntPtr<ASTContext> Context;
865eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar
8712ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// The AST consumer.
8812ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  llvm::OwningPtr<ASTConsumer> Consumer;
8912ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar
90c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// The code completion consumer.
91c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  llvm::OwningPtr<CodeCompleteConsumer> CompletionConsumer;
92c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
93f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// \brief The semantic analysis object.
94f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  llvm::OwningPtr<Sema> TheSema;
95f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor
96f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregor  /// \brief The frontend timer
97f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  llvm::OwningPtr<llvm::Timer> FrontendTimer;
98f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam
99f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregor  /// \brief Non-owning reference to the ASTReader, if one exists.
100f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregor  ASTReader *ModuleManager;
101f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregor
10249009ec701feb3009450e57e40c656e2ad7c1f41Douglas Gregor  /// \brief A module that we have already attempted to load, which is known
10349009ec701feb3009450e57e40c656e2ad7c1f41Douglas Gregor  /// by either a file entry (FIXME: a temporary measure) or via its module
10449009ec701feb3009450e57e40c656e2ad7c1f41Douglas Gregor  /// definition.
10549009ec701feb3009450e57e40c656e2ad7c1f41Douglas Gregor  typedef llvm::PointerUnion<const FileEntry *, ModuleMap::Module *>
10649009ec701feb3009450e57e40c656e2ad7c1f41Douglas Gregor    KnownModule;
10749009ec701feb3009450e57e40c656e2ad7c1f41Douglas Gregor
10849009ec701feb3009450e57e40c656e2ad7c1f41Douglas Gregor  /// \brief The set of top-level modules that has already been loaded,
10949009ec701feb3009450e57e40c656e2ad7c1f41Douglas Gregor  /// along with the module map
11049009ec701feb3009450e57e40c656e2ad7c1f41Douglas Gregor  llvm::DenseMap<const IdentifierInfo *, KnownModule> KnownModules;
11149009ec701feb3009450e57e40c656e2ad7c1f41Douglas Gregor
112b514c792821a8f053027d88444e13bfaa8efef76Douglas Gregor  /// \brief The location of the module-import keyword for the last module
113b514c792821a8f053027d88444e13bfaa8efef76Douglas Gregor  /// import.
114b514c792821a8f053027d88444e13bfaa8efef76Douglas Gregor  SourceLocation LastModuleImportLoc;
115b514c792821a8f053027d88444e13bfaa8efef76Douglas Gregor
116b514c792821a8f053027d88444e13bfaa8efef76Douglas Gregor  /// \brief The result of the last module import.
117b514c792821a8f053027d88444e13bfaa8efef76Douglas Gregor  ///
118b514c792821a8f053027d88444e13bfaa8efef76Douglas Gregor  KnownModule LastModuleImportResult;
119b514c792821a8f053027d88444e13bfaa8efef76Douglas Gregor
120dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// \brief Holds information about the output file.
121dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  ///
122dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// If TempFilename is not empty we must rename it to Filename at the end.
123dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// TempFilename may be empty and Filename non empty if creating the temporary
124dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// failed.
125dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  struct OutputFile {
126dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis    std::string Filename;
127dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis    std::string TempFilename;
1288cc488fefb2fb04bc8d5398da29f0182f97934cfChris Lattner    raw_ostream *OS;
129dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis
130dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis    OutputFile(const std::string &filename, const std::string &tempFilename,
1318cc488fefb2fb04bc8d5398da29f0182f97934cfChris Lattner               raw_ostream *os)
132dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis      : Filename(filename), TempFilename(tempFilename), OS(os) { }
133dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  };
134dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis
135a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// The list of active output files.
136dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  std::list<OutputFile> OutputFiles;
137a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar
13842e9f8e4983d50f896ec716207817b9d96e7e79cDaniel Dunbar  void operator=(const CompilerInstance &);  // DO NOT IMPLEMENT
13942e9f8e4983d50f896ec716207817b9d96e7e79cDaniel Dunbar  CompilerInstance(const CompilerInstance&); // DO NOT IMPLEMENT
1402a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbarpublic:
14142e9f8e4983d50f896ec716207817b9d96e7e79cDaniel Dunbar  CompilerInstance();
1422a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  ~CompilerInstance();
1432a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
1440397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// @name High-Level Operations
1450397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// {
1460397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar
1470397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// ExecuteAction - Execute the provided action against the compiler's
1480397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// CompilerInvocation object.
1490397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1500397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// This function makes the following assumptions:
1510397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1520397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///  - The invocation options should be initialized. This function does not
1530397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///    handle the '-help' or '-version' options, clients should handle those
1540397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///    directly.
1550397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1560397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///  - The diagnostics engine should have already been created by the client.
1570397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1580397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///  - No other CompilerInstance state should have been initialized (this is
1590397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///    an unchecked error).
1600397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1610397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///  - Clients should have initialized any LLVM target features that may be
1620397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///    required.
1630397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1640397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///  - Clients should eventually call llvm_shutdown() upon the completion of
1650397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///    this routine to ensure that any managed objects are properly destroyed.
1660397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1670397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// Note that this routine may write output to 'stderr'.
1680397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1690397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// \param Act - The action to execute.
1700397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// \return - True on success.
1710397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  //
1720397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  // FIXME: This function should take the stream to write any debugging /
1730397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  // verbose output to as an argument.
1740397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  //
1750397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  // FIXME: Eliminate the llvm_shutdown requirement, that should either be part
1760397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  // of the context or else not CompilerInstance specific.
1770397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  bool ExecuteAction(FrontendAction &Act);
1780397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar
1790397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// }
1802a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// @name Compiler Invocation and Options
1812a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// {
1822a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
1836228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar  bool hasInvocation() const { return Invocation != 0; }
1846228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar
1856228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar  CompilerInvocation &getInvocation() {
1866228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    assert(Invocation && "Compiler instance has no invocation!");
1876228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return *Invocation;
1886228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar  }
1896228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar
1904f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// setInvocation - Replace the current invocation.
1916228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar  void setInvocation(CompilerInvocation *Value);
1922a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
1932a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// }
1942a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// @name Forwarding Methods
1952a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// {
1962a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
1972a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  AnalyzerOptions &getAnalyzerOpts() {
1986228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getAnalyzerOpts();
1992a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2002a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const AnalyzerOptions &getAnalyzerOpts() const {
2016228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getAnalyzerOpts();
2022a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2032a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2042a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  CodeGenOptions &getCodeGenOpts() {
2056228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getCodeGenOpts();
2062a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2072a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const CodeGenOptions &getCodeGenOpts() const {
2086228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getCodeGenOpts();
2092a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2102a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2112a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  DependencyOutputOptions &getDependencyOutputOpts() {
2126228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getDependencyOutputOpts();
2132a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2142a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const DependencyOutputOptions &getDependencyOutputOpts() const {
2156228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getDependencyOutputOpts();
2162a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2172a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2182a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  DiagnosticOptions &getDiagnosticOpts() {
2196228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getDiagnosticOpts();
2202a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2212a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const DiagnosticOptions &getDiagnosticOpts() const {
2226228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getDiagnosticOpts();
2232a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2242a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
225389db16c63eec6ecfa9b235155252d8da766e94eArgyrios Kyrtzidis  const FileSystemOptions &getFileSystemOpts() const {
226389db16c63eec6ecfa9b235155252d8da766e94eArgyrios Kyrtzidis    return Invocation->getFileSystemOpts();
227389db16c63eec6ecfa9b235155252d8da766e94eArgyrios Kyrtzidis  }
228389db16c63eec6ecfa9b235155252d8da766e94eArgyrios Kyrtzidis
2292a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  FrontendOptions &getFrontendOpts() {
2306228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getFrontendOpts();
2312a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2322a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const FrontendOptions &getFrontendOpts() const {
2336228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getFrontendOpts();
2342a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2352a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2362a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  HeaderSearchOptions &getHeaderSearchOpts() {
2376228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getHeaderSearchOpts();
2382a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2392a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const HeaderSearchOptions &getHeaderSearchOpts() const {
2406228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getHeaderSearchOpts();
2412a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2422a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2432a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  LangOptions &getLangOpts() {
244d3b74d9ca4f239a7a90ad193378c494306c57352Ted Kremenek    return *Invocation->getLangOpts();
2452a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2462a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const LangOptions &getLangOpts() const {
247d3b74d9ca4f239a7a90ad193378c494306c57352Ted Kremenek    return *Invocation->getLangOpts();
2482a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2492a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2502a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  PreprocessorOptions &getPreprocessorOpts() {
2516228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getPreprocessorOpts();
2522a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2532a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const PreprocessorOptions &getPreprocessorOpts() const {
2546228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getPreprocessorOpts();
2552a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2562a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2572a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  PreprocessorOutputOptions &getPreprocessorOutputOpts() {
2586228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getPreprocessorOutputOpts();
2592a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2602a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const PreprocessorOutputOptions &getPreprocessorOutputOpts() const {
2616228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getPreprocessorOutputOpts();
2622a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2632a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
264d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbar  TargetOptions &getTargetOpts() {
2656228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getTargetOpts();
266d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbar  }
267d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbar  const TargetOptions &getTargetOpts() const {
2686228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getTargetOpts();
269d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbar  }
270d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbar
2712a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// }
2722a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// @name Diagnostics Engine
2732a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// {
2742a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
275704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar  bool hasDiagnostics() const { return Diagnostics != 0; }
276704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar
2774f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// Get the current diagnostics engine.
278d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikie  DiagnosticsEngine &getDiagnostics() const {
27922dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    assert(Diagnostics && "Compiler instance has no diagnostics!");
28022dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    return *Diagnostics;
28122dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  }
2822a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2834f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// setDiagnostics - Replace the current diagnostics engine.
284d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikie  void setDiagnostics(DiagnosticsEngine *Value);
2852a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
28678ad0b98848c17a0a11847fa1d456e2dfec8aa2fDavid Blaikie  DiagnosticConsumer &getDiagnosticClient() const {
287bdbb004f38978da0c4a75af3294d1c7b5ff84af1Douglas Gregor    assert(Diagnostics && Diagnostics->getClient() &&
288bdbb004f38978da0c4a75af3294d1c7b5ff84af1Douglas Gregor           "Compiler instance has no diagnostic client!");
289bdbb004f38978da0c4a75af3294d1c7b5ff84af1Douglas Gregor    return *Diagnostics->getClient();
29081f5a1e699b2eefa4a5e50b5dfc06df600748f59Daniel Dunbar  }
2912a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2922a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// }
2932a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// @name Target Info
2942a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// {
2952a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
296704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar  bool hasTarget() const { return Target != 0; }
297704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar
29822dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  TargetInfo &getTarget() const {
29922dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    assert(Target && "Compiler instance has no target!");
30022dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    return *Target;
30122dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  }
3022a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
3034f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// Replace the current diagnostics engine.
3048a9f569262860b8d03203327afd6047be2a9b5a6Daniel Dunbar  void setTarget(TargetInfo *Value);
3052a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
3062a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// }
30716b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// @name File Manager
30816b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// {
30916b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
310704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar  bool hasFileManager() const { return FileMgr != 0; }
311704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar
3124f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// Return the current file manager to the caller.
31322dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  FileManager &getFileManager() const {
31422dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    assert(FileMgr && "Compiler instance has no file manager!");
31522dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    return *FileMgr;
31622dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  }
3174f32786ac45210143654390177105eb749b614e9Ted Kremenek
3184f32786ac45210143654390177105eb749b614e9Ted Kremenek  void resetAndLeakFileManager() {
3194f32786ac45210143654390177105eb749b614e9Ted Kremenek    FileMgr.resetWithoutRelease();
3204f32786ac45210143654390177105eb749b614e9Ted Kremenek  }
32116b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
3224f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// setFileManager - Replace the current file manager.
3238a9f569262860b8d03203327afd6047be2a9b5a6Daniel Dunbar  void setFileManager(FileManager *Value);
32416b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
32516b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// }
32616b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// @name Source Manager
32716b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// {
32816b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
329704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar  bool hasSourceManager() const { return SourceMgr != 0; }
330704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar
3314f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// Return the current source manager.
33222dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  SourceManager &getSourceManager() const {
33322dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    assert(SourceMgr && "Compiler instance has no source manager!");
33422dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    return *SourceMgr;
33522dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  }
3364f32786ac45210143654390177105eb749b614e9Ted Kremenek
3374f32786ac45210143654390177105eb749b614e9Ted Kremenek  void resetAndLeakSourceManager() {
3384f32786ac45210143654390177105eb749b614e9Ted Kremenek    SourceMgr.resetWithoutRelease();
3394f32786ac45210143654390177105eb749b614e9Ted Kremenek  }
34016b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
3414f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// setSourceManager - Replace the current source manager.
3428a9f569262860b8d03203327afd6047be2a9b5a6Daniel Dunbar  void setSourceManager(SourceManager *Value);
34316b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
34416b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// }
34522dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// @name Preprocessor
34622dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// {
34722dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar
348704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar  bool hasPreprocessor() const { return PP != 0; }
349704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar
3504f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// Return the current preprocessor.
35122dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  Preprocessor &getPreprocessor() const {
35222dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    assert(PP && "Compiler instance has no preprocessor!");
35322dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    return *PP;
35422dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  }
35522dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar
3564f32786ac45210143654390177105eb749b614e9Ted Kremenek  void resetAndLeakPreprocessor() {
3574f32786ac45210143654390177105eb749b614e9Ted Kremenek    PP.resetWithoutRelease();
3584f32786ac45210143654390177105eb749b614e9Ted Kremenek  }
35922dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar
3604f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// Replace the current preprocessor.
3618a9f569262860b8d03203327afd6047be2a9b5a6Daniel Dunbar  void setPreprocessor(Preprocessor *Value);
36222dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar
36322dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// }
3645eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  /// @name ASTContext
3655eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  /// {
3665eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar
367704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar  bool hasASTContext() const { return Context != 0; }
368704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar
3695eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  ASTContext &getASTContext() const {
3705eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar    assert(Context && "Compiler instance has no AST context!");
3715eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar    return *Context;
3725eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  }
3734f32786ac45210143654390177105eb749b614e9Ted Kremenek
3744f32786ac45210143654390177105eb749b614e9Ted Kremenek  void resetAndLeakASTContext() {
3754f32786ac45210143654390177105eb749b614e9Ted Kremenek    Context.resetWithoutRelease();
3764f32786ac45210143654390177105eb749b614e9Ted Kremenek  }
3775eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar
3784f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// setASTContext - Replace the current AST context.
3798a9f569262860b8d03203327afd6047be2a9b5a6Daniel Dunbar  void setASTContext(ASTContext *Value);
3805eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar
381f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// \brief Replace the current Sema; the compiler instance takes ownership
382f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// of S.
383f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  void setSema(Sema *S);
384f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor
3855eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  /// }
38612ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// @name ASTConsumer
38712ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// {
38812ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar
38912ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  bool hasASTConsumer() const { return Consumer != 0; }
39012ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar
39112ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  ASTConsumer &getASTConsumer() const {
39212ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar    assert(Consumer && "Compiler instance has no AST consumer!");
39312ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar    return *Consumer;
39412ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  }
39512ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar
39612ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// takeASTConsumer - Remove the current AST consumer and give ownership to
39712ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// the caller.
39812ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  ASTConsumer *takeASTConsumer() { return Consumer.take(); }
39912ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar
40012ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// setASTConsumer - Replace the current AST consumer; the compiler instance
40112ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// takes ownership of \arg Value.
40212ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  void setASTConsumer(ASTConsumer *Value);
40312ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar
40412ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// }
405f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// @name Semantic analysis
406f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// {
407f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  bool hasSema() const { return TheSema != 0; }
408f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor
409f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  Sema &getSema() const {
410f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor    assert(TheSema && "Compiler instance has no Sema object!");
411f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor    return *TheSema;
412f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  }
413f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor
414f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  Sema *takeSema() { return TheSema.take(); }
415f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor
416f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// }
417f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregor  /// @name Module Management
418f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregor  /// {
419f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregor
420f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregor  ASTReader *getModuleManager() const { return ModuleManager; }
421f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregor
422f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregor  /// }
423c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// @name Code Completion
424c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// {
425c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
426c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  bool hasCodeCompletionConsumer() const { return CompletionConsumer != 0; }
427c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
428c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  CodeCompleteConsumer &getCodeCompletionConsumer() const {
429c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar    assert(CompletionConsumer &&
430c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar           "Compiler instance has no code completion consumer!");
431c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar    return *CompletionConsumer;
432c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  }
433c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
434c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// takeCodeCompletionConsumer - Remove the current code completion consumer
435c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// and give ownership to the caller.
436c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  CodeCompleteConsumer *takeCodeCompletionConsumer() {
437c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar    return CompletionConsumer.take();
438c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  }
439c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
440c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// setCodeCompletionConsumer - Replace the current code completion consumer;
441c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// the compiler instance takes ownership of \arg Value.
4428a9f569262860b8d03203327afd6047be2a9b5a6Daniel Dunbar  void setCodeCompletionConsumer(CodeCompleteConsumer *Value);
443c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
444c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// }
445f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  /// @name Frontend timer
446f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  /// {
447f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam
448f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  bool hasFrontendTimer() const { return FrontendTimer != 0; }
449f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam
450f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  llvm::Timer &getFrontendTimer() const {
451f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam    assert(FrontendTimer && "Compiler instance has no frontend timer!");
452f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam    return *FrontendTimer;
453f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  }
454f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam
455f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  /// }
456a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// @name Output Files
457a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// {
458a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar
459a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// addOutputFile - Add an output file onto the list of tracked output files.
460a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  ///
461dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// \param OutFile - The output file info.
462dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  void addOutputFile(const OutputFile &OutFile);
463a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar
464e51dd7be67808d52c80c09b832d875e9655ce6e0Kovarththanan Rajaratnam  /// clearOutputFiles - Clear the output file list, destroying the contained
465a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// output streams.
466a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  ///
467a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// \param EraseFiles - If true, attempt to erase the files from disk.
468e51dd7be67808d52c80c09b832d875e9655ce6e0Kovarththanan Rajaratnam  void clearOutputFiles(bool EraseFiles);
469a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar
470a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// }
47116b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// @name Construction Utility Methods
47216b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// {
47316b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
4740fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  /// Create the diagnostics engine using the invocation's diagnostic options
4750fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  /// and replace any existing one with it.
4760fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  ///
477e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// Note that this routine also replaces the diagnostic client,
478e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// allocating one if one is not provided.
479e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  ///
480e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// \param Client If non-NULL, a diagnostic client that will be
481d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikie  /// attached to (and, then, owned by) the DiagnosticsEngine inside this AST
482e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// unit.
48378243658c533168d51fd076fba328437932ba6f1Douglas Gregor  ///
48478243658c533168d51fd076fba328437932ba6f1Douglas Gregor  /// \param ShouldOwnClient If Client is non-NULL, specifies whether
48578243658c533168d51fd076fba328437932ba6f1Douglas Gregor  /// the diagnostic object should take ownership of the client.
486aee526e77657afd1600276450e9c346953ad51d7Douglas Gregor  ///
487aee526e77657afd1600276450e9c346953ad51d7Douglas Gregor  /// \param ShouldCloneClient If Client is non-NULL, specifies whether that
488aee526e77657afd1600276450e9c346953ad51d7Douglas Gregor  /// client should be cloned.
489e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  void createDiagnostics(int Argc, const char* const *Argv,
49078ad0b98848c17a0a11847fa1d456e2dfec8aa2fDavid Blaikie                         DiagnosticConsumer *Client = 0,
491aee526e77657afd1600276450e9c346953ad51d7Douglas Gregor                         bool ShouldOwnClient = true,
492aee526e77657afd1600276450e9c346953ad51d7Douglas Gregor                         bool ShouldCloneClient = true);
4930fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar
494d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikie  /// Create a DiagnosticsEngine object with a the TextDiagnosticPrinter.
4950fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  ///
4960fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  /// The \arg Argc and \arg Argv arguments are used only for logging purposes,
4970fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  /// when the diagnostic options indicate that the compiler should output
4980fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  /// logging information.
4990fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  ///
500e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// If no diagnostic client is provided, this creates a
50178ad0b98848c17a0a11847fa1d456e2dfec8aa2fDavid Blaikie  /// DiagnosticConsumer that is owned by the returned diagnostic
502e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// object, if using directly the caller is responsible for
503d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikie  /// releasing the returned DiagnosticsEngine's client eventually.
5045eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  ///
505bb3503a146f5eee6393a8b7542f38d9f5fce6583Daniel Dunbar  /// \param Opts - The diagnostic options; note that the created text
506bb3503a146f5eee6393a8b7542f38d9f5fce6583Daniel Dunbar  /// diagnostic object contains a reference to these options and its lifetime
507bb3503a146f5eee6393a8b7542f38d9f5fce6583Daniel Dunbar  /// must extend past that of the diagnostic engine.
508bb3503a146f5eee6393a8b7542f38d9f5fce6583Daniel Dunbar  ///
509e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// \param Client If non-NULL, a diagnostic client that will be
510d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikie  /// attached to (and, then, owned by) the returned DiagnosticsEngine
511e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// object.
512e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  ///
513b6534bbee90bf73f364072051d10b60352d43c3eDaniel Dunbar  /// \param CodeGenOpts If non-NULL, the code gen options in use, which may be
514b6534bbee90bf73f364072051d10b60352d43c3eDaniel Dunbar  /// used by some diagnostics printers (for logging purposes only).
515b6534bbee90bf73f364072051d10b60352d43c3eDaniel Dunbar  ///
5160fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  /// \return The new object on success, or null on failure.
517d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikie  static llvm::IntrusiveRefCntPtr<DiagnosticsEngine>
5187d0c4ccd65b4549283c55e4923602e234f3811c5Axel Naumann  createDiagnostics(const DiagnosticOptions &Opts, int Argc,
519e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor                    const char* const *Argv,
52078ad0b98848c17a0a11847fa1d456e2dfec8aa2fDavid Blaikie                    DiagnosticConsumer *Client = 0,
52178243658c533168d51fd076fba328437932ba6f1Douglas Gregor                    bool ShouldOwnClient = true,
522aee526e77657afd1600276450e9c346953ad51d7Douglas Gregor                    bool ShouldCloneClient = true,
523b6534bbee90bf73f364072051d10b60352d43c3eDaniel Dunbar                    const CodeGenOptions *CodeGenOpts = 0);
5240fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar
52516b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// Create the file manager and replace any existing one with it.
52616b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  void createFileManager();
52716b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
52816b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// Create the source manager and replace any existing one with it.
52939b49bcaaddb1049234fca9500c0ac02c088e23dChris Lattner  void createSourceManager(FileManager &FileMgr);
53016b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
53122dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// Create the preprocessor, using the invocation, file, and source managers,
53222dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// and replace any existing one with it.
53322dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  void createPreprocessor();
53422dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar
5355eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  /// Create the AST context.
5365eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  void createASTContext();
5375eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar
5380f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar  /// Create an external AST source to read a PCH file and attach it to the AST
5390f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar  /// context.
540686775deca8b8685eb90801495880e3abdd844c2Chris Lattner  void createPCHExternalASTSource(StringRef Path,
541ffaab3e2bb13991bb3357e80f14bcae3745b2347Sebastian Redl                                  bool DisablePCHValidation,
5428ef6c8cb6c5627240e2339fd7062c9873f821d7eDouglas Gregor                                  bool DisableStatCache,
543ffaab3e2bb13991bb3357e80f14bcae3745b2347Sebastian Redl                                  void *DeserializationListener);
5440f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar
5450f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar  /// Create an external AST source to read a PCH file.
5460f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar  ///
5470f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar  /// \return - The new object on success, or null on failure.
5480f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar  static ExternalASTSource *
549686775deca8b8685eb90801495880e3abdd844c2Chris Lattner  createPCHExternalASTSource(StringRef Path, const std::string &Sysroot,
550fae3b2f4743dad616623c4df2fdb0f5128bd36d9Douglas Gregor                             bool DisablePCHValidation,
5518ef6c8cb6c5627240e2339fd7062c9873f821d7eDouglas Gregor                             bool DisableStatCache,
552ffaab3e2bb13991bb3357e80f14bcae3745b2347Sebastian Redl                             Preprocessor &PP, ASTContext &Context,
5531d9f1fe7173e3084325f43c78af812a36d8a2a7cSebastian Redl                             void *DeserializationListener, bool Preamble);
554a93e3b5bde9f0a7b59215f19f176f7d69881b81cSebastian Redl
555c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// Create a code completion consumer using the invocation; note that this
556c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// will cause the source manager to truncate the input source file at the
557c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// completion point.
558c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  void createCodeCompletionConsumer();
559c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
560c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// Create a code completion consumer to print code completion results, at
561c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// \arg Filename, \arg Line, and \arg Column, to the given output stream \arg
562c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// OS.
563c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  static CodeCompleteConsumer *
564c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  createCodeCompletionConsumer(Preprocessor &PP, const std::string &Filename,
565c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar                               unsigned Line, unsigned Column,
566a9f4f620daf073805b89e893afcdc5eb7a9bdc50Douglas Gregor                               bool ShowMacros,
5678071e4212ae08f8014e0c3ae6d18b7388003a5ccDouglas Gregor                               bool ShowCodePatterns, bool ShowGlobals,
5688cc488fefb2fb04bc8d5398da29f0182f97934cfChris Lattner                               raw_ostream &OS);
569c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
570f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// \brief Create the Sema object to be used for parsing.
571467dc88512b4ba4bb16e274ea3771dc1415d31daDouglas Gregor  void createSema(TranslationUnitKind TUKind,
572f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor                  CodeCompleteConsumer *CompletionConsumer);
573f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor
574f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  /// Create the frontend timer and replace any existing one with it.
575f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  void createFrontendTimer();
576f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam
577f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// Create the default output file (from the invocation's options) and add it
578f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// to the list of tracked output files.
579360435908c9b90429cfe192fab22854af1d4497cDaniel Dunbar  ///
580360435908c9b90429cfe192fab22854af1d4497cDaniel Dunbar  /// \return - Null on error.
581f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  llvm::raw_fd_ostream *
582686775deca8b8685eb90801495880e3abdd844c2Chris Lattner  createDefaultOutputFile(bool Binary = true, StringRef BaseInput = "",
583686775deca8b8685eb90801495880e3abdd844c2Chris Lattner                          StringRef Extension = "");
584f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar
585f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// Create a new output file and add it to the list of tracked output files,
586f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// optionally deriving the output path name.
587360435908c9b90429cfe192fab22854af1d4497cDaniel Dunbar  ///
588360435908c9b90429cfe192fab22854af1d4497cDaniel Dunbar  /// \return - Null on error.
589f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  llvm::raw_fd_ostream *
590686775deca8b8685eb90801495880e3abdd844c2Chris Lattner  createOutputFile(StringRef OutputPath,
591ff9cd968cd5b623e3ec7e5f862b598cd22f7ec79Daniel Dunbar                   bool Binary = true, bool RemoveFileOnSignal = true,
592686775deca8b8685eb90801495880e3abdd844c2Chris Lattner                   StringRef BaseInput = "",
5937e90985df09855dc309ed888a5b16a0ae684f8e3Argyrios Kyrtzidis                   StringRef Extension = "",
5947e90985df09855dc309ed888a5b16a0ae684f8e3Argyrios Kyrtzidis                   bool UseTemporary = false);
595f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar
596f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// Create a new output file, optionally deriving the output path name.
597f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  ///
598f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// If \arg OutputPath is empty, then createOutputFile will derive an output
599f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// path location as \arg BaseInput, with any suffix removed, and \arg
6007e90985df09855dc309ed888a5b16a0ae684f8e3Argyrios Kyrtzidis  /// Extension appended. If OutputPath is not stdout and \arg UseTemporary
6017e90985df09855dc309ed888a5b16a0ae684f8e3Argyrios Kyrtzidis  /// is true, createOutputFile will create a new temporary file that must be
6027e90985df09855dc309ed888a5b16a0ae684f8e3Argyrios Kyrtzidis  /// renamed to OutputPath in the end.
603f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  ///
604f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// \param OutputPath - If given, the path to the output file.
605f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// \param Error [out] - On failure, the error message.
606f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// \param BaseInput - If \arg OutputPath is empty, the input path name to use
607f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// for deriving the output path.
608f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// \param Extension - The extension to use for derived output names.
609f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// \param Binary - The mode to open the file in.
610ff9cd968cd5b623e3ec7e5f862b598cd22f7ec79Daniel Dunbar  /// \param RemoveFileOnSignal - Whether the file should be registered with
611ff9cd968cd5b623e3ec7e5f862b598cd22f7ec79Daniel Dunbar  /// llvm::sys::RemoveFileOnSignal. Note that this is not safe for
612ff9cd968cd5b623e3ec7e5f862b598cd22f7ec79Daniel Dunbar  /// multithreaded use, as the underlying signal mechanism is not reentrant
6137e90985df09855dc309ed888a5b16a0ae684f8e3Argyrios Kyrtzidis  /// \param UseTemporary - Create a new temporary file that must be renamed to
6147e90985df09855dc309ed888a5b16a0ae684f8e3Argyrios Kyrtzidis  ///         OutputPath in the end
615f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// \param ResultPathName [out] - If given, the result path name will be
616f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// stored here on success.
617dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// \param TempPathName [out] - If given, the temporary file path name
618dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// will be stored here on success.
619f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  static llvm::raw_fd_ostream *
620686775deca8b8685eb90801495880e3abdd844c2Chris Lattner  createOutputFile(StringRef OutputPath, std::string &Error,
621ff9cd968cd5b623e3ec7e5f862b598cd22f7ec79Daniel Dunbar                   bool Binary = true, bool RemoveFileOnSignal = true,
622686775deca8b8685eb90801495880e3abdd844c2Chris Lattner                   StringRef BaseInput = "",
623686775deca8b8685eb90801495880e3abdd844c2Chris Lattner                   StringRef Extension = "",
6247e90985df09855dc309ed888a5b16a0ae684f8e3Argyrios Kyrtzidis                   bool UseTemporary = false,
625dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis                   std::string *ResultPathName = 0,
626dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis                   std::string *TempPathName = 0);
627f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar
62816b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// }
629ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// @name Initialization Utility Methods
630ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// {
631ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar
632ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// InitializeSourceManager - Initialize the source manager to set InputFile
633ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// as the main file.
634ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  ///
635ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// \return True on success.
636686775deca8b8685eb90801495880e3abdd844c2Chris Lattner  bool InitializeSourceManager(StringRef InputFile);
637ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar
638ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// InitializeSourceManager - Initialize the source manager to set InputFile
639ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// as the main file.
640ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  ///
641ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// \return True on success.
642686775deca8b8685eb90801495880e3abdd844c2Chris Lattner  static bool InitializeSourceManager(StringRef InputFile,
643d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikie                                      DiagnosticsEngine &Diags,
644ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar                                      FileManager &FileMgr,
645ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar                                      SourceManager &SourceMgr,
646ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar                                      const FrontendOptions &Opts);
647ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar
648ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// }
6496aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor
6503d3589db579f7695667b913c5043dd264ebe546fDouglas Gregor  virtual ModuleKey loadModule(SourceLocation ImportLoc, ModuleIdPath Path);
6512a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar};
6522a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
6532a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar} // end namespace clang
6542a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
6552a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar#endif
656