1f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//===--- PrecompiledPreamble.h - Build precompiled preambles ----*- C++ -*-===//
2f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
3f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//                     The LLVM Compiler Infrastructure
4f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
5f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// This file is distributed under the University of Illinois Open Source
6f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// License. See LICENSE.TXT for details.
7f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
8f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//===----------------------------------------------------------------------===//
9f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
10f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// Helper class to build precompiled preamble.
11f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
12f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//===----------------------------------------------------------------------===//
13f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
14f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#ifndef LLVM_CLANG_FRONTEND_PRECOMPILED_PREAMBLE_H
15f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#define LLVM_CLANG_FRONTEND_PRECOMPILED_PREAMBLE_H
16f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
17f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "clang/Lex/Lexer.h"
18f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "clang/Lex/Preprocessor.h"
19f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "llvm/ADT/IntrusiveRefCntPtr.h"
20f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "llvm/Support/MD5.h"
21f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include <memory>
22f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include <system_error>
23f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include <type_traits>
24f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
25f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotnamespace llvm {
26f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass MemoryBuffer;
27f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}
28f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
29f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotnamespace clang {
30f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotnamespace vfs {
31f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass FileSystem;
32f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}
33f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
34f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass CompilerInstance;
35f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass CompilerInvocation;
36f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass DeclGroupRef;
37f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass PCHContainerOperations;
38f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
39f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// \brief Runs lexer to compute suggested preamble bounds.
40f3014761c955345d6e05491608e73228d014afbandroid-build-team RobotPreambleBounds ComputePreambleBounds(const LangOptions &LangOpts,
41f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot                                     llvm::MemoryBuffer *Buffer,
42f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot                                     unsigned MaxLines);
43f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
44f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass PreambleCallbacks;
45f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
46f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// A class holding a PCH and all information to check whether it is valid to
47f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// reuse the PCH for the subsequent runs. Use BuildPreamble to create PCH and
48f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// CanReusePreamble + AddImplicitPreamble to make use of it.
49f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass PrecompiledPreamble {
50f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  class TempPCHFile;
51f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  struct PreambleFileHash;
52f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
53f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic:
54f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// \brief Try to build PrecompiledPreamble for \p Invocation. See
55f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// BuildPreambleError for possible error codes.
56f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  ///
57f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// \param Invocation Original CompilerInvocation with options to compile the
58f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// file.
59f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  ///
60f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// \param MainFileBuffer Buffer with the contents of the main file.
61f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  ///
62f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// \param Bounds Bounds of the preamble, result of calling
63f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// ComputePreambleBounds.
64f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  ///
65f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// \param Diagnostics Diagnostics engine to be used while building the
66f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// preamble.
67f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  ///
68f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// \param VFS An instance of vfs::FileSystem to be used for file
69f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// accesses.
70f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  ///
71f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// \param PCHContainerOps An instance of PCHContainerOperations.
72f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  ///
73f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// \param Callbacks A set of callbacks to be executed when building
74f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// the preamble.
75f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  static llvm::ErrorOr<PrecompiledPreamble>
76f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  Build(const CompilerInvocation &Invocation,
77f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot        const llvm::MemoryBuffer *MainFileBuffer, PreambleBounds Bounds,
78f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot        DiagnosticsEngine &Diagnostics, IntrusiveRefCntPtr<vfs::FileSystem> VFS,
79f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot        std::shared_ptr<PCHContainerOperations> PCHContainerOps,
80f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot        PreambleCallbacks &Callbacks);
81f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
82f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  PrecompiledPreamble(PrecompiledPreamble &&) = default;
83f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  PrecompiledPreamble &operator=(PrecompiledPreamble &&) = default;
84f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
85f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// PreambleBounds used to build the preamble.
86f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  PreambleBounds getBounds() const;
87f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
88f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// The temporary file path at which the preamble PCH was placed.
89f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  StringRef GetPCHPath() const { return PCHFile.getFilePath(); }
90f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
91f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// Check whether PrecompiledPreamble can be reused for the new contents(\p
92f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// MainFileBuffer) of the main file.
93f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  bool CanReuse(const CompilerInvocation &Invocation,
94f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot                const llvm::MemoryBuffer *MainFileBuffer, PreambleBounds Bounds,
95f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot                vfs::FileSystem *VFS) const;
96f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
97f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// Changes options inside \p CI to use PCH from this preamble. Also remaps
98f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// main file to \p MainFileBuffer.
99f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  void AddImplicitPreamble(CompilerInvocation &CI,
100f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot                           llvm::MemoryBuffer *MainFileBuffer) const;
101f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
102f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotprivate:
103f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  PrecompiledPreamble(TempPCHFile PCHFile, std::vector<char> PreambleBytes,
104f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot                      bool PreambleEndsAtStartOfLine,
105f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot                      llvm::StringMap<PreambleFileHash> FilesInPreamble);
106f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
107f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// A temp file that would be deleted on destructor call. If destructor is not
108f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// called for any reason, the file will be deleted at static objects'
109f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// destruction.
110f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// An assertion will fire if two TempPCHFiles are created with the same name,
111f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// so it's not intended to be used outside preamble-handling.
112f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  class TempPCHFile {
113f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  public:
114f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    // A main method used to construct TempPCHFile.
115f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    static llvm::ErrorOr<TempPCHFile> CreateNewPreamblePCHFile();
116f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
117f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    /// Call llvm::sys::fs::createTemporaryFile to create a new temporary file.
118f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    static llvm::ErrorOr<TempPCHFile> createInSystemTempDir(const Twine &Prefix,
119f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot                                                            StringRef Suffix);
120f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    /// Create a new instance of TemporaryFile for file at \p Path. Use with
121f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    /// extreme caution, there's an assertion checking that there's only a
122f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    /// single instance of TempPCHFile alive for each path.
123f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    static llvm::ErrorOr<TempPCHFile> createFromCustomPath(const Twine &Path);
124f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
125f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  private:
126f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    TempPCHFile(std::string FilePath);
127f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
128f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  public:
129f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    TempPCHFile(TempPCHFile &&Other);
130f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    TempPCHFile &operator=(TempPCHFile &&Other);
131f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
132f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    TempPCHFile(const TempPCHFile &) = delete;
133f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    ~TempPCHFile();
134f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
135f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    /// A path where temporary file is stored.
136f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    llvm::StringRef getFilePath() const;
137f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
138f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  private:
139f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    void RemoveFileIfPresent();
140f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
141f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  private:
142f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    llvm::Optional<std::string> FilePath;
143f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  };
144f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
145f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// Data used to determine if a file used in the preamble has been changed.
146f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  struct PreambleFileHash {
147f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    /// All files have size set.
148f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    off_t Size = 0;
149f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
150f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    /// Modification time is set for files that are on disk.  For memory
151f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    /// buffers it is zero.
152f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    time_t ModTime = 0;
153f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
154f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    /// Memory buffers have MD5 instead of modification time.  We don't
155f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    /// compute MD5 for on-disk files because we hope that modification time is
156f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    /// enough to tell if the file was changed.
157f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    llvm::MD5::MD5Result MD5 = {};
158f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
159f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    static PreambleFileHash createForFile(off_t Size, time_t ModTime);
160f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    static PreambleFileHash
161f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    createForMemoryBuffer(const llvm::MemoryBuffer *Buffer);
162f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
163f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    friend bool operator==(const PreambleFileHash &LHS,
164f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot                           const PreambleFileHash &RHS) {
165f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot      return LHS.Size == RHS.Size && LHS.ModTime == RHS.ModTime &&
166f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot             LHS.MD5 == RHS.MD5;
167f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    }
168f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    friend bool operator!=(const PreambleFileHash &LHS,
169f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot                           const PreambleFileHash &RHS) {
170f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot      return !(LHS == RHS);
171f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    }
172f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  };
173f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
174f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// Manages the lifetime of temporary file that stores a PCH.
175f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  TempPCHFile PCHFile;
176f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// Keeps track of the files that were used when computing the
177f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// preamble, with both their buffer size and their modification time.
178f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  ///
179f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// If any of the files have changed from one compile to the next,
180f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// the preamble must be thrown away.
181f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  llvm::StringMap<PreambleFileHash> FilesInPreamble;
182f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// The contents of the file that was used to precompile the preamble. Only
183f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// contains first PreambleBounds::Size bytes. Used to compare if the relevant
184f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// part of the file has not changed, so that preamble can be reused.
185f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  std::vector<char> PreambleBytes;
186f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// See PreambleBounds::PreambleEndsAtStartOfLine
187f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  bool PreambleEndsAtStartOfLine;
188f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot};
189f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
190f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// A set of callbacks to gather useful information while building a preamble.
191f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass PreambleCallbacks {
192f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic:
193f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  virtual ~PreambleCallbacks() = default;
194f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
195f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// Called after FrontendAction::Execute(), but before
196f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// FrontendAction::EndSourceFile(). Can be used to transfer ownership of
197f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// various CompilerInstance fields before they are destroyed.
198f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  virtual void AfterExecute(CompilerInstance &CI);
199f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// Called after PCH has been emitted. \p Writer may be used to retrieve
200f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// information about AST, serialized in PCH.
201f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  virtual void AfterPCHEmitted(ASTWriter &Writer);
202f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// Called for each TopLevelDecl.
203f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// NOTE: To allow more flexibility a custom ASTConsumer could probably be
204f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// used instead, but having only this method allows a simpler API.
205f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  virtual void HandleTopLevelDecl(DeclGroupRef DG);
206f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// Called for each macro defined in the Preamble.
207f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// NOTE: To allow more flexibility a custom PPCallbacks could probably be
208f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// used instead, but having only this method allows a simpler API.
209f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  virtual void HandleMacroDefined(const Token &MacroNameTok,
210f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot                                  const MacroDirective *MD);
211f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot};
212f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
213f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotenum class BuildPreambleError {
214f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  PreambleIsEmpty = 1,
215f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  CouldntCreateTempFile,
216f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  CouldntCreateTargetInfo,
217f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  CouldntCreateVFSOverlay,
218f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  BeginSourceFileFailed,
219f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  CouldntEmitPCH
220f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot};
221f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
222f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass BuildPreambleErrorCategory final : public std::error_category {
223f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic:
224f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  const char *name() const noexcept override;
225f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  std::string message(int condition) const override;
226f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot};
227f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
228f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotstd::error_code make_error_code(BuildPreambleError Error);
229f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot} // namespace clang
230f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
231f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotnamespace std {
232f3014761c955345d6e05491608e73228d014afbandroid-build-team Robottemplate <>
233f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotstruct is_error_code_enum<clang::BuildPreambleError> : std::true_type {};
234f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot} // namespace std
235f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
236f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#endif
237