clang  3.7.0
PreprocessingRecord.h
Go to the documentation of this file.
1 //===--- PreprocessingRecord.h - Record of Preprocessing --------*- 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 // This file defines the PreprocessingRecord class, which maintains a record
11 // of what occurred during preprocessing.
12 //
13 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_LEX_PREPROCESSINGRECORD_H
15 #define LLVM_CLANG_LEX_PREPROCESSINGRECORD_H
16 
19 #include "clang/Lex/PPCallbacks.h"
20 #include "llvm/ADT/DenseMap.h"
21 #include "llvm/ADT/Optional.h"
22 #include "llvm/ADT/SmallVector.h"
23 #include "llvm/ADT/iterator.h"
24 #include "llvm/Support/Allocator.h"
25 #include "llvm/Support/Compiler.h"
26 #include <vector>
27 
28 namespace clang {
29  class IdentifierInfo;
30  class MacroInfo;
31  class PreprocessingRecord;
32 }
33 
34 /// \brief Allocates memory within a Clang preprocessing record.
35 void* operator new(size_t bytes, clang::PreprocessingRecord& PR,
36  unsigned alignment = 8) throw();
37 
38 /// \brief Frees memory allocated in a Clang preprocessing record.
39 void operator delete(void *ptr, clang::PreprocessingRecord &PR,
40  unsigned) throw();
41 
42 namespace clang {
43  class MacroDefinitionRecord;
44  class FileEntry;
45 
46  /// \brief Base class that describes a preprocessed entity, which may be a
47  /// preprocessor directive or macro expansion.
49  public:
50  /// \brief The kind of preprocessed entity an object describes.
51  enum EntityKind {
52  /// \brief Indicates a problem trying to load the preprocessed entity.
54 
55  /// \brief A macro expansion.
57 
58  /// \defgroup Preprocessing directives
59  /// @{
60 
61  /// \brief A macro definition.
63 
64  /// \brief An inclusion directive, such as \c \#include, \c
65  /// \#import, or \c \#include_next.
67 
68  /// @}
69 
72  };
73 
74  private:
75  /// \brief The kind of preprocessed entity that this object describes.
77 
78  /// \brief The source range that covers this preprocessed entity.
79  SourceRange Range;
80 
81  protected:
83  : Kind(Kind), Range(Range) { }
84 
85  friend class PreprocessingRecord;
86 
87  public:
88  /// \brief Retrieve the kind of preprocessed entity stored in this object.
89  EntityKind getKind() const { return Kind; }
90 
91  /// \brief Retrieve the source range that covers this entire preprocessed
92  /// entity.
93  SourceRange getSourceRange() const LLVM_READONLY { return Range; }
94 
95  /// \brief Returns true if there was a problem loading the preprocessed
96  /// entity.
97  bool isInvalid() const { return Kind == InvalidKind; }
98 
99  // Only allow allocation of preprocessed entities using the allocator
100  // in PreprocessingRecord or by doing a placement new.
101  void* operator new(size_t bytes, PreprocessingRecord& PR,
102  unsigned alignment = 8) throw() {
103  return ::operator new(bytes, PR, alignment);
104  }
105 
106  void* operator new(size_t bytes, void* mem) throw() {
107  return mem;
108  }
109 
110  void operator delete(void* ptr, PreprocessingRecord& PR,
111  unsigned alignment) throw() {
112  return ::operator delete(ptr, PR, alignment);
113  }
114 
115  void operator delete(void*, std::size_t) throw() { }
116  void operator delete(void*, void*) throw() { }
117 
118  private:
119  // Make vanilla 'new' and 'delete' illegal for preprocessed entities.
120  void* operator new(size_t bytes) throw();
121  void operator delete(void* data) throw();
122  };
123 
124  /// \brief Records the presence of a preprocessor directive.
126  public:
128  : PreprocessedEntity(Kind, Range) { }
129 
130  // Implement isa/cast/dyncast/etc.
131  static bool classof(const PreprocessedEntity *PD) {
132  return PD->getKind() >= FirstPreprocessingDirective &&
134  }
135  };
136 
137  /// \brief Record the location of a macro definition.
139  /// \brief The name of the macro being defined.
140  const IdentifierInfo *Name;
141 
142  public:
143  explicit MacroDefinitionRecord(const IdentifierInfo *Name,
144  SourceRange Range)
145  : PreprocessingDirective(MacroDefinitionKind, Range), Name(Name) {}
146 
147  /// \brief Retrieve the name of the macro being defined.
148  const IdentifierInfo *getName() const { return Name; }
149 
150  /// \brief Retrieve the location of the macro name in the definition.
152 
153  // Implement isa/cast/dyncast/etc.
154  static bool classof(const PreprocessedEntity *PE) {
155  return PE->getKind() == MacroDefinitionKind;
156  }
157  };
158 
159  /// \brief Records the location of a macro expansion.
161  /// \brief The definition of this macro or the name of the macro if it is
162  /// a builtin macro.
163  llvm::PointerUnion<IdentifierInfo *, MacroDefinitionRecord *> NameOrDef;
164 
165  public:
168  NameOrDef(BuiltinName) {}
169 
171  : PreprocessedEntity(MacroExpansionKind, Range), NameOrDef(Definition) {
172  }
173 
174  /// \brief True if it is a builtin macro.
175  bool isBuiltinMacro() const { return NameOrDef.is<IdentifierInfo *>(); }
176 
177  /// \brief The name of the macro being expanded.
178  const IdentifierInfo *getName() const {
180  return Def->getName();
181  return NameOrDef.get<IdentifierInfo *>();
182  }
183 
184  /// \brief The definition of the macro being expanded. May return null if
185  /// this is a builtin macro.
187  return NameOrDef.dyn_cast<MacroDefinitionRecord *>();
188  }
189 
190  // Implement isa/cast/dyncast/etc.
191  static bool classof(const PreprocessedEntity *PE) {
192  return PE->getKind() == MacroExpansionKind;
193  }
194  };
195 
196  /// \brief Record the location of an inclusion directive, such as an
197  /// \c \#include or \c \#import statement.
199  public:
200  /// \brief The kind of inclusion directives known to the
201  /// preprocessor.
203  /// \brief An \c \#include directive.
205  /// \brief An Objective-C \c \#import directive.
207  /// \brief A GNU \c \#include_next directive.
209  /// \brief A Clang \c \#__include_macros directive.
211  };
212 
213  private:
214  /// \brief The name of the file that was included, as written in
215  /// the source.
216  StringRef FileName;
217 
218  /// \brief Whether the file name was in quotation marks; otherwise, it was
219  /// in angle brackets.
220  unsigned InQuotes : 1;
221 
222  /// \brief The kind of inclusion directive we have.
223  ///
224  /// This is a value of type InclusionKind.
225  unsigned Kind : 2;
226 
227  /// \brief Whether the inclusion directive was automatically turned into
228  /// a module import.
229  unsigned ImportedModule : 1;
230 
231  /// \brief The file that was included.
232  const FileEntry *File;
233 
234  public:
236  InclusionKind Kind, StringRef FileName,
237  bool InQuotes, bool ImportedModule,
238  const FileEntry *File, SourceRange Range);
239 
240  /// \brief Determine what kind of inclusion directive this is.
241  InclusionKind getKind() const { return static_cast<InclusionKind>(Kind); }
242 
243  /// \brief Retrieve the included file name as it was written in the source.
244  StringRef getFileName() const { return FileName; }
245 
246  /// \brief Determine whether the included file name was written in quotes;
247  /// otherwise, it was written in angle brackets.
248  bool wasInQuotes() const { return InQuotes; }
249 
250  /// \brief Determine whether the inclusion directive was automatically
251  /// turned into a module import.
252  bool importedModule() const { return ImportedModule; }
253 
254  /// \brief Retrieve the file entry for the actual file that was included
255  /// by this directive.
256  const FileEntry *getFile() const { return File; }
257 
258  // Implement isa/cast/dyncast/etc.
259  static bool classof(const PreprocessedEntity *PE) {
260  return PE->getKind() == InclusionDirectiveKind;
261  }
262  };
263 
264  /// \brief An abstract class that should be subclassed by any external source
265  /// of preprocessing record entries.
267  public:
269 
270  /// \brief Read a preallocated preprocessed entity from the external source.
271  ///
272  /// \returns null if an error occurred that prevented the preprocessed
273  /// entity from being loaded.
274  virtual PreprocessedEntity *ReadPreprocessedEntity(unsigned Index) = 0;
275 
276  /// \brief Returns a pair of [Begin, End) indices of preallocated
277  /// preprocessed entities that \p Range encompasses.
278  virtual std::pair<unsigned, unsigned>
280 
281  /// \brief Optionally returns true or false if the preallocated preprocessed
282  /// entity with index \p Index came from file \p FID.
284  FileID FID) {
285  return None;
286  }
287  };
288 
289  /// \brief A record of the steps taken while preprocessing a source file,
290  /// including the various preprocessing directives processed, macros
291  /// expanded, etc.
293  SourceManager &SourceMgr;
294 
295  /// \brief Allocator used to store preprocessing objects.
296  llvm::BumpPtrAllocator BumpAlloc;
297 
298  /// \brief The set of preprocessed entities in this record, in order they
299  /// were seen.
300  std::vector<PreprocessedEntity *> PreprocessedEntities;
301 
302  /// \brief The set of preprocessed entities in this record that have been
303  /// loaded from external sources.
304  ///
305  /// The entries in this vector are loaded lazily from the external source,
306  /// and are referenced by the iterator using negative indices.
307  std::vector<PreprocessedEntity *> LoadedPreprocessedEntities;
308 
309  /// \brief The set of ranges that were skipped by the preprocessor,
310  std::vector<SourceRange> SkippedRanges;
311 
312  /// \brief Global (loaded or local) ID for a preprocessed entity.
313  /// Negative values are used to indicate preprocessed entities
314  /// loaded from the external source while non-negative values are used to
315  /// indicate preprocessed entities introduced by the current preprocessor.
316  /// Value -1 corresponds to element 0 in the loaded entities vector,
317  /// value -2 corresponds to element 1 in the loaded entities vector, etc.
318  /// Value 0 is an invalid value, the index to local entities is 1-based,
319  /// value 1 corresponds to element 0 in the local entities vector,
320  /// value 2 corresponds to element 1 in the local entities vector, etc.
321  class PPEntityID {
322  int ID;
323  explicit PPEntityID(int ID) : ID(ID) {}
324  friend class PreprocessingRecord;
325  public:
326  PPEntityID() : ID(0) {}
327  };
328 
329  static PPEntityID getPPEntityID(unsigned Index, bool isLoaded) {
330  return isLoaded ? PPEntityID(-int(Index)-1) : PPEntityID(Index+1);
331  }
332 
333  /// \brief Mapping from MacroInfo structures to their definitions.
334  llvm::DenseMap<const MacroInfo *, MacroDefinitionRecord *> MacroDefinitions;
335 
336  /// \brief External source of preprocessed entities.
337  ExternalPreprocessingRecordSource *ExternalSource;
338 
339  /// \brief Retrieve the preprocessed entity at the given ID.
340  PreprocessedEntity *getPreprocessedEntity(PPEntityID PPID);
341 
342  /// \brief Retrieve the loaded preprocessed entity at the given index.
343  PreprocessedEntity *getLoadedPreprocessedEntity(unsigned Index);
344 
345  /// \brief Determine the number of preprocessed entities that were
346  /// loaded (or can be loaded) from an external source.
347  unsigned getNumLoadedPreprocessedEntities() const {
348  return LoadedPreprocessedEntities.size();
349  }
350 
351  /// \brief Returns a pair of [Begin, End) indices of local preprocessed
352  /// entities that \p Range encompasses.
353  std::pair<unsigned, unsigned>
354  findLocalPreprocessedEntitiesInRange(SourceRange Range) const;
355  unsigned findBeginLocalPreprocessedEntity(SourceLocation Loc) const;
356  unsigned findEndLocalPreprocessedEntity(SourceLocation Loc) const;
357 
358  /// \brief Allocate space for a new set of loaded preprocessed entities.
359  ///
360  /// \returns The index into the set of loaded preprocessed entities, which
361  /// corresponds to the first newly-allocated entity.
362  unsigned allocateLoadedEntities(unsigned NumEntities);
363 
364  /// \brief Register a new macro definition.
365  void RegisterMacroDefinition(MacroInfo *Macro, MacroDefinitionRecord *Def);
366 
367  public:
368  /// \brief Construct a new preprocessing record.
370 
371  /// \brief Allocate memory in the preprocessing record.
372  void *Allocate(unsigned Size, unsigned Align = 8) {
373  return BumpAlloc.Allocate(Size, Align);
374  }
375 
376  /// \brief Deallocate memory in the preprocessing record.
377  void Deallocate(void *Ptr) { }
378 
379  size_t getTotalMemory() const;
380 
382 
383  /// Iteration over the preprocessed entities.
384  ///
385  /// In a complete iteration, the iterator walks the range [-M, N),
386  /// where negative values are used to indicate preprocessed entities
387  /// loaded from the external source while non-negative values are used to
388  /// indicate preprocessed entities introduced by the current preprocessor.
389  /// However, to provide iteration in source order (for, e.g., chained
390  /// precompiled headers), dereferencing the iterator flips the negative
391  /// values (corresponding to loaded entities), so that position -M
392  /// corresponds to element 0 in the loaded entities vector, position -M+1
393  /// corresponds to element 1 in the loaded entities vector, etc. This
394  /// gives us a reasonably efficient, source-order walk.
395  ///
396  /// We define this as a wrapping iterator around an int. The
397  /// iterator_adaptor_base class forwards the iterator methods to basic
398  /// integer arithmetic.
399  class iterator : public llvm::iterator_adaptor_base<
400  iterator, int, std::random_access_iterator_tag,
401  PreprocessedEntity *, int, PreprocessedEntity *,
402  PreprocessedEntity *> {
403  PreprocessingRecord *Self;
404 
406  : iterator::iterator_adaptor_base(Position), Self(Self) {}
407  friend class PreprocessingRecord;
408 
409  public:
410  iterator() : iterator(nullptr, 0) {}
411 
413  bool isLoaded = this->I < 0;
414  unsigned Index = isLoaded ?
415  Self->LoadedPreprocessedEntities.size() + this->I : this->I;
416  PPEntityID ID = Self->getPPEntityID(Index, isLoaded);
417  return Self->getPreprocessedEntity(ID);
418  }
419  PreprocessedEntity *operator->() const { return **this; }
420  };
421 
422  /// \brief Begin iterator for all preprocessed entities.
424  return iterator(this, -(int)LoadedPreprocessedEntities.size());
425  }
426 
427  /// \brief End iterator for all preprocessed entities.
429  return iterator(this, PreprocessedEntities.size());
430  }
431 
432  /// \brief Begin iterator for local, non-loaded, preprocessed entities.
434  return iterator(this, 0);
435  }
436 
437  /// \brief End iterator for local, non-loaded, preprocessed entities.
439  return iterator(this, PreprocessedEntities.size());
440  }
441 
442  /// \brief iterator range for the given range of loaded
443  /// preprocessed entities.
444  llvm::iterator_range<iterator> getIteratorsForLoadedRange(unsigned start,
445  unsigned count) {
446  unsigned end = start + count;
447  assert(end <= LoadedPreprocessedEntities.size());
448  return llvm::make_range(
449  iterator(this, int(start) - LoadedPreprocessedEntities.size()),
450  iterator(this, int(end) - LoadedPreprocessedEntities.size()));
451  }
452 
453  /// \brief Returns a range of preprocessed entities that source range \p R
454  /// encompasses.
455  ///
456  /// \param R the range to look for preprocessed entities.
457  ///
458  llvm::iterator_range<iterator>
460 
461  /// \brief Returns true if the preprocessed entity that \p PPEI iterator
462  /// points to is coming from the file \p FID.
463  ///
464  /// Can be used to avoid implicit deserializations of preallocated
465  /// preprocessed entities if we only care about entities of a specific file
466  /// and not from files \#included in the range given at
467  /// \see getPreprocessedEntitiesInRange.
468  bool isEntityInFileID(iterator PPEI, FileID FID);
469 
470  /// \brief Add a new preprocessed entity to this record.
471  PPEntityID addPreprocessedEntity(PreprocessedEntity *Entity);
472 
473  /// \brief Set the external source for preprocessed entities.
475 
476  /// \brief Retrieve the external source for preprocessed entities.
478  return ExternalSource;
479  }
480 
481  /// \brief Retrieve the macro definition that corresponds to the given
482  /// \c MacroInfo.
484 
485  /// \brief Retrieve all ranges that got skipped while preprocessing.
486  const std::vector<SourceRange> &getSkippedRanges() const {
487  return SkippedRanges;
488  }
489 
490  private:
491  void MacroExpands(const Token &Id, const MacroDefinition &MD,
492  SourceRange Range, const MacroArgs *Args) override;
493  void MacroDefined(const Token &Id, const MacroDirective *MD) override;
494  void MacroUndefined(const Token &Id, const MacroDefinition &MD) override;
495  void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok,
496  StringRef FileName, bool IsAngled,
497  CharSourceRange FilenameRange,
498  const FileEntry *File, StringRef SearchPath,
499  StringRef RelativePath,
500  const Module *Imported) override;
501  void Ifdef(SourceLocation Loc, const Token &MacroNameTok,
502  const MacroDefinition &MD) override;
503  void Ifndef(SourceLocation Loc, const Token &MacroNameTok,
504  const MacroDefinition &MD) override;
505  /// \brief Hook called whenever the 'defined' operator is seen.
506  void Defined(const Token &MacroNameTok, const MacroDefinition &MD,
507  SourceRange Range) override;
508 
509  void SourceRangeSkipped(SourceRange Range) override;
510 
511  void addMacroExpansion(const Token &Id, const MacroInfo *MI,
512  SourceRange Range);
513 
514  /// \brief Cached result of the last \see getPreprocessedEntitiesInRange
515  /// query.
516  struct {
518  std::pair<int, int> Result;
519  } CachedRangeQuery;
520 
521  std::pair<int, int> getPreprocessedEntitiesInRangeSlow(SourceRange R);
522 
523  friend class ASTReader;
524  friend class ASTWriter;
525  };
526 } // end namespace clang
527 
528 inline void* operator new(size_t bytes, clang::PreprocessingRecord& PR,
529  unsigned alignment) throw() {
530  return PR.Allocate(bytes, alignment);
531 }
532 
533 inline void operator delete(void* ptr, clang::PreprocessingRecord& PR,
534  unsigned) throw() {
535  PR.Deallocate(ptr);
536 }
537 
538 #endif // LLVM_CLANG_LEX_PREPROCESSINGRECORD_H
static bool classof(const PreprocessedEntity *PE)
int Position
MacroExpansion(MacroDefinitionRecord *Definition, SourceRange Range)
A description of the current definition of a macro.
Definition: MacroInfo.h:564
Indicates a problem trying to load the preprocessed entity.
Base class that describes a preprocessed entity, which may be a preprocessor directive or macro expan...
virtual PreprocessedEntity * ReadPreprocessedEntity(unsigned Index)=0
Read a preallocated preprocessed entity from the external source.
const std::vector< SourceRange > & getSkippedRanges() const
Retrieve all ranges that got skipped while preprocessing.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range that covers this entire preprocessed entity.
iterator local_end()
End iterator for local, non-loaded, preprocessed entities.
StringRef getFileName() const
Retrieve the included file name as it was written in the source.
bool isBuiltinMacro() const
True if it is a builtin macro.
static StringRef bytes(const std::vector< T, Allocator > &v)
Definition: ASTWriter.cpp:63
This interface provides a way to observe the actions of the preprocessor as it does its thing...
Definition: PPCallbacks.h:38
Records the presence of a preprocessor directive.
InclusionKind getKind() const
Determine what kind of inclusion directive this is.
Record the location of a macro definition.
bool wasInQuotes() const
Determine whether the included file name was written in quotes; otherwise, it was written in angle br...
Describes a module or submodule.
Definition: Basic/Module.h:49
llvm::iterator_range< iterator > getPreprocessedEntitiesInRange(SourceRange R)
Returns a range of preprocessed entities that source range R encompasses.
EntityKind getKind() const
Retrieve the kind of preprocessed entity stored in this object.
A record of the steps taken while preprocessing a source file, including the various preprocessing di...
virtual std::pair< unsigned, unsigned > findPreprocessedEntitiesInRange(SourceRange Range)=0
Returns a pair of [Begin, End) indices of preallocated preprocessed entities that Range encompasses...
MacroDefinitionRecord * getDefinition() const
The definition of the macro being expanded. May return null if this is a builtin macro.
MacroExpansion(IdentifierInfo *BuiltinName, SourceRange Range)
SourceManager & getSourceManager() const
const FileEntry * getFile() const
Retrieve the file entry for the actual file that was included by this directive.
Records the location of a macro expansion.
PreprocessingRecord(SourceManager &SM)
Construct a new preprocessing record.
A GNU #include_next directive.
static bool classof(const PreprocessedEntity *PE)
std::pair< int, int > Result
ID
Defines the set of possible language-specific address spaces.
Definition: AddressSpaces.h:27
virtual Optional< bool > isPreprocessedEntityInFileID(unsigned Index, FileID FID)
Optionally returns true or false if the preallocated preprocessed entity with index Index came from f...
SourceManager & SM
static bool classof(const PreprocessedEntity *PD)
StringRef getName() const
Return the actual identifier string.
void * Allocate(unsigned Size, unsigned Align=8)
Allocate memory in the preprocessing record.
Represents a character-granular source range.
SourceManager & SourceMgr
Definition: Format.cpp:1205
PreprocessedEntity * operator->() const
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
bool importedModule() const
Determine whether the inclusion directive was automatically turned into a module import.
const IdentifierInfo * getName() const
The name of the macro being expanded.
Record the location of an inclusion directive, such as an #include or #import statement.
InclusionKind
The kind of inclusion directives known to the preprocessor.
llvm::iterator_range< iterator > getIteratorsForLoadedRange(unsigned start, unsigned count)
iterator range for the given range of loaded preprocessed entities.
ExternalPreprocessingRecordSource * getExternalSource() const
Retrieve the external source for preprocessed entities.
InclusionDirective(PreprocessingRecord &PPRec, InclusionKind Kind, StringRef FileName, bool InQuotes, bool ImportedModule, const FileEntry *File, SourceRange Range)
EntityKind
The kind of preprocessed entity an object describes.
Encapsulates changes to the "macros namespace" (the location where the macro name became active...
Definition: MacroInfo.h:308
Kind
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
void Deallocate(void *Ptr)
Deallocate memory in the preprocessing record.
PreprocessedEntity(EntityKind Kind, SourceRange Range)
Cached information about one file (either on disk or in the virtual file system). ...
Definition: FileManager.h:53
An abstract class that should be subclassed by any external source of preprocessing record entries...
MacroDefinitionRecord(const IdentifierInfo *Name, SourceRange Range)
SourceLocation getBegin() const
An inclusion directive, such as #include, #import, or #include_next.
bool isEntityInFileID(iterator PPEI, FileID FID)
Returns true if the preprocessed entity that PPEI iterator points to is coming from the file FID...
const IdentifierInfo * getName() const
Retrieve the name of the macro being defined.
A Clang #__include_macros directive.
__SIZE_TYPE__ size_t
Definition: stddef.h:62
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
iterator end()
End iterator for all preprocessed entities.
static bool classof(const PreprocessedEntity *PE)
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:302
Encapsulates the data about a macro definition (e.g. its tokens).
Definition: MacroInfo.h:34
PPEntityID addPreprocessedEntity(PreprocessedEntity *Entity)
Add a new preprocessed entity to this record.
An Objective-C #import directive.
Defines the PPCallbacks interface.
Defines the clang::SourceLocation class and associated facilities.
PreprocessedEntity * operator*() const
iterator begin()
Begin iterator for all preprocessed entities.
PreprocessingDirective(EntityKind Kind, SourceRange Range)
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:82
SourceLocation getLocation() const
Retrieve the location of the macro name in the definition.
MacroDefinitionRecord * findMacroDefinition(const MacroInfo *MI)
Retrieve the macro definition that corresponds to the given MacroInfo.
void SetExternalSource(ExternalPreprocessingRecordSource &Source)
Set the external source for preprocessed entities.
A trivial tuple used to represent a source range.
This class handles loading and caching of source files into memory.
bool isInvalid() const
Returns true if there was a problem loading the preprocessed entity.
iterator local_begin()
Begin iterator for local, non-loaded, preprocessed entities.