clang  14.0.0git
PPCallbacks.h
Go to the documentation of this file.
1 //===--- PPCallbacks.h - Callbacks for Preprocessor actions -----*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// Defines the PPCallbacks interface.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_LEX_PPCALLBACKS_H
15 #define LLVM_CLANG_LEX_PPCALLBACKS_H
16 
20 #include "clang/Lex/ModuleLoader.h"
21 #include "clang/Lex/Pragma.h"
22 #include "llvm/ADT/StringRef.h"
23 
24 namespace clang {
25  class Token;
26  class IdentifierInfo;
27  class MacroDefinition;
28  class MacroDirective;
29  class MacroArgs;
30 
31 /// This interface provides a way to observe the actions of the
32 /// preprocessor as it does its thing.
33 ///
34 /// Clients can define their hooks here to implement preprocessor level tools.
35 class PPCallbacks {
36 public:
37  virtual ~PPCallbacks();
38 
41  };
42 
43  /// Callback invoked whenever a source file is entered or exited.
44  ///
45  /// \param Loc Indicates the new location.
46  /// \param PrevFID the file that was exited if \p Reason is ExitFile.
47  virtual void FileChanged(SourceLocation Loc, FileChangeReason Reason,
49  FileID PrevFID = FileID()) {
50  }
51 
52  /// Callback invoked whenever a source file is skipped as the result
53  /// of header guard optimization.
54  ///
55  /// \param SkippedFile The file that is skipped instead of entering \#include
56  ///
57  /// \param FilenameTok The file name token in \#include "FileName" directive
58  /// or macro expanded file name token from \#include MACRO(PARAMS) directive.
59  /// Note that FilenameTok contains corresponding quotes/angles symbols.
60  virtual void FileSkipped(const FileEntryRef &SkippedFile,
61  const Token &FilenameTok,
62  SrcMgr::CharacteristicKind FileType) {}
63 
64  /// Callback invoked whenever an inclusion directive results in a
65  /// file-not-found error.
66  ///
67  /// \param FileName The name of the file being included, as written in the
68  /// source code.
69  ///
70  /// \param RecoveryPath If this client indicates that it can recover from
71  /// this missing file, the client should set this as an additional header
72  /// search patch.
73  ///
74  /// \returns true to indicate that the preprocessor should attempt to recover
75  /// by adding \p RecoveryPath as a header search path.
76  virtual bool FileNotFound(StringRef FileName,
77  SmallVectorImpl<char> &RecoveryPath) {
78  return false;
79  }
80 
81  /// Callback invoked whenever an inclusion directive of
82  /// any kind (\c \#include, \c \#import, etc.) has been processed, regardless
83  /// of whether the inclusion will actually result in an inclusion.
84  ///
85  /// \param HashLoc The location of the '#' that starts the inclusion
86  /// directive.
87  ///
88  /// \param IncludeTok The token that indicates the kind of inclusion
89  /// directive, e.g., 'include' or 'import'.
90  ///
91  /// \param FileName The name of the file being included, as written in the
92  /// source code.
93  ///
94  /// \param IsAngled Whether the file name was enclosed in angle brackets;
95  /// otherwise, it was enclosed in quotes.
96  ///
97  /// \param FilenameRange The character range of the quotes or angle brackets
98  /// for the written file name.
99  ///
100  /// \param File The actual file that may be included by this inclusion
101  /// directive.
102  ///
103  /// \param SearchPath Contains the search path which was used to find the file
104  /// in the file system. If the file was found via an absolute include path,
105  /// SearchPath will be empty. For framework includes, the SearchPath and
106  /// RelativePath will be split up. For example, if an include of "Some/Some.h"
107  /// is found via the framework path
108  /// "path/to/Frameworks/Some.framework/Headers/Some.h", SearchPath will be
109  /// "path/to/Frameworks/Some.framework/Headers" and RelativePath will be
110  /// "Some.h".
111  ///
112  /// \param RelativePath The path relative to SearchPath, at which the include
113  /// file was found. This is equal to FileName except for framework includes.
114  ///
115  /// \param Imported The module, whenever an inclusion directive was
116  /// automatically turned into a module import or null otherwise.
117  ///
118  /// \param FileType The characteristic kind, indicates whether a file or
119  /// directory holds normal user code, system code, or system code which is
120  /// implicitly 'extern "C"' in C++ mode.
121  ///
122  virtual void InclusionDirective(SourceLocation HashLoc,
123  const Token &IncludeTok,
124  StringRef FileName,
125  bool IsAngled,
126  CharSourceRange FilenameRange,
127  const FileEntry *File,
128  StringRef SearchPath,
129  StringRef RelativePath,
130  const Module *Imported,
131  SrcMgr::CharacteristicKind FileType) {
132  }
133 
134  /// Callback invoked whenever a submodule was entered.
135  ///
136  /// \param M The submodule we have entered.
137  ///
138  /// \param ImportLoc The location of import directive token.
139  ///
140  /// \param ForPragma If entering from pragma directive.
141  ///
142  virtual void EnteredSubmodule(Module *M, SourceLocation ImportLoc,
143  bool ForPragma) { }
144 
145  /// Callback invoked whenever a submodule was left.
146  ///
147  /// \param M The submodule we have left.
148  ///
149  /// \param ImportLoc The location of import directive token.
150  ///
151  /// \param ForPragma If entering from pragma directive.
152  ///
153  virtual void LeftSubmodule(Module *M, SourceLocation ImportLoc,
154  bool ForPragma) { }
155 
156  /// Callback invoked whenever there was an explicit module-import
157  /// syntax.
158  ///
159  /// \param ImportLoc The location of import directive token.
160  ///
161  /// \param Path The identifiers (and their locations) of the module
162  /// "path", e.g., "std.vector" would be split into "std" and "vector".
163  ///
164  /// \param Imported The imported module; can be null if importing failed.
165  ///
166  virtual void moduleImport(SourceLocation ImportLoc,
167  ModuleIdPath Path,
168  const Module *Imported) {
169  }
170 
171  /// Callback invoked when the end of the main file is reached.
172  ///
173  /// No subsequent callbacks will be made.
174  virtual void EndOfMainFile() {
175  }
176 
177  /// Callback invoked when a \#ident or \#sccs directive is read.
178  /// \param Loc The location of the directive.
179  /// \param str The text of the directive.
180  ///
181  virtual void Ident(SourceLocation Loc, StringRef str) {
182  }
183 
184  /// Callback invoked when start reading any pragma directive.
185  virtual void PragmaDirective(SourceLocation Loc,
186  PragmaIntroducerKind Introducer) {
187  }
188 
189  /// Callback invoked when a \#pragma comment directive is read.
191  StringRef Str) {
192  }
193 
194  /// Callback invoked when a \#pragma mark comment is read.
195  virtual void PragmaMark(SourceLocation Loc, StringRef Trivia) {
196  }
197 
198  /// Callback invoked when a \#pragma detect_mismatch directive is
199  /// read.
200  virtual void PragmaDetectMismatch(SourceLocation Loc, StringRef Name,
201  StringRef Value) {
202  }
203 
204  /// Callback invoked when a \#pragma clang __debug directive is read.
205  /// \param Loc The location of the debug directive.
206  /// \param DebugType The identifier following __debug.
207  virtual void PragmaDebug(SourceLocation Loc, StringRef DebugType) {
208  }
209 
210  /// Determines the kind of \#pragma invoking a call to PragmaMessage.
212  /// \#pragma message has been invoked.
214 
215  /// \#pragma GCC warning has been invoked.
217 
218  /// \#pragma GCC error has been invoked.
220  };
221 
222  /// Callback invoked when a \#pragma message directive is read.
223  /// \param Loc The location of the message directive.
224  /// \param Namespace The namespace of the message directive.
225  /// \param Kind The type of the message directive.
226  /// \param Str The text of the message directive.
227  virtual void PragmaMessage(SourceLocation Loc, StringRef Namespace,
228  PragmaMessageKind Kind, StringRef Str) {
229  }
230 
231  /// Callback invoked when a \#pragma gcc diagnostic push directive
232  /// is read.
234  StringRef Namespace) {
235  }
236 
237  /// Callback invoked when a \#pragma gcc diagnostic pop directive
238  /// is read.
240  StringRef Namespace) {
241  }
242 
243  /// Callback invoked when a \#pragma gcc diagnostic directive is read.
244  virtual void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace,
245  diag::Severity mapping, StringRef Str) {}
246 
247  /// Called when an OpenCL extension is either disabled or
248  /// enabled with a pragma.
249  virtual void PragmaOpenCLExtension(SourceLocation NameLoc,
250  const IdentifierInfo *Name,
251  SourceLocation StateLoc, unsigned State) {
252  }
253 
254  /// Callback invoked when a \#pragma warning directive is read.
265  };
266  virtual void PragmaWarning(SourceLocation Loc,
267  PragmaWarningSpecifier WarningSpec,
268  ArrayRef<int> Ids) {}
269 
270  /// Callback invoked when a \#pragma warning(push) directive is read.
271  virtual void PragmaWarningPush(SourceLocation Loc, int Level) {
272  }
273 
274  /// Callback invoked when a \#pragma warning(pop) directive is read.
275  virtual void PragmaWarningPop(SourceLocation Loc) {
276  }
277 
278  /// Callback invoked when a \#pragma execution_character_set(push) directive
279  /// is read.
280  virtual void PragmaExecCharsetPush(SourceLocation Loc, StringRef Str) {}
281 
282  /// Callback invoked when a \#pragma execution_character_set(pop) directive
283  /// is read.
285 
286  /// Callback invoked when a \#pragma clang assume_nonnull begin directive
287  /// is read.
289 
290  /// Callback invoked when a \#pragma clang assume_nonnull end directive
291  /// is read.
293 
294  /// Called by Preprocessor::HandleMacroExpandedIdentifier when a
295  /// macro invocation is found.
296  virtual void MacroExpands(const Token &MacroNameTok,
297  const MacroDefinition &MD, SourceRange Range,
298  const MacroArgs *Args) {}
299 
300  /// Hook called whenever a macro definition is seen.
301  virtual void MacroDefined(const Token &MacroNameTok,
302  const MacroDirective *MD) {
303  }
304 
305  /// Hook called whenever a macro \#undef is seen.
306  /// \param MacroNameTok The active Token
307  /// \param MD A MacroDefinition for the named macro.
308  /// \param Undef New MacroDirective if the macro was defined, null otherwise.
309  ///
310  /// MD is released immediately following this callback.
311  virtual void MacroUndefined(const Token &MacroNameTok,
312  const MacroDefinition &MD,
313  const MacroDirective *Undef) {
314  }
315 
316  /// Hook called whenever the 'defined' operator is seen.
317  /// \param MD The MacroDirective if the name was a macro, null otherwise.
318  virtual void Defined(const Token &MacroNameTok, const MacroDefinition &MD,
319  SourceRange Range) {
320  }
321 
322  /// Hook called when a '__has_include' or '__has_include_next' directive is
323  /// read.
324  virtual void HasInclude(SourceLocation Loc, StringRef FileName, bool IsAngled,
326  SrcMgr::CharacteristicKind FileType);
327 
328  /// Hook called when a source range is skipped.
329  /// \param Range The SourceRange that was skipped. The range begins at the
330  /// \#if/\#else directive and ends after the \#endif/\#else directive.
331  /// \param EndifLoc The end location of the 'endif' token, which may precede
332  /// the range skipped by the directive (e.g excluding comments after an
333  /// 'endif').
334  virtual void SourceRangeSkipped(SourceRange Range, SourceLocation EndifLoc) {
335  }
336 
339  };
340 
341  /// Hook called whenever an \#if is seen.
342  /// \param Loc the source location of the directive.
343  /// \param ConditionRange The SourceRange of the expression being tested.
344  /// \param ConditionValue The evaluated value of the condition.
345  ///
346  // FIXME: better to pass in a list (or tree!) of Tokens.
347  virtual void If(SourceLocation Loc, SourceRange ConditionRange,
348  ConditionValueKind ConditionValue) {
349  }
350 
351  /// Hook called whenever an \#elif is seen.
352  /// \param Loc the source location of the directive.
353  /// \param ConditionRange The SourceRange of the expression being tested.
354  /// \param ConditionValue The evaluated value of the condition.
355  /// \param IfLoc the source location of the \#if/\#ifdef/\#ifndef directive.
356  // FIXME: better to pass in a list (or tree!) of Tokens.
357  virtual void Elif(SourceLocation Loc, SourceRange ConditionRange,
358  ConditionValueKind ConditionValue, SourceLocation IfLoc) {
359  }
360 
361  /// Hook called whenever an \#ifdef is seen.
362  /// \param Loc the source location of the directive.
363  /// \param MacroNameTok Information on the token being tested.
364  /// \param MD The MacroDefinition if the name was a macro, null otherwise.
365  virtual void Ifdef(SourceLocation Loc, const Token &MacroNameTok,
366  const MacroDefinition &MD) {
367  }
368 
369  /// Hook called whenever an \#elifdef branch is taken.
370  /// \param Loc the source location of the directive.
371  /// \param MacroNameTok Information on the token being tested.
372  /// \param MD The MacroDefinition if the name was a macro, null otherwise.
373  virtual void Elifdef(SourceLocation Loc, const Token &MacroNameTok,
374  const MacroDefinition &MD) {
375  }
376  /// Hook called whenever an \#elifdef is skipped.
377  /// \param Loc the source location of the directive.
378  /// \param ConditionRange The SourceRange of the expression being tested.
379  /// \param IfLoc the source location of the \#if/\#ifdef/\#ifndef directive.
380  // FIXME: better to pass in a list (or tree!) of Tokens.
381  virtual void Elifdef(SourceLocation Loc, SourceRange ConditionRange,
382  SourceLocation IfLoc) {
383  }
384 
385  /// Hook called whenever an \#ifndef is seen.
386  /// \param Loc the source location of the directive.
387  /// \param MacroNameTok Information on the token being tested.
388  /// \param MD The MacroDefiniton if the name was a macro, null otherwise.
389  virtual void Ifndef(SourceLocation Loc, const Token &MacroNameTok,
390  const MacroDefinition &MD) {
391  }
392 
393  /// Hook called whenever an \#elifndef branch is taken.
394  /// \param Loc the source location of the directive.
395  /// \param MacroNameTok Information on the token being tested.
396  /// \param MD The MacroDefinition if the name was a macro, null otherwise.
397  virtual void Elifndef(SourceLocation Loc, const Token &MacroNameTok,
398  const MacroDefinition &MD) {
399  }
400  /// Hook called whenever an \#elifndef is skipped.
401  /// \param Loc the source location of the directive.
402  /// \param ConditionRange The SourceRange of the expression being tested.
403  /// \param IfLoc the source location of the \#if/\#ifdef/\#ifndef directive.
404  // FIXME: better to pass in a list (or tree!) of Tokens.
405  virtual void Elifndef(SourceLocation Loc, SourceRange ConditionRange,
406  SourceLocation IfLoc) {
407  }
408 
409  /// Hook called whenever an \#else is seen.
410  /// \param Loc the source location of the directive.
411  /// \param IfLoc the source location of the \#if/\#ifdef/\#ifndef directive.
412  virtual void Else(SourceLocation Loc, SourceLocation IfLoc) {
413  }
414 
415  /// Hook called whenever an \#endif is seen.
416  /// \param Loc the source location of the directive.
417  /// \param IfLoc the source location of the \#if/\#ifdef/\#ifndef directive.
418  virtual void Endif(SourceLocation Loc, SourceLocation IfLoc) {
419  }
420 };
421 
422 /// Simple wrapper class for chaining callbacks.
424  std::unique_ptr<PPCallbacks> First, Second;
425 
426 public:
427  PPChainedCallbacks(std::unique_ptr<PPCallbacks> _First,
428  std::unique_ptr<PPCallbacks> _Second)
429  : First(std::move(_First)), Second(std::move(_Second)) {}
430 
431  ~PPChainedCallbacks() override;
432 
435  FileID PrevFID) override {
436  First->FileChanged(Loc, Reason, FileType, PrevFID);
437  Second->FileChanged(Loc, Reason, FileType, PrevFID);
438  }
439 
440  void FileSkipped(const FileEntryRef &SkippedFile, const Token &FilenameTok,
441  SrcMgr::CharacteristicKind FileType) override {
442  First->FileSkipped(SkippedFile, FilenameTok, FileType);
443  Second->FileSkipped(SkippedFile, FilenameTok, FileType);
444  }
445 
446  bool FileNotFound(StringRef FileName,
447  SmallVectorImpl<char> &RecoveryPath) override {
448  return First->FileNotFound(FileName, RecoveryPath) ||
449  Second->FileNotFound(FileName, RecoveryPath);
450  }
451 
452  void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok,
453  StringRef FileName, bool IsAngled,
454  CharSourceRange FilenameRange, const FileEntry *File,
455  StringRef SearchPath, StringRef RelativePath,
456  const Module *Imported,
457  SrcMgr::CharacteristicKind FileType) override {
458  First->InclusionDirective(HashLoc, IncludeTok, FileName, IsAngled,
459  FilenameRange, File, SearchPath, RelativePath,
460  Imported, FileType);
461  Second->InclusionDirective(HashLoc, IncludeTok, FileName, IsAngled,
462  FilenameRange, File, SearchPath, RelativePath,
463  Imported, FileType);
464  }
465 
467  bool ForPragma) override {
468  First->EnteredSubmodule(M, ImportLoc, ForPragma);
469  Second->EnteredSubmodule(M, ImportLoc, ForPragma);
470  }
471 
472  void LeftSubmodule(Module *M, SourceLocation ImportLoc,
473  bool ForPragma) override {
474  First->LeftSubmodule(M, ImportLoc, ForPragma);
475  Second->LeftSubmodule(M, ImportLoc, ForPragma);
476  }
477 
479  const Module *Imported) override {
480  First->moduleImport(ImportLoc, Path, Imported);
481  Second->moduleImport(ImportLoc, Path, Imported);
482  }
483 
484  void EndOfMainFile() override {
485  First->EndOfMainFile();
486  Second->EndOfMainFile();
487  }
488 
489  void Ident(SourceLocation Loc, StringRef str) override {
490  First->Ident(Loc, str);
491  Second->Ident(Loc, str);
492  }
493 
495  PragmaIntroducerKind Introducer) override {
496  First->PragmaDirective(Loc, Introducer);
497  Second->PragmaDirective(Loc, Introducer);
498  }
499 
501  StringRef Str) override {
502  First->PragmaComment(Loc, Kind, Str);
503  Second->PragmaComment(Loc, Kind, Str);
504  }
505 
506  void PragmaMark(SourceLocation Loc, StringRef Trivia) override {
507  First->PragmaMark(Loc, Trivia);
508  Second->PragmaMark(Loc, Trivia);
509  }
510 
511  void PragmaDetectMismatch(SourceLocation Loc, StringRef Name,
512  StringRef Value) override {
513  First->PragmaDetectMismatch(Loc, Name, Value);
514  Second->PragmaDetectMismatch(Loc, Name, Value);
515  }
516 
517  void PragmaDebug(SourceLocation Loc, StringRef DebugType) override {
518  First->PragmaDebug(Loc, DebugType);
519  Second->PragmaDebug(Loc, DebugType);
520  }
521 
522  void PragmaMessage(SourceLocation Loc, StringRef Namespace,
523  PragmaMessageKind Kind, StringRef Str) override {
524  First->PragmaMessage(Loc, Namespace, Kind, Str);
525  Second->PragmaMessage(Loc, Namespace, Kind, Str);
526  }
527 
528  void PragmaDiagnosticPush(SourceLocation Loc, StringRef Namespace) override {
529  First->PragmaDiagnosticPush(Loc, Namespace);
530  Second->PragmaDiagnosticPush(Loc, Namespace);
531  }
532 
533  void PragmaDiagnosticPop(SourceLocation Loc, StringRef Namespace) override {
534  First->PragmaDiagnosticPop(Loc, Namespace);
535  Second->PragmaDiagnosticPop(Loc, Namespace);
536  }
537 
538  void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace,
539  diag::Severity mapping, StringRef Str) override {
540  First->PragmaDiagnostic(Loc, Namespace, mapping, Str);
541  Second->PragmaDiagnostic(Loc, Namespace, mapping, Str);
542  }
543 
544  void HasInclude(SourceLocation Loc, StringRef FileName, bool IsAngled,
546  SrcMgr::CharacteristicKind FileType) override;
547 
549  SourceLocation StateLoc, unsigned State) override {
550  First->PragmaOpenCLExtension(NameLoc, Name, StateLoc, State);
551  Second->PragmaOpenCLExtension(NameLoc, Name, StateLoc, State);
552  }
553 
555  ArrayRef<int> Ids) override {
556  First->PragmaWarning(Loc, WarningSpec, Ids);
557  Second->PragmaWarning(Loc, WarningSpec, Ids);
558  }
559 
560  void PragmaWarningPush(SourceLocation Loc, int Level) override {
561  First->PragmaWarningPush(Loc, Level);
562  Second->PragmaWarningPush(Loc, Level);
563  }
564 
565  void PragmaWarningPop(SourceLocation Loc) override {
566  First->PragmaWarningPop(Loc);
567  Second->PragmaWarningPop(Loc);
568  }
569 
570  void PragmaExecCharsetPush(SourceLocation Loc, StringRef Str) override {
571  First->PragmaExecCharsetPush(Loc, Str);
572  Second->PragmaExecCharsetPush(Loc, Str);
573  }
574 
576  First->PragmaExecCharsetPop(Loc);
577  Second->PragmaExecCharsetPop(Loc);
578  }
579 
581  First->PragmaAssumeNonNullBegin(Loc);
582  Second->PragmaAssumeNonNullBegin(Loc);
583  }
584 
586  First->PragmaAssumeNonNullEnd(Loc);
587  Second->PragmaAssumeNonNullEnd(Loc);
588  }
589 
590  void MacroExpands(const Token &MacroNameTok, const MacroDefinition &MD,
591  SourceRange Range, const MacroArgs *Args) override {
592  First->MacroExpands(MacroNameTok, MD, Range, Args);
593  Second->MacroExpands(MacroNameTok, MD, Range, Args);
594  }
595 
596  void MacroDefined(const Token &MacroNameTok,
597  const MacroDirective *MD) override {
598  First->MacroDefined(MacroNameTok, MD);
599  Second->MacroDefined(MacroNameTok, MD);
600  }
601 
602  void MacroUndefined(const Token &MacroNameTok,
603  const MacroDefinition &MD,
604  const MacroDirective *Undef) override {
605  First->MacroUndefined(MacroNameTok, MD, Undef);
606  Second->MacroUndefined(MacroNameTok, MD, Undef);
607  }
608 
609  void Defined(const Token &MacroNameTok, const MacroDefinition &MD,
610  SourceRange Range) override {
611  First->Defined(MacroNameTok, MD, Range);
612  Second->Defined(MacroNameTok, MD, Range);
613  }
614 
615  void SourceRangeSkipped(SourceRange Range, SourceLocation EndifLoc) override {
616  First->SourceRangeSkipped(Range, EndifLoc);
617  Second->SourceRangeSkipped(Range, EndifLoc);
618  }
619 
620  /// Hook called whenever an \#if is seen.
621  void If(SourceLocation Loc, SourceRange ConditionRange,
622  ConditionValueKind ConditionValue) override {
623  First->If(Loc, ConditionRange, ConditionValue);
624  Second->If(Loc, ConditionRange, ConditionValue);
625  }
626 
627  /// Hook called whenever an \#elif is seen.
628  void Elif(SourceLocation Loc, SourceRange ConditionRange,
629  ConditionValueKind ConditionValue, SourceLocation IfLoc) override {
630  First->Elif(Loc, ConditionRange, ConditionValue, IfLoc);
631  Second->Elif(Loc, ConditionRange, ConditionValue, IfLoc);
632  }
633 
634  /// Hook called whenever an \#ifdef is seen.
635  void Ifdef(SourceLocation Loc, const Token &MacroNameTok,
636  const MacroDefinition &MD) override {
637  First->Ifdef(Loc, MacroNameTok, MD);
638  Second->Ifdef(Loc, MacroNameTok, MD);
639  }
640 
641  /// Hook called whenever an \#elifdef is taken.
642  void Elifdef(SourceLocation Loc, const Token &MacroNameTok,
643  const MacroDefinition &MD) override {
644  First->Elifdef(Loc, MacroNameTok, MD);
645  Second->Elifdef(Loc, MacroNameTok, MD);
646  }
647  /// Hook called whenever an \#elifdef is skipped.
648  void Elifdef(SourceLocation Loc, SourceRange ConditionRange,
649  SourceLocation IfLoc) override {
650  First->Elifdef(Loc, ConditionRange, IfLoc);
651  Second->Elifdef(Loc, ConditionRange, IfLoc);
652  }
653 
654  /// Hook called whenever an \#ifndef is seen.
655  void Ifndef(SourceLocation Loc, const Token &MacroNameTok,
656  const MacroDefinition &MD) override {
657  First->Ifndef(Loc, MacroNameTok, MD);
658  Second->Ifndef(Loc, MacroNameTok, MD);
659  }
660 
661  /// Hook called whenever an \#elifndef is taken.
662  void Elifndef(SourceLocation Loc, const Token &MacroNameTok,
663  const MacroDefinition &MD) override {
664  First->Elifndef(Loc, MacroNameTok, MD);
665  Second->Elifndef(Loc, MacroNameTok, MD);
666  }
667  /// Hook called whenever an \#elifndef is skipped.
668  void Elifndef(SourceLocation Loc, SourceRange ConditionRange,
669  SourceLocation IfLoc) override {
670  First->Elifndef(Loc, ConditionRange, IfLoc);
671  Second->Elifndef(Loc, ConditionRange, IfLoc);
672  }
673 
674  /// Hook called whenever an \#else is seen.
675  void Else(SourceLocation Loc, SourceLocation IfLoc) override {
676  First->Else(Loc, IfLoc);
677  Second->Else(Loc, IfLoc);
678  }
679 
680  /// Hook called whenever an \#endif is seen.
681  void Endif(SourceLocation Loc, SourceLocation IfLoc) override {
682  First->Endif(Loc, IfLoc);
683  Second->Endif(Loc, IfLoc);
684  }
685 };
686 
687 } // end namespace clang
688 
689 #endif
clang::PPCallbacks::PWS_Once
@ PWS_Once
Definition: PPCallbacks.h:259
clang::PPCallbacks::CVK_True
@ CVK_True
Definition: PPCallbacks.h:338
clang::PPCallbacks::~PPCallbacks
virtual ~PPCallbacks()
clang::diag::Severity
Severity
Enum values that allow the client to map NOTEs, WARNINGs, and EXTENSIONs to either Ignore (nothing),...
Definition: DiagnosticIDs.h:82
clang::PPChainedCallbacks::PragmaDirective
void PragmaDirective(SourceLocation Loc, PragmaIntroducerKind Introducer) override
Callback invoked when start reading any pragma directive.
Definition: PPCallbacks.h:494
clang::PPCallbacks::FileSkipped
virtual void FileSkipped(const FileEntryRef &SkippedFile, const Token &FilenameTok, SrcMgr::CharacteristicKind FileType)
Callback invoked whenever a source file is skipped as the result of header guard optimization.
Definition: PPCallbacks.h:60
clang::PPCallbacks::PragmaAssumeNonNullBegin
virtual void PragmaAssumeNonNullBegin(SourceLocation Loc)
Callback invoked when a #pragma clang assume_nonnull begin directive is read.
Definition: PPCallbacks.h:288
clang::PPCallbacks::PragmaDebug
virtual void PragmaDebug(SourceLocation Loc, StringRef DebugType)
Callback invoked when a #pragma clang __debug directive is read.
Definition: PPCallbacks.h:207
clang::PragmaIntroducerKind
PragmaIntroducerKind
Describes how the pragma was introduced, e.g., with #pragma, _Pragma, or __pragma.
Definition: Pragma.h:32
clang::FileEntryRef
A reference to a FileEntry that includes the name of the file as it was accessed by the FileManager's...
Definition: FileEntry.h:60
clang::PPChainedCallbacks::EnteredSubmodule
void EnteredSubmodule(Module *M, SourceLocation ImportLoc, bool ForPragma) override
Callback invoked whenever a submodule was entered.
Definition: PPCallbacks.h:466
clang::PPCallbacks::SourceRangeSkipped
virtual void SourceRangeSkipped(SourceRange Range, SourceLocation EndifLoc)
Hook called when a source range is skipped.
Definition: PPCallbacks.h:334
clang::DeclaratorContext::File
@ File
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:210
clang::PPCallbacks::PragmaAssumeNonNullEnd
virtual void PragmaAssumeNonNullEnd(SourceLocation Loc)
Callback invoked when a #pragma clang assume_nonnull end directive is read.
Definition: PPCallbacks.h:292
clang::PPCallbacks::Ident
virtual void Ident(SourceLocation Loc, StringRef str)
Callback invoked when a #ident or #sccs directive is read.
Definition: PPCallbacks.h:181
clang::PPCallbacks::If
virtual void If(SourceLocation Loc, SourceRange ConditionRange, ConditionValueKind ConditionValue)
Hook called whenever an #if is seen.
Definition: PPCallbacks.h:347
clang::PPCallbacks::PWS_Disable
@ PWS_Disable
Definition: PPCallbacks.h:257
clang::PPChainedCallbacks::Elif
void Elif(SourceLocation Loc, SourceRange ConditionRange, ConditionValueKind ConditionValue, SourceLocation IfLoc) override
Hook called whenever an #elif is seen.
Definition: PPCallbacks.h:628
clang::PPChainedCallbacks::If
void If(SourceLocation Loc, SourceRange ConditionRange, ConditionValueKind ConditionValue) override
Hook called whenever an #if is seen.
Definition: PPCallbacks.h:621
clang::MacroDefinition
A description of the current definition of a macro.
Definition: MacroInfo.h:564
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::PPChainedCallbacks::HasInclude
void HasInclude(SourceLocation Loc, StringRef FileName, bool IsAngled, Optional< FileEntryRef > File, SrcMgr::CharacteristicKind FileType) override
Hook called when a '__has_include' or '__has_include_next' directive is read.
Definition: PPCallbacks.cpp:24
clang::PPCallbacks::PMK_Error
@ PMK_Error
#pragma GCC error has been invoked.
Definition: PPCallbacks.h:219
clang::PPCallbacks
This interface provides a way to observe the actions of the preprocessor as it does its thing.
Definition: PPCallbacks.h:35
clang::PPCallbacks::EnteredSubmodule
virtual void EnteredSubmodule(Module *M, SourceLocation ImportLoc, bool ForPragma)
Callback invoked whenever a submodule was entered.
Definition: PPCallbacks.h:142
clang::PPCallbacks::LeftSubmodule
virtual void LeftSubmodule(Module *M, SourceLocation ImportLoc, bool ForPragma)
Callback invoked whenever a submodule was left.
Definition: PPCallbacks.h:153
clang::PPCallbacks::MacroUndefined
virtual void MacroUndefined(const Token &MacroNameTok, const MacroDefinition &MD, const MacroDirective *Undef)
Hook called whenever a macro #undef is seen.
Definition: PPCallbacks.h:311
clang::PPCallbacks::PragmaComment
virtual void PragmaComment(SourceLocation Loc, const IdentifierInfo *Kind, StringRef Str)
Callback invoked when a #pragma comment directive is read.
Definition: PPCallbacks.h:190
clang::MacroArgs
MacroArgs - An instance of this class captures information about the formal arguments specified to a ...
Definition: MacroArgs.h:29
clang::PPChainedCallbacks::PragmaDiagnosticPop
void PragmaDiagnosticPop(SourceLocation Loc, StringRef Namespace) override
Callback invoked when a #pragma gcc diagnostic pop directive is read.
Definition: PPCallbacks.h:533
clang::PPCallbacks::PragmaDetectMismatch
virtual void PragmaDetectMismatch(SourceLocation Loc, StringRef Name, StringRef Value)
Callback invoked when a #pragma detect_mismatch directive is read.
Definition: PPCallbacks.h:200
clang::PPCallbacks::EnterFile
@ EnterFile
Definition: PPCallbacks.h:40
llvm::Optional< FileEntryRef >
clang::ComparisonCategoryType::First
@ First
clang::PPCallbacks::PragmaDiagnosticPush
virtual void PragmaDiagnosticPush(SourceLocation Loc, StringRef Namespace)
Callback invoked when a #pragma gcc diagnostic push directive is read.
Definition: PPCallbacks.h:233
clang::PPChainedCallbacks::Elifndef
void Elifndef(SourceLocation Loc, const Token &MacroNameTok, const MacroDefinition &MD) override
Hook called whenever an #elifndef is taken.
Definition: PPCallbacks.h:662
SourceManager.h
clang::PPChainedCallbacks::PragmaMark
void PragmaMark(SourceLocation Loc, StringRef Trivia) override
Callback invoked when a #pragma mark comment is read.
Definition: PPCallbacks.h:506
clang::SrcMgr::CharacteristicKind
CharacteristicKind
Indicates whether a file or directory holds normal user code, system code, or system code which is im...
Definition: SourceManager.h:78
clang::PPChainedCallbacks::PPChainedCallbacks
PPChainedCallbacks(std::unique_ptr< PPCallbacks > _First, std::unique_ptr< PPCallbacks > _Second)
Definition: PPCallbacks.h:427
clang::PPCallbacks::PWS_Suppress
@ PWS_Suppress
Definition: PPCallbacks.h:260
DiagnosticIDs.h
clang::PPCallbacks::Ifndef
virtual void Ifndef(SourceLocation Loc, const Token &MacroNameTok, const MacroDefinition &MD)
Hook called whenever an #ifndef is seen.
Definition: PPCallbacks.h:389
clang::PPChainedCallbacks::PragmaAssumeNonNullBegin
void PragmaAssumeNonNullBegin(SourceLocation Loc) override
Callback invoked when a #pragma clang assume_nonnull begin directive is read.
Definition: PPCallbacks.h:580
clang::Token
Token - This structure provides full information about a lexed token.
Definition: Token.h:34
clang::PPChainedCallbacks::EndOfMainFile
void EndOfMainFile() override
Callback invoked when the end of the main file is reached.
Definition: PPCallbacks.h:484
clang::PPChainedCallbacks::FileSkipped
void FileSkipped(const FileEntryRef &SkippedFile, const Token &FilenameTok, SrcMgr::CharacteristicKind FileType) override
Callback invoked whenever a source file is skipped as the result of header guard optimization.
Definition: PPCallbacks.h:440
clang::PPCallbacks::CVK_False
@ CVK_False
Definition: PPCallbacks.h:338
clang::PPCallbacks::MacroExpands
virtual void MacroExpands(const Token &MacroNameTok, const MacroDefinition &MD, SourceRange Range, const MacroArgs *Args)
Called by Preprocessor::HandleMacroExpandedIdentifier when a macro invocation is found.
Definition: PPCallbacks.h:296
clang::Module
Describes a module or submodule.
Definition: Module.h:96
clang::PPChainedCallbacks::PragmaWarningPop
void PragmaWarningPop(SourceLocation Loc) override
Callback invoked when a #pragma warning(pop) directive is read.
Definition: PPCallbacks.h:565
clang::PPChainedCallbacks::Endif
void Endif(SourceLocation Loc, SourceLocation IfLoc) override
Hook called whenever an #endif is seen.
Definition: PPCallbacks.h:681
clang::PPCallbacks::PragmaDirective
virtual void PragmaDirective(SourceLocation Loc, PragmaIntroducerKind Introducer)
Callback invoked when start reading any pragma directive.
Definition: PPCallbacks.h:185
clang::PPChainedCallbacks::Ifdef
void Ifdef(SourceLocation Loc, const Token &MacroNameTok, const MacroDefinition &MD) override
Hook called whenever an #ifdef is seen.
Definition: PPCallbacks.h:635
Pragma.h
clang::PPChainedCallbacks::MacroDefined
void MacroDefined(const Token &MacroNameTok, const MacroDirective *MD) override
Hook called whenever a macro definition is seen.
Definition: PPCallbacks.h:596
clang::PPChainedCallbacks::PragmaExecCharsetPush
void PragmaExecCharsetPush(SourceLocation Loc, StringRef Str) override
Callback invoked when a #pragma execution_character_set(push) directive is read.
Definition: PPCallbacks.h:570
clang::PPChainedCallbacks::PragmaOpenCLExtension
void PragmaOpenCLExtension(SourceLocation NameLoc, const IdentifierInfo *Name, SourceLocation StateLoc, unsigned State) override
Called when an OpenCL extension is either disabled or enabled with a pragma.
Definition: PPCallbacks.h:548
clang::PPCallbacks::Elifdef
virtual void Elifdef(SourceLocation Loc, const Token &MacroNameTok, const MacroDefinition &MD)
Hook called whenever an #elifdef branch is taken.
Definition: PPCallbacks.h:373
clang::PPCallbacks::PragmaExecCharsetPush
virtual void PragmaExecCharsetPush(SourceLocation Loc, StringRef Str)
Callback invoked when a #pragma execution_character_set(push) directive is read.
Definition: PPCallbacks.h:280
clang::PPCallbacks::PragmaWarning
virtual void PragmaWarning(SourceLocation Loc, PragmaWarningSpecifier WarningSpec, ArrayRef< int > Ids)
Definition: PPCallbacks.h:266
clang::PPCallbacks::Elif
virtual void Elif(SourceLocation Loc, SourceRange ConditionRange, ConditionValueKind ConditionValue, SourceLocation IfLoc)
Hook called whenever an #elif is seen.
Definition: PPCallbacks.h:357
clang::PPCallbacks::PragmaMessage
virtual void PragmaMessage(SourceLocation Loc, StringRef Namespace, PragmaMessageKind Kind, StringRef Str)
Callback invoked when a #pragma message directive is read.
Definition: PPCallbacks.h:227
clang::PPChainedCallbacks::Else
void Else(SourceLocation Loc, SourceLocation IfLoc) override
Hook called whenever an #else is seen.
Definition: PPCallbacks.h:675
ModuleLoader.h
clang::PPChainedCallbacks::FileChanged
void FileChanged(SourceLocation Loc, FileChangeReason Reason, SrcMgr::CharacteristicKind FileType, FileID PrevFID) override
Callback invoked whenever a source file is entered or exited.
Definition: PPCallbacks.h:433
clang::PPCallbacks::RenameFile
@ RenameFile
Definition: PPCallbacks.h:40
clang::PPChainedCallbacks::PragmaAssumeNonNullEnd
void PragmaAssumeNonNullEnd(SourceLocation Loc) override
Callback invoked when a #pragma clang assume_nonnull end directive is read.
Definition: PPCallbacks.h:585
clang::PPCallbacks::Elifndef
virtual void Elifndef(SourceLocation Loc, const Token &MacroNameTok, const MacroDefinition &MD)
Hook called whenever an #elifndef branch is taken.
Definition: PPCallbacks.h:397
clang::PPCallbacks::InclusionDirective
virtual void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, const FileEntry *File, StringRef SearchPath, StringRef RelativePath, const Module *Imported, SrcMgr::CharacteristicKind FileType)
Callback invoked whenever an inclusion directive of any kind (#include, #import, etc....
Definition: PPCallbacks.h:122
clang::PPChainedCallbacks::PragmaDiagnosticPush
void PragmaDiagnosticPush(SourceLocation Loc, StringRef Namespace) override
Callback invoked when a #pragma gcc diagnostic push directive is read.
Definition: PPCallbacks.h:528
clang::PPCallbacks::ConditionValueKind
ConditionValueKind
Definition: PPCallbacks.h:337
clang::PPChainedCallbacks::PragmaWarning
void PragmaWarning(SourceLocation Loc, PragmaWarningSpecifier WarningSpec, ArrayRef< int > Ids) override
Definition: PPCallbacks.h:554
clang::PPChainedCallbacks::Ifndef
void Ifndef(SourceLocation Loc, const Token &MacroNameTok, const MacroDefinition &MD) override
Hook called whenever an #ifndef is seen.
Definition: PPCallbacks.h:655
clang::PPCallbacks::FileNotFound
virtual bool FileNotFound(StringRef FileName, SmallVectorImpl< char > &RecoveryPath)
Callback invoked whenever an inclusion directive results in a file-not-found error.
Definition: PPCallbacks.h:76
clang::PPCallbacks::PMK_Warning
@ PMK_Warning
#pragma GCC warning has been invoked.
Definition: PPCallbacks.h:216
clang::PPChainedCallbacks
Simple wrapper class for chaining callbacks.
Definition: PPCallbacks.h:423
clang::PPChainedCallbacks::LeftSubmodule
void LeftSubmodule(Module *M, SourceLocation ImportLoc, bool ForPragma) override
Callback invoked whenever a submodule was left.
Definition: PPCallbacks.h:472
clang::PPCallbacks::Else
virtual void Else(SourceLocation Loc, SourceLocation IfLoc)
Hook called whenever an #else is seen.
Definition: PPCallbacks.h:412
clang::PPCallbacks::PMK_Message
@ PMK_Message
#pragma message has been invoked.
Definition: PPCallbacks.h:213
clang::PPCallbacks::Elifdef
virtual void Elifdef(SourceLocation Loc, SourceRange ConditionRange, SourceLocation IfLoc)
Hook called whenever an #elifdef is skipped.
Definition: PPCallbacks.h:381
clang::PPChainedCallbacks::FileNotFound
bool FileNotFound(StringRef FileName, SmallVectorImpl< char > &RecoveryPath) override
Callback invoked whenever an inclusion directive results in a file-not-found error.
Definition: PPCallbacks.h:446
clang::FileEntry
Cached information about one file (either on disk or in the virtual file system).
Definition: FileEntry.h:331
clang::PPChainedCallbacks::PragmaWarningPush
void PragmaWarningPush(SourceLocation Loc, int Level) override
Callback invoked when a #pragma warning(push) directive is read.
Definition: PPCallbacks.h:560
clang::PPChainedCallbacks::MacroExpands
void MacroExpands(const Token &MacroNameTok, const MacroDefinition &MD, SourceRange Range, const MacroArgs *Args) override
Called by Preprocessor::HandleMacroExpandedIdentifier when a macro invocation is found.
Definition: PPCallbacks.h:590
clang::PPChainedCallbacks::InclusionDirective
void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, const FileEntry *File, StringRef SearchPath, StringRef RelativePath, const Module *Imported, SrcMgr::CharacteristicKind FileType) override
Callback invoked whenever an inclusion directive of any kind (#include, #import, etc....
Definition: PPCallbacks.h:452
clang::PPCallbacks::PWS_Level1
@ PWS_Level1
Definition: PPCallbacks.h:261
clang::PPCallbacks::Endif
virtual void Endif(SourceLocation Loc, SourceLocation IfLoc)
Hook called whenever an #endif is seen.
Definition: PPCallbacks.h:418
clang::PPCallbacks::ExitFile
@ ExitFile
Definition: PPCallbacks.h:40
SourceLocation.h
clang::PPCallbacks::FileChangeReason
FileChangeReason
Definition: PPCallbacks.h:39
clang::PPChainedCallbacks::MacroUndefined
void MacroUndefined(const Token &MacroNameTok, const MacroDefinition &MD, const MacroDirective *Undef) override
Hook called whenever a macro #undef is seen.
Definition: PPCallbacks.h:602
clang::PPCallbacks::SystemHeaderPragma
@ SystemHeaderPragma
Definition: PPCallbacks.h:40
clang::PPChainedCallbacks::Elifndef
void Elifndef(SourceLocation Loc, SourceRange ConditionRange, SourceLocation IfLoc) override
Hook called whenever an #elifndef is skipped.
Definition: PPCallbacks.h:668
llvm::ArrayRef
Definition: LLVM.h:34
clang::PPCallbacks::PragmaMark
virtual void PragmaMark(SourceLocation Loc, StringRef Trivia)
Callback invoked when a #pragma mark comment is read.
Definition: PPCallbacks.h:195
clang::PPCallbacks::Defined
virtual void Defined(const Token &MacroNameTok, const MacroDefinition &MD, SourceRange Range)
Hook called whenever the 'defined' operator is seen.
Definition: PPCallbacks.h:318
Value
Value
Definition: UninitializedValues.cpp:102
clang::PPChainedCallbacks::Ident
void Ident(SourceLocation Loc, StringRef str) override
Callback invoked when a #ident or #sccs directive is read.
Definition: PPCallbacks.h:489
clang::CharSourceRange
Represents a character-granular source range.
Definition: SourceLocation.h:253
clang::PPCallbacks::EndOfMainFile
virtual void EndOfMainFile()
Callback invoked when the end of the main file is reached.
Definition: PPCallbacks.h:174
State
LineState State
Definition: UnwrappedLineFormatter.cpp:1052
clang::PPChainedCallbacks::PragmaDebug
void PragmaDebug(SourceLocation Loc, StringRef DebugType) override
Callback invoked when a #pragma clang __debug directive is read.
Definition: PPCallbacks.h:517
clang::PPCallbacks::PragmaDiagnosticPop
virtual void PragmaDiagnosticPop(SourceLocation Loc, StringRef Namespace)
Callback invoked when a #pragma gcc diagnostic pop directive is read.
Definition: PPCallbacks.h:239
clang::PPChainedCallbacks::moduleImport
void moduleImport(SourceLocation ImportLoc, ModuleIdPath Path, const Module *Imported) override
Callback invoked whenever there was an explicit module-import syntax.
Definition: PPCallbacks.h:478
clang::PPCallbacks::PragmaWarningSpecifier
PragmaWarningSpecifier
Callback invoked when a #pragma warning directive is read.
Definition: PPCallbacks.h:255
clang::PPChainedCallbacks::PragmaMessage
void PragmaMessage(SourceLocation Loc, StringRef Namespace, PragmaMessageKind Kind, StringRef Str) override
Callback invoked when a #pragma message directive is read.
Definition: PPCallbacks.h:522
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:84
clang::PPChainedCallbacks::PragmaExecCharsetPop
void PragmaExecCharsetPop(SourceLocation Loc) override
Callback invoked when a #pragma execution_character_set(pop) directive is read.
Definition: PPCallbacks.h:575
clang::PPCallbacks::HasInclude
virtual void HasInclude(SourceLocation Loc, StringRef FileName, bool IsAngled, Optional< FileEntryRef > File, SrcMgr::CharacteristicKind FileType)
Hook called when a '__has_include' or '__has_include_next' directive is read.
Definition: PPCallbacks.cpp:17
clang::PPChainedCallbacks::SourceRangeSkipped
void SourceRangeSkipped(SourceRange Range, SourceLocation EndifLoc) override
Hook called when a source range is skipped.
Definition: PPCallbacks.h:615
clang::ObjCPropertyAttribute::Kind
Kind
Definition: DeclObjCCommon.h:22
clang::PPChainedCallbacks::~PPChainedCallbacks
~PPChainedCallbacks() override
std
Definition: Format.h:4275
clang::PPCallbacks::PWS_Default
@ PWS_Default
Definition: PPCallbacks.h:256
clang::PPCallbacks::Elifndef
virtual void Elifndef(SourceLocation Loc, SourceRange ConditionRange, SourceLocation IfLoc)
Hook called whenever an #elifndef is skipped.
Definition: PPCallbacks.h:405
clang::PPChainedCallbacks::PragmaDetectMismatch
void PragmaDetectMismatch(SourceLocation Loc, StringRef Name, StringRef Value) override
Callback invoked when a #pragma detect_mismatch directive is read.
Definition: PPCallbacks.h:511
clang
Definition: CalledOnceCheck.h:17
clang::PPCallbacks::PragmaOpenCLExtension
virtual void PragmaOpenCLExtension(SourceLocation NameLoc, const IdentifierInfo *Name, SourceLocation StateLoc, unsigned State)
Called when an OpenCL extension is either disabled or enabled with a pragma.
Definition: PPCallbacks.h:249
clang::PPChainedCallbacks::Defined
void Defined(const Token &MacroNameTok, const MacroDefinition &MD, SourceRange Range) override
Hook called whenever the 'defined' operator is seen.
Definition: PPCallbacks.h:609
clang::MacroDirective
Encapsulates changes to the "macros namespace" (the location where the macro name became active,...
Definition: MacroInfo.h:290
clang::PPCallbacks::PragmaMessageKind
PragmaMessageKind
Determines the kind of #pragma invoking a call to PragmaMessage.
Definition: PPCallbacks.h:211
clang::PPChainedCallbacks::Elifdef
void Elifdef(SourceLocation Loc, SourceRange ConditionRange, SourceLocation IfLoc) override
Hook called whenever an #elifdef is skipped.
Definition: PPCallbacks.h:648
clang::PPCallbacks::Ifdef
virtual void Ifdef(SourceLocation Loc, const Token &MacroNameTok, const MacroDefinition &MD)
Hook called whenever an #ifdef is seen.
Definition: PPCallbacks.h:365
clang::prec::Level
Level
Definition: OperatorPrecedence.h:26
clang::FileID
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Definition: SourceLocation.h:38
clang::PPCallbacks::PWS_Level3
@ PWS_Level3
Definition: PPCallbacks.h:263
clang::PPCallbacks::PWS_Level4
@ PWS_Level4
Definition: PPCallbacks.h:264
clang::PPCallbacks::PragmaExecCharsetPop
virtual void PragmaExecCharsetPop(SourceLocation Loc)
Callback invoked when a #pragma execution_character_set(pop) directive is read.
Definition: PPCallbacks.h:284
clang::PPCallbacks::CVK_NotEvaluated
@ CVK_NotEvaluated
Definition: PPCallbacks.h:338
clang::PPCallbacks::MacroDefined
virtual void MacroDefined(const Token &MacroNameTok, const MacroDirective *MD)
Hook called whenever a macro definition is seen.
Definition: PPCallbacks.h:301
clang::PPChainedCallbacks::PragmaDiagnostic
void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace, diag::Severity mapping, StringRef Str) override
Callback invoked when a #pragma gcc diagnostic directive is read.
Definition: PPCallbacks.h:538
clang::PPCallbacks::FileChanged
virtual void FileChanged(SourceLocation Loc, FileChangeReason Reason, SrcMgr::CharacteristicKind FileType, FileID PrevFID=FileID())
Callback invoked whenever a source file is entered or exited.
Definition: PPCallbacks.h:47
llvm::SmallVectorImpl< char >
clang::PPChainedCallbacks::Elifdef
void Elifdef(SourceLocation Loc, const Token &MacroNameTok, const MacroDefinition &MD) override
Hook called whenever an #elifdef is taken.
Definition: PPCallbacks.h:642
clang::PPCallbacks::PragmaWarningPush
virtual void PragmaWarningPush(SourceLocation Loc, int Level)
Callback invoked when a #pragma warning(push) directive is read.
Definition: PPCallbacks.h:271
clang::PPCallbacks::PragmaWarningPop
virtual void PragmaWarningPop(SourceLocation Loc)
Callback invoked when a #pragma warning(pop) directive is read.
Definition: PPCallbacks.h:275
clang::PPCallbacks::moduleImport
virtual void moduleImport(SourceLocation ImportLoc, ModuleIdPath Path, const Module *Imported)
Callback invoked whenever there was an explicit module-import syntax.
Definition: PPCallbacks.h:166
clang::PPCallbacks::PragmaDiagnostic
virtual void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace, diag::Severity mapping, StringRef Str)
Callback invoked when a #pragma gcc diagnostic directive is read.
Definition: PPCallbacks.h:244
clang::PPChainedCallbacks::PragmaComment
void PragmaComment(SourceLocation Loc, const IdentifierInfo *Kind, StringRef Str) override
Callback invoked when a #pragma comment directive is read.
Definition: PPCallbacks.h:500
clang::PPCallbacks::PWS_Error
@ PWS_Error
Definition: PPCallbacks.h:258
clang::PPCallbacks::PWS_Level2
@ PWS_Level2
Definition: PPCallbacks.h:262