27#include "llvm/ADT/ArrayRef.h"
28#include "llvm/ADT/ScopeExit.h"
29#include "llvm/ADT/StringSwitch.h"
36 explicit PragmaAlignHandler() : PragmaHandler(
"align") {}
37 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
38 Token &FirstToken)
override;
42 explicit PragmaGCCVisibilityHandler() : PragmaHandler(
"visibility") {}
43 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
44 Token &FirstToken)
override;
48 explicit PragmaOptionsHandler() : PragmaHandler(
"options") {}
49 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
50 Token &FirstToken)
override;
54 explicit PragmaPackHandler() : PragmaHandler(
"pack") {}
55 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
56 Token &FirstToken)
override;
60 explicit PragmaClangSectionHandler(Sema &S)
61 : PragmaHandler(
"section"), Actions(S) {}
62 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
63 Token &FirstToken)
override;
70 explicit PragmaMSStructHandler() : PragmaHandler(
"ms_struct") {}
71 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
72 Token &FirstToken)
override;
76 PragmaUnusedHandler() : PragmaHandler(
"unused") {}
77 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
78 Token &FirstToken)
override;
82 explicit PragmaWeakHandler() : PragmaHandler(
"weak") {}
83 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
84 Token &FirstToken)
override;
88 explicit PragmaRedefineExtnameHandler() : PragmaHandler(
"redefine_extname") {}
89 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
90 Token &FirstToken)
override;
94 PragmaOpenCLExtensionHandler() : PragmaHandler(
"EXTENSION") {}
95 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
96 Token &FirstToken)
override;
101 PragmaFPContractHandler() : PragmaHandler(
"FP_CONTRACT") {}
102 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
103 Token &FirstToken)
override;
110 PragmaSTDC_FENV_ACCESSHandler() : PragmaHandler(
"FENV_ACCESS") {}
112 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
113 Token &
Tok)
override {
114 Token PragmaName =
Tok;
128 reinterpret_cast<void *
>(
static_cast<uintptr_t>(OOS)));
129 PP.EnterTokenStream(Toks,
true,
135struct PragmaSTDC_CX_LIMITED_RANGEHandler :
public PragmaHandler {
136 PragmaSTDC_CX_LIMITED_RANGEHandler() : PragmaHandler(
"CX_LIMITED_RANGE") {}
138 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
139 Token &
Tok)
override {
144 MutableArrayRef<Token> Toks(
149 reinterpret_cast<void *
>(
static_cast<uintptr_t>(OOS)));
150 PP.EnterTokenStream(Toks,
true,
157 PragmaSTDC_FENV_ROUNDHandler() : PragmaHandler(
"FENV_ROUND") {}
159 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
160 Token &
Tok)
override;
165 PragmaSTDC_UnknownHandler() =
default;
167 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
168 Token &UnknownTok)
override {
170 PP.
Diag(UnknownTok, diag::ext_stdc_pragma_ignored);
175 PragmaFPHandler() : PragmaHandler(
"fp") {}
176 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
177 Token &FirstToken)
override;
183template <diag::kind IgnoredDiag>
185 PragmaNoSupportHandler(StringRef Name) : PragmaHandler(Name) {}
186 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
187 Token &FirstToken)
override;
190struct PragmaNoOpenMPHandler
191 :
public PragmaNoSupportHandler<diag::warn_pragma_omp_ignored> {
192 PragmaNoOpenMPHandler() : PragmaNoSupportHandler(
"omp") {}
195struct PragmaNoOpenACCHandler
196 :
public PragmaNoSupportHandler<diag::warn_pragma_acc_ignored> {
197 PragmaNoOpenACCHandler() : PragmaNoSupportHandler(
"acc") {}
206 PragmaSupportHandler(StringRef Name) : PragmaHandler(Name) {}
207 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
208 Token &FirstToken)
override;
211struct PragmaOpenMPHandler
212 :
public PragmaSupportHandler<tok::annot_pragma_openmp,
213 tok::annot_pragma_openmp_end,
214 diag::err_omp_unexpected_directive> {
215 PragmaOpenMPHandler() : PragmaSupportHandler(
"omp") {}
218struct PragmaOpenACCHandler
219 :
public PragmaSupportHandler<tok::annot_pragma_openacc,
220 tok::annot_pragma_openacc_end,
221 diag::err_acc_unexpected_directive> {
222 PragmaOpenACCHandler() : PragmaSupportHandler(
"acc") {}
227 PragmaCommentHandler(Sema &Actions)
228 : PragmaHandler(
"comment"), Actions(Actions) {}
229 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
230 Token &FirstToken)
override;
234 bool SeenCopyrightInTU =
false;
238 PragmaDetectMismatchHandler(Sema &Actions)
239 : PragmaHandler(
"detect_mismatch"), Actions(Actions) {}
240 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
241 Token &FirstToken)
override;
248 PragmaFloatControlHandler(Sema &Actions)
249 : PragmaHandler(
"float_control") {}
250 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
251 Token &FirstToken)
override;
255 explicit PragmaMSPointersToMembers() : PragmaHandler(
"pointers_to_members") {}
256 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
257 Token &FirstToken)
override;
261 explicit PragmaMSVtorDisp() : PragmaHandler(
"vtordisp") {}
262 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
263 Token &FirstToken)
override;
267 explicit PragmaMSPragma(
const char *name) : PragmaHandler(
name) {}
268 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
269 Token &FirstToken)
override;
274 PragmaOptimizeHandler(Sema &S)
275 : PragmaHandler(
"optimize"), Actions(S) {}
276 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
277 Token &FirstToken)
override;
284 PragmaLoopHintHandler() : PragmaHandler(
"loop") {}
285 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
286 Token &FirstToken)
override;
290 PragmaUnrollHintHandler(
const char *name) : PragmaHandler(
name) {}
291 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
292 Token &FirstToken)
override;
296 PragmaMSRuntimeChecksHandler() : EmptyPragmaHandler(
"runtime_checks") {}
301 PragmaMSFenvAccessHandler() : PragmaHandler(
"fenv_access") {}
302 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
303 Token &FirstToken)
override {
325 if (II->
isStr(
"on")) {
328 }
else if (II->
isStr(
"off")) {
348 MutableArrayRef<Token> Toks(
351 tok::annot_pragma_fenv_access_ms,
353 reinterpret_cast<void *
>(
static_cast<uintptr_t>(OOS)));
354 PP.EnterTokenStream(Toks,
true,
359struct PragmaForceCUDAHostDeviceHandler :
public PragmaHandler {
360 PragmaForceCUDAHostDeviceHandler(Sema &Actions)
361 : PragmaHandler(
"force_cuda_host_device"), Actions(Actions) {}
362 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
363 Token &FirstToken)
override;
371 PragmaAttributeHandler(AttributeFactory &AttrFactory)
372 : PragmaHandler(
"attribute"), AttributesForPragmaAttribute(AttrFactory) {}
373 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
374 Token &FirstToken)
override;
377 ParsedAttributes AttributesForPragmaAttribute;
381 PragmaMaxTokensHereHandler() : PragmaHandler(
"max_tokens_here") {}
382 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
383 Token &FirstToken)
override;
387 PragmaMaxTokensTotalHandler() : PragmaHandler(
"max_tokens_total") {}
388 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
389 Token &FirstToken)
override;
393 explicit PragmaExportHandler() : PragmaHandler(
"export") {}
394 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
395 Token &FirstToken)
override;
399 PragmaRISCVHandler(Sema &Actions)
400 : PragmaHandler(
"riscv"), Actions(Actions) {}
401 void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
402 Token &FirstToken)
override;
414void Parser::initializePragmaHandlers() {
415 AlignHandler = std::make_unique<PragmaAlignHandler>();
416 PP.AddPragmaHandler(AlignHandler.get());
418 GCCVisibilityHandler = std::make_unique<PragmaGCCVisibilityHandler>();
419 PP.AddPragmaHandler(
"GCC", GCCVisibilityHandler.get());
421 OptionsHandler = std::make_unique<PragmaOptionsHandler>();
422 PP.AddPragmaHandler(OptionsHandler.get());
424 PackHandler = std::make_unique<PragmaPackHandler>();
425 PP.AddPragmaHandler(PackHandler.get());
427 MSStructHandler = std::make_unique<PragmaMSStructHandler>();
428 PP.AddPragmaHandler(MSStructHandler.get());
430 UnusedHandler = std::make_unique<PragmaUnusedHandler>();
431 PP.AddPragmaHandler(UnusedHandler.get());
433 WeakHandler = std::make_unique<PragmaWeakHandler>();
434 PP.AddPragmaHandler(WeakHandler.get());
436 RedefineExtnameHandler = std::make_unique<PragmaRedefineExtnameHandler>();
437 PP.AddPragmaHandler(RedefineExtnameHandler.get());
439 FPContractHandler = std::make_unique<PragmaFPContractHandler>();
440 PP.AddPragmaHandler(
"STDC", FPContractHandler.get());
442 STDCFenvAccessHandler = std::make_unique<PragmaSTDC_FENV_ACCESSHandler>();
443 PP.AddPragmaHandler(
"STDC", STDCFenvAccessHandler.get());
445 STDCFenvRoundHandler = std::make_unique<PragmaSTDC_FENV_ROUNDHandler>();
446 PP.AddPragmaHandler(
"STDC", STDCFenvRoundHandler.get());
448 STDCCXLIMITHandler = std::make_unique<PragmaSTDC_CX_LIMITED_RANGEHandler>();
449 PP.AddPragmaHandler(
"STDC", STDCCXLIMITHandler.get());
451 STDCUnknownHandler = std::make_unique<PragmaSTDC_UnknownHandler>();
452 PP.AddPragmaHandler(
"STDC", STDCUnknownHandler.get());
454 PCSectionHandler = std::make_unique<PragmaClangSectionHandler>(Actions);
455 PP.AddPragmaHandler(
"clang", PCSectionHandler.get());
458 OpenCLExtensionHandler = std::make_unique<PragmaOpenCLExtensionHandler>();
459 PP.AddPragmaHandler(
"OPENCL", OpenCLExtensionHandler.get());
461 PP.AddPragmaHandler(
"OPENCL", FPContractHandler.get());
464 OpenMPHandler = std::make_unique<PragmaOpenMPHandler>();
466 OpenMPHandler = std::make_unique<PragmaNoOpenMPHandler>();
467 PP.AddPragmaHandler(OpenMPHandler.get());
470 OpenACCHandler = std::make_unique<PragmaOpenACCHandler>();
472 OpenACCHandler = std::make_unique<PragmaNoOpenACCHandler>();
473 PP.AddPragmaHandler(OpenACCHandler.get());
478 MSCommentHandler = std::make_unique<PragmaCommentHandler>(Actions);
479 PP.AddPragmaHandler(MSCommentHandler.get());
482 FloatControlHandler = std::make_unique<PragmaFloatControlHandler>(Actions);
483 PP.AddPragmaHandler(FloatControlHandler.get());
485 MSDetectMismatchHandler =
486 std::make_unique<PragmaDetectMismatchHandler>(Actions);
487 PP.AddPragmaHandler(MSDetectMismatchHandler.get());
488 MSPointersToMembers = std::make_unique<PragmaMSPointersToMembers>();
489 PP.AddPragmaHandler(MSPointersToMembers.get());
490 MSVtorDisp = std::make_unique<PragmaMSVtorDisp>();
491 PP.AddPragmaHandler(MSVtorDisp.get());
492 MSInitSeg = std::make_unique<PragmaMSPragma>(
"init_seg");
493 PP.AddPragmaHandler(MSInitSeg.get());
494 MSDataSeg = std::make_unique<PragmaMSPragma>(
"data_seg");
495 PP.AddPragmaHandler(MSDataSeg.get());
496 MSBSSSeg = std::make_unique<PragmaMSPragma>(
"bss_seg");
497 PP.AddPragmaHandler(MSBSSSeg.get());
498 MSConstSeg = std::make_unique<PragmaMSPragma>(
"const_seg");
499 PP.AddPragmaHandler(MSConstSeg.get());
500 MSCodeSeg = std::make_unique<PragmaMSPragma>(
"code_seg");
501 PP.AddPragmaHandler(MSCodeSeg.get());
502 MSSection = std::make_unique<PragmaMSPragma>(
"section");
503 PP.AddPragmaHandler(MSSection.get());
504 MSStrictGuardStackCheck =
505 std::make_unique<PragmaMSPragma>(
"strict_gs_check");
506 PP.AddPragmaHandler(MSStrictGuardStackCheck.get());
507 MSFunction = std::make_unique<PragmaMSPragma>(
"function");
508 PP.AddPragmaHandler(MSFunction.get());
509 MSAllocText = std::make_unique<PragmaMSPragma>(
"alloc_text");
510 PP.AddPragmaHandler(MSAllocText.get());
511 MSOptimize = std::make_unique<PragmaMSPragma>(
"optimize");
512 PP.AddPragmaHandler(MSOptimize.get());
513 MSRuntimeChecks = std::make_unique<PragmaMSRuntimeChecksHandler>();
514 PP.AddPragmaHandler(MSRuntimeChecks.get());
515 MSIntrinsic = std::make_unique<PragmaMSPragma>(
"intrinsic");
516 PP.AddPragmaHandler(MSIntrinsic.get());
517 MSFenvAccess = std::make_unique<PragmaMSFenvAccessHandler>();
518 PP.AddPragmaHandler(MSFenvAccess.get());
522 CUDAForceHostDeviceHandler =
523 std::make_unique<PragmaForceCUDAHostDeviceHandler>(Actions);
524 PP.AddPragmaHandler(
"clang", CUDAForceHostDeviceHandler.get());
527 OptimizeHandler = std::make_unique<PragmaOptimizeHandler>(Actions);
528 PP.AddPragmaHandler(
"clang", OptimizeHandler.get());
530 LoopHintHandler = std::make_unique<PragmaLoopHintHandler>();
531 PP.AddPragmaHandler(
"clang", LoopHintHandler.get());
533 UnrollHintHandler = std::make_unique<PragmaUnrollHintHandler>(
"unroll");
534 PP.AddPragmaHandler(UnrollHintHandler.get());
535 PP.AddPragmaHandler(
"GCC", UnrollHintHandler.get());
537 NoUnrollHintHandler = std::make_unique<PragmaUnrollHintHandler>(
"nounroll");
538 PP.AddPragmaHandler(NoUnrollHintHandler.get());
539 PP.AddPragmaHandler(
"GCC", NoUnrollHintHandler.get());
541 UnrollAndJamHintHandler =
542 std::make_unique<PragmaUnrollHintHandler>(
"unroll_and_jam");
543 PP.AddPragmaHandler(UnrollAndJamHintHandler.get());
545 NoUnrollAndJamHintHandler =
546 std::make_unique<PragmaUnrollHintHandler>(
"nounroll_and_jam");
547 PP.AddPragmaHandler(NoUnrollAndJamHintHandler.get());
549 FPHandler = std::make_unique<PragmaFPHandler>();
550 PP.AddPragmaHandler(
"clang", FPHandler.get());
552 AttributePragmaHandler =
553 std::make_unique<PragmaAttributeHandler>(AttrFactory);
554 PP.AddPragmaHandler(
"clang", AttributePragmaHandler.get());
556 MaxTokensHerePragmaHandler = std::make_unique<PragmaMaxTokensHereHandler>();
557 PP.AddPragmaHandler(
"clang", MaxTokensHerePragmaHandler.get());
559 MaxTokensTotalPragmaHandler = std::make_unique<PragmaMaxTokensTotalHandler>();
560 PP.AddPragmaHandler(
"clang", MaxTokensTotalPragmaHandler.get());
563 ExportHandler = std::make_unique<PragmaExportHandler>();
564 PP.AddPragmaHandler(ExportHandler.get());
568 RISCVPragmaHandler = std::make_unique<PragmaRISCVHandler>(Actions);
569 PP.AddPragmaHandler(
"clang", RISCVPragmaHandler.get());
573void Parser::resetPragmaHandlers() {
575 PP.RemovePragmaHandler(AlignHandler.get());
576 AlignHandler.reset();
577 PP.RemovePragmaHandler(
"GCC", GCCVisibilityHandler.get());
578 GCCVisibilityHandler.reset();
579 PP.RemovePragmaHandler(OptionsHandler.get());
580 OptionsHandler.reset();
581 PP.RemovePragmaHandler(PackHandler.get());
583 PP.RemovePragmaHandler(MSStructHandler.get());
584 MSStructHandler.reset();
585 PP.RemovePragmaHandler(UnusedHandler.get());
586 UnusedHandler.reset();
587 PP.RemovePragmaHandler(WeakHandler.get());
589 PP.RemovePragmaHandler(RedefineExtnameHandler.get());
590 RedefineExtnameHandler.reset();
593 PP.RemovePragmaHandler(
"OPENCL", OpenCLExtensionHandler.get());
594 OpenCLExtensionHandler.reset();
595 PP.RemovePragmaHandler(
"OPENCL", FPContractHandler.get());
597 PP.RemovePragmaHandler(OpenMPHandler.get());
598 OpenMPHandler.reset();
600 PP.RemovePragmaHandler(OpenACCHandler.get());
601 OpenACCHandler.reset();
606 PP.RemovePragmaHandler(MSCommentHandler.get());
607 MSCommentHandler.reset();
610 PP.RemovePragmaHandler(
"clang", PCSectionHandler.get());
611 PCSectionHandler.reset();
613 PP.RemovePragmaHandler(FloatControlHandler.get());
614 FloatControlHandler.reset();
616 PP.RemovePragmaHandler(MSDetectMismatchHandler.get());
617 MSDetectMismatchHandler.reset();
618 PP.RemovePragmaHandler(MSPointersToMembers.get());
619 MSPointersToMembers.reset();
620 PP.RemovePragmaHandler(MSVtorDisp.get());
622 PP.RemovePragmaHandler(MSInitSeg.get());
624 PP.RemovePragmaHandler(MSDataSeg.get());
626 PP.RemovePragmaHandler(MSBSSSeg.get());
628 PP.RemovePragmaHandler(MSConstSeg.get());
630 PP.RemovePragmaHandler(MSCodeSeg.get());
632 PP.RemovePragmaHandler(MSSection.get());
634 PP.RemovePragmaHandler(MSStrictGuardStackCheck.get());
635 MSStrictGuardStackCheck.reset();
636 PP.RemovePragmaHandler(MSFunction.get());
638 PP.RemovePragmaHandler(MSAllocText.get());
640 PP.RemovePragmaHandler(MSRuntimeChecks.get());
641 MSRuntimeChecks.reset();
642 PP.RemovePragmaHandler(MSIntrinsic.get());
644 PP.RemovePragmaHandler(MSOptimize.get());
646 PP.RemovePragmaHandler(MSFenvAccess.get());
647 MSFenvAccess.reset();
651 PP.RemovePragmaHandler(
"clang", CUDAForceHostDeviceHandler.get());
652 CUDAForceHostDeviceHandler.reset();
655 PP.RemovePragmaHandler(
"STDC", FPContractHandler.get());
656 FPContractHandler.reset();
658 PP.RemovePragmaHandler(
"STDC", STDCFenvAccessHandler.get());
659 STDCFenvAccessHandler.reset();
661 PP.RemovePragmaHandler(
"STDC", STDCFenvRoundHandler.get());
662 STDCFenvRoundHandler.reset();
664 PP.RemovePragmaHandler(
"STDC", STDCCXLIMITHandler.get());
665 STDCCXLIMITHandler.reset();
667 PP.RemovePragmaHandler(
"STDC", STDCUnknownHandler.get());
668 STDCUnknownHandler.reset();
670 PP.RemovePragmaHandler(
"clang", OptimizeHandler.get());
671 OptimizeHandler.reset();
673 PP.RemovePragmaHandler(
"clang", LoopHintHandler.get());
674 LoopHintHandler.reset();
676 PP.RemovePragmaHandler(UnrollHintHandler.get());
677 PP.RemovePragmaHandler(
"GCC", UnrollHintHandler.get());
678 UnrollHintHandler.reset();
680 PP.RemovePragmaHandler(NoUnrollHintHandler.get());
681 PP.RemovePragmaHandler(
"GCC", NoUnrollHintHandler.get());
682 NoUnrollHintHandler.reset();
684 PP.RemovePragmaHandler(UnrollAndJamHintHandler.get());
685 UnrollAndJamHintHandler.reset();
687 PP.RemovePragmaHandler(NoUnrollAndJamHintHandler.get());
688 NoUnrollAndJamHintHandler.reset();
690 PP.RemovePragmaHandler(
"clang", FPHandler.get());
693 PP.RemovePragmaHandler(
"clang", AttributePragmaHandler.get());
694 AttributePragmaHandler.reset();
696 PP.RemovePragmaHandler(
"clang", MaxTokensHerePragmaHandler.get());
697 MaxTokensHerePragmaHandler.reset();
699 PP.RemovePragmaHandler(
"clang", MaxTokensTotalPragmaHandler.get());
700 MaxTokensTotalPragmaHandler.reset();
703 PP.RemovePragmaHandler(ExportHandler.get());
704 ExportHandler.reset();
708 PP.RemovePragmaHandler(
"clang", RISCVPragmaHandler.get());
709 RISCVPragmaHandler.reset();
713void Parser::HandlePragmaUnused() {
714 assert(Tok.is(tok::annot_pragma_unused));
715 SourceLocation UnusedLoc = ConsumeAnnotationToken();
716 Actions.ActOnPragmaUnused(Tok,
getCurScope(), UnusedLoc);
720void Parser::HandlePragmaVisibility() {
721 assert(Tok.is(tok::annot_pragma_vis));
722 const IdentifierInfo *VisType =
723 static_cast<IdentifierInfo *
>(Tok.getAnnotationValue());
724 SourceLocation VisLoc = ConsumeAnnotationToken();
725 Actions.ActOnPragmaVisibility(VisType, VisLoc);
728void Parser::HandlePragmaPack() {
729 assert(Tok.is(tok::annot_pragma_pack));
730 Sema::PragmaPackInfo *Info =
731 static_cast<Sema::PragmaPackInfo *
>(Tok.getAnnotationValue());
732 SourceLocation PragmaLoc = Tok.getLocation();
735 Alignment = Actions.ActOnNumericConstant(Info->
Alignment);
737 ConsumeAnnotationToken();
745 ConsumeAnnotationToken();
748void Parser::HandlePragmaMSStruct() {
749 assert(Tok.is(tok::annot_pragma_msstruct));
751 reinterpret_cast<uintptr_t>(Tok.getAnnotationValue()));
752 Actions.ActOnPragmaMSStruct(Kind);
753 ConsumeAnnotationToken();
756void Parser::HandlePragmaAlign() {
757 assert(Tok.is(tok::annot_pragma_align));
759 reinterpret_cast<uintptr_t>(Tok.getAnnotationValue()));
760 Actions.ActOnPragmaOptionsAlign(Kind, Tok.getLocation());
763 ConsumeAnnotationToken();
766void Parser::HandlePragmaDump() {
767 assert(Tok.is(tok::annot_pragma_dump));
768 ConsumeAnnotationToken();
769 if (Tok.is(tok::eod)) {
770 PP.Diag(Tok, diag::warn_pragma_debug_missing_argument) <<
"dump";
772 if (Tok.isNot(tok::identifier)) {
773 PP.Diag(Tok, diag::warn_pragma_debug_unexpected_argument);
775 ExpectAndConsume(tok::eod);
778 IdentifierInfo *II = Tok.getIdentifierInfo();
779 Actions.ActOnPragmaDump(
getCurScope(), Tok.getLocation(), II);
782 SourceLocation StartLoc = Tok.getLocation();
783 EnterExpressionEvaluationContext Ctx(
789 PP.Diag(StartLoc, diag::warn_pragma_debug_dependent_argument)
791 << SourceRange(StartLoc, Tok.getLocation());
793 Actions.ActOnPragmaDump(E.
get());
797 ExpectAndConsume(tok::eod);
800void Parser::HandlePragmaWeak() {
801 assert(Tok.is(tok::annot_pragma_weak));
802 SourceLocation PragmaLoc = ConsumeAnnotationToken();
803 Actions.ActOnPragmaWeakID(Tok.getIdentifierInfo(), PragmaLoc,
808void Parser::HandlePragmaWeakAlias() {
809 assert(Tok.is(tok::annot_pragma_weakalias));
810 SourceLocation PragmaLoc = ConsumeAnnotationToken();
811 IdentifierInfo *WeakName = Tok.getIdentifierInfo();
812 SourceLocation WeakNameLoc = Tok.getLocation();
814 IdentifierInfo *AliasName = Tok.getIdentifierInfo();
815 SourceLocation AliasNameLoc = Tok.getLocation();
817 Actions.ActOnPragmaWeakAlias(WeakName, AliasName, PragmaLoc,
818 WeakNameLoc, AliasNameLoc);
822void Parser::HandlePragmaRedefineExtname() {
823 assert(Tok.is(tok::annot_pragma_redefine_extname));
824 SourceLocation RedefLoc = ConsumeAnnotationToken();
825 IdentifierInfo *RedefName = Tok.getIdentifierInfo();
826 SourceLocation RedefNameLoc = Tok.getLocation();
828 IdentifierInfo *AliasName = Tok.getIdentifierInfo();
829 SourceLocation AliasNameLoc = Tok.getLocation();
831 Actions.ActOnPragmaRedefineExtname(RedefName, AliasName, RedefLoc,
832 RedefNameLoc, AliasNameLoc);
835void Parser::HandlePragmaFPContract() {
836 assert(Tok.is(tok::annot_pragma_fp_contract));
839 reinterpret_cast<uintptr_t>(Tok.getAnnotationValue()));
859 SourceLocation PragmaLoc = ConsumeAnnotationToken();
860 Actions.ActOnPragmaFPContract(PragmaLoc, FPC);
863void Parser::HandlePragmaFloatControl() {
864 assert(Tok.is(tok::annot_pragma_float_control));
875 SourceLocation PragmaLoc = ConsumeAnnotationToken();
876 Actions.ActOnPragmaFloatControl(PragmaLoc, Action, Kind);
879void Parser::HandlePragmaFEnvAccess() {
880 assert(Tok.is(tok::annot_pragma_fenv_access) ||
881 Tok.is(tok::annot_pragma_fenv_access_ms));
884 reinterpret_cast<uintptr_t>(Tok.getAnnotationValue()));
899 SourceLocation PragmaLoc = ConsumeAnnotationToken();
900 Actions.ActOnPragmaFEnvAccess(PragmaLoc, IsEnabled);
903void Parser::HandlePragmaFEnvRound() {
904 assert(Tok.is(tok::annot_pragma_fenv_round));
905 auto RM =
static_cast<llvm::RoundingMode
>(
906 reinterpret_cast<uintptr_t>(Tok.getAnnotationValue()));
908 SourceLocation PragmaLoc = ConsumeAnnotationToken();
909 Actions.ActOnPragmaFEnvRound(PragmaLoc, RM);
912void Parser::HandlePragmaCXLimitedRange() {
913 assert(Tok.is(tok::annot_pragma_cx_limited_range));
915 reinterpret_cast<uintptr_t>(Tok.getAnnotationValue()));
933 SourceLocation PragmaLoc = ConsumeAnnotationToken();
934 Actions.ActOnPragmaCXLimitedRange(PragmaLoc, Range);
939 assert(Tok.is(tok::annot_pragma_captured));
940 ConsumeAnnotationToken();
942 if (Tok.isNot(tok::l_brace)) {
943 PP.Diag(Tok, diag::err_expected) << tok::l_brace;
947 SourceLocation Loc = Tok.getLocation();
955 CapturedRegionScope.Exit();
958 Actions.ActOnCapturedRegionError();
962 return Actions.ActOnCapturedRegionEnd(
R.get());
966 enum OpenCLExtState :
char {
967 Disable, Enable, Begin, End
969 typedef std::pair<const IdentifierInfo *, OpenCLExtState> OpenCLExtData;
972void Parser::HandlePragmaOpenCLExtension() {
973 assert(Tok.is(tok::annot_pragma_opencl_extension));
974 OpenCLExtData *
Data =
static_cast<OpenCLExtData*
>(Tok.getAnnotationValue());
975 auto State =
Data->second;
976 auto Ident =
Data->first;
977 SourceLocation NameLoc = Tok.getLocation();
978 ConsumeAnnotationToken();
980 auto &Opt = Actions.getOpenCLOptions();
981 auto Name = Ident->getName();
986 if (State == Disable)
989 PP.Diag(NameLoc, diag::warn_pragma_expected_predicate) << 1;
990 }
else if (State == Begin) {
991 if (!Opt.isKnown(Name) || !Opt.isSupported(Name,
getLangOpts())) {
995 Opt.acceptsPragma(Name);
997 }
else if (State == End) {
1000 }
else if (!Opt.isKnown(Name) || !Opt.isWithPragma(Name))
1001 PP.Diag(NameLoc, diag::warn_pragma_unknown_extension) << Ident;
1002 else if (Opt.isSupportedExtension(Name,
getLangOpts()))
1003 Opt.enable(Name, State == Enable);
1004 else if (Opt.isSupportedCoreOrOptionalCore(Name,
getLangOpts()))
1005 PP.Diag(NameLoc, diag::warn_pragma_extension_is_core) << Ident;
1007 PP.Diag(NameLoc, diag::warn_pragma_unsupported_extension) << Ident;
1010void Parser::HandlePragmaMSPointersToMembers() {
1011 assert(Tok.is(tok::annot_pragma_ms_pointers_to_members));
1014 reinterpret_cast<uintptr_t>(Tok.getAnnotationValue()));
1015 SourceLocation PragmaLoc = ConsumeAnnotationToken();
1016 Actions.ActOnPragmaMSPointersToMembers(RepresentationMethod, PragmaLoc);
1019void Parser::HandlePragmaMSVtorDisp() {
1020 assert(Tok.is(tok::annot_pragma_ms_vtordisp));
1025 SourceLocation PragmaLoc = ConsumeAnnotationToken();
1026 Actions.ActOnPragmaMSVtorDisp(Action, PragmaLoc, Mode);
1029void Parser::HandlePragmaMSPragma() {
1030 assert(Tok.is(tok::annot_pragma_ms_pragma));
1033 (std::pair<std::unique_ptr<Token[]>,
size_t> *)Tok.getAnnotationValue();
1034 PP.EnterTokenStream(std::move(TheTokens->first), TheTokens->second,
true,
1036 SourceLocation PragmaLocation = ConsumeAnnotationToken();
1037 assert(Tok.isAnyIdentifier());
1038 StringRef PragmaName = Tok.getIdentifierInfo()->getName();
1043 typedef bool (
Parser::*PragmaHandler)(StringRef, SourceLocation);
1044 PragmaHandler Handler =
1045 llvm::StringSwitch<PragmaHandler>(PragmaName)
1046 .Case(
"data_seg", &Parser::HandlePragmaMSSegment)
1047 .Case(
"bss_seg", &Parser::HandlePragmaMSSegment)
1048 .Case(
"const_seg", &Parser::HandlePragmaMSSegment)
1049 .Case(
"code_seg", &Parser::HandlePragmaMSSegment)
1050 .Case(
"section", &Parser::HandlePragmaMSSection)
1051 .Case(
"init_seg", &Parser::HandlePragmaMSInitSeg)
1052 .Case(
"strict_gs_check", &Parser::HandlePragmaMSStrictGuardStackCheck)
1053 .Case(
"function", &Parser::HandlePragmaMSFunction)
1054 .Case(
"alloc_text", &Parser::HandlePragmaMSAllocText)
1055 .Case(
"optimize", &Parser::HandlePragmaMSOptimize)
1056 .Case(
"intrinsic", &Parser::HandlePragmaMSIntrinsic);
1058 if (!(this->*Handler)(PragmaName, PragmaLocation)) {
1061 while (Tok.isNot(tok::eof))
1067bool Parser::HandlePragmaMSSection(StringRef PragmaName,
1069 if (Tok.isNot(tok::l_paren)) {
1070 PP.Diag(PragmaLocation, diag::warn_pragma_expected_lparen) << PragmaName;
1075 if (Tok.isNot(tok::string_literal)) {
1076 PP.Diag(PragmaLocation, diag::warn_pragma_expected_section_name)
1085 PP.Diag(PragmaLocation, diag::warn_pragma_expected_non_wide_string)
1090 bool SectionFlagsAreDefault =
true;
1091 while (Tok.is(tok::comma)) {
1096 if (Tok.is(tok::kw_long) || Tok.is(tok::kw_short)) {
1101 if (!Tok.isAnyIdentifier()) {
1102 PP.Diag(PragmaLocation, diag::warn_pragma_expected_action_or_r_paren)
1107 llvm::StringSwitch<ASTContext::PragmaSectionFlag>(
1108 Tok.getIdentifierInfo()->getName())
1120 ? diag::warn_pragma_invalid_specific_action
1121 : diag::warn_pragma_unsupported_action)
1122 << PragmaName << Tok.getIdentifierInfo()->getName();
1125 SectionFlags |= Flag;
1126 SectionFlagsAreDefault =
false;
1131 if (SectionFlagsAreDefault)
1133 if (Tok.isNot(tok::r_paren)) {
1134 PP.Diag(PragmaLocation, diag::warn_pragma_expected_rparen) << PragmaName;
1138 if (Tok.isNot(tok::eof)) {
1139 PP.Diag(PragmaLocation, diag::warn_pragma_extra_tokens_at_eol)
1144 Actions.ActOnPragmaMSSection(PragmaLocation, SectionFlags, SegmentName);
1148bool Parser::HandlePragmaMSSegment(StringRef PragmaName,
1150 if (Tok.isNot(tok::l_paren)) {
1151 PP.Diag(PragmaLocation, diag::warn_pragma_expected_lparen) << PragmaName;
1156 StringRef SlotLabel;
1157 if (Tok.isAnyIdentifier()) {
1158 StringRef PushPop = Tok.getIdentifierInfo()->getName();
1159 if (PushPop ==
"push")
1161 else if (PushPop ==
"pop")
1164 PP.Diag(PragmaLocation,
1165 diag::warn_pragma_expected_section_push_pop_or_name)
1171 if (Tok.is(tok::comma)) {
1174 if (Tok.isAnyIdentifier()) {
1175 SlotLabel = Tok.getIdentifierInfo()->getName();
1177 if (Tok.is(tok::comma))
1179 else if (Tok.isNot(tok::r_paren)) {
1180 PP.Diag(PragmaLocation, diag::warn_pragma_expected_punc)
1185 }
else if (Tok.isNot(tok::r_paren)) {
1186 PP.Diag(PragmaLocation, diag::warn_pragma_expected_punc) << PragmaName;
1192 StringLiteral *SegmentName =
nullptr;
1193 if (Tok.isNot(tok::r_paren)) {
1194 if (Tok.isNot(tok::string_literal)) {
1196 diag::warn_pragma_expected_section_name :
1197 diag::warn_pragma_expected_section_label_or_name :
1198 diag::warn_pragma_expected_section_push_pop_or_name;
1199 PP.Diag(PragmaLocation, DiagID) << PragmaName;
1207 PP.Diag(PragmaLocation, diag::warn_pragma_expected_non_wide_string)
1215 if (Tok.isNot(tok::r_paren)) {
1216 PP.Diag(PragmaLocation, diag::warn_pragma_expected_rparen) << PragmaName;
1220 if (Tok.isNot(tok::eof)) {
1221 PP.Diag(PragmaLocation, diag::warn_pragma_extra_tokens_at_eol)
1226 Actions.ActOnPragmaMSSeg(PragmaLocation, Action, SlotLabel,
1227 SegmentName, PragmaName);
1231bool Parser::HandlePragmaMSInitSeg(StringRef PragmaName,
1234 PP.Diag(PragmaLocation, diag::warn_pragma_init_seg_unsupported_target);
1238 if (ExpectAndConsume(tok::l_paren, diag::warn_pragma_expected_lparen,
1243 StringLiteral *SegmentName =
nullptr;
1244 if (Tok.isAnyIdentifier()) {
1245 auto *II = Tok.getIdentifierInfo();
1246 StringRef Section = llvm::StringSwitch<StringRef>(II->
getName())
1247 .Case(
"compiler",
"\".CRT$XCC\"")
1248 .Case(
"lib",
"\".CRT$XCL\"")
1249 .Case(
"user",
"\".CRT$XCU\"")
1252 if (!Section.empty()) {
1256 Token::create(tok::string_literal, Tok.getLocation(), Section.size());
1262 }
else if (Tok.is(tok::string_literal)) {
1268 PP.Diag(PragmaLocation, diag::warn_pragma_expected_non_wide_string)
1276 PP.Diag(PragmaLocation, diag::warn_pragma_expected_init_seg) << PragmaName;
1280 if (ExpectAndConsume(tok::r_paren, diag::warn_pragma_expected_rparen,
1282 ExpectAndConsume(tok::eof, diag::warn_pragma_extra_tokens_at_eol,
1286 Actions.ActOnPragmaMSInitSeg(PragmaLocation, SegmentName);
1290bool Parser::HandlePragmaMSStrictGuardStackCheck(
1292 if (ExpectAndConsume(tok::l_paren, diag::warn_pragma_expected_lparen,
1297 if (Tok.is(tok::identifier)) {
1298 StringRef PushPop = Tok.getIdentifierInfo()->getName();
1299 if (PushPop ==
"push") {
1302 if (ExpectAndConsume(tok::comma, diag::warn_pragma_expected_punc,
1305 }
else if (PushPop ==
"pop") {
1313 const IdentifierInfo *II = Tok.getIdentifierInfo();
1314 if (II && II->
isStr(
"off")) {
1317 }
else if (II && II->
isStr(
"on")) {
1321 PP.Diag(Tok.getLocation(), diag::warn_pragma_invalid_action)
1328 if (ExpectAndConsume(tok::r_paren, diag::warn_pragma_expected_rparen,
1332 if (ExpectAndConsume(tok::eof, diag::warn_pragma_extra_tokens_at_eol,
1336 Actions.ActOnPragmaMSStrictGuardStackCheck(PragmaLocation, Action,
Value);
1340bool Parser::HandlePragmaMSAllocText(StringRef PragmaName,
1342 Token FirstTok = Tok;
1343 if (ExpectAndConsume(tok::l_paren, diag::warn_pragma_expected_lparen,
1348 if (Tok.is(tok::string_literal)) {
1354 PP.Diag(PragmaLocation, diag::warn_pragma_expected_non_wide_string)
1359 }
else if (Tok.is(tok::identifier)) {
1360 Section = Tok.getIdentifierInfo()->getName();
1363 PP.Diag(PragmaLocation, diag::warn_pragma_expected_section_name)
1368 if (ExpectAndConsume(tok::comma, diag::warn_pragma_expected_comma,
1372 SmallVector<std::tuple<IdentifierInfo *, SourceLocation>> Functions;
1374 if (Tok.isNot(tok::identifier)) {
1375 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_identifier)
1380 IdentifierInfo *II = Tok.getIdentifierInfo();
1381 Functions.emplace_back(II, Tok.getLocation());
1384 if (Tok.isNot(tok::comma))
1389 if (ExpectAndConsume(tok::r_paren, diag::warn_pragma_expected_rparen,
1391 ExpectAndConsume(tok::eof, diag::warn_pragma_extra_tokens_at_eol,
1395 Actions.ActOnPragmaMSAllocText(FirstTok.
getLocation(), Section, Functions);
1400 assert(Tok.is(PragmaKind));
1402 StringRef PragmaName =
"export";
1404 using namespace clang::charinfo;
1405 auto *TheTokens =
static_cast<std::pair<std::unique_ptr<Token[]>,
size_t> *>(
1406 Tok.getAnnotationValue());
1407 PP.EnterTokenStream(std::move(TheTokens->first), TheTokens->second,
true,
1409 Tok.setAnnotationValue(
nullptr);
1410 ConsumeAnnotationToken();
1412 llvm::scope_exit OnReturn([
this]() {
1413 while (Tok.isNot(tok::eof))
1420 if (Tok.isNot(tok::l_paren)) {
1421 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_lparen)
1427 if (Tok.isNot(tok::identifier)) {
1428 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_identifier)
1433 IdentifierInfo *IdentName = Tok.getIdentifierInfo();
1434 SourceLocation IdentNameLoc = Tok.getLocation();
1437 if (Tok.isNot(tok::r_paren)) {
1438 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_rparen)
1444 Actions.ActOnPragmaExport(IdentName, IdentNameLoc,
getCurScope());
1447 if (Tok.is(tok::identifier) || Tok.is(tok::kw_export)) {
1448 PragmaName = Tok.getIdentifierInfo()->getName();
1449 if (PragmaName !=
"export")
1450 PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
1452 }
else if (Tok.isNot(tok::eof)) {
1453 PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
1457 }
while (Tok.isNot(tok::eof));
1461void Parser::HandlePragmaExport() {
1462 assert(Tok.is(tok::annot_pragma_export));
1464 zOSHandlePragmaHelper(tok::annot_pragma_export);
1469 std::string ClangLoopStr(
"clang loop ");
1472 return std::string(llvm::StringSwitch<StringRef>(Str)
1473 .Case(
"loop", ClangLoopStr)
1474 .Case(
"unroll_and_jam", Str)
1475 .Case(
"unroll", Str)
1479bool Parser::HandlePragmaLoopHint(
LoopHint &Hint) {
1480 assert(Tok.is(tok::annot_pragma_loop_hint));
1481 PragmaLoopHintInfo *Info =
1482 static_cast<PragmaLoopHintInfo *
>(Tok.getAnnotationValue());
1490 IdentifierInfo *OptionInfo = Info->
Option.
is(tok::identifier)
1496 llvm::ArrayRef<Token> Toks = Info->
Toks;
1501 llvm::StringSwitch<bool>(PragmaNameInfo->
getName())
1502 .Cases({
"unroll",
"nounroll",
"unroll_and_jam",
"nounroll_and_jam"},
1506 if (Toks.empty() && IsLoopHint) {
1507 ConsumeAnnotationToken();
1514 assert(!Toks.empty() &&
1515 "PragmaLoopHintInfo::Toks must contain at least one token.");
1518 bool OptionUnroll =
false;
1519 bool OptionUnrollAndJam =
false;
1520 bool OptionDistribute =
false;
1521 bool OptionPipelineDisabled =
false;
1522 bool OptionLICMDisabled =
false;
1523 bool StateOption =
false;
1525 OptionUnroll = OptionInfo->
isStr(
"unroll");
1526 OptionUnrollAndJam = OptionInfo->
isStr(
"unroll_and_jam");
1527 OptionDistribute = OptionInfo->
isStr(
"distribute");
1528 OptionPipelineDisabled = OptionInfo->
isStr(
"pipeline");
1529 OptionLICMDisabled = OptionInfo->
isStr(
"licm");
1530 StateOption = llvm::StringSwitch<bool>(OptionInfo->
getName())
1531 .Case(
"vectorize",
true)
1532 .Case(
"interleave",
true)
1533 .Case(
"vectorize_predicate",
true)
1535 OptionUnroll || OptionUnrollAndJam || OptionDistribute ||
1536 OptionPipelineDisabled || OptionLICMDisabled;
1539 bool AssumeSafetyArg = !OptionUnroll && !OptionUnrollAndJam &&
1540 !OptionDistribute && !OptionPipelineDisabled &&
1541 !OptionLICMDisabled;
1543 if (Toks[0].
is(tok::eof)) {
1544 ConsumeAnnotationToken();
1545 Diag(Toks[0].getLocation(), diag::err_pragma_loop_missing_argument)
1547 << (OptionUnroll || OptionUnrollAndJam)
1554 ConsumeAnnotationToken();
1555 SourceLocation StateLoc = Toks[0].getLocation();
1556 IdentifierInfo *StateInfo = Toks[0].getIdentifierInfo();
1560 llvm::StringSwitch<bool>(StateInfo->
getName())
1561 .Case(
"disable",
true)
1562 .Case(
"enable", !OptionPipelineDisabled && !OptionLICMDisabled)
1563 .Case(
"full", OptionUnroll || OptionUnrollAndJam)
1564 .Case(
"assume_safety", AssumeSafetyArg)
1567 if (OptionPipelineDisabled || OptionLICMDisabled) {
1568 Diag(Toks[0].getLocation(), diag::err_pragma_pipeline_invalid_keyword);
1570 Diag(Toks[0].getLocation(), diag::err_pragma_invalid_keyword)
1571 << (OptionUnroll || OptionUnrollAndJam)
1576 if (Toks.size() > 2)
1577 Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
1579 Hint.
StateLoc =
new (Actions.Context) IdentifierLoc(StateLoc, StateInfo);
1580 }
else if (OptionInfo && OptionInfo->
getName() ==
"vectorize_width") {
1581 PP.EnterTokenStream(Toks,
false,
1583 ConsumeAnnotationToken();
1585 SourceLocation StateLoc = Toks[0].getLocation();
1586 IdentifierInfo *StateInfo = Toks[0].getIdentifierInfo();
1587 StringRef IsScalableStr = StateInfo ? StateInfo->
getName() :
"";
1590 if (IsScalableStr ==
"scalable" || IsScalableStr ==
"fixed") {
1593 if (Toks.size() > 2) {
1594 Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
1596 while (Tok.isNot(tok::eof))
1600 Hint.
StateLoc =
new (Actions.Context) IdentifierLoc(StateLoc, StateInfo);
1607 if (
R.isInvalid() && !Tok.is(tok::comma))
1608 Diag(Toks[0].getLocation(),
1609 diag::note_pragma_loop_invalid_vectorize_option);
1611 bool Arg2Error =
false;
1612 if (Tok.is(tok::comma)) {
1615 StateInfo = Tok.getIdentifierInfo();
1616 IsScalableStr = StateInfo ? StateInfo->
getName() :
"";
1618 if (IsScalableStr !=
"scalable" && IsScalableStr !=
"fixed") {
1619 Diag(Tok.getLocation(),
1620 diag::err_pragma_loop_invalid_vectorize_option);
1624 new (Actions.Context) IdentifierLoc(StateLoc, StateInfo);
1631 if (Tok.isNot(tok::eof)) {
1632 Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
1634 while (Tok.isNot(tok::eof))
1640 if (Arg2Error ||
R.isInvalid() ||
1641 Actions.CheckLoopHintExpr(
R.get(), Toks[0].getLocation(),
1650 PP.EnterTokenStream(Toks,
false,
1652 ConsumeAnnotationToken();
1657 if (Tok.isNot(tok::eof)) {
1658 Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
1660 while (Tok.isNot(tok::eof))
1666 if (
R.isInvalid() ||
1667 Actions.CheckLoopHintExpr(
R.get(), Toks[0].getLocation(),
1676 Info->
Toks.back().getLocation());
1681struct PragmaAttributeInfo {
1682 enum ActionType { Push,
Pop, Attribute };
1683 ParsedAttributes &Attributes;
1685 const IdentifierInfo *
Namespace =
nullptr;
1686 ArrayRef<Token> Tokens;
1688 PragmaAttributeInfo(ParsedAttributes &Attributes) : Attributes(Attributes) {}
1691#include "clang/Parse/AttrSubMatchRulesParserStringSwitches.inc"
1696 if (
Tok.is(tok::identifier))
1697 return Tok.getIdentifierInfo()->getName();
1705 using namespace attr;
1707#define ATTR_MATCH_RULE(Value, Spelling, IsAbstract) \
1710#include "clang/Basic/AttrSubMatchRulesList.inc"
1712 llvm_unreachable(
"Invalid attribute subject match rule");
1720 PRef.
Diag(SubRuleLoc,
1721 diag::err_pragma_attribute_expected_subject_sub_identifier)
1723 if (
const char *SubRules = validAttributeSubjectMatchSubRules(PrimaryRule))
1734 PRef.
Diag(SubRuleLoc, diag::err_pragma_attribute_unknown_subject_sub_rule)
1735 << SubRuleName << PrimaryRuleName;
1736 if (
const char *SubRules = validAttributeSubjectMatchSubRules(PrimaryRule))
1742bool Parser::ParsePragmaAttributeSubjectMatchRuleSet(
1750 if (AnyParens.expectAndConsume())
1758 Diag(Tok, diag::err_pragma_attribute_expected_subject_identifier);
1761 std::pair<std::optional<attr::SubjectMatchRule>,
1762 std::optional<attr::SubjectMatchRule> (*)(StringRef,
bool)>
1763 Rule = isAttributeSubjectMatchRule(Name);
1765 Diag(Tok, diag::err_pragma_attribute_unknown_subject_rule) << Name;
1773 if (
Parens.expectAndConsume())
1775 }
else if (
Parens.consumeOpen()) {
1776 if (!SubjectMatchRules
1778 std::make_pair(PrimaryRule, SourceRange(RuleLoc, RuleLoc)))
1780 Diag(RuleLoc, diag::err_pragma_attribute_duplicate_subject)
1783 RuleLoc, Tok.is(tok::comma) ? Tok.getLocation() : RuleLoc));
1784 LastMatchRuleEndLoc = RuleLoc;
1790 if (SubRuleName.empty()) {
1796 if (SubRuleName ==
"unless") {
1799 if (
Parens.expectAndConsume())
1802 if (SubRuleName.empty()) {
1807 auto SubRuleOrNone =
Rule.second(SubRuleName,
true);
1808 if (!SubRuleOrNone) {
1809 std::string SubRuleUnlessName =
"unless(" + SubRuleName.str() +
")";
1811 SubRuleUnlessName, SubRuleLoc);
1814 SubRule = *SubRuleOrNone;
1816 if (
Parens.consumeClose())
1819 auto SubRuleOrNone =
Rule.second(SubRuleName,
false);
1820 if (!SubRuleOrNone) {
1822 SubRuleName, Tok.getLocation());
1825 SubRule = *SubRuleOrNone;
1828 SourceLocation RuleEndLoc = Tok.getLocation();
1829 LastMatchRuleEndLoc = RuleEndLoc;
1830 if (
Parens.consumeClose())
1832 if (!SubjectMatchRules
1833 .insert(std::make_pair(SubRule, SourceRange(RuleLoc, RuleEndLoc)))
1835 Diag(RuleLoc, diag::err_pragma_attribute_duplicate_subject)
1838 RuleLoc, Tok.is(tok::comma) ? Tok.getLocation() : RuleEndLoc));
1844 if (AnyParens.consumeClose())
1853enum class MissingAttributeSubjectRulesRecoveryPoint {
1861MissingAttributeSubjectRulesRecoveryPoint
1862getAttributeSubjectRulesRecoveryPointForToken(
const Token &
Tok) {
1864 if (II->
isStr(
"apply_to"))
1865 return MissingAttributeSubjectRulesRecoveryPoint::ApplyTo;
1866 if (II->
isStr(
"any"))
1867 return MissingAttributeSubjectRulesRecoveryPoint::Any;
1869 if (
Tok.
is(tok::equal))
1870 return MissingAttributeSubjectRulesRecoveryPoint::Equals;
1871 return MissingAttributeSubjectRulesRecoveryPoint::None;
1879 MissingAttributeSubjectRulesRecoveryPoint Point,
Parser &PRef) {
1885 MissingAttributeSubjectRulesRecoveryPoint EndPoint =
1886 getAttributeSubjectRulesRecoveryPointForToken(PRef.
getCurToken());
1887 if (Point == MissingAttributeSubjectRulesRecoveryPoint::Comma)
1889 if (Point <= MissingAttributeSubjectRulesRecoveryPoint::ApplyTo &&
1890 EndPoint > MissingAttributeSubjectRulesRecoveryPoint::ApplyTo)
1891 FixIt +=
"apply_to";
1892 if (Point <= MissingAttributeSubjectRulesRecoveryPoint::Equals &&
1893 EndPoint > MissingAttributeSubjectRulesRecoveryPoint::Equals)
1896 if (EndPoint == MissingAttributeSubjectRulesRecoveryPoint::None) {
1903 Attribute.getMatchRules(PRef.
getLangOpts(), MatchRules);
1905 for (
const auto &Rule : MatchRules) {
1910 IsSupported[
Rule.first] =
true;
1912 IsMatchRuleAvailable &= IsSupported;
1914 if (IsMatchRuleAvailable.count() == 0) {
1920 bool NeedsComma =
false;
1922 if (!IsMatchRuleAvailable[I])
1936 if (FixItRange.getBegin() == FixItRange.getEnd())
1946void Parser::HandlePragmaAttribute() {
1947 assert(Tok.is(tok::annot_pragma_attribute) &&
1948 "Expected #pragma attribute annotation token");
1949 SourceLocation PragmaLoc = Tok.getLocation();
1950 auto *Info =
static_cast<PragmaAttributeInfo *
>(Tok.getAnnotationValue());
1951 if (Info->Action == PragmaAttributeInfo::Pop) {
1952 ConsumeAnnotationToken();
1953 Actions.ActOnPragmaAttributePop(PragmaLoc, Info->Namespace);
1957 assert((Info->Action == PragmaAttributeInfo::Push ||
1958 Info->Action == PragmaAttributeInfo::Attribute) &&
1959 "Unexpected #pragma attribute command");
1961 if (Info->Action == PragmaAttributeInfo::Push && Info->Tokens.empty()) {
1962 ConsumeAnnotationToken();
1963 Actions.ActOnPragmaAttributeEmptyPush(PragmaLoc, Info->Namespace);
1967 PP.EnterTokenStream(Info->Tokens,
false,
1969 ConsumeAnnotationToken();
1971 ParsedAttributes &Attrs = Info->Attributes;
1974 auto SkipToEnd = [
this]() {
1979 if ((Tok.is(tok::l_square) &&
NextToken().
is(tok::l_square)) ||
1980 Tok.isRegularKeywordAttribute()) {
1982 SourceLocation EndLoc = Tok.getLocation();
1983 ParseCXX11AttributeSpecifier(Attrs, &EndLoc);
1984 }
else if (Tok.is(tok::kw___attribute)) {
1986 if (ExpectAndConsume(tok::l_paren, diag::err_expected_lparen_after,
1989 if (ExpectAndConsume(tok::l_paren, diag::err_expected_lparen_after,
"("))
1994 if (Tok.is(tok::code_completion)) {
1997 Actions.CodeCompletion().CodeCompleteAttribute(
2004 if (Tok.isNot(tok::identifier)) {
2005 Diag(Tok, diag::err_pragma_attribute_expected_attribute_name);
2009 IdentifierInfo *
AttrName = Tok.getIdentifierInfo();
2012 if (Tok.isNot(tok::l_paren))
2013 Attrs.
addNew(AttrName, AttrNameLoc, AttributeScopeInfo(),
nullptr, 0,
2014 ParsedAttr::Form::GNU());
2016 ParseGNUAttributeArgs(AttrName, AttrNameLoc, Attrs,
nullptr,
2019 ParsedAttr::Form::GNU(),
2023 if (ExpectAndConsume(tok::r_paren))
2025 if (ExpectAndConsume(tok::r_paren))
2027 }
else if (Tok.is(tok::kw___declspec)) {
2028 ParseMicrosoftDeclSpecs(Attrs);
2030 Diag(Tok, diag::err_pragma_attribute_expected_attribute_syntax);
2031 if (Tok.getIdentifierInfo()) {
2035 Tok.getIdentifierInfo(),
nullptr,
2037 SourceLocation InsertStartLoc = Tok.getLocation();
2039 if (Tok.is(tok::l_paren)) {
2042 if (Tok.isNot(tok::r_paren))
2045 Diag(Tok, diag::note_pragma_attribute_use_attribute_kw)
2054 if (Attrs.
empty() || Attrs.
begin()->isInvalid()) {
2059 for (
const ParsedAttr &Attribute : Attrs) {
2060 if (!Attribute.isSupportedByPragmaAttribute()) {
2061 Diag(PragmaLoc, diag::err_pragma_attribute_unsupported_attribute)
2070 createExpectedAttributeSubjectRulesTokenDiagnostic(
2071 diag::err_expected, Attrs,
2072 MissingAttributeSubjectRulesRecoveryPoint::Comma, *
this)
2078 if (Tok.isNot(tok::identifier)) {
2079 createExpectedAttributeSubjectRulesTokenDiagnostic(
2080 diag::err_pragma_attribute_invalid_subject_set_specifier, Attrs,
2081 MissingAttributeSubjectRulesRecoveryPoint::ApplyTo, *
this);
2085 const IdentifierInfo *II = Tok.getIdentifierInfo();
2086 if (!II->
isStr(
"apply_to")) {
2087 createExpectedAttributeSubjectRulesTokenDiagnostic(
2088 diag::err_pragma_attribute_invalid_subject_set_specifier, Attrs,
2089 MissingAttributeSubjectRulesRecoveryPoint::ApplyTo, *
this);
2096 createExpectedAttributeSubjectRulesTokenDiagnostic(
2097 diag::err_expected, Attrs,
2098 MissingAttributeSubjectRulesRecoveryPoint::Equals, *
this)
2105 SourceLocation AnyLoc, LastMatchRuleEndLoc;
2106 if (ParsePragmaAttributeSubjectMatchRuleSet(SubjectMatchRules, AnyLoc,
2107 LastMatchRuleEndLoc)) {
2114 if (Tok.isNot(tok::eof)) {
2115 Diag(Tok, diag::err_pragma_attribute_extra_tokens_after_attribute);
2124 if (Info->Action == PragmaAttributeInfo::Push)
2125 Actions.ActOnPragmaAttributeEmptyPush(PragmaLoc, Info->Namespace);
2127 for (ParsedAttr &Attribute : Attrs) {
2128 Actions.ActOnPragmaAttributeAttribute(Attribute, PragmaLoc,
2136void PragmaGCCVisibilityHandler::HandlePragma(
Preprocessor &PP,
2147 if (PushPop && PushPop->
isStr(
"pop")) {
2149 }
else if (PushPop && PushPop->
isStr(
"push")) {
2182 auto Toks = std::make_unique<Token[]>(1);
2184 tok::annot_pragma_vis,
SourceRange(VisLoc, EndLoc),
2185 const_cast<void *
>(
static_cast<const void *
>(VisType)));
2186 PP.EnterTokenStream(std::move(Toks), 1,
true,
2208 StringRef SlotLabel;
2212 if (
Tok.
is(tok::numeric_constant)) {
2223 }
else if (
Tok.
is(tok::identifier)) {
2225 auto MapPack = [&](
const char *
Literal) {
2228 Alignment.
setKind(tok::numeric_constant);
2234 if (II->
isStr(
"show")) {
2254 if (II->
isStr(
"push")) {
2256 }
else if (II->
isStr(
"pop")) {
2264 if (
Tok.
is(tok::comma)) {
2267 if (
Tok.
is(tok::numeric_constant)) {
2272 }
else if (
Tok.
is(tok::identifier)) {
2276 if (
Tok.
is(tok::comma)) {
2279 if (
Tok.
isNot(tok::numeric_constant)) {
2326 static_cast<void *
>(Info));
2327 PP.EnterTokenStream(Toks,
true,
2333void PragmaMSStructHandler::HandlePragma(
Preprocessor &PP,
2335 Token &MSStructTok) {
2346 if (II->
isStr(
"on")) {
2350 else if (II->
isStr(
"off") || II->
isStr(
"reset"))
2366 tok::annot_pragma_msstruct,
2368 reinterpret_cast<void *
>(
static_cast<uintptr_t>(Kind)));
2369 PP.EnterTokenStream(Toks,
true,
2374void PragmaClangSectionHandler::HandlePragma(
Preprocessor &PP,
2376 Token &FirstToken) {
2384 PP.
Diag(
Tok.
getLocation(), diag::err_pragma_expected_clang_section_name) <<
"clang section";
2389 if (SecType->
isStr(
"bss"))
2391 else if (SecType->
isStr(
"data"))
2393 else if (SecType->
isStr(
"rodata"))
2395 else if (SecType->
isStr(
"relro"))
2397 else if (SecType->
isStr(
"text"))
2400 PP.
Diag(
Tok.
getLocation(), diag::err_pragma_expected_clang_section_name) <<
"clang section";
2412 std::string SecName;
2416 Actions.ActOnPragmaClangSection(PragmaLocation,
2433 if (
Tok.isNot(tok::identifier) ||
2434 !
Tok.getIdentifierInfo()->isStr(
"align")) {
2435 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_options_expected_align);
2442 if (
Tok.isNot(tok::l_paren)) {
2443 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_expected_lparen) <<
"align";
2446 }
else if (
Tok.isNot(tok::equal)) {
2447 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_align_expected_equal)
2453 if (
Tok.isNot(tok::identifier)) {
2454 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_expected_identifier)
2455 << (IsOptions ?
"options" :
"align");
2461 if (II->
isStr(
"native"))
2463 else if (II->
isStr(
"natural"))
2465 else if (II->
isStr(
"packed"))
2467 else if (II->
isStr(
"power"))
2469 else if (II->
isStr(
"mac68k"))
2471 else if (II->
isStr(
"reset"))
2474 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_align_invalid_option)
2481 if (
Tok.isNot(tok::r_paren)) {
2482 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_expected_rparen) <<
"align";
2489 if (
Tok.isNot(tok::eod)) {
2490 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
2491 << (IsOptions ?
"options" :
"align");
2499 reinterpret_cast<void *
>(
static_cast<uintptr_t>(Kind)));
2500 PP.EnterTokenStream(Toks,
true,
2510void PragmaOptionsHandler::HandlePragma(
Preprocessor &PP,
2512 Token &OptionsTok) {
2517void PragmaUnusedHandler::HandlePragma(
Preprocessor &PP,
2540 if (
Tok.
is(tok::identifier)) {
2541 Identifiers.push_back(
Tok);
2552 if (
Tok.
is(tok::comma)) {
2557 if (
Tok.
is(tok::r_paren)) {
2575 assert(RParenLoc.
isValid() &&
"Valid '#pragma unused' must have ')'");
2576 assert(!Identifiers.empty() &&
"Valid '#pragma unused' must have arguments");
2585 2 * Identifiers.size());
2586 for (
unsigned i=0; i != Identifiers.size(); i++) {
2587 Token &pragmaUnusedTok = Toks[2*i], &idTok = Toks[2*i+1];
2590 idTok = Identifiers[i];
2592 PP.EnterTokenStream(Toks,
true,
2611 bool HasAlias =
false;
2615 if (
Tok.
is(tok::equal)) {
2635 Token &pragmaUnusedTok = Toks[0];
2640 Toks[2] = AliasName;
2641 PP.EnterTokenStream(Toks,
true,
2646 Token &pragmaUnusedTok = Toks[0];
2649 PP.EnterTokenStream(Toks,
true,
2655void PragmaRedefineExtnameHandler::HandlePragma(
Preprocessor &PP,
2657 Token &RedefToken) {
2673 <<
"redefine_extname";
2688 Token &pragmaRedefTok = Toks[0];
2692 Toks[1] = RedefName;
2693 Toks[2] = AliasName;
2694 PP.EnterTokenStream(Toks,
true,
2698void PragmaFPContractHandler::HandlePragma(
Preprocessor &PP,
2709 reinterpret_cast<void *
>(
static_cast<uintptr_t>(OOS)));
2710 PP.EnterTokenStream(Toks,
true,
2714void PragmaOpenCLExtensionHandler::HandlePragma(
Preprocessor &PP,
2739 OpenCLExtState State;
2740 if (Pred->
isStr(
"enable")) {
2742 }
else if (Pred->
isStr(
"disable")) {
2744 }
else if (Pred->
isStr(
"begin"))
2746 else if (Pred->
isStr(
"end"))
2750 << Ext->
isStr(
"all");
2764 Info->second = State;
2769 static_cast<void *
>(Info));
2770 PP.EnterTokenStream(Toks,
true,
2780template <diag::kind IgnoredDiag>
2781void PragmaNoSupportHandler<IgnoredDiag>::HandlePragma(
2784 PP.
Diag(FirstTok, IgnoredDiag);
2795void PragmaSupportHandler<StartTok, EndTok, UnexpectedDiag>::HandlePragma(
2801 Pragma.push_back(
Tok);
2803 if (
Tok.
is(StartTok)) {
2804 PP.
Diag(
Tok, UnexpectedDiag) << 0;
2805 unsigned InnerPragmaCnt = 1;
2806 while (InnerPragmaCnt != 0) {
2808 if (
Tok.
is(StartTok))
2810 else if (
Tok.
is(EndTok))
2818 Pragma.push_back(
Tok);
2820 auto Toks = std::make_unique<Token[]>(Pragma.size());
2821 std::copy(Pragma.begin(), Pragma.end(), Toks.get());
2822 PP.EnterTokenStream(std::move(Toks), Pragma.size(),
2834void PragmaMSPointersToMembers::HandlePragma(
Preprocessor &PP,
2840 PP.
Diag(PointersToMembersLoc, diag::warn_pragma_expected_lparen)
2841 <<
"pointers_to_members";
2848 <<
"pointers_to_members";
2854 if (Arg->
isStr(
"best_case")) {
2857 if (Arg->
isStr(
"full_generality")) {
2858 if (
Tok.
is(tok::comma)) {
2864 diag::err_pragma_pointers_to_members_unknown_kind)
2869 }
else if (
Tok.
is(tok::r_paren)) {
2876 <<
"full_generality";
2882 if (Arg->
isStr(
"single_inheritance")) {
2883 RepresentationMethod =
2885 }
else if (Arg->
isStr(
"multiple_inheritance")) {
2886 RepresentationMethod =
2888 }
else if (Arg->
isStr(
"virtual_inheritance")) {
2889 RepresentationMethod =
2893 diag::err_pragma_pointers_to_members_unknown_kind)
2902 << (Arg ? Arg->
getName() :
"full_generality");
2910 <<
"pointers_to_members";
2915 tok::annot_pragma_ms_pointers_to_members,
2917 reinterpret_cast<void *
>(
static_cast<uintptr_t>(RepresentationMethod)));
2934 PP.
Diag(VtorDispLoc, diag::warn_pragma_expected_lparen) <<
"vtordisp";
2942 if (II->
isStr(
"push")) {
2946 PP.
Diag(VtorDispLoc, diag::warn_pragma_expected_punc) <<
"vtordisp";
2952 }
else if (II->
isStr(
"pop")) {
2959 if (
Tok.
is(tok::r_paren)) {
2969 if (II && II->
isStr(
"off")) {
2972 }
else if (II && II->
isStr(
"on")) {
2975 }
else if (
Tok.
is(tok::numeric_constant) &&
2979 << 0 << 2 <<
"vtordisp";
2991 PP.
Diag(VtorDispLoc, diag::warn_pragma_expected_rparen) <<
"vtordisp";
3004 tok::annot_pragma_ms_vtordisp,
SourceRange(VtorDispLoc, EndLoc),
3005 reinterpret_cast<void *
>(
3020 TokenVector.push_back(
Tok);
3024 TokenVector.push_back(EoF);
3027 markAsReinjectedForRelexing(TokenVector);
3028 auto TokenArray = std::make_unique<Token[]>(TokenVector.size());
3029 std::copy(TokenVector.begin(), TokenVector.end(), TokenArray.get());
3031 std::pair<std::unique_ptr<Token[]>,
size_t>(std::move(TokenArray),
3032 TokenVector.size());
3048void PragmaFloatControlHandler::HandlePragma(
Preprocessor &PP,
3061 PP.
Diag(FloatControlLoc, diag::err_expected) << tok::l_paren;
3075 llvm::StringSwitch<PragmaFloatControlKind>(II->
getName())
3093 if (
Tok.
is(tok::r_paren))
3106 if (PushOnOff ==
"on")
3109 else if (PushOnOff ==
"off") {
3114 }
else if (PushOnOff ==
"push") {
3121 if (
Tok.
is(tok::comma)) {
3128 if (ExpectedPush ==
"push") {
3153 auto TokenArray = std::make_unique<Token[]>(1);
3157 tok::annot_pragma_float_control,
SourceRange(FloatControlLoc, EndLoc),
3158 reinterpret_cast<void *
>(
3159 static_cast<uintptr_t>((Action << 16) | (Kind & 0xFFFF))));
3160 PP.EnterTokenStream(std::move(TokenArray), 1,
3174void PragmaDetectMismatchHandler::HandlePragma(
Preprocessor &PP,
3180 PP.
Diag(DetectMismatchLoc, diag::err_expected) << tok::l_paren;
3185 std::string NameString;
3187 "pragma detect_mismatch",
3192 std::string ValueString;
3218 Actions.ActOnPragmaDetectMismatch(DetectMismatchLoc, NameString, ValueString);
3232void PragmaCommentHandler::HandlePragma(
Preprocessor &PP,
3238 PP.
Diag(CommentLoc, diag::err_pragma_comment_malformed);
3245 PP.
Diag(CommentLoc, diag::err_pragma_comment_malformed);
3252 llvm::StringSwitch<PragmaMSCommentKind>(II->
getName())
3281 if (SeenCopyrightInTU) {
3287 SeenCopyrightInTU =
true;
3292 std::string ArgumentString;
3324 Actions.ActOnPragmaMSComment(CommentLoc, Kind, ArgumentString);
3329void PragmaOptimizeHandler::HandlePragma(
Preprocessor &PP,
3331 Token &FirstToken) {
3334 if (
Tok.
is(tok::eod)) {
3336 <<
"clang optimize" <<
true <<
"'on' or 'off'";
3347 if (II->
isStr(
"on")) {
3349 }
else if (!II->
isStr(
"off")) {
3362 Actions.ActOnPragmaOptimize(IsOn, FirstToken.
getLocation());
3367struct TokFPAnnotValue {
3368 enum FlagValues {
On,
Off, Fast };
3370 std::optional<LangOptions::FPModeKind> ContractValue;
3371 std::optional<LangOptions::FPModeKind> ReassociateValue;
3372 std::optional<LangOptions::FPModeKind> ReciprocalValue;
3373 std::optional<LangOptions::FPExceptionModeKind> ExceptionsValue;
3374 std::optional<LangOptions::FPEvalMethodKind> EvalMethodValue;
3392 while (
Tok.
is(tok::identifier)) {
3396 llvm::StringSwitch<std::optional<PragmaFPKind>>(OptionInfo->
getName())
3402 .Default(std::nullopt);
3405 <<
false << OptionInfo;
3416 bool isEvalMethodDouble =
3420 if (
Tok.
isNot(tok::identifier) && !isEvalMethodDouble) {
3423 <<
static_cast<int>(*FlagKind);
3429 AnnotValue->ContractValue =
3430 llvm::StringSwitch<std::optional<LangOptions::FPModeKind>>(
3435 .Default(std::nullopt);
3436 if (!AnnotValue->ContractValue) {
3443 : AnnotValue->ReciprocalValue;
3444 Value = llvm::StringSwitch<std::optional<LangOptions::FPModeKind>>(
3448 .Default(std::nullopt);
3455 AnnotValue->ExceptionsValue =
3456 llvm::StringSwitch<std::optional<LangOptions::FPExceptionModeKind>>(
3461 .Default(std::nullopt);
3462 if (!AnnotValue->ExceptionsValue) {
3468 AnnotValue->EvalMethodValue =
3469 llvm::StringSwitch<std::optional<LangOptions::FPEvalMethodKind>>(
3474 .Default(std::nullopt);
3475 if (!AnnotValue->EvalMethodValue) {
3499 reinterpret_cast<void *
>(AnnotValue));
3500 TokenList.push_back(FPTok);
3502 auto TokenArray = std::make_unique<Token[]>(TokenList.size());
3503 std::copy(TokenList.begin(), TokenList.end(), TokenArray.get());
3505 PP.EnterTokenStream(std::move(TokenArray), TokenList.size(),
3509void PragmaSTDC_FENV_ROUNDHandler::HandlePragma(
Preprocessor &PP,
3528 llvm::StringSwitch<llvm::RoundingMode>(II->
getName())
3529 .Case(
"FE_TOWARDZERO", llvm::RoundingMode::TowardZero)
3530 .Case(
"FE_TONEAREST", llvm::RoundingMode::NearestTiesToEven)
3531 .Case(
"FE_UPWARD", llvm::RoundingMode::TowardPositive)
3532 .Case(
"FE_DOWNWARD", llvm::RoundingMode::TowardNegative)
3533 .Case(
"FE_TONEARESTFROMZERO", llvm::RoundingMode::NearestTiesToAway)
3534 .Case(
"FE_DYNAMIC", llvm::RoundingMode::Dynamic)
3535 .Default(llvm::RoundingMode::Invalid);
3536 if (RM == llvm::RoundingMode::Invalid) {
3544 <<
"STDC FENV_ROUND";
3555 reinterpret_cast<void *
>(
static_cast<uintptr_t>(RM)));
3556 PP.EnterTokenStream(Toks,
true,
3560void Parser::HandlePragmaFP() {
3561 assert(Tok.is(tok::annot_pragma_fp));
3563 reinterpret_cast<TokFPAnnotValue *
>(Tok.getAnnotationValue());
3565 if (AnnotValue->ReassociateValue)
3566 Actions.ActOnPragmaFPValueChangingOption(
3570 if (AnnotValue->ReciprocalValue)
3571 Actions.ActOnPragmaFPValueChangingOption(
3575 if (AnnotValue->ContractValue)
3576 Actions.ActOnPragmaFPContract(Tok.getLocation(),
3577 *AnnotValue->ContractValue);
3578 if (AnnotValue->ExceptionsValue)
3579 Actions.ActOnPragmaFPExceptions(Tok.getLocation(),
3580 *AnnotValue->ExceptionsValue);
3581 if (AnnotValue->EvalMethodValue)
3582 Actions.ActOnPragmaFPEvalMethod(Tok.getLocation(),
3583 *AnnotValue->EvalMethodValue);
3584 ConsumeAnnotationToken();
3589 Token Option,
bool ValueInParens,
3592 int OpenParens = ValueInParens ? 1 : 0;
3594 while (
Tok.isNot(tok::eod)) {
3595 if (
Tok.is(tok::l_paren))
3597 else if (
Tok.is(tok::r_paren)) {
3599 if (OpenParens == 0 && ValueInParens)
3607 if (ValueInParens) {
3609 if (
Tok.isNot(tok::r_paren)) {
3610 PP.
Diag(
Tok.getLocation(), diag::err_expected) << tok::r_paren;
3675void PragmaLoopHintHandler::HandlePragma(
Preprocessor &PP,
3690 while (
Tok.
is(tok::identifier)) {
3694 bool OptionValid = llvm::StringSwitch<bool>(OptionInfo->
getName())
3695 .Case(
"vectorize",
true)
3696 .Case(
"interleave",
true)
3697 .Case(
"unroll",
true)
3698 .Case(
"distribute",
true)
3699 .Case(
"vectorize_predicate",
true)
3700 .Case(
"vectorize_width",
true)
3701 .Case(
"interleave_count",
true)
3702 .Case(
"unroll_count",
true)
3703 .Case(
"pipeline",
true)
3704 .Case(
"pipeline_initiation_interval",
true)
3709 <<
false << OptionInfo;
3728 tok::annot_pragma_loop_hint,
3730 static_cast<void *
>(Info));
3731 TokenList.push_back(LoopHintTok);
3740 auto TokenArray = std::make_unique<Token[]>(TokenList.size());
3741 std::copy(TokenList.begin(), TokenList.end(), TokenArray.get());
3743 PP.EnterTokenStream(std::move(TokenArray), TokenList.size(),
3768void PragmaUnrollHintHandler::HandlePragma(
Preprocessor &PP,
3776 if (
Tok.
is(tok::eod)) {
3778 Info->PragmaName = PragmaName;
3779 Info->Option.startToken();
3789 bool ValueInParens =
Tok.
is(tok::l_paren);
3801 PP.
Diag(Info->Toks[0].getLocation(),
3802 diag::warn_pragma_unroll_cuda_value_in_parens);
3812 auto TokenArray = std::make_unique<Token[]>(1);
3814 tok::annot_pragma_loop_hint,
3816 static_cast<void *
>(Info));
3817 PP.EnterTokenStream(std::move(TokenArray), 1,
3821bool Parser::HandlePragmaMSFunction(StringRef PragmaName,
3823 Token FirstTok = Tok;
3825 if (ExpectAndConsume(tok::l_paren, diag::warn_pragma_expected_lparen,
3829 bool SuggestIntrinH = !PP.isMacroDefined(
"__INTRIN_H");
3831 llvm::SmallVector<StringRef> NoBuiltins;
3832 while (Tok.is(tok::identifier)) {
3833 IdentifierInfo *II = Tok.getIdentifierInfo();
3835 PP.Diag(Tok.getLocation(), diag::warn_pragma_intrinsic_builtin)
3836 << II << SuggestIntrinH;
3838 NoBuiltins.emplace_back(II->
getName());
3841 if (Tok.isNot(tok::comma))
3846 if (ExpectAndConsume(tok::r_paren, diag::warn_pragma_expected_rparen,
3848 ExpectAndConsume(tok::eof, diag::warn_pragma_extra_tokens_at_eol,
3852 Actions.ActOnPragmaMSFunction(FirstTok.
getLocation(), NoBuiltins);
3856bool Parser::HandlePragmaMSOptimize(StringRef PragmaName,
3858 Token FirstTok = Tok;
3859 if (ExpectAndConsume(tok::l_paren, diag::warn_pragma_expected_lparen,
3863 if (Tok.isNot(tok::string_literal)) {
3864 PP.Diag(PragmaLocation, diag::warn_pragma_expected_string) << PragmaName;
3872 PP.Diag(PragmaLocation, diag::warn_pragma_expected_non_wide_string)
3877 if (ExpectAndConsume(tok::comma, diag::warn_pragma_expected_comma,
3881 if (Tok.is(tok::eof) || Tok.is(tok::r_paren)) {
3882 PP.Diag(PragmaLocation, diag::warn_pragma_missing_argument)
3883 << PragmaName <<
true <<
"'on' or 'off'";
3886 IdentifierInfo *II = Tok.getIdentifierInfo();
3887 if (!II || (!II->
isStr(
"on") && !II->
isStr(
"off"))) {
3888 PP.Diag(PragmaLocation, diag::warn_pragma_invalid_argument)
3889 << PP.getSpelling(Tok) << PragmaName <<
true
3893 bool IsOn = II->
isStr(
"on");
3896 if (ExpectAndConsume(tok::r_paren, diag::warn_pragma_expected_rparen,
3901 if (!OptimizationList->
getString().empty()) {
3902 PP.Diag(PragmaLocation, diag::warn_pragma_invalid_argument)
3903 << OptimizationList->
getString() << PragmaName <<
true
3908 if (ExpectAndConsume(tok::eof, diag::warn_pragma_extra_tokens_at_eol,
3912 Actions.ActOnPragmaMSOptimize(FirstTok.
getLocation(), IsOn);
3929bool Parser::HandlePragmaMSIntrinsic(StringRef PragmaName,
3931 if (ExpectAndConsume(tok::l_paren, diag::warn_pragma_expected_lparen,
3935 bool SuggestIntrinH = !PP.isMacroDefined(
"__INTRIN_H");
3937 while (Tok.is(tok::identifier)) {
3938 IdentifierInfo *II = Tok.getIdentifierInfo();
3940 PP.Diag(Tok.getLocation(), diag::warn_pragma_intrinsic_builtin)
3941 << II << SuggestIntrinH;
3943 DeclarationNameInfo NameInfo(II, Tok.getLocation());
3946 Actions.LookupName(
Previous, Actions.getCurScope(),
3949 Actions.LazilyCreateBuiltin(II, II->
getBuiltinID(), Actions.getCurScope(),
3950 true, Tok.getLocation());
3952 if (Tok.isNot(tok::comma))
3956 if (ExpectAndConsume(tok::r_paren, diag::warn_pragma_expected_rparen,
3960 if (ExpectAndConsume(tok::eof, diag::warn_pragma_extra_tokens_at_eol,
3966void PragmaForceCUDAHostDeviceHandler::HandlePragma(
3972 if (!Info || (!Info->
isStr(
"begin") && !Info->
isStr(
"end"))) {
3974 diag::warn_pragma_force_cuda_host_device_bad_arg);
3978 if (Info->
isStr(
"begin"))
3979 Actions.CUDA().PushForceHostDevice();
3980 else if (!Actions.CUDA().PopForceHostDevice())
3982 diag::err_pragma_cannot_end_force_cuda_host_device);
3985 if (!
Tok.
is(tok::eod))
3987 diag::warn_pragma_force_cuda_host_device_bad_arg);
4017void PragmaAttributeHandler::HandlePragma(
Preprocessor &PP,
4019 Token &FirstToken) {
4023 PragmaAttributeInfo(AttributesForPragmaAttribute);
4026 if (
Tok.
is(tok::identifier)) {
4028 if (!II->
isStr(
"push") && !II->
isStr(
"pop")) {
4029 Info->Namespace = II;
4032 if (!
Tok.
is(tok::period)) {
4041 if (!
Tok.
isOneOf(tok::identifier, tok::l_paren)) {
4043 diag::err_pragma_attribute_expected_push_pop_paren);
4048 if (
Tok.
is(tok::l_paren)) {
4049 if (Info->Namespace) {
4051 diag::err_pragma_attribute_namespace_on_attribute);
4053 diag::note_pragma_attribute_namespace_on_attribute);
4056 Info->Action = PragmaAttributeInfo::Attribute;
4059 if (II->
isStr(
"push"))
4060 Info->Action = PragmaAttributeInfo::Push;
4061 else if (II->
isStr(
"pop"))
4062 Info->Action = PragmaAttributeInfo::Pop;
4073 if ((Info->Action == PragmaAttributeInfo::Push &&
Tok.
isNot(tok::eod)) ||
4074 Info->Action == PragmaAttributeInfo::Attribute) {
4085 if (
Tok.
is(tok::l_paren))
4087 else if (
Tok.
is(tok::r_paren)) {
4089 if (OpenParens == 0)
4093 AttributeTokens.push_back(
Tok);
4097 if (AttributeTokens.empty()) {
4110 AttributeTokens.push_back(EOFTok);
4112 markAsReinjectedForRelexing(AttributeTokens);
4119 <<
"clang attribute";
4122 auto TokenArray = std::make_unique<Token[]>(1);
4125 static_cast<void *
>(Info));
4126 PP.EnterTokenStream(std::move(TokenArray), 1,
4131void PragmaMaxTokensHereHandler::HandlePragma(
Preprocessor &PP,
4135 if (
Tok.
is(tok::eod)) {
4137 <<
"clang max_tokens_here" <<
true <<
"integer";
4143 if (
Tok.
isNot(tok::numeric_constant) ||
4146 <<
"clang max_tokens_here";
4152 <<
"clang max_tokens_here";
4157 PP.
Diag(Loc, diag::warn_max_tokens)
4163void PragmaMaxTokensTotalHandler::HandlePragma(
Preprocessor &PP,
4167 if (
Tok.
is(tok::eod)) {
4169 <<
"clang max_tokens_total" <<
true <<
"integer";
4175 if (
Tok.
isNot(tok::numeric_constant) ||
4178 <<
"clang max_tokens_total";
4184 <<
"clang max_tokens_total";
4196 for (;
Tok.isNot(tok::eod); PP.
Lex(
Tok)) {
4197 TokenVector.push_back(
Tok);
4202 TokenVector.push_back(EoF);
4205 markAsReinjectedForRelexing(TokenVector);
4206 auto TokenArray = std::make_unique<Token[]>(TokenVector.size());
4207 std::copy(TokenVector.begin(), TokenVector.end(), TokenArray.get());
4209 std::pair<std::unique_ptr<Token[]>,
size_t>(std::move(TokenArray),
4210 TokenVector.size());
4216void PragmaExportHandler::HandlePragma(
Preprocessor &PP,
4218 Token &FirstToken) {
4227 Token &FirstToken) {
4232 if (!II || !II->
isStr(
"intrinsic")) {
4240 if (!II || !(II->
isStr(
"vector") || II->
isStr(
"sifive_vector") ||
4241 II->
isStr(
"andes_vector"))) {
4244 <<
"'vector', 'sifive_vector' or 'andes_vector'";
4251 <<
"clang riscv intrinsic";
4255 if (II->
isStr(
"vector"))
4256 Actions.RISCV().DeclareRVVBuiltins =
true;
4257 else if (II->
isStr(
"sifive_vector"))
4258 Actions.RISCV().DeclareSiFiveVectorBuiltins =
true;
4259 else if (II->
isStr(
"andes_vector"))
4260 Actions.RISCV().DeclareAndesVectorBuiltins =
true;
Defines the clang::ASTContext interface.
static StringRef getTriple(const Command &Job)
static void ParseAlignPragma(Preprocessor &PP, Token &FirstTok, bool IsOptions)
static void diagnoseUnknownAttributeSubjectSubRule(Parser &PRef, attr::SubjectMatchRule PrimaryRule, StringRef PrimaryRuleName, StringRef SubRuleName, SourceLocation SubRuleLoc)
static void zOSPragmaHandlerHelper(Preprocessor &PP, Token &Tok, tok::TokenKind TokKind)
static bool ParseLoopHintValue(Preprocessor &PP, Token &Tok, Token PragmaName, Token Option, bool ValueInParens, PragmaLoopHintInfo &Info)
Parses loop or unroll pragma hint value and fills in Info.
static void diagnoseExpectedAttributeSubjectSubRule(Parser &PRef, attr::SubjectMatchRule PrimaryRule, StringRef PrimaryRuleName, SourceLocation SubRuleLoc)
static bool isAbstractAttrMatcherRule(attr::SubjectMatchRule Rule)
static StringRef getIdentifier(const Token &Tok)
static std::string PragmaLoopHintString(Token PragmaName, Token Option)
Defines the clang::Preprocessor interface.
ArrayRef< SVal > ValueList
@ NotForRedeclaration
The lookup is a reference to this name that is not for the purpose of redeclaring the name.
This file declares semantic analysis for CUDA constructs.
This file declares facilities that support code completion.
This file declares semantic analysis functions specific to RISC-V.
Kind getParsedKind() const
static CharSourceRange getCharRange(SourceRange R)
A little helper class used to produce diagnostics.
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine a...
void setSeverity(diag::kind Diag, diag::Severity Map, SourceLocation Loc)
This allows the client to specify that certain warnings are ignored.
bool isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
EmptyPragmaHandler - A pragma handler which takes no action, which can be used to ignore particular p...
bool isTypeDependent() const
Determines whether the type of this expression depends on.
bool containsErrors() const
Whether this expression contains subexpressions which had errors.
ExprDependence getDependence() const
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string.
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code string at a specific location.
One of these records is kept for each identifier that is lexed.
unsigned getBuiltinID() const
Return a value indicating whether this is a builtin function.
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
StringRef getName() const
Return the actual identifier string.
@ FEM_Extended
Use extended type for fp arithmetic.
@ FEM_Double
Use the type double for fp arithmetic.
@ FEM_Source
Use the declared type for fp arithmetic.
ComplexRangeKind
Controls the various implementations for complex multiplication and.
@ CX_Full
Implementation of complex division and multiplication using a call to runtime library functions(gener...
@ CX_Basic
Implementation of complex division and multiplication using algebraic formulas at source precision.
PragmaMSPointersToMembersKind
@ PPTMK_FullGeneralityMultipleInheritance
@ PPTMK_FullGeneralityVirtualInheritance
@ PPTMK_FullGeneralitySingleInheritance
@ FPE_Strict
Strictly preserve the floating-point exception semantics.
@ FPE_MayTrap
Transformations do not cause new exceptions but may hide some.
@ FPE_Ignore
Assume that floating-point exceptions are masked.
virtual void PragmaComment(SourceLocation Loc, const IdentifierInfo *Kind, StringRef Str)
Callback invoked when a #pragma comment directive is read.
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.
virtual void PragmaDetectMismatch(SourceLocation Loc, StringRef Name, StringRef Value)
Callback invoked when a #pragma detect_mismatch directive is read.
ParsedAttr - Represents a syntactic attribute.
ParsedAttributes - A collection of parsed attributes.
ParsedAttr * addNew(IdentifierInfo *attrName, SourceRange attrRange, AttributeScopeInfo scope, ArgsUnion *args, unsigned numArgs, ParsedAttr::Form form, SourceLocation ellipsisLoc=SourceLocation())
Add attribute with expression arguments.
ParseScope - Introduces a new scope for parsing.
Parser - This implements a parser for the C family of languages.
DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
SourceLocation getEndOfPreviousToken() const
ExprResult ParseStringLiteralExpression(bool AllowUserDefinedLiteral=false)
ParseStringLiteralExpression - This handles the various token types that form string literals,...
SourceLocation ConsumeToken()
ConsumeToken - Consume the current 'peek token' and lex the next one.
Parser(Preprocessor &PP, Sema &Actions, bool SkipFunctionBodies)
SourceLocation ConsumeAnyToken(bool ConsumeCodeCompletionTok=false)
ConsumeAnyToken - Dispatch to the right Consume* method based on the current token type.
ExprResult ParseConstantExpression()
bool TryConsumeToken(tok::TokenKind Expected)
Scope * getCurScope() const
const TargetInfo & getTargetInfo() const
bool SkipUntil(tok::TokenKind T, SkipUntilFlags Flags=static_cast< SkipUntilFlags >(0))
SkipUntil - Read tokens until we get to the specified token, then consume it (unless StopBeforeMatch ...
const Token & getCurToken() const
const LangOptions & getLangOpts() const
ExprResult ParseExpression(TypoCorrectionTypeBehavior CorrectionBehavior=TypoCorrectionTypeBehavior::AllowNonTypes)
Simple precedence-based parser for binary/ternary operators.
@ StopBeforeMatch
Stop skipping at specified token, but don't skip the token itself.
const Token & NextToken()
NextToken - This peeks ahead one token and returns it without consuming it.
friend class BalancedDelimiterTracker
PragmaHandler - Instances of this interface defined to handle the various pragmas that the language f...
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
void EnterToken(const Token &Tok, bool IsReinject)
Enters a token in the token stream to be lexed next.
PPCallbacks * getPPCallbacks() const
SourceRange DiscardUntilEndOfDirective(SmallVectorImpl< Token > *DiscardedToks=nullptr)
Read and discard all tokens remaining on the current line until the tok::eod token is found.
void overrideMaxTokens(unsigned Value, SourceLocation Loc)
void Lex(Token &Result)
Lex the next token for this preprocessor.
bool LexOnOffSwitch(tok::OnOffSwitch &Result)
Lex an on-off-switch (C99 6.10.6p2) and verify that it is followed by EOD.
unsigned getTokenCount() const
Get the number of tokens processed so far.
const TargetInfo & getTargetInfo() const
bool parseSimpleIntegerLiteral(Token &Tok, uint64_t &Value)
Parses a simple integer literal to get its numeric value.
void LexUnexpandedToken(Token &Result)
Just like Lex, but disables macro expansion of identifier tokens.
llvm::BumpPtrAllocator & getPreprocessorAllocator()
StringRef getSpelling(SourceLocation loc, SmallVectorImpl< char > &buffer, bool *invalid=nullptr) const
Return the 'spelling' of the token at the given location; does not go up to the spelling location or ...
const LangOptions & getLangOpts() const
DiagnosticsEngine & getDiagnostics() const
DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID) const
Forwarding function for diagnostics.
bool LexStringLiteral(Token &Result, std::string &String, const char *DiagnosticTag, bool AllowMacroExpansion)
Lex a string literal, which may be the concatenation of multiple string literals and may even come fr...
@ CompoundStmtScope
This is a compound statement scope.
@ FnScope
This indicates that the scope corresponds to a function, which means that labels are set here.
@ DeclScope
This is a scope that can contain a declaration.
Sema - This implements semantic analysis and AST building for C.
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
unsigned getLength() const
StringRef getString() const
unsigned getCharByteWidth() const
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
virtual bool hasStrictFP() const
Determine whether constrained floating point is supported on this target.
Token - This structure provides full information about a lexed token.
IdentifierInfo * getIdentifierInfo() const
void setLiteralData(const char *Ptr)
bool isAnyIdentifier() const
Return true if this is a raw identifier (when lexing in raw mode) or a non-keyword identifier (when l...
void setAnnotationEndLoc(SourceLocation L)
static Token create(tok::TokenKind Kind, SourceLocation Loc, unsigned Length=0)
SourceLocation getLocation() const
Return a source location identifier for the specified offset in the current file.
void setLength(unsigned Len)
void setKind(tok::TokenKind K)
static Token createEof(SourceLocation Loc=SourceLocation(), const void *Data=nullptr)
bool is(tok::TokenKind K) const
is/isNot - Predicates to check if this token is a specific kind, as in "if (Tok.is(tok::l_brace)) {....
tok::TokenKind getKind() const
bool isOneOf(Ts... Ks) const
static Token createAnnotation(tok::TokenKind Kind, SourceRange Range, void *Value=nullptr)
bool isNot(tok::TokenKind K) const
void setAnnotationValue(void *val)
void startToken()
Reset all flags to cleared.
Defines the clang::TargetInfo interface.
SubjectMatchRule
A list of all the recognized kinds of attributes.
const char * getSubjectMatchRuleSpelling(SubjectMatchRule Rule)
llvm::DenseMap< int, SourceRange > ParsedSubjectMatchRuleSet
uint32_t Literal
Literals are represented as positive integers.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
@ Ignored
Do not present this diagnostic, ignore it.
@ FixIt
Parse and apply any fixits to the source.
const Regex Rule("(.+)/(.+)\\.framework/")
const char * getKeywordSpelling(TokenKind Kind) LLVM_READNONE
Determines the spelling of simple keyword and contextual keyword tokens like 'int' and 'dynamic_cast'...
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
OnOffSwitch
Defines the possible values of an on-off-switch (C99 6.10.6p2).
Top level wrappers for InstallAPI frontend operations.
@ Default
Set to the current date and time.
const FunctionProtoType * T
MSVtorDispMode
In the Microsoft ABI, this controls the placement of virtual displacement members used to implement v...
@ On
Always emit colors regardless of the output stream.
@ Off
Never emit colors regardless of the output stream.
U cast(CodeGen::Address addr)
ActionResult< Expr * > ExprResult
@ Parens
New-expression has a C++98 paren-delimited initializer.
ActionResult< Stmt * > StmtResult
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
Loop optimization hint for loop and unroll pragmas.
IdentifierLoc * OptionLoc
IdentifierLoc * PragmaNameLoc
Describes how and where the pragma was introduced.
PragmaMsStackAction Action