Coverage Report

Created: 2021-09-21 08:58

/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
304k
                           FileID PrevFID = FileID()) {
50
304k
  }
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
966k
                           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
165
                            SmallVectorImpl<char> &RecoveryPath) {
78
165
    return false;
79
165
  }
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
1.55M
                                  SrcMgr::CharacteristicKind FileType) {
132
1.55M
  }
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
76.2k
                                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
76.2k
                             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
2.64k
                            const Module *Imported) {
169
2.64k
  }
170
171
  /// Callback invoked when the end of the main file is reached.
172
  ///
173
  /// No subsequent callbacks will be made.
174
99.1k
  virtual void EndOfMainFile() {
175
99.1k
  }
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
1
  virtual void Ident(SourceLocation Loc, StringRef str) {
182
1
  }
183
184
  /// Callback invoked when start reading any pragma directive.
185
  virtual void PragmaDirective(SourceLocation Loc,
186
1.95M
                               PragmaIntroducerKind Introducer) {
187
1.95M
  }
188
189
  /// Callback invoked when a \#pragma comment directive is read.
190
  virtual void PragmaComment(SourceLocation Loc, const IdentifierInfo *Kind,
191
66
                             StringRef Str) {
192
66
  }
193
194
  /// Callback invoked when a \#pragma mark comment is read.
195
37.8k
  virtual void PragmaMark(SourceLocation Loc, StringRef Trivia) {
196
37.8k
  }
197
198
  /// Callback invoked when a \#pragma detect_mismatch directive is
199
  /// read.
200
  virtual void PragmaDetectMismatch(SourceLocation Loc, StringRef Name,
201
18
                                    StringRef Value) {
202
18
  }
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
178
  virtual void PragmaDebug(SourceLocation Loc, StringRef DebugType) {
208
178
  }
209
210
  /// Determines the kind of \#pragma invoking a call to PragmaMessage.
211
  enum PragmaMessageKind {
212
    /// \#pragma message has been invoked.
213
    PMK_Message,
214
215
    /// \#pragma GCC warning has been invoked.
216
    PMK_Warning,
217
218
    /// \#pragma GCC error has been invoked.
219
    PMK_Error
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
30
                             PragmaMessageKind Kind, StringRef Str) {
229
30
  }
230
231
  /// Callback invoked when a \#pragma gcc diagnostic push directive
232
  /// is read.
233
  virtual void PragmaDiagnosticPush(SourceLocation Loc,
234
58.1k
                                    StringRef Namespace) {
235
58.1k
  }
236
237
  /// Callback invoked when a \#pragma gcc diagnostic pop directive
238
  /// is read.
239
  virtual void PragmaDiagnosticPop(SourceLocation Loc,
240
58.1k
                                   StringRef Namespace) {
241
58.1k
  }
242
243
  /// Callback invoked when a \#pragma gcc diagnostic directive is read.
244
  virtual void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace,
245
108k
                                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
3.69k
                                     SourceLocation StateLoc, unsigned State) {
252
3.69k
  }
253
254
  /// Callback invoked when a \#pragma warning directive is read.
255
  virtual void PragmaWarning(SourceLocation Loc, StringRef WarningSpec,
256
25
                             ArrayRef<int> Ids) {
257
25
  }
258
259
  /// Callback invoked when a \#pragma warning(push) directive is read.
260
16
  virtual void PragmaWarningPush(SourceLocation Loc, int Level) {
261
16
  }
262
263
  /// Callback invoked when a \#pragma warning(pop) directive is read.
264
10
  virtual void PragmaWarningPop(SourceLocation Loc) {
265
10
  }
266
267
  /// Callback invoked when a \#pragma execution_character_set(push) directive
268
  /// is read.
269
8
  virtual void PragmaExecCharsetPush(SourceLocation Loc, StringRef Str) {}
270
271
  /// Callback invoked when a \#pragma execution_character_set(pop) directive
272
  /// is read.
273
6
  virtual void PragmaExecCharsetPop(SourceLocation Loc) {}
274
275
  /// Callback invoked when a \#pragma clang assume_nonnull begin directive
276
  /// is read.
277
140k
  virtual void PragmaAssumeNonNullBegin(SourceLocation Loc) {}
278
279
  /// Callback invoked when a \#pragma clang assume_nonnull end directive
280
  /// is read.
281
140k
  virtual void PragmaAssumeNonNullEnd(SourceLocation Loc) {}
282
283
  /// Called by Preprocessor::HandleMacroExpandedIdentifier when a
284
  /// macro invocation is found.
285
  virtual void MacroExpands(const Token &MacroNameTok,
286
                            const MacroDefinition &MD, SourceRange Range,
287
99.2M
                            const MacroArgs *Args) {}
288
289
  /// Hook called whenever a macro definition is seen.
290
  virtual void MacroDefined(const Token &MacroNameTok,
291
73.5M
                            const MacroDirective *MD) {
292
73.5M
  }
293
294
  /// Hook called whenever a macro \#undef is seen.
295
  /// \param MacroNameTok The active Token
296
  /// \param MD A MacroDefinition for the named macro.
297
  /// \param Undef New MacroDirective if the macro was defined, null otherwise.
298
  ///
299
  /// MD is released immediately following this callback.
300
  virtual void MacroUndefined(const Token &MacroNameTok,
301
                              const MacroDefinition &MD,
302
189k
                              const MacroDirective *Undef) {
303
189k
  }
304
305
  /// Hook called whenever the 'defined' operator is seen.
306
  /// \param MD The MacroDirective if the name was a macro, null otherwise.
307
  virtual void Defined(const Token &MacroNameTok, const MacroDefinition &MD,
308
2.59M
                       SourceRange Range) {
309
2.59M
  }
310
311
  /// Hook called when a '__has_include' or '__has_include_next' directive is
312
  /// read.
313
  virtual void HasInclude(SourceLocation Loc, StringRef FileName, bool IsAngled,
314
                          Optional<FileEntryRef> File,
315
                          SrcMgr::CharacteristicKind FileType);
316
317
  /// Hook called when a source range is skipped.
318
  /// \param Range The SourceRange that was skipped. The range begins at the
319
  /// \#if/\#else directive and ends after the \#endif/\#else directive.
320
  /// \param EndifLoc The end location of the 'endif' token, which may precede
321
  /// the range skipped by the directive (e.g excluding comments after an
322
  /// 'endif').
323
4.62M
  virtual void SourceRangeSkipped(SourceRange Range, SourceLocation EndifLoc) {
324
4.62M
  }
325
326
  enum ConditionValueKind {
327
    CVK_NotEvaluated, CVK_False, CVK_True
328
  };
329
330
  /// Hook called whenever an \#if is seen.
331
  /// \param Loc the source location of the directive.
332
  /// \param ConditionRange The SourceRange of the expression being tested.
333
  /// \param ConditionValue The evaluated value of the condition.
334
  ///
335
  // FIXME: better to pass in a list (or tree!) of Tokens.
336
  virtual void If(SourceLocation Loc, SourceRange ConditionRange,
337
3.99M
                  ConditionValueKind ConditionValue) {
338
3.99M
  }
339
340
  /// Hook called whenever an \#elif is seen.
341
  /// \param Loc the source location of the directive.
342
  /// \param ConditionRange The SourceRange of the expression being tested.
343
  /// \param ConditionValue The evaluated value of the condition.
344
  /// \param IfLoc the source location of the \#if/\#ifdef/\#ifndef directive.
345
  // FIXME: better to pass in a list (or tree!) of Tokens.
346
  virtual void Elif(SourceLocation Loc, SourceRange ConditionRange,
347
336k
                    ConditionValueKind ConditionValue, SourceLocation IfLoc) {
348
336k
  }
349
350
  /// Hook called whenever an \#ifdef is seen.
351
  /// \param Loc the source location of the directive.
352
  /// \param MacroNameTok Information on the token being tested.
353
  /// \param MD The MacroDefinition if the name was a macro, null otherwise.
354
  virtual void Ifdef(SourceLocation Loc, const Token &MacroNameTok,
355
1.79M
                     const MacroDefinition &MD) {
356
1.79M
  }
357
358
  /// Hook called whenever an \#elifdef branch is taken.
359
  /// \param Loc the source location of the directive.
360
  /// \param MacroNameTok Information on the token being tested.
361
  /// \param MD The MacroDefinition if the name was a macro, null otherwise.
362
  virtual void Elifdef(SourceLocation Loc, const Token &MacroNameTok,
363
16
                       const MacroDefinition &MD) {
364
16
  }
365
  /// Hook called whenever an \#elifdef is skipped.
366
  /// \param Loc the source location of the directive.
367
  /// \param ConditionRange The SourceRange of the expression being tested.
368
  /// \param IfLoc the source location of the \#if/\#ifdef/\#ifndef directive.
369
  // FIXME: better to pass in a list (or tree!) of Tokens.
370
  virtual void Elifdef(SourceLocation Loc, SourceRange ConditionRange,
371
6
                       SourceLocation IfLoc) {
372
6
  }
373
374
  /// Hook called whenever an \#ifndef is seen.
375
  /// \param Loc the source location of the directive.
376
  /// \param MacroNameTok Information on the token being tested.
377
  /// \param MD The MacroDefiniton if the name was a macro, null otherwise.
378
  virtual void Ifndef(SourceLocation Loc, const Token &MacroNameTok,
379
9.90M
                      const MacroDefinition &MD) {
380
9.90M
  }
381
382
  /// Hook called whenever an \#elifndef branch is taken.
383
  /// \param Loc the source location of the directive.
384
  /// \param MacroNameTok Information on the token being tested.
385
  /// \param MD The MacroDefinition if the name was a macro, null otherwise.
386
  virtual void Elifndef(SourceLocation Loc, const Token &MacroNameTok,
387
9
                        const MacroDefinition &MD) {
388
9
  }
389
  /// Hook called whenever an \#elifndef is skipped.
390
  /// \param Loc the source location of the directive.
391
  /// \param ConditionRange The SourceRange of the expression being tested.
392
  /// \param IfLoc the source location of the \#if/\#ifdef/\#ifndef directive.
393
  // FIXME: better to pass in a list (or tree!) of Tokens.
394
  virtual void Elifndef(SourceLocation Loc, SourceRange ConditionRange,
395
5
                        SourceLocation IfLoc) {
396
5
  }
397
398
  /// Hook called whenever an \#else is seen.
399
  /// \param Loc the source location of the directive.
400
  /// \param IfLoc the source location of the \#if/\#ifdef/\#ifndef directive.
401
2.62M
  virtual void Else(SourceLocation Loc, SourceLocation IfLoc) {
402
2.62M
  }
403
404
  /// Hook called whenever an \#endif is seen.
405
  /// \param Loc the source location of the directive.
406
  /// \param IfLoc the source location of the \#if/\#ifdef/\#ifndef directive.
407
15.7M
  virtual void Endif(SourceLocation Loc, SourceLocation IfLoc) {
408
15.7M
  }
409
};
410
411
/// Simple wrapper class for chaining callbacks.
412
class PPChainedCallbacks : public PPCallbacks {
413
  std::unique_ptr<PPCallbacks> First, Second;
414
415
public:
416
  PPChainedCallbacks(std::unique_ptr<PPCallbacks> _First,
417
                     std::unique_ptr<PPCallbacks> _Second)
418
60.3k
    : First(std::move(_First)), Second(std::move(_Second)) {}
419
420
  ~PPChainedCallbacks() override;
421
422
  void FileChanged(SourceLocation Loc, FileChangeReason Reason,
423
                   SrcMgr::CharacteristicKind FileType,
424
1.38M
                   FileID PrevFID) override {
425
1.38M
    First->FileChanged(Loc, Reason, FileType, PrevFID);
426
1.38M
    Second->FileChanged(Loc, Reason, FileType, PrevFID);
427
1.38M
  }
428
429
  void FileSkipped(const FileEntryRef &SkippedFile, const Token &FilenameTok,
430
946k
                   SrcMgr::CharacteristicKind FileType) override {
431
946k
    First->FileSkipped(SkippedFile, FilenameTok, FileType);
432
946k
    Second->FileSkipped(SkippedFile, FilenameTok, FileType);
433
946k
  }
434
435
  bool FileNotFound(StringRef FileName,
436
65
                    SmallVectorImpl<char> &RecoveryPath) override {
437
65
    return First->FileNotFound(FileName, RecoveryPath) ||
438
65
           Second->FileNotFound(FileName, RecoveryPath);
439
65
  }
440
441
  void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok,
442
                          StringRef FileName, bool IsAngled,
443
                          CharSourceRange FilenameRange, const FileEntry *File,
444
                          StringRef SearchPath, StringRef RelativePath,
445
                          const Module *Imported,
446
1.37M
                          SrcMgr::CharacteristicKind FileType) override {
447
1.37M
    First->InclusionDirective(HashLoc, IncludeTok, FileName, IsAngled,
448
1.37M
                              FilenameRange, File, SearchPath, RelativePath,
449
1.37M
                              Imported, FileType);
450
1.37M
    Second->InclusionDirective(HashLoc, IncludeTok, FileName, IsAngled,
451
1.37M
                               FilenameRange, File, SearchPath, RelativePath,
452
1.37M
                               Imported, FileType);
453
1.37M
  }
454
455
  void EnteredSubmodule(Module *M, SourceLocation ImportLoc,
456
297
                        bool ForPragma) override {
457
297
    First->EnteredSubmodule(M, ImportLoc, ForPragma);
458
297
    Second->EnteredSubmodule(M, ImportLoc, ForPragma);
459
297
  }
460
461
  void LeftSubmodule(Module *M, SourceLocation ImportLoc,
462
295
                     bool ForPragma) override {
463
295
    First->LeftSubmodule(M, ImportLoc, ForPragma);
464
295
    Second->LeftSubmodule(M, ImportLoc, ForPragma);
465
295
  }
466
467
  void moduleImport(SourceLocation ImportLoc, ModuleIdPath Path,
468
1.49k
                    const Module *Imported) override {
469
1.49k
    First->moduleImport(ImportLoc, Path, Imported);
470
1.49k
    Second->moduleImport(ImportLoc, Path, Imported);
471
1.49k
  }
472
473
33.9k
  void EndOfMainFile() override {
474
33.9k
    First->EndOfMainFile();
475
33.9k
    Second->EndOfMainFile();
476
33.9k
  }
477
478
0
  void Ident(SourceLocation Loc, StringRef str) override {
479
0
    First->Ident(Loc, str);
480
0
    Second->Ident(Loc, str);
481
0
  }
482
483
  void PragmaDirective(SourceLocation Loc,
484
933k
                       PragmaIntroducerKind Introducer) override {
485
933k
    First->PragmaDirective(Loc, Introducer);
486
933k
    Second->PragmaDirective(Loc, Introducer);
487
933k
  }
488
489
  void PragmaComment(SourceLocation Loc, const IdentifierInfo *Kind,
490
10
                     StringRef Str) override {
491
10
    First->PragmaComment(Loc, Kind, Str);
492
10
    Second->PragmaComment(Loc, Kind, Str);
493
10
  }
494
495
  void PragmaDetectMismatch(SourceLocation Loc, StringRef Name,
496
2
                            StringRef Value) override {
497
2
    First->PragmaDetectMismatch(Loc, Name, Value);
498
2
    Second->PragmaDetectMismatch(Loc, Name, Value);
499
2
  }
500
501
69
  void PragmaDebug(SourceLocation Loc, StringRef DebugType) override {
502
69
    First->PragmaDebug(Loc, DebugType);
503
69
    Second->PragmaDebug(Loc, DebugType);
504
69
  }
505
506
  void PragmaMessage(SourceLocation Loc, StringRef Namespace,
507
15
                     PragmaMessageKind Kind, StringRef Str) override {
508
15
    First->PragmaMessage(Loc, Namespace, Kind, Str);
509
15
    Second->PragmaMessage(Loc, Namespace, Kind, Str);
510
15
  }
511
512
27.8k
  void PragmaDiagnosticPush(SourceLocation Loc, StringRef Namespace) override {
513
27.8k
    First->PragmaDiagnosticPush(Loc, Namespace);
514
27.8k
    Second->PragmaDiagnosticPush(Loc, Namespace);
515
27.8k
  }
516
517
27.8k
  void PragmaDiagnosticPop(SourceLocation Loc, StringRef Namespace) override {
518
27.8k
    First->PragmaDiagnosticPop(Loc, Namespace);
519
27.8k
    Second->PragmaDiagnosticPop(Loc, Namespace);
520
27.8k
  }
521
522
  void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace,
523
52.0k
                        diag::Severity mapping, StringRef Str) override {
524
52.0k
    First->PragmaDiagnostic(Loc, Namespace, mapping, Str);
525
52.0k
    Second->PragmaDiagnostic(Loc, Namespace, mapping, Str);
526
52.0k
  }
527
528
  void HasInclude(SourceLocation Loc, StringRef FileName, bool IsAngled,
529
                  Optional<FileEntryRef> File,
530
                  SrcMgr::CharacteristicKind FileType) override;
531
532
  void PragmaOpenCLExtension(SourceLocation NameLoc, const IdentifierInfo *Name,
533
1.72k
                             SourceLocation StateLoc, unsigned State) override {
534
1.72k
    First->PragmaOpenCLExtension(NameLoc, Name, StateLoc, State);
535
1.72k
    Second->PragmaOpenCLExtension(NameLoc, Name, StateLoc, State);
536
1.72k
  }
537
538
  void PragmaWarning(SourceLocation Loc, StringRef WarningSpec,
539
12
                     ArrayRef<int> Ids) override {
540
12
    First->PragmaWarning(Loc, WarningSpec, Ids);
541
12
    Second->PragmaWarning(Loc, WarningSpec, Ids);
542
12
  }
543
544
8
  void PragmaWarningPush(SourceLocation Loc, int Level) override {
545
8
    First->PragmaWarningPush(Loc, Level);
546
8
    Second->PragmaWarningPush(Loc, Level);
547
8
  }
548
549
5
  void PragmaWarningPop(SourceLocation Loc) override {
550
5
    First->PragmaWarningPop(Loc);
551
5
    Second->PragmaWarningPop(Loc);
552
5
  }
553
554
4
  void PragmaExecCharsetPush(SourceLocation Loc, StringRef Str) override {
555
4
    First->PragmaExecCharsetPush(Loc, Str);
556
4
    Second->PragmaExecCharsetPush(Loc, Str);
557
4
  }
558
559
3
  void PragmaExecCharsetPop(SourceLocation Loc) override {
560
3
    First->PragmaExecCharsetPop(Loc);
561
3
    Second->PragmaExecCharsetPop(Loc);
562
3
  }
563
564
68.5k
  void PragmaAssumeNonNullBegin(SourceLocation Loc) override {
565
68.5k
    First->PragmaAssumeNonNullBegin(Loc);
566
68.5k
    Second->PragmaAssumeNonNullBegin(Loc);
567
68.5k
  }
568
569
68.5k
  void PragmaAssumeNonNullEnd(SourceLocation Loc) override {
570
68.5k
    First->PragmaAssumeNonNullEnd(Loc);
571
68.5k
    Second->PragmaAssumeNonNullEnd(Loc);
572
68.5k
  }
573
574
  void MacroExpands(const Token &MacroNameTok, const MacroDefinition &MD,
575
37.1M
                    SourceRange Range, const MacroArgs *Args) override {
576
37.1M
    First->MacroExpands(MacroNameTok, MD, Range, Args);
577
37.1M
    Second->MacroExpands(MacroNameTok, MD, Range, Args);
578
37.1M
  }
579
580
  void MacroDefined(const Token &MacroNameTok,
581
29.0M
                    const MacroDirective *MD) override {
582
29.0M
    First->MacroDefined(MacroNameTok, MD);
583
29.0M
    Second->MacroDefined(MacroNameTok, MD);
584
29.0M
  }
585
586
  void MacroUndefined(const Token &MacroNameTok,
587
                      const MacroDefinition &MD,
588
74.8k
                      const MacroDirective *Undef) override {
589
74.8k
    First->MacroUndefined(MacroNameTok, MD, Undef);
590
74.8k
    Second->MacroUndefined(MacroNameTok, MD, Undef);
591
74.8k
  }
592
593
  void Defined(const Token &MacroNameTok, const MacroDefinition &MD,
594
1.12M
               SourceRange Range) override {
595
1.12M
    First->Defined(MacroNameTok, MD, Range);
596
1.12M
    Second->Defined(MacroNameTok, MD, Range);
597
1.12M
  }
598
599
1.90M
  void SourceRangeSkipped(SourceRange Range, SourceLocation EndifLoc) override {
600
1.90M
    First->SourceRangeSkipped(Range, EndifLoc);
601
1.90M
    Second->SourceRangeSkipped(Range, EndifLoc);
602
1.90M
  }
603
604
  /// Hook called whenever an \#if is seen.
605
  void If(SourceLocation Loc, SourceRange ConditionRange,
606
1.84M
          ConditionValueKind ConditionValue) override {
607
1.84M
    First->If(Loc, ConditionRange, ConditionValue);
608
1.84M
    Second->If(Loc, ConditionRange, ConditionValue);
609
1.84M
  }
610
611
  /// Hook called whenever an \#elif is seen.
612
  void Elif(SourceLocation Loc, SourceRange ConditionRange,
613
160k
            ConditionValueKind ConditionValue, SourceLocation IfLoc) override {
614
160k
    First->Elif(Loc, ConditionRange, ConditionValue, IfLoc);
615
160k
    Second->Elif(Loc, ConditionRange, ConditionValue, IfLoc);
616
160k
  }
617
618
  /// Hook called whenever an \#ifdef is seen.
619
  void Ifdef(SourceLocation Loc, const Token &MacroNameTok,
620
579k
             const MacroDefinition &MD) override {
621
579k
    First->Ifdef(Loc, MacroNameTok, MD);
622
579k
    Second->Ifdef(Loc, MacroNameTok, MD);
623
579k
  }
624
625
  /// Hook called whenever an \#elifdef is taken.
626
  void Elifdef(SourceLocation Loc, const Token &MacroNameTok,
627
2
               const MacroDefinition &MD) override {
628
2
    First->Elifdef(Loc, MacroNameTok, MD);
629
2
    Second->Elifdef(Loc, MacroNameTok, MD);
630
2
  }
631
  /// Hook called whenever an \#elifdef is skipped.
632
  void Elifdef(SourceLocation Loc, SourceRange ConditionRange,
633
2
               SourceLocation IfLoc) override {
634
2
    First->Elifdef(Loc, ConditionRange, IfLoc);
635
2
    Second->Elifdef(Loc, ConditionRange, IfLoc);
636
2
  }
637
638
  /// Hook called whenever an \#ifndef is seen.
639
  void Ifndef(SourceLocation Loc, const Token &MacroNameTok,
640
4.85M
              const MacroDefinition &MD) override {
641
4.85M
    First->Ifndef(Loc, MacroNameTok, MD);
642
4.85M
    Second->Ifndef(Loc, MacroNameTok, MD);
643
4.85M
  }
644
645
  /// Hook called whenever an \#elifndef is taken.
646
  void Elifndef(SourceLocation Loc, const Token &MacroNameTok,
647
2
                const MacroDefinition &MD) override {
648
2
    First->Elifndef(Loc, MacroNameTok, MD);
649
2
    Second->Elifndef(Loc, MacroNameTok, MD);
650
2
  }
651
  /// Hook called whenever an \#elifndef is skipped.
652
  void Elifndef(SourceLocation Loc, SourceRange ConditionRange,
653
2
               SourceLocation IfLoc) override {
654
2
    First->Elifndef(Loc, ConditionRange, IfLoc);
655
2
    Second->Elifndef(Loc, ConditionRange, IfLoc);
656
2
  }
657
658
  /// Hook called whenever an \#else is seen.
659
1.05M
  void Else(SourceLocation Loc, SourceLocation IfLoc) override {
660
1.05M
    First->Else(Loc, IfLoc);
661
1.05M
    Second->Else(Loc, IfLoc);
662
1.05M
  }
663
664
  /// Hook called whenever an \#endif is seen.
665
7.27M
  void Endif(SourceLocation Loc, SourceLocation IfLoc) override {
666
7.27M
    First->Endif(Loc, IfLoc);
667
7.27M
    Second->Endif(Loc, IfLoc);
668
7.27M
  }
669
};
670
671
}  // end namespace clang
672
673
#endif