Coverage Report

Created: 2022-05-21 09:15

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