CompilerInstance.h revision 30a2e16f6c27f888dd11eba6bbbae1e980078fcb
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
13dc7b641574a733624489bd87fc7061771edf2113Douglas Gregor#include "clang/Basic/Diagnostic.h"
14a1f1fad8b60e1cb9d21a40a37f2e03150bcbeb6fDouglas Gregor#include "clang/Basic/SourceManager.h"
1530a2e16f6c27f888dd11eba6bbbae1e980078fcbChandler Carruth#include "clang/Frontend/CompilerInvocation.h"
166aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor#include "clang/Lex/ModuleLoader.h"
173d3589db579f7695667b913c5043dd264ebe546fDouglas Gregor#include "llvm/ADT/ArrayRef.h"
1849009ec701feb3009450e57e40c656e2ad7c1f41Douglas Gregor#include "llvm/ADT/DenseMap.h"
1928019772db70d4547be05a042eb950bc910f134fDouglas Gregor#include "llvm/ADT/IntrusiveRefCntPtr.h"
202a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar#include "llvm/ADT/OwningPtr.h"
2130a2e16f6c27f888dd11eba6bbbae1e980078fcbChandler Carruth#include "llvm/ADT/StringRef.h"
2222dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar#include <cassert>
23a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar#include <list>
24a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar#include <string>
253d3589db579f7695667b913c5043dd264ebe546fDouglas Gregor#include <utility>
262a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
272a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbarnamespace llvm {
28f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbarclass raw_fd_ostream;
29f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnamclass Timer;
302a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar}
312a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
322a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbarnamespace clang {
335eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbarclass ASTContext;
3412ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbarclass ASTConsumer;
35f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregorclass ASTReader;
36c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbarclass CodeCompleteConsumer;
37d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikieclass DiagnosticsEngine;
3878ad0b98848c17a0a11847fa1d456e2dfec8aa2fDavid Blaikieclass DiagnosticConsumer;
390f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbarclass ExternalASTSource;
4049009ec701feb3009450e57e40c656e2ad7c1f41Douglas Gregorclass FileEntry;
4116b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbarclass FileManager;
420397af277e3bba16da1fd125ddba07415686b429Daniel Dunbarclass FrontendAction;
431a4761edca58c6b559de825b9abfb66f7f1ba94aDouglas Gregorclass Module;
440f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbarclass Preprocessor;
45f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregorclass Sema;
4616b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbarclass SourceManager;
472a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbarclass TargetInfo;
482a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
492a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// CompilerInstance - Helper class for managing a single instance of the Clang
502a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// compiler.
512a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///
522a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// The CompilerInstance serves two purposes:
532a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///  (1) It manages the various objects which are necessary to run the compiler,
542a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///      for example the preprocessor, the target information, and the AST
552a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///      context.
562a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///  (2) It provides utility routines for constructing and manipulating the
572a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///      common Clang objects.
582a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///
592a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// The compiler instance generally owns the instance of all the objects that it
602a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// manages. However, clients can still share objects by manually setting the
612a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// object and retaking ownership prior to destroying the CompilerInstance.
622a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar///
632a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// The compiler instance is intended to simplify clients, but not to lock them
642a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// in to the compiler instance for everything. When possible, utility functions
652a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// come in two forms; a short form that reuses the CompilerInstance objects,
662a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar/// and a long form that takes explicit instances of any required objects.
676aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregorclass CompilerInstance : public ModuleLoader {
682a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// The options used in this compiler instance.
69c93dc7889644293e318e19d82830ea2acc45b678Dylan Noblesmith  IntrusiveRefCntPtr<CompilerInvocation> Invocation;
702a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
712a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// The diagnostics engine instance.
72c93dc7889644293e318e19d82830ea2acc45b678Dylan Noblesmith  IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics;
732a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
742a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// The target being compiled for.
75c93dc7889644293e318e19d82830ea2acc45b678Dylan Noblesmith  IntrusiveRefCntPtr<TargetInfo> Target;
762a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
7716b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// The file manager.
78c93dc7889644293e318e19d82830ea2acc45b678Dylan Noblesmith  IntrusiveRefCntPtr<FileManager> FileMgr;
7916b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
8016b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// The source manager.
81c93dc7889644293e318e19d82830ea2acc45b678Dylan Noblesmith  IntrusiveRefCntPtr<SourceManager> SourceMgr;
8216b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
8322dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// The preprocessor.
84c93dc7889644293e318e19d82830ea2acc45b678Dylan Noblesmith  IntrusiveRefCntPtr<Preprocessor> PP;
8522dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar
865eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  /// The AST context.
87c93dc7889644293e318e19d82830ea2acc45b678Dylan Noblesmith  IntrusiveRefCntPtr<ASTContext> Context;
885eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar
8912ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// The AST consumer.
906f42b62b6194f53bcbc349f5d17388e1936535d7Dylan Noblesmith  OwningPtr<ASTConsumer> Consumer;
9112ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar
92c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// The code completion consumer.
936f42b62b6194f53bcbc349f5d17388e1936535d7Dylan Noblesmith  OwningPtr<CodeCompleteConsumer> CompletionConsumer;
94c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
95f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// \brief The semantic analysis object.
966f42b62b6194f53bcbc349f5d17388e1936535d7Dylan Noblesmith  OwningPtr<Sema> TheSema;
97463d90986ec54c62bf8fe31193ef5db701db48a5Douglas Gregor
98f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregor  /// \brief The frontend timer
996f42b62b6194f53bcbc349f5d17388e1936535d7Dylan Noblesmith  OwningPtr<llvm::Timer> FrontendTimer;
100f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam
101f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregor  /// \brief Non-owning reference to the ASTReader, if one exists.
102f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregor  ASTReader *ModuleManager;
103f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregor
10449009ec701feb3009450e57e40c656e2ad7c1f41Douglas Gregor  /// \brief The set of top-level modules that has already been loaded,
10549009ec701feb3009450e57e40c656e2ad7c1f41Douglas Gregor  /// along with the module map
1061a4761edca58c6b559de825b9abfb66f7f1ba94aDouglas Gregor  llvm::DenseMap<const IdentifierInfo *, Module *> KnownModules;
10749009ec701feb3009450e57e40c656e2ad7c1f41Douglas Gregor
108b514c792821a8f053027d88444e13bfaa8efef76Douglas Gregor  /// \brief The location of the module-import keyword for the last module
109b514c792821a8f053027d88444e13bfaa8efef76Douglas Gregor  /// import.
110b514c792821a8f053027d88444e13bfaa8efef76Douglas Gregor  SourceLocation LastModuleImportLoc;
111b514c792821a8f053027d88444e13bfaa8efef76Douglas Gregor
112b514c792821a8f053027d88444e13bfaa8efef76Douglas Gregor  /// \brief The result of the last module import.
113b514c792821a8f053027d88444e13bfaa8efef76Douglas Gregor  ///
114463d90986ec54c62bf8fe31193ef5db701db48a5Douglas Gregor  ModuleLoadResult LastModuleImportResult;
115b514c792821a8f053027d88444e13bfaa8efef76Douglas Gregor
116dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// \brief Holds information about the output file.
117dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  ///
118dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// If TempFilename is not empty we must rename it to Filename at the end.
119dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// TempFilename may be empty and Filename non empty if creating the temporary
120dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// failed.
121dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  struct OutputFile {
122dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis    std::string Filename;
123dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis    std::string TempFilename;
1248cc488fefb2fb04bc8d5398da29f0182f97934cfChris Lattner    raw_ostream *OS;
125dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis
126dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis    OutputFile(const std::string &filename, const std::string &tempFilename,
1278cc488fefb2fb04bc8d5398da29f0182f97934cfChris Lattner               raw_ostream *os)
128dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis      : Filename(filename), TempFilename(tempFilename), OS(os) { }
129dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  };
130dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis
131a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// The list of active output files.
132dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  std::list<OutputFile> OutputFiles;
133a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar
134f56faa01936b9cf909623d7f06e3c2569ca4a78eDmitri Gribenko  CompilerInstance(const CompilerInstance &) LLVM_DELETED_FUNCTION;
135f56faa01936b9cf909623d7f06e3c2569ca4a78eDmitri Gribenko  void operator=(const CompilerInstance &) LLVM_DELETED_FUNCTION;
1362a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbarpublic:
13742e9f8e4983d50f896ec716207817b9d96e7e79cDaniel Dunbar  CompilerInstance();
1382a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  ~CompilerInstance();
1392a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
1400397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// @name High-Level Operations
1410397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// {
1420397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar
1430397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// ExecuteAction - Execute the provided action against the compiler's
1440397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// CompilerInvocation object.
1450397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1460397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// This function makes the following assumptions:
1470397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1480397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///  - The invocation options should be initialized. This function does not
1490397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///    handle the '-help' or '-version' options, clients should handle those
1500397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///    directly.
1510397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1520397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///  - The diagnostics engine should have already been created by the client.
1530397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1540397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///  - No other CompilerInstance state should have been initialized (this is
1550397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///    an unchecked error).
1560397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1570397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///  - Clients should have initialized any LLVM target features that may be
1580397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///    required.
1590397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1600397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///  - Clients should eventually call llvm_shutdown() upon the completion of
1610397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///    this routine to ensure that any managed objects are properly destroyed.
1620397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1630397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// Note that this routine may write output to 'stderr'.
1640397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  ///
1650397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// \param Act - The action to execute.
1660397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// \return - True on success.
1670397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  //
1680397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  // FIXME: This function should take the stream to write any debugging /
1690397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  // verbose output to as an argument.
1700397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  //
1710397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  // FIXME: Eliminate the llvm_shutdown requirement, that should either be part
1720397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  // of the context or else not CompilerInstance specific.
1730397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  bool ExecuteAction(FrontendAction &Act);
1740397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar
1750397af277e3bba16da1fd125ddba07415686b429Daniel Dunbar  /// }
1762a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// @name Compiler Invocation and Options
1772a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// {
1782a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
1796228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar  bool hasInvocation() const { return Invocation != 0; }
1806228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar
1816228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar  CompilerInvocation &getInvocation() {
1826228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    assert(Invocation && "Compiler instance has no invocation!");
1836228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return *Invocation;
1846228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar  }
1856228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar
1864f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// setInvocation - Replace the current invocation.
1876228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar  void setInvocation(CompilerInvocation *Value);
1882a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
1892a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// }
1902a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// @name Forwarding Methods
1912a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// {
1922a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
19345796b10d11869e86c6b85e24df165410536b313Ted Kremenek  AnalyzerOptionsRef getAnalyzerOpts() {
1946228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getAnalyzerOpts();
1952a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
1962a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
1972a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  CodeGenOptions &getCodeGenOpts() {
1986228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getCodeGenOpts();
1992a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2002a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const CodeGenOptions &getCodeGenOpts() const {
2016228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getCodeGenOpts();
2022a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2032a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2042a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  DependencyOutputOptions &getDependencyOutputOpts() {
2056228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getDependencyOutputOpts();
2062a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2072a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const DependencyOutputOptions &getDependencyOutputOpts() const {
2086228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getDependencyOutputOpts();
2092a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2102a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2112a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  DiagnosticOptions &getDiagnosticOpts() {
2126228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getDiagnosticOpts();
2132a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2142a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const DiagnosticOptions &getDiagnosticOpts() const {
2156228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getDiagnosticOpts();
2162a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2172a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
218389db16c63eec6ecfa9b235155252d8da766e94eArgyrios Kyrtzidis  const FileSystemOptions &getFileSystemOpts() const {
219389db16c63eec6ecfa9b235155252d8da766e94eArgyrios Kyrtzidis    return Invocation->getFileSystemOpts();
220389db16c63eec6ecfa9b235155252d8da766e94eArgyrios Kyrtzidis  }
221389db16c63eec6ecfa9b235155252d8da766e94eArgyrios Kyrtzidis
2222a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  FrontendOptions &getFrontendOpts() {
2236228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getFrontendOpts();
2242a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2252a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const FrontendOptions &getFrontendOpts() const {
2266228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getFrontendOpts();
2272a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2282a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2292a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  HeaderSearchOptions &getHeaderSearchOpts() {
2306228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getHeaderSearchOpts();
2312a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2322a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const HeaderSearchOptions &getHeaderSearchOpts() const {
2336228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getHeaderSearchOpts();
2342a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2352a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2362a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  LangOptions &getLangOpts() {
237d3b74d9ca4f239a7a90ad193378c494306c57352Ted Kremenek    return *Invocation->getLangOpts();
2382a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2392a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const LangOptions &getLangOpts() const {
240d3b74d9ca4f239a7a90ad193378c494306c57352Ted Kremenek    return *Invocation->getLangOpts();
2412a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2422a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2432a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  PreprocessorOptions &getPreprocessorOpts() {
2446228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getPreprocessorOpts();
2452a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2462a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const PreprocessorOptions &getPreprocessorOpts() const {
2476228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getPreprocessorOpts();
2482a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2492a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2502a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  PreprocessorOutputOptions &getPreprocessorOutputOpts() {
2516228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getPreprocessorOutputOpts();
2522a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2532a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  const PreprocessorOutputOptions &getPreprocessorOutputOpts() const {
2546228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getPreprocessorOutputOpts();
2552a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  }
2562a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
257d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbar  TargetOptions &getTargetOpts() {
2586228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getTargetOpts();
259d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbar  }
260d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbar  const TargetOptions &getTargetOpts() const {
2616228ca00121669ec06a19df4fad87d5049c097cfDaniel Dunbar    return Invocation->getTargetOpts();
262d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbar  }
263d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbar
2642a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// }
2652a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// @name Diagnostics Engine
2662a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// {
2672a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
268704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar  bool hasDiagnostics() const { return Diagnostics != 0; }
269704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar
2704f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// Get the current diagnostics engine.
271d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikie  DiagnosticsEngine &getDiagnostics() const {
27222dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    assert(Diagnostics && "Compiler instance has no diagnostics!");
27322dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    return *Diagnostics;
27422dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  }
2752a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2764f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// setDiagnostics - Replace the current diagnostics engine.
277d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikie  void setDiagnostics(DiagnosticsEngine *Value);
2782a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
27978ad0b98848c17a0a11847fa1d456e2dfec8aa2fDavid Blaikie  DiagnosticConsumer &getDiagnosticClient() const {
280bdbb004f38978da0c4a75af3294d1c7b5ff84af1Douglas Gregor    assert(Diagnostics && Diagnostics->getClient() &&
281bdbb004f38978da0c4a75af3294d1c7b5ff84af1Douglas Gregor           "Compiler instance has no diagnostic client!");
282bdbb004f38978da0c4a75af3294d1c7b5ff84af1Douglas Gregor    return *Diagnostics->getClient();
28381f5a1e699b2eefa4a5e50b5dfc06df600748f59Daniel Dunbar  }
2842a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2852a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// }
2862a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// @name Target Info
2872a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// {
2882a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
289704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar  bool hasTarget() const { return Target != 0; }
290704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar
29122dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  TargetInfo &getTarget() const {
29222dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    assert(Target && "Compiler instance has no target!");
29322dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    return *Target;
29422dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  }
2952a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2964f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// Replace the current diagnostics engine.
2978a9f569262860b8d03203327afd6047be2a9b5a6Daniel Dunbar  void setTarget(TargetInfo *Value);
2982a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
2992a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar  /// }
30016b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// @name File Manager
30116b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// {
30216b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
303704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar  bool hasFileManager() const { return FileMgr != 0; }
304704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar
3054f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// Return the current file manager to the caller.
30622dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  FileManager &getFileManager() const {
30722dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    assert(FileMgr && "Compiler instance has no file manager!");
30822dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    return *FileMgr;
30922dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  }
3104f32786ac45210143654390177105eb749b614e9Ted Kremenek
3114f32786ac45210143654390177105eb749b614e9Ted Kremenek  void resetAndLeakFileManager() {
3124f32786ac45210143654390177105eb749b614e9Ted Kremenek    FileMgr.resetWithoutRelease();
3134f32786ac45210143654390177105eb749b614e9Ted Kremenek  }
31416b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
3154f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// setFileManager - Replace the current file manager.
3168a9f569262860b8d03203327afd6047be2a9b5a6Daniel Dunbar  void setFileManager(FileManager *Value);
31716b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
31816b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// }
31916b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// @name Source Manager
32016b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// {
32116b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
322704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar  bool hasSourceManager() const { return SourceMgr != 0; }
323704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar
3244f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// Return the current source manager.
32522dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  SourceManager &getSourceManager() const {
32622dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    assert(SourceMgr && "Compiler instance has no source manager!");
32722dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    return *SourceMgr;
32822dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  }
3294f32786ac45210143654390177105eb749b614e9Ted Kremenek
3304f32786ac45210143654390177105eb749b614e9Ted Kremenek  void resetAndLeakSourceManager() {
3314f32786ac45210143654390177105eb749b614e9Ted Kremenek    SourceMgr.resetWithoutRelease();
3324f32786ac45210143654390177105eb749b614e9Ted Kremenek  }
33316b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
3344f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// setSourceManager - Replace the current source manager.
3358a9f569262860b8d03203327afd6047be2a9b5a6Daniel Dunbar  void setSourceManager(SourceManager *Value);
33616b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
33716b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// }
33822dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// @name Preprocessor
33922dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// {
34022dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar
341704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar  bool hasPreprocessor() const { return PP != 0; }
342704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar
3434f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// Return the current preprocessor.
34422dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  Preprocessor &getPreprocessor() const {
34522dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    assert(PP && "Compiler instance has no preprocessor!");
34622dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar    return *PP;
34722dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  }
34822dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar
3494f32786ac45210143654390177105eb749b614e9Ted Kremenek  void resetAndLeakPreprocessor() {
3504f32786ac45210143654390177105eb749b614e9Ted Kremenek    PP.resetWithoutRelease();
3514f32786ac45210143654390177105eb749b614e9Ted Kremenek  }
35222dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar
3534f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// Replace the current preprocessor.
3548a9f569262860b8d03203327afd6047be2a9b5a6Daniel Dunbar  void setPreprocessor(Preprocessor *Value);
35522dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar
35622dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// }
3575eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  /// @name ASTContext
3585eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  /// {
3595eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar
360704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar  bool hasASTContext() const { return Context != 0; }
361704e48ae75111072eecaa20a365dff46fb49d2beDaniel Dunbar
3625eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  ASTContext &getASTContext() const {
3635eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar    assert(Context && "Compiler instance has no AST context!");
3645eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar    return *Context;
3655eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  }
3664f32786ac45210143654390177105eb749b614e9Ted Kremenek
3674f32786ac45210143654390177105eb749b614e9Ted Kremenek  void resetAndLeakASTContext() {
3684f32786ac45210143654390177105eb749b614e9Ted Kremenek    Context.resetWithoutRelease();
3694f32786ac45210143654390177105eb749b614e9Ted Kremenek  }
3705eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar
3714f32786ac45210143654390177105eb749b614e9Ted Kremenek  /// setASTContext - Replace the current AST context.
3728a9f569262860b8d03203327afd6047be2a9b5a6Daniel Dunbar  void setASTContext(ASTContext *Value);
3735eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar
374f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// \brief Replace the current Sema; the compiler instance takes ownership
375f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// of S.
376f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  void setSema(Sema *S);
377f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor
3785eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  /// }
37912ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// @name ASTConsumer
38012ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// {
38112ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar
38212ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  bool hasASTConsumer() const { return Consumer != 0; }
38312ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar
38412ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  ASTConsumer &getASTConsumer() const {
38512ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar    assert(Consumer && "Compiler instance has no AST consumer!");
38612ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar    return *Consumer;
38712ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  }
38812ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar
38912ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// takeASTConsumer - Remove the current AST consumer and give ownership to
39012ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// the caller.
39112ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  ASTConsumer *takeASTConsumer() { return Consumer.take(); }
39212ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar
39312ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// setASTConsumer - Replace the current AST consumer; the compiler instance
3941824d54df85a462ada812dadda18130f951d40f3Dmitri Gribenko  /// takes ownership of \p Value.
39512ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  void setASTConsumer(ASTConsumer *Value);
39612ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar
39712ce6943aae499225708ecf364c5a8b0a3269c87Daniel Dunbar  /// }
398f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// @name Semantic analysis
399f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// {
400f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  bool hasSema() const { return TheSema != 0; }
401f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor
402f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  Sema &getSema() const {
403f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor    assert(TheSema && "Compiler instance has no Sema object!");
404f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor    return *TheSema;
405f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  }
406f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor
407f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  Sema *takeSema() { return TheSema.take(); }
408f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor
409f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// }
410f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregor  /// @name Module Management
411f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregor  /// {
412f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregor
413f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregor  ASTReader *getModuleManager() const { return ModuleManager; }
414f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregor
415f62d43d2afe1960755a1b5813cae1e5983bcac1bDouglas Gregor  /// }
416c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// @name Code Completion
417c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// {
418c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
419c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  bool hasCodeCompletionConsumer() const { return CompletionConsumer != 0; }
420c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
421c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  CodeCompleteConsumer &getCodeCompletionConsumer() const {
422c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar    assert(CompletionConsumer &&
423c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar           "Compiler instance has no code completion consumer!");
424c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar    return *CompletionConsumer;
425c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  }
426c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
427c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// takeCodeCompletionConsumer - Remove the current code completion consumer
428c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// and give ownership to the caller.
429c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  CodeCompleteConsumer *takeCodeCompletionConsumer() {
430c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar    return CompletionConsumer.take();
431c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  }
432c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
433c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// setCodeCompletionConsumer - Replace the current code completion consumer;
4341824d54df85a462ada812dadda18130f951d40f3Dmitri Gribenko  /// the compiler instance takes ownership of \p Value.
4358a9f569262860b8d03203327afd6047be2a9b5a6Daniel Dunbar  void setCodeCompletionConsumer(CodeCompleteConsumer *Value);
436c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
437c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// }
438f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  /// @name Frontend timer
439f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  /// {
440f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam
441f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  bool hasFrontendTimer() const { return FrontendTimer != 0; }
442f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam
443f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  llvm::Timer &getFrontendTimer() const {
444f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam    assert(FrontendTimer && "Compiler instance has no frontend timer!");
445f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam    return *FrontendTimer;
446f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  }
447f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam
448f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  /// }
449a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// @name Output Files
450a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// {
451a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar
452a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// addOutputFile - Add an output file onto the list of tracked output files.
453a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  ///
454dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// \param OutFile - The output file info.
455dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  void addOutputFile(const OutputFile &OutFile);
456a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar
457e51dd7be67808d52c80c09b832d875e9655ce6e0Kovarththanan Rajaratnam  /// clearOutputFiles - Clear the output file list, destroying the contained
458a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// output streams.
459a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  ///
460a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// \param EraseFiles - If true, attempt to erase the files from disk.
461e51dd7be67808d52c80c09b832d875e9655ce6e0Kovarththanan Rajaratnam  void clearOutputFiles(bool EraseFiles);
462a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar
463a9204831639e31474b927681b97c46781b758a1aDaniel Dunbar  /// }
46416b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// @name Construction Utility Methods
46516b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// {
46616b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
4670fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  /// Create the diagnostics engine using the invocation's diagnostic options
4680fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  /// and replace any existing one with it.
4690fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  ///
470e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// Note that this routine also replaces the diagnostic client,
471e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// allocating one if one is not provided.
472e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  ///
473e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// \param Client If non-NULL, a diagnostic client that will be
474d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikie  /// attached to (and, then, owned by) the DiagnosticsEngine inside this AST
475e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// unit.
47678243658c533168d51fd076fba328437932ba6f1Douglas Gregor  ///
47778243658c533168d51fd076fba328437932ba6f1Douglas Gregor  /// \param ShouldOwnClient If Client is non-NULL, specifies whether
47878243658c533168d51fd076fba328437932ba6f1Douglas Gregor  /// the diagnostic object should take ownership of the client.
479aee526e77657afd1600276450e9c346953ad51d7Douglas Gregor  ///
480aee526e77657afd1600276450e9c346953ad51d7Douglas Gregor  /// \param ShouldCloneClient If Client is non-NULL, specifies whether that
481aee526e77657afd1600276450e9c346953ad51d7Douglas Gregor  /// client should be cloned.
482e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  void createDiagnostics(int Argc, const char* const *Argv,
48378ad0b98848c17a0a11847fa1d456e2dfec8aa2fDavid Blaikie                         DiagnosticConsumer *Client = 0,
484aee526e77657afd1600276450e9c346953ad51d7Douglas Gregor                         bool ShouldOwnClient = true,
485aee526e77657afd1600276450e9c346953ad51d7Douglas Gregor                         bool ShouldCloneClient = true);
4860fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar
487d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikie  /// Create a DiagnosticsEngine object with a the TextDiagnosticPrinter.
4880fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  ///
4891824d54df85a462ada812dadda18130f951d40f3Dmitri Gribenko  /// The \p Argc and \p Argv arguments are used only for logging purposes,
4900fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  /// when the diagnostic options indicate that the compiler should output
4910fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  /// logging information.
4920fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  ///
493e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// If no diagnostic client is provided, this creates a
49478ad0b98848c17a0a11847fa1d456e2dfec8aa2fDavid Blaikie  /// DiagnosticConsumer that is owned by the returned diagnostic
495e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// object, if using directly the caller is responsible for
496d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikie  /// releasing the returned DiagnosticsEngine's client eventually.
4975eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  ///
498bb3503a146f5eee6393a8b7542f38d9f5fce6583Daniel Dunbar  /// \param Opts - The diagnostic options; note that the created text
49902c23ebf41ae2f70da0ba7337e05c51fbfe35f7fDouglas Gregor  /// diagnostic object contains a reference to these options.
500bb3503a146f5eee6393a8b7542f38d9f5fce6583Daniel Dunbar  ///
501e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// \param Client If non-NULL, a diagnostic client that will be
502d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikie  /// attached to (and, then, owned by) the returned DiagnosticsEngine
503e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  /// object.
504e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor  ///
505b6534bbee90bf73f364072051d10b60352d43c3eDaniel Dunbar  /// \param CodeGenOpts If non-NULL, the code gen options in use, which may be
506b6534bbee90bf73f364072051d10b60352d43c3eDaniel Dunbar  /// used by some diagnostics printers (for logging purposes only).
507b6534bbee90bf73f364072051d10b60352d43c3eDaniel Dunbar  ///
5080fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar  /// \return The new object on success, or null on failure.
509c93dc7889644293e318e19d82830ea2acc45b678Dylan Noblesmith  static IntrusiveRefCntPtr<DiagnosticsEngine>
51002c23ebf41ae2f70da0ba7337e05c51fbfe35f7fDouglas Gregor  createDiagnostics(DiagnosticOptions *Opts, int Argc,
511e47be3e9682e82da15059006f43c7f3c021e4fffDouglas Gregor                    const char* const *Argv,
51278ad0b98848c17a0a11847fa1d456e2dfec8aa2fDavid Blaikie                    DiagnosticConsumer *Client = 0,
51378243658c533168d51fd076fba328437932ba6f1Douglas Gregor                    bool ShouldOwnClient = true,
514aee526e77657afd1600276450e9c346953ad51d7Douglas Gregor                    bool ShouldCloneClient = true,
515b6534bbee90bf73f364072051d10b60352d43c3eDaniel Dunbar                    const CodeGenOptions *CodeGenOpts = 0);
5160fbb3d9a9cdd2201848be9eb017c54cd78538122Daniel Dunbar
51716b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// Create the file manager and replace any existing one with it.
51816b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  void createFileManager();
51916b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
52016b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// Create the source manager and replace any existing one with it.
52139b49bcaaddb1049234fca9500c0ac02c088e23dChris Lattner  void createSourceManager(FileManager &FileMgr);
52216b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar
52322dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// Create the preprocessor, using the invocation, file, and source managers,
52422dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  /// and replace any existing one with it.
52522dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar  void createPreprocessor();
52622dacfacacf5559028550ba6ddfbaa4ea6cb3944Daniel Dunbar
5275eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  /// Create the AST context.
5285eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar  void createASTContext();
5295eb810024dc8a1d12d5f066c02c978f07c4fcb00Daniel Dunbar
5300f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar  /// Create an external AST source to read a PCH file and attach it to the AST
5310f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar  /// context.
532686775deca8b8685eb90801495880e3abdd844c2Chris Lattner  void createPCHExternalASTSource(StringRef Path,
533ffaab3e2bb13991bb3357e80f14bcae3745b2347Sebastian Redl                                  bool DisablePCHValidation,
534bef35c91b594f66216f4aab303b71a6c5ab7abcfArgyrios Kyrtzidis                                  bool AllowPCHWithCompilerErrors,
535ffaab3e2bb13991bb3357e80f14bcae3745b2347Sebastian Redl                                  void *DeserializationListener);
5360f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar
5370f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar  /// Create an external AST source to read a PCH file.
5380f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar  ///
5390f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar  /// \return - The new object on success, or null on failure.
5400f800391ffbfe3820e1c60246a09a97e5f065179Daniel Dunbar  static ExternalASTSource *
541686775deca8b8685eb90801495880e3abdd844c2Chris Lattner  createPCHExternalASTSource(StringRef Path, const std::string &Sysroot,
542fae3b2f4743dad616623c4df2fdb0f5128bd36d9Douglas Gregor                             bool DisablePCHValidation,
543bef35c91b594f66216f4aab303b71a6c5ab7abcfArgyrios Kyrtzidis                             bool AllowPCHWithCompilerErrors,
544ffaab3e2bb13991bb3357e80f14bcae3745b2347Sebastian Redl                             Preprocessor &PP, ASTContext &Context,
5451d9f1fe7173e3084325f43c78af812a36d8a2a7cSebastian Redl                             void *DeserializationListener, bool Preamble);
546a93e3b5bde9f0a7b59215f19f176f7d69881b81cSebastian Redl
547c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// Create a code completion consumer using the invocation; note that this
548c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// will cause the source manager to truncate the input source file at the
549c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// completion point.
550c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  void createCodeCompletionConsumer();
551c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
552c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  /// Create a code completion consumer to print code completion results, at
5531824d54df85a462ada812dadda18130f951d40f3Dmitri Gribenko  /// \p Filename, \p Line, and \p Column, to the given output stream \p OS.
554c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  static CodeCompleteConsumer *
555c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar  createCodeCompletionConsumer(Preprocessor &PP, const std::string &Filename,
556c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar                               unsigned Line, unsigned Column,
557d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko                               const CodeCompleteOptions &Opts,
5588cc488fefb2fb04bc8d5398da29f0182f97934cfChris Lattner                               raw_ostream &OS);
559c2f484f1f05216a9a427ac84b5773789a4661111Daniel Dunbar
560f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor  /// \brief Create the Sema object to be used for parsing.
561467dc88512b4ba4bb16e274ea3771dc1415d31daDouglas Gregor  void createSema(TranslationUnitKind TUKind,
562f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor                  CodeCompleteConsumer *CompletionConsumer);
563f18d0d8b39e891460d50f8a8b85029885b264986Douglas Gregor
564f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  /// Create the frontend timer and replace any existing one with it.
565f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam  void createFrontendTimer();
566f79bafa608a5d7c49ec40ad199af5e32f3038b47Kovarththanan Rajaratnam
567f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// Create the default output file (from the invocation's options) and add it
568f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// to the list of tracked output files.
569360435908c9b90429cfe192fab22854af1d4497cDaniel Dunbar  ///
570e21dd284d8209a89137a03a0d63f2bd57be9e660Daniel Dunbar  /// The files created by this function always use temporary files to write to
571e21dd284d8209a89137a03a0d63f2bd57be9e660Daniel Dunbar  /// their result (that is, the data is written to a temporary file which will
572e21dd284d8209a89137a03a0d63f2bd57be9e660Daniel Dunbar  /// atomically replace the target output on success).
573e21dd284d8209a89137a03a0d63f2bd57be9e660Daniel Dunbar  ///
574360435908c9b90429cfe192fab22854af1d4497cDaniel Dunbar  /// \return - Null on error.
575f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  llvm::raw_fd_ostream *
576686775deca8b8685eb90801495880e3abdd844c2Chris Lattner  createDefaultOutputFile(bool Binary = true, StringRef BaseInput = "",
577686775deca8b8685eb90801495880e3abdd844c2Chris Lattner                          StringRef Extension = "");
578f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar
579f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// Create a new output file and add it to the list of tracked output files,
580f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// optionally deriving the output path name.
581360435908c9b90429cfe192fab22854af1d4497cDaniel Dunbar  ///
582360435908c9b90429cfe192fab22854af1d4497cDaniel Dunbar  /// \return - Null on error.
583f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  llvm::raw_fd_ostream *
584686775deca8b8685eb90801495880e3abdd844c2Chris Lattner  createOutputFile(StringRef OutputPath,
585ff9cd968cd5b623e3ec7e5f862b598cd22f7ec79Daniel Dunbar                   bool Binary = true, bool RemoveFileOnSignal = true,
586686775deca8b8685eb90801495880e3abdd844c2Chris Lattner                   StringRef BaseInput = "",
5877e90985df09855dc309ed888a5b16a0ae684f8e3Argyrios Kyrtzidis                   StringRef Extension = "",
58812f28ab8a53d7743081d607617309891fa8156f3Daniel Dunbar                   bool UseTemporary = false,
58912f28ab8a53d7743081d607617309891fa8156f3Daniel Dunbar                   bool CreateMissingDirectories = false);
590f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar
591f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// Create a new output file, optionally deriving the output path name.
592f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  ///
5931824d54df85a462ada812dadda18130f951d40f3Dmitri Gribenko  /// If \p OutputPath is empty, then createOutputFile will derive an output
5941824d54df85a462ada812dadda18130f951d40f3Dmitri Gribenko  /// path location as \p BaseInput, with any suffix removed, and \p Extension
5951824d54df85a462ada812dadda18130f951d40f3Dmitri Gribenko  /// appended. If \p OutputPath is not stdout and \p UseTemporary
5967e90985df09855dc309ed888a5b16a0ae684f8e3Argyrios Kyrtzidis  /// is true, createOutputFile will create a new temporary file that must be
5971824d54df85a462ada812dadda18130f951d40f3Dmitri Gribenko  /// renamed to \p OutputPath in the end.
598f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  ///
599f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// \param OutputPath - If given, the path to the output file.
600f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// \param Error [out] - On failure, the error message.
6011824d54df85a462ada812dadda18130f951d40f3Dmitri Gribenko  /// \param BaseInput - If \p OutputPath is empty, the input path name to use
602f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// for deriving the output path.
603f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// \param Extension - The extension to use for derived output names.
604f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// \param Binary - The mode to open the file in.
605ff9cd968cd5b623e3ec7e5f862b598cd22f7ec79Daniel Dunbar  /// \param RemoveFileOnSignal - Whether the file should be registered with
606ff9cd968cd5b623e3ec7e5f862b598cd22f7ec79Daniel Dunbar  /// llvm::sys::RemoveFileOnSignal. Note that this is not safe for
607ff9cd968cd5b623e3ec7e5f862b598cd22f7ec79Daniel Dunbar  /// multithreaded use, as the underlying signal mechanism is not reentrant
6087e90985df09855dc309ed888a5b16a0ae684f8e3Argyrios Kyrtzidis  /// \param UseTemporary - Create a new temporary file that must be renamed to
60912f28ab8a53d7743081d607617309891fa8156f3Daniel Dunbar  /// OutputPath in the end.
6101824d54df85a462ada812dadda18130f951d40f3Dmitri Gribenko  /// \param CreateMissingDirectories - When \p UseTemporary is true, create
61112f28ab8a53d7743081d607617309891fa8156f3Daniel Dunbar  /// missing directories in the output path.
612f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// \param ResultPathName [out] - If given, the result path name will be
613f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  /// stored here on success.
614dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// \param TempPathName [out] - If given, the temporary file path name
615dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis  /// will be stored here on success.
616f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar  static llvm::raw_fd_ostream *
617686775deca8b8685eb90801495880e3abdd844c2Chris Lattner  createOutputFile(StringRef OutputPath, std::string &Error,
618ff9cd968cd5b623e3ec7e5f862b598cd22f7ec79Daniel Dunbar                   bool Binary = true, bool RemoveFileOnSignal = true,
619686775deca8b8685eb90801495880e3abdd844c2Chris Lattner                   StringRef BaseInput = "",
620686775deca8b8685eb90801495880e3abdd844c2Chris Lattner                   StringRef Extension = "",
6217e90985df09855dc309ed888a5b16a0ae684f8e3Argyrios Kyrtzidis                   bool UseTemporary = false,
62212f28ab8a53d7743081d607617309891fa8156f3Daniel Dunbar                   bool CreateMissingDirectories = false,
623dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis                   std::string *ResultPathName = 0,
624dc24572a44575e07a5d8bb6de52641a69f1bab27Argyrios Kyrtzidis                   std::string *TempPathName = 0);
625f482d59386dbc70716f7a5f65adb37ff86b501e6Daniel Dunbar
62616b7449d86b843d0926b04f87104cf3fff7149feDaniel Dunbar  /// }
627ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// @name Initialization Utility Methods
628ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// {
629ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar
630ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// InitializeSourceManager - Initialize the source manager to set InputFile
631ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// as the main file.
632ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  ///
633ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// \return True on success.
6348e1fbbc492bc1f4833136d9b55e1aaf478565d32Argyrios Kyrtzidis  bool InitializeSourceManager(const FrontendInputFile &Input);
635ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar
636ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// InitializeSourceManager - Initialize the source manager to set InputFile
637ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// as the main file.
638ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  ///
639ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// \return True on success.
6408e1fbbc492bc1f4833136d9b55e1aaf478565d32Argyrios Kyrtzidis  static bool InitializeSourceManager(const FrontendInputFile &Input,
641a1f1fad8b60e1cb9d21a40a37f2e03150bcbeb6fDouglas Gregor                DiagnosticsEngine &Diags,
642a1f1fad8b60e1cb9d21a40a37f2e03150bcbeb6fDouglas Gregor                FileManager &FileMgr,
643a1f1fad8b60e1cb9d21a40a37f2e03150bcbeb6fDouglas Gregor                SourceManager &SourceMgr,
644a1f1fad8b60e1cb9d21a40a37f2e03150bcbeb6fDouglas Gregor                const FrontendOptions &Opts);
645ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar
646ccb6cb6fd9e48697564d536b07397b95dfc28d5bDaniel Dunbar  /// }
6476aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor
648463d90986ec54c62bf8fe31193ef5db701db48a5Douglas Gregor  virtual ModuleLoadResult loadModule(SourceLocation ImportLoc,
649463d90986ec54c62bf8fe31193ef5db701db48a5Douglas Gregor                                      ModuleIdPath Path,
650463d90986ec54c62bf8fe31193ef5db701db48a5Douglas Gregor                                      Module::NameVisibilityKind Visibility,
651463d90986ec54c62bf8fe31193ef5db701db48a5Douglas Gregor                                      bool IsInclusionDirective);
6522a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar};
6532a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
6542a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar} // end namespace clang
6552a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar
6562a79e162a3fde25c1941151a67966830d873f2dbDaniel Dunbar#endif
657