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