ASTUnit.h revision 89d9980bbc2e4a4ac86673e6ec16fb9f5babb63b
1//===--- ASTUnit.h - ASTUnit utility ----------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// ASTUnit utility class.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_FRONTEND_ASTUNIT_H
15#define LLVM_CLANG_FRONTEND_ASTUNIT_H
16
17#include "clang/Index/ASTLocation.h"
18#include "clang/Serialization/ASTBitCodes.h"
19#include "clang/Sema/Sema.h"
20#include "clang/Sema/CodeCompleteConsumer.h"
21#include "clang/Lex/PreprocessingRecord.h"
22#include "clang/Basic/SourceManager.h"
23#include "clang/Basic/FileManager.h"
24#include "clang/Basic/FileSystemOptions.h"
25#include "clang-c/Index.h"
26#include "llvm/ADT/IntrusiveRefCntPtr.h"
27#include "llvm/ADT/OwningPtr.h"
28#include "llvm/ADT/SmallVector.h"
29#include "llvm/ADT/StringMap.h"
30#include "llvm/Support/Path.h"
31#include <map>
32#include <string>
33#include <vector>
34#include <cassert>
35#include <utility>
36#include <sys/types.h>
37
38namespace llvm {
39  class MemoryBuffer;
40}
41
42namespace clang {
43class ASTContext;
44class CodeCompleteConsumer;
45class CompilerInvocation;
46class Decl;
47class Diagnostic;
48class FileEntry;
49class FileManager;
50class HeaderSearch;
51class Preprocessor;
52class SourceManager;
53class TargetInfo;
54
55using namespace idx;
56
57/// \brief Utility class for loading a ASTContext from an AST file.
58///
59class ASTUnit {
60public:
61  typedef std::map<FileID, std::vector<PreprocessedEntity *> >
62    PreprocessedEntitiesByFileMap;
63
64private:
65  llvm::IntrusiveRefCntPtr<Diagnostic> Diagnostics;
66  llvm::OwningPtr<FileManager>      FileMgr;
67  llvm::OwningPtr<SourceManager>    SourceMgr;
68  llvm::OwningPtr<HeaderSearch>     HeaderInfo;
69  llvm::OwningPtr<TargetInfo>       Target;
70  llvm::OwningPtr<Preprocessor>     PP;
71  llvm::OwningPtr<ASTContext>       Ctx;
72
73  FileSystemOptions FileSystemOpts;
74
75  /// \brief The AST consumer that received information about the translation
76  /// unit as it was parsed or loaded.
77  llvm::OwningPtr<ASTConsumer> Consumer;
78
79  /// \brief The semantic analysis object used to type-check the translation
80  /// unit.
81  llvm::OwningPtr<Sema> TheSema;
82
83  /// Optional owned invocation, just used to make the invocation used in
84  /// LoadFromCommandLine available.
85  llvm::OwningPtr<CompilerInvocation> Invocation;
86
87  // OnlyLocalDecls - when true, walking this AST should only visit declarations
88  // that come from the AST itself, not from included precompiled headers.
89  // FIXME: This is temporary; eventually, CIndex will always do this.
90  bool                              OnlyLocalDecls;
91
92  /// \brief Whether to capture any diagnostics produced.
93  bool CaptureDiagnostics;
94
95  /// \brief Track whether the main file was loaded from an AST or not.
96  bool MainFileIsAST;
97
98  /// \brief Whether this AST represents a complete translation unit.
99  bool CompleteTranslationUnit;
100
101  /// \brief Whether we should time each operation.
102  bool WantTiming;
103
104  /// Track the top-level decls which appeared in an ASTUnit which was loaded
105  /// from a source file.
106  //
107  // FIXME: This is just an optimization hack to avoid deserializing large parts
108  // of a PCH file when using the Index library on an ASTUnit loaded from
109  // source. In the long term we should make the Index library use efficient and
110  // more scalable search mechanisms.
111  std::vector<Decl*> TopLevelDecls;
112
113  /// \brief The list of preprocessed entities which appeared when the ASTUnit
114  /// was loaded.
115  ///
116  /// FIXME: This is just an optimization hack to avoid deserializing large
117  /// parts of a PCH file while performing a walk or search. In the long term,
118  /// we should provide more scalable search mechanisms.
119  std::vector<PreprocessedEntity *> PreprocessedEntities;
120
121  /// The name of the original source file used to generate this ASTUnit.
122  std::string OriginalSourceFile;
123
124  // Critical optimization when using clang_getCursor().
125  ASTLocation LastLoc;
126
127  /// \brief The set of diagnostics produced when creating this
128  /// translation unit.
129  llvm::SmallVector<StoredDiagnostic, 4> StoredDiagnostics;
130
131  /// \brief The number of stored diagnostics that come from the driver
132  /// itself.
133  ///
134  /// Diagnostics that come from the driver are retained from one parse to
135  /// the next.
136  unsigned NumStoredDiagnosticsFromDriver;
137
138  /// \brief Temporary files that should be removed when the ASTUnit is
139  /// destroyed.
140  llvm::SmallVector<llvm::sys::Path, 4> TemporaryFiles;
141
142  /// \brief A mapping from file IDs to the set of preprocessed entities
143  /// stored in that file.
144  ///
145  /// FIXME: This is just an optimization hack to avoid searching through
146  /// many preprocessed entities during cursor traversal in the CIndex library.
147  /// Ideally, we would just be able to perform a binary search within the
148  /// list of preprocessed entities.
149  PreprocessedEntitiesByFileMap PreprocessedEntitiesByFile;
150
151  /// \brief Simple hack to allow us to assert that ASTUnit is not being
152  /// used concurrently, which is not supported.
153  ///
154  /// Clients should create instances of the ConcurrencyCheck class whenever
155  /// using the ASTUnit in a way that isn't intended to be concurrent, which is
156  /// just about any usage.
157  unsigned int ConcurrencyCheckValue;
158  static const unsigned int CheckLocked = 28573289;
159  static const unsigned int CheckUnlocked = 9803453;
160
161  /// \brief Counter that determines when we want to try building a
162  /// precompiled preamble.
163  ///
164  /// If zero, we will never build a precompiled preamble. Otherwise,
165  /// it's treated as a counter that decrements each time we reparse
166  /// without the benefit of a precompiled preamble. When it hits 1,
167  /// we'll attempt to rebuild the precompiled header. This way, if
168  /// building the precompiled preamble fails, we won't try again for
169  /// some number of calls.
170  unsigned PreambleRebuildCounter;
171
172  /// \brief The file in which the precompiled preamble is stored.
173  std::string PreambleFile;
174
175  /// \brief The contents of the preamble that has been precompiled to
176  /// \c PreambleFile.
177  std::vector<char> Preamble;
178
179  /// \brief Whether the preamble ends at the start of a new line.
180  ///
181  /// Used to inform the lexer as to whether it's starting at the beginning of
182  /// a line after skipping the preamble.
183  bool PreambleEndsAtStartOfLine;
184
185  /// \brief The size of the source buffer that we've reserved for the main
186  /// file within the precompiled preamble.
187  unsigned PreambleReservedSize;
188
189  /// \brief Keeps track of the files that were used when computing the
190  /// preamble, with both their buffer size and their modification time.
191  ///
192  /// If any of the files have changed from one compile to the next,
193  /// the preamble must be thrown away.
194  llvm::StringMap<std::pair<off_t, time_t> > FilesInPreamble;
195
196  /// \brief When non-NULL, this is the buffer used to store the contents of
197  /// the main file when it has been padded for use with the precompiled
198  /// preamble.
199  llvm::MemoryBuffer *SavedMainFileBuffer;
200
201  /// \brief When non-NULL, this is the buffer used to store the
202  /// contents of the preamble when it has been padded to build the
203  /// precompiled preamble.
204  llvm::MemoryBuffer *PreambleBuffer;
205
206  /// \brief The number of warnings that occurred while parsing the preamble.
207  ///
208  /// This value will be used to restore the state of the \c Diagnostic object
209  /// when re-using the precompiled preamble. Note that only the
210  /// number of warnings matters, since we will not save the preamble
211  /// when any errors are present.
212  unsigned NumWarningsInPreamble;
213
214  /// \brief The number of diagnostics that were stored when parsing
215  /// the precompiled preamble.
216  ///
217  /// This value is used to determine how many of the stored
218  /// diagnostics should be retained when reparsing in the presence of
219  /// a precompiled preamble.
220  unsigned NumStoredDiagnosticsInPreamble;
221
222  /// \brief A list of the serialization ID numbers for each of the top-level
223  /// declarations parsed within the precompiled preamble.
224  std::vector<serialization::DeclID> TopLevelDeclsInPreamble;
225
226  /// \brief A list of the offsets into the precompiled preamble which
227  /// correspond to preprocessed entities.
228  std::vector<uint64_t> PreprocessedEntitiesInPreamble;
229
230  /// \brief Whether we should be caching code-completion results.
231  bool ShouldCacheCodeCompletionResults;
232
233  static void ConfigureDiags(llvm::IntrusiveRefCntPtr<Diagnostic> &Diags,
234                             ASTUnit &AST, bool CaptureDiagnostics);
235
236public:
237  /// \brief A cached code-completion result, which may be introduced in one of
238  /// many different contexts.
239  struct CachedCodeCompletionResult {
240    /// \brief The code-completion string corresponding to this completion
241    /// result.
242    CodeCompletionString *Completion;
243
244    /// \brief A bitmask that indicates which code-completion contexts should
245    /// contain this completion result.
246    ///
247    /// The bits in the bitmask correspond to the values of
248    /// CodeCompleteContext::Kind. To map from a completion context kind to a
249    /// bit, subtract one from the completion context kind and shift 1 by that
250    /// number of bits. Many completions can occur in several different
251    /// contexts.
252    unsigned ShowInContexts;
253
254    /// \brief The priority given to this code-completion result.
255    unsigned Priority;
256
257    /// \brief The libclang cursor kind corresponding to this code-completion
258    /// result.
259    CXCursorKind Kind;
260
261    /// \brief The availability of this code-completion result.
262    CXAvailabilityKind Availability;
263
264    /// \brief The simplified type class for a non-macro completion result.
265    SimplifiedTypeClass TypeClass;
266
267    /// \brief The type of a non-macro completion result, stored as a unique
268    /// integer used by the string map of cached completion types.
269    ///
270    /// This value will be zero if the type is not known, or a unique value
271    /// determined by the formatted type string. Se \c CachedCompletionTypes
272    /// for more information.
273    unsigned Type;
274  };
275
276  /// \brief Retrieve the mapping from formatted type names to unique type
277  /// identifiers.
278  llvm::StringMap<unsigned> &getCachedCompletionTypes() {
279    return CachedCompletionTypes;
280  }
281
282private:
283  /// \brief The set of cached code-completion results.
284  std::vector<CachedCodeCompletionResult> CachedCompletionResults;
285
286  /// \brief A mapping from the formatted type name to a unique number for that
287  /// type, which is used for type equality comparisons.
288  llvm::StringMap<unsigned> CachedCompletionTypes;
289
290  /// \brief The number of top-level declarations present the last time we
291  /// cached code-completion results.
292  ///
293  /// The value is used to help detect when we should repopulate the global
294  /// completion cache.
295  unsigned NumTopLevelDeclsAtLastCompletionCache;
296
297  /// \brief The number of reparses left until we'll consider updating the
298  /// code-completion cache.
299  ///
300  /// This is meant to avoid thrashing during reparsing, by not allowing the
301  /// code-completion cache to be updated on every reparse.
302  unsigned CacheCodeCompletionCoolDown;
303
304  /// \brief Bit used by CIndex to mark when a translation unit may be in an
305  /// inconsistent state, and is not safe to free.
306  unsigned UnsafeToFree : 1;
307
308  /// \brief Cache any "global" code-completion results, so that we can avoid
309  /// recomputing them with each completion.
310  void CacheCodeCompletionResults();
311
312  /// \brief Clear out and deallocate
313  void ClearCachedCompletionResults();
314
315  ASTUnit(const ASTUnit&); // DO NOT IMPLEMENT
316  ASTUnit &operator=(const ASTUnit &); // DO NOT IMPLEMENT
317
318  explicit ASTUnit(bool MainFileIsAST);
319
320  void CleanTemporaryFiles();
321  bool Parse(llvm::MemoryBuffer *OverrideMainBuffer);
322
323  std::pair<llvm::MemoryBuffer *, std::pair<unsigned, bool> >
324  ComputePreamble(CompilerInvocation &Invocation,
325                  unsigned MaxLines, bool &CreatedBuffer);
326
327  llvm::MemoryBuffer *getMainBufferWithPrecompiledPreamble(
328                                         CompilerInvocation PreambleInvocation,
329                                                     bool AllowRebuild = true,
330                                                        unsigned MaxLines = 0);
331  void RealizeTopLevelDeclsFromPreamble();
332  void RealizePreprocessedEntitiesFromPreamble();
333
334public:
335  class ConcurrencyCheck {
336    volatile ASTUnit &Self;
337
338  public:
339    explicit ConcurrencyCheck(ASTUnit &Self)
340      : Self(Self)
341    {
342      assert(Self.ConcurrencyCheckValue == CheckUnlocked &&
343             "Concurrent access to ASTUnit!");
344      Self.ConcurrencyCheckValue = CheckLocked;
345    }
346
347    ~ConcurrencyCheck() {
348      Self.ConcurrencyCheckValue = CheckUnlocked;
349    }
350  };
351  friend class ConcurrencyCheck;
352
353  ~ASTUnit();
354
355  bool isMainFileAST() const { return MainFileIsAST; }
356
357  bool isUnsafeToFree() const { return UnsafeToFree; }
358  void setUnsafeToFree(bool Value) { UnsafeToFree = Value; }
359
360  const Diagnostic &getDiagnostics() const { return *Diagnostics; }
361  Diagnostic &getDiagnostics()             { return *Diagnostics; }
362
363  const SourceManager &getSourceManager() const { return *SourceMgr; }
364        SourceManager &getSourceManager()       { return *SourceMgr; }
365
366  const Preprocessor &getPreprocessor() const { return *PP.get(); }
367        Preprocessor &getPreprocessor()       { return *PP.get(); }
368
369  const ASTContext &getASTContext() const { return *Ctx.get(); }
370        ASTContext &getASTContext()       { return *Ctx.get(); }
371
372  bool hasSema() const { return TheSema; }
373  Sema &getSema() const {
374    assert(TheSema && "ASTUnit does not have a Sema object!");
375    return *TheSema;
376  }
377
378  const FileManager &getFileManager() const { return *FileMgr; }
379        FileManager &getFileManager()       { return *FileMgr; }
380
381  const FileSystemOptions &getFileSystemOpts() const { return FileSystemOpts; }
382
383  const std::string &getOriginalSourceFileName();
384  const std::string &getASTFileName();
385
386  /// \brief Add a temporary file that the ASTUnit depends on.
387  ///
388  /// This file will be erased when the ASTUnit is destroyed.
389  void addTemporaryFile(const llvm::sys::Path &TempFile) {
390    TemporaryFiles.push_back(TempFile);
391  }
392
393  bool getOnlyLocalDecls() const { return OnlyLocalDecls; }
394
395  /// \brief Retrieve the maximum PCH level of declarations that a
396  /// traversal of the translation unit should consider.
397  unsigned getMaxPCHLevel() const;
398
399  void setLastASTLocation(ASTLocation ALoc) { LastLoc = ALoc; }
400  ASTLocation getLastASTLocation() const { return LastLoc; }
401
402
403  llvm::StringRef getMainFileName() const;
404
405  typedef std::vector<Decl *>::iterator top_level_iterator;
406
407  top_level_iterator top_level_begin() {
408    assert(!isMainFileAST() && "Invalid call for AST based ASTUnit!");
409    if (!TopLevelDeclsInPreamble.empty())
410      RealizeTopLevelDeclsFromPreamble();
411    return TopLevelDecls.begin();
412  }
413
414  top_level_iterator top_level_end() {
415    assert(!isMainFileAST() && "Invalid call for AST based ASTUnit!");
416    if (!TopLevelDeclsInPreamble.empty())
417      RealizeTopLevelDeclsFromPreamble();
418    return TopLevelDecls.end();
419  }
420
421  std::size_t top_level_size() const {
422    assert(!isMainFileAST() && "Invalid call for AST based ASTUnit!");
423    return TopLevelDeclsInPreamble.size() + TopLevelDecls.size();
424  }
425
426  bool top_level_empty() const {
427    assert(!isMainFileAST() && "Invalid call for AST based ASTUnit!");
428    return TopLevelDeclsInPreamble.empty() && TopLevelDecls.empty();
429  }
430
431  /// \brief Add a new top-level declaration.
432  void addTopLevelDecl(Decl *D) {
433    TopLevelDecls.push_back(D);
434  }
435
436  /// \brief Add a new top-level declaration, identified by its ID in
437  /// the precompiled preamble.
438  void addTopLevelDeclFromPreamble(serialization::DeclID D) {
439    TopLevelDeclsInPreamble.push_back(D);
440  }
441
442  typedef std::vector<PreprocessedEntity *>::iterator pp_entity_iterator;
443
444  pp_entity_iterator pp_entity_begin();
445  pp_entity_iterator pp_entity_end();
446
447  /// \brief Add a new preprocessed entity that's stored at the given offset
448  /// in the precompiled preamble.
449  void addPreprocessedEntityFromPreamble(uint64_t Offset) {
450    PreprocessedEntitiesInPreamble.push_back(Offset);
451  }
452
453  /// \brief Retrieve the mapping from File IDs to the preprocessed entities
454  /// within that file.
455  PreprocessedEntitiesByFileMap &getPreprocessedEntitiesByFile() {
456    return PreprocessedEntitiesByFile;
457  }
458
459  // Retrieve the diagnostics associated with this AST
460  typedef const StoredDiagnostic *stored_diag_iterator;
461  stored_diag_iterator stored_diag_begin() const {
462    return StoredDiagnostics.begin();
463  }
464  stored_diag_iterator stored_diag_end() const {
465    return StoredDiagnostics.end();
466  }
467  unsigned stored_diag_size() const { return StoredDiagnostics.size(); }
468
469  llvm::SmallVector<StoredDiagnostic, 4> &getStoredDiagnostics() {
470    return StoredDiagnostics;
471  }
472
473  typedef std::vector<CachedCodeCompletionResult>::iterator
474    cached_completion_iterator;
475
476  cached_completion_iterator cached_completion_begin() {
477    return CachedCompletionResults.begin();
478  }
479
480  cached_completion_iterator cached_completion_end() {
481    return CachedCompletionResults.end();
482  }
483
484  unsigned cached_completion_size() const {
485    return CachedCompletionResults.size();
486  }
487
488  llvm::MemoryBuffer *getBufferForFile(llvm::StringRef Filename,
489                                       std::string *ErrorStr = 0);
490
491  /// \brief Whether this AST represents a complete translation unit.
492  ///
493  /// If false, this AST is only a partial translation unit, e.g., one
494  /// that might still be used as a precompiled header or preamble.
495  bool isCompleteTranslationUnit() const { return CompleteTranslationUnit; }
496
497  /// \brief A mapping from a file name to the memory buffer that stores the
498  /// remapped contents of that file.
499  typedef std::pair<std::string, const llvm::MemoryBuffer *> RemappedFile;
500
501  /// \brief Create a ASTUnit from an AST file.
502  ///
503  /// \param Filename - The AST file to load.
504  ///
505  /// \param Diags - The diagnostics engine to use for reporting errors; its
506  /// lifetime is expected to extend past that of the returned ASTUnit.
507  ///
508  /// \returns - The initialized ASTUnit or null if the AST failed to load.
509  static ASTUnit *LoadFromASTFile(const std::string &Filename,
510                                  llvm::IntrusiveRefCntPtr<Diagnostic> Diags,
511                                  const FileSystemOptions &FileSystemOpts,
512                                  bool OnlyLocalDecls = false,
513                                  RemappedFile *RemappedFiles = 0,
514                                  unsigned NumRemappedFiles = 0,
515                                  bool CaptureDiagnostics = false);
516
517private:
518  /// \brief Helper function for \c LoadFromCompilerInvocation() and
519  /// \c LoadFromCommandLine(), which loads an AST from a compiler invocation.
520  ///
521  /// \param PrecompilePreamble Whether to precompile the preamble of this
522  /// translation unit, to improve the performance of reparsing.
523  ///
524  /// \returns \c true if a catastrophic failure occurred (which means that the
525  /// \c ASTUnit itself is invalid), or \c false otherwise.
526  bool LoadFromCompilerInvocation(bool PrecompilePreamble);
527
528public:
529
530  /// LoadFromCompilerInvocation - Create an ASTUnit from a source file, via a
531  /// CompilerInvocation object.
532  ///
533  /// \param CI - The compiler invocation to use; it must have exactly one input
534  /// source file. The ASTUnit takes ownership of the CompilerInvocation object.
535  ///
536  /// \param Diags - The diagnostics engine to use for reporting errors; its
537  /// lifetime is expected to extend past that of the returned ASTUnit.
538  //
539  // FIXME: Move OnlyLocalDecls, UseBumpAllocator to setters on the ASTUnit, we
540  // shouldn't need to specify them at construction time.
541  static ASTUnit *LoadFromCompilerInvocation(CompilerInvocation *CI,
542                                     llvm::IntrusiveRefCntPtr<Diagnostic> Diags,
543                                             bool OnlyLocalDecls = false,
544                                             bool CaptureDiagnostics = false,
545                                             bool PrecompilePreamble = false,
546                                          bool CompleteTranslationUnit = true,
547                                       bool CacheCodeCompletionResults = false);
548
549  /// LoadFromCommandLine - Create an ASTUnit from a vector of command line
550  /// arguments, which must specify exactly one source file.
551  ///
552  /// \param ArgBegin - The beginning of the argument vector.
553  ///
554  /// \param ArgEnd - The end of the argument vector.
555  ///
556  /// \param Diags - The diagnostics engine to use for reporting errors; its
557  /// lifetime is expected to extend past that of the returned ASTUnit.
558  ///
559  /// \param ResourceFilesPath - The path to the compiler resource files.
560  //
561  // FIXME: Move OnlyLocalDecls, UseBumpAllocator to setters on the ASTUnit, we
562  // shouldn't need to specify them at construction time.
563  static ASTUnit *LoadFromCommandLine(const char **ArgBegin,
564                                      const char **ArgEnd,
565                                    llvm::IntrusiveRefCntPtr<Diagnostic> Diags,
566                                      llvm::StringRef ResourceFilesPath,
567                                      bool OnlyLocalDecls = false,
568                                      bool CaptureDiagnostics = false,
569                                      RemappedFile *RemappedFiles = 0,
570                                      unsigned NumRemappedFiles = 0,
571                                      bool PrecompilePreamble = false,
572                                      bool CompleteTranslationUnit = true,
573                                      bool CacheCodeCompletionResults = false,
574                                      bool CXXPrecompilePreamble = false,
575                                      bool CXXChainedPCH = false);
576
577  /// \brief Reparse the source files using the same command-line options that
578  /// were originally used to produce this translation unit.
579  ///
580  /// \returns True if a failure occurred that causes the ASTUnit not to
581  /// contain any translation-unit information, false otherwise.
582  bool Reparse(RemappedFile *RemappedFiles = 0,
583               unsigned NumRemappedFiles = 0);
584
585  /// \brief Perform code completion at the given file, line, and
586  /// column within this translation unit.
587  ///
588  /// \param File The file in which code completion will occur.
589  ///
590  /// \param Line The line at which code completion will occur.
591  ///
592  /// \param Column The column at which code completion will occur.
593  ///
594  /// \param IncludeMacros Whether to include macros in the code-completion
595  /// results.
596  ///
597  /// \param IncludeCodePatterns Whether to include code patterns (such as a
598  /// for loop) in the code-completion results.
599  ///
600  /// FIXME: The Diag, LangOpts, SourceMgr, FileMgr, StoredDiagnostics, and
601  /// OwnedBuffers parameters are all disgusting hacks. They will go away.
602  void CodeComplete(llvm::StringRef File, unsigned Line, unsigned Column,
603                    RemappedFile *RemappedFiles, unsigned NumRemappedFiles,
604                    bool IncludeMacros, bool IncludeCodePatterns,
605                    CodeCompleteConsumer &Consumer,
606                    Diagnostic &Diag, LangOptions &LangOpts,
607                    SourceManager &SourceMgr, FileManager &FileMgr,
608                    llvm::SmallVectorImpl<StoredDiagnostic> &StoredDiagnostics,
609              llvm::SmallVectorImpl<const llvm::MemoryBuffer *> &OwnedBuffers);
610
611  /// \brief Save this translation unit to a file with the given name.
612  ///
613  /// \returns True if an error occurred, false otherwise.
614  bool Save(llvm::StringRef File);
615};
616
617} // namespace clang
618
619#endif
620