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 IdentifierLoc *FuncId =
nullptr;
1245 if (Tok.isAnyIdentifier()) {
1246 auto *II = Tok.getIdentifierInfo();
1247 StringRef Section = llvm::StringSwitch<StringRef>(II->
getName())
1248 .Case(
"compiler",
"\".CRT$XCC\"")
1249 .Case(
"lib",
"\".CRT$XCL\"")
1250 .Case(
"user",
"\".CRT$XCU\"")
1253 if (!Section.empty()) {
1257 Token::create(tok::string_literal, Tok.getLocation(), Section.size());
1263 }
else if (Tok.is(tok::string_literal)) {
1269 PP.Diag(PragmaLocation, diag::warn_pragma_expected_non_wide_string)
1276 if (Tok.is(tok::comma)) {
1278 if (Tok.isNot(tok::identifier)) {
1279 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_identifier)
1283 FuncId =
new (Actions.Context)
1284 IdentifierLoc(Tok.getLocation(), Tok.getIdentifierInfo());
1289 PP.Diag(PragmaLocation, diag::warn_pragma_expected_init_seg) << PragmaName;
1293 if (ExpectAndConsume(tok::r_paren, diag::warn_pragma_expected_rparen,
1295 ExpectAndConsume(tok::eof, diag::warn_pragma_extra_tokens_at_eol,
1299 Actions.ActOnPragmaMSInitSeg(PragmaLocation, SegmentName, FuncId);
1303bool Parser::HandlePragmaMSStrictGuardStackCheck(
1305 if (ExpectAndConsume(tok::l_paren, diag::warn_pragma_expected_lparen,
1310 if (Tok.is(tok::identifier)) {
1311 StringRef PushPop = Tok.getIdentifierInfo()->getName();
1312 if (PushPop ==
"push") {
1315 if (ExpectAndConsume(tok::comma, diag::warn_pragma_expected_punc,
1318 }
else if (PushPop ==
"pop") {
1326 const IdentifierInfo *II = Tok.getIdentifierInfo();
1327 if (II && II->
isStr(
"off")) {
1330 }
else if (II && II->
isStr(
"on")) {
1334 PP.Diag(Tok.getLocation(), diag::warn_pragma_invalid_action)
1341 if (ExpectAndConsume(tok::r_paren, diag::warn_pragma_expected_rparen,
1345 if (ExpectAndConsume(tok::eof, diag::warn_pragma_extra_tokens_at_eol,
1349 Actions.ActOnPragmaMSStrictGuardStackCheck(PragmaLocation, Action,
Value);
1353bool Parser::HandlePragmaMSAllocText(StringRef PragmaName,
1355 Token FirstTok = Tok;
1356 if (ExpectAndConsume(tok::l_paren, diag::warn_pragma_expected_lparen,
1361 if (Tok.is(tok::string_literal)) {
1367 PP.Diag(PragmaLocation, diag::warn_pragma_expected_non_wide_string)
1372 }
else if (Tok.is(tok::identifier)) {
1373 Section = Tok.getIdentifierInfo()->getName();
1376 PP.Diag(PragmaLocation, diag::warn_pragma_expected_section_name)
1381 if (ExpectAndConsume(tok::comma, diag::warn_pragma_expected_comma,
1385 SmallVector<std::tuple<IdentifierInfo *, SourceLocation>> Functions;
1387 if (Tok.isNot(tok::identifier)) {
1388 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_identifier)
1393 IdentifierInfo *II = Tok.getIdentifierInfo();
1394 Functions.emplace_back(II, Tok.getLocation());
1397 if (Tok.isNot(tok::comma))
1402 if (ExpectAndConsume(tok::r_paren, diag::warn_pragma_expected_rparen,
1404 ExpectAndConsume(tok::eof, diag::warn_pragma_extra_tokens_at_eol,
1408 Actions.ActOnPragmaMSAllocText(FirstTok.
getLocation(), Section, Functions);
1413 assert(Tok.is(PragmaKind));
1415 StringRef PragmaName =
"export";
1417 using namespace clang::charinfo;
1418 auto *TheTokens =
static_cast<std::pair<std::unique_ptr<Token[]>,
size_t> *>(
1419 Tok.getAnnotationValue());
1420 PP.EnterTokenStream(std::move(TheTokens->first), TheTokens->second,
true,
1422 Tok.setAnnotationValue(
nullptr);
1423 ConsumeAnnotationToken();
1425 llvm::scope_exit OnReturn([
this]() {
1426 while (Tok.isNot(tok::eof))
1433 if (Tok.isNot(tok::l_paren)) {
1434 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_lparen)
1440 if (Tok.isNot(tok::identifier)) {
1441 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_identifier)
1446 IdentifierInfo *IdentName = Tok.getIdentifierInfo();
1447 SourceLocation IdentNameLoc = Tok.getLocation();
1450 if (Tok.isNot(tok::r_paren)) {
1451 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_rparen)
1457 Actions.ActOnPragmaExport(IdentName, IdentNameLoc,
getCurScope());
1460 if (Tok.is(tok::identifier) || Tok.is(tok::kw_export)) {
1461 PragmaName = Tok.getIdentifierInfo()->getName();
1462 if (PragmaName !=
"export")
1463 PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
1465 }
else if (Tok.isNot(tok::eof)) {
1466 PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
1470 }
while (Tok.isNot(tok::eof));
1474void Parser::HandlePragmaExport() {
1475 assert(Tok.is(tok::annot_pragma_export));
1477 zOSHandlePragmaHelper(tok::annot_pragma_export);
1482 std::string ClangLoopStr(
"clang loop ");
1485 return std::string(llvm::StringSwitch<StringRef>(Str)
1486 .Case(
"loop", ClangLoopStr)
1487 .Case(
"unroll_and_jam", Str)
1488 .Case(
"unroll", Str)
1492bool Parser::HandlePragmaLoopHint(
LoopHint &Hint) {
1493 assert(Tok.is(tok::annot_pragma_loop_hint));
1494 PragmaLoopHintInfo *Info =
1495 static_cast<PragmaLoopHintInfo *
>(Tok.getAnnotationValue());
1503 IdentifierInfo *OptionInfo = Info->
Option.
is(tok::identifier)
1509 llvm::ArrayRef<Token> Toks = Info->
Toks;
1514 llvm::StringSwitch<bool>(PragmaNameInfo->
getName())
1515 .Cases({
"unroll",
"nounroll",
"unroll_and_jam",
"nounroll_and_jam"},
1519 if (Toks.empty() && IsLoopHint) {
1520 ConsumeAnnotationToken();
1527 assert(!Toks.empty() &&
1528 "PragmaLoopHintInfo::Toks must contain at least one token.");
1531 bool OptionUnroll =
false;
1532 bool OptionUnrollAndJam =
false;
1533 bool OptionDistribute =
false;
1534 bool OptionPipelineDisabled =
false;
1535 bool OptionLICMDisabled =
false;
1536 bool StateOption =
false;
1538 OptionUnroll = OptionInfo->
isStr(
"unroll");
1539 OptionUnrollAndJam = OptionInfo->
isStr(
"unroll_and_jam");
1540 OptionDistribute = OptionInfo->
isStr(
"distribute");
1541 OptionPipelineDisabled = OptionInfo->
isStr(
"pipeline");
1542 OptionLICMDisabled = OptionInfo->
isStr(
"licm");
1543 StateOption = llvm::StringSwitch<bool>(OptionInfo->
getName())
1544 .Case(
"vectorize",
true)
1545 .Case(
"interleave",
true)
1546 .Case(
"vectorize_predicate",
true)
1548 OptionUnroll || OptionUnrollAndJam || OptionDistribute ||
1549 OptionPipelineDisabled || OptionLICMDisabled;
1552 bool AssumeSafetyArg = !OptionUnroll && !OptionUnrollAndJam &&
1553 !OptionDistribute && !OptionPipelineDisabled &&
1554 !OptionLICMDisabled;
1556 if (Toks[0].
is(tok::eof)) {
1557 ConsumeAnnotationToken();
1558 Diag(Toks[0].getLocation(), diag::err_pragma_loop_missing_argument)
1560 << (OptionUnroll || OptionUnrollAndJam)
1567 ConsumeAnnotationToken();
1568 SourceLocation StateLoc = Toks[0].getLocation();
1569 IdentifierInfo *StateInfo = Toks[0].getIdentifierInfo();
1573 llvm::StringSwitch<bool>(StateInfo->
getName())
1574 .Case(
"disable",
true)
1575 .Case(
"enable", !OptionPipelineDisabled && !OptionLICMDisabled)
1576 .Case(
"full", OptionUnroll || OptionUnrollAndJam)
1577 .Case(
"assume_safety", AssumeSafetyArg)
1580 if (OptionPipelineDisabled || OptionLICMDisabled) {
1581 Diag(Toks[0].getLocation(), diag::err_pragma_pipeline_invalid_keyword);
1583 Diag(Toks[0].getLocation(), diag::err_pragma_invalid_keyword)
1584 << (OptionUnroll || OptionUnrollAndJam)
1589 if (Toks.size() > 2)
1590 Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
1592 Hint.
StateLoc =
new (Actions.Context) IdentifierLoc(StateLoc, StateInfo);
1593 }
else if (OptionInfo && OptionInfo->
getName() ==
"vectorize_width") {
1594 PP.EnterTokenStream(Toks,
false,
1596 ConsumeAnnotationToken();
1598 SourceLocation StateLoc = Toks[0].getLocation();
1599 IdentifierInfo *StateInfo = Toks[0].getIdentifierInfo();
1600 StringRef IsScalableStr = StateInfo ? StateInfo->
getName() :
"";
1603 if (IsScalableStr ==
"scalable" || IsScalableStr ==
"fixed") {
1606 if (Toks.size() > 2) {
1607 Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
1609 while (Tok.isNot(tok::eof))
1613 Hint.
StateLoc =
new (Actions.Context) IdentifierLoc(StateLoc, StateInfo);
1620 if (
R.isInvalid() && !Tok.is(tok::comma))
1621 Diag(Toks[0].getLocation(),
1622 diag::note_pragma_loop_invalid_vectorize_option);
1624 bool Arg2Error =
false;
1625 if (Tok.is(tok::comma)) {
1628 const Token Arg2 = Tok;
1631 if (StateInfo->
isStr(
"scalable") || StateInfo->
isStr(
"fixed"))
1633 new (Actions.Context) IdentifierLoc(StateLoc, StateInfo);
1639 diag::err_pragma_loop_invalid_vectorize_option);
1645 if (Tok.isNot(tok::eof)) {
1646 Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
1648 while (Tok.isNot(tok::eof))
1654 if (Arg2Error ||
R.isInvalid() ||
1655 Actions.CheckLoopHintExpr(
R.get(), Toks[0].getLocation(),
1664 PP.EnterTokenStream(Toks,
false,
1666 ConsumeAnnotationToken();
1671 if (Tok.isNot(tok::eof)) {
1672 Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
1674 while (Tok.isNot(tok::eof))
1680 if (
R.isInvalid() ||
1681 Actions.CheckLoopHintExpr(
R.get(), Toks[0].getLocation(),
1690 Info->
Toks.back().getLocation());
1695struct PragmaAttributeInfo {
1696 enum ActionType { Push,
Pop, Attribute };
1697 ParsedAttributes &Attributes;
1699 const IdentifierInfo *
Namespace =
nullptr;
1700 ArrayRef<Token> Tokens;
1702 PragmaAttributeInfo(ParsedAttributes &Attributes) : Attributes(Attributes) {}
1705#include "clang/Parse/AttrSubMatchRulesParserStringSwitches.inc"
1710 if (
Tok.is(tok::identifier))
1711 return Tok.getIdentifierInfo()->getName();
1719 using namespace attr;
1721#define ATTR_MATCH_RULE(Value, Spelling, IsAbstract) \
1724#include "clang/Basic/AttrSubMatchRulesList.inc"
1726 llvm_unreachable(
"Invalid attribute subject match rule");
1734 PRef.
Diag(SubRuleLoc,
1735 diag::err_pragma_attribute_expected_subject_sub_identifier)
1737 if (
const char *SubRules = validAttributeSubjectMatchSubRules(PrimaryRule))
1748 PRef.
Diag(SubRuleLoc, diag::err_pragma_attribute_unknown_subject_sub_rule)
1749 << SubRuleName << PrimaryRuleName;
1750 if (
const char *SubRules = validAttributeSubjectMatchSubRules(PrimaryRule))
1756bool Parser::ParsePragmaAttributeSubjectMatchRuleSet(
1764 if (AnyParens.expectAndConsume())
1772 Diag(Tok, diag::err_pragma_attribute_expected_subject_identifier);
1775 std::pair<std::optional<attr::SubjectMatchRule>,
1776 std::optional<attr::SubjectMatchRule> (*)(StringRef,
bool)>
1777 Rule = isAttributeSubjectMatchRule(Name);
1779 Diag(Tok, diag::err_pragma_attribute_unknown_subject_rule) << Name;
1787 if (
Parens.expectAndConsume())
1789 }
else if (
Parens.consumeOpen()) {
1790 if (!SubjectMatchRules
1792 std::make_pair(PrimaryRule, SourceRange(RuleLoc, RuleLoc)))
1794 Diag(RuleLoc, diag::err_pragma_attribute_duplicate_subject)
1797 RuleLoc, Tok.is(tok::comma) ? Tok.getLocation() : RuleLoc));
1798 LastMatchRuleEndLoc = RuleLoc;
1804 if (SubRuleName.empty()) {
1810 if (SubRuleName ==
"unless") {
1813 if (
Parens.expectAndConsume())
1816 if (SubRuleName.empty()) {
1821 auto SubRuleOrNone =
Rule.second(SubRuleName,
true);
1822 if (!SubRuleOrNone) {
1823 std::string SubRuleUnlessName =
"unless(" + SubRuleName.str() +
")";
1825 SubRuleUnlessName, SubRuleLoc);
1828 SubRule = *SubRuleOrNone;
1830 if (
Parens.consumeClose())
1833 auto SubRuleOrNone =
Rule.second(SubRuleName,
false);
1834 if (!SubRuleOrNone) {
1836 SubRuleName, Tok.getLocation());
1839 SubRule = *SubRuleOrNone;
1842 SourceLocation RuleEndLoc = Tok.getLocation();
1843 LastMatchRuleEndLoc = RuleEndLoc;
1844 if (
Parens.consumeClose())
1846 if (!SubjectMatchRules
1847 .insert(std::make_pair(SubRule, SourceRange(RuleLoc, RuleEndLoc)))
1849 Diag(RuleLoc, diag::err_pragma_attribute_duplicate_subject)
1852 RuleLoc, Tok.is(tok::comma) ? Tok.getLocation() : RuleEndLoc));
1858 if (AnyParens.consumeClose())
1867enum class MissingAttributeSubjectRulesRecoveryPoint {
1875MissingAttributeSubjectRulesRecoveryPoint
1876getAttributeSubjectRulesRecoveryPointForToken(
const Token &
Tok) {
1878 if (II->
isStr(
"apply_to"))
1879 return MissingAttributeSubjectRulesRecoveryPoint::ApplyTo;
1880 if (II->
isStr(
"any"))
1881 return MissingAttributeSubjectRulesRecoveryPoint::Any;
1883 if (
Tok.
is(tok::equal))
1884 return MissingAttributeSubjectRulesRecoveryPoint::Equals;
1885 return MissingAttributeSubjectRulesRecoveryPoint::None;
1893 MissingAttributeSubjectRulesRecoveryPoint Point,
Parser &PRef) {
1899 MissingAttributeSubjectRulesRecoveryPoint EndPoint =
1900 getAttributeSubjectRulesRecoveryPointForToken(PRef.
getCurToken());
1901 if (Point == MissingAttributeSubjectRulesRecoveryPoint::Comma)
1903 if (Point <= MissingAttributeSubjectRulesRecoveryPoint::ApplyTo &&
1904 EndPoint > MissingAttributeSubjectRulesRecoveryPoint::ApplyTo)
1905 FixIt +=
"apply_to";
1906 if (Point <= MissingAttributeSubjectRulesRecoveryPoint::Equals &&
1907 EndPoint > MissingAttributeSubjectRulesRecoveryPoint::Equals)
1910 if (EndPoint == MissingAttributeSubjectRulesRecoveryPoint::None) {
1917 Attribute.getMatchRules(PRef.
getLangOpts(), MatchRules);
1919 for (
const auto &Rule : MatchRules) {
1924 IsSupported[
Rule.first] =
true;
1926 IsMatchRuleAvailable &= IsSupported;
1928 if (IsMatchRuleAvailable.count() == 0) {
1934 bool NeedsComma =
false;
1936 if (!IsMatchRuleAvailable[I])
1950 if (FixItRange.getBegin() == FixItRange.getEnd())
1960void Parser::HandlePragmaAttribute() {
1961 assert(Tok.is(tok::annot_pragma_attribute) &&
1962 "Expected #pragma attribute annotation token");
1963 SourceLocation PragmaLoc = Tok.getLocation();
1964 auto *Info =
static_cast<PragmaAttributeInfo *
>(Tok.getAnnotationValue());
1965 if (Info->Action == PragmaAttributeInfo::Pop) {
1966 ConsumeAnnotationToken();
1967 Actions.ActOnPragmaAttributePop(PragmaLoc, Info->Namespace);
1971 assert((Info->Action == PragmaAttributeInfo::Push ||
1972 Info->Action == PragmaAttributeInfo::Attribute) &&
1973 "Unexpected #pragma attribute command");
1975 if (Info->Action == PragmaAttributeInfo::Push && Info->Tokens.empty()) {
1976 ConsumeAnnotationToken();
1977 Actions.ActOnPragmaAttributeEmptyPush(PragmaLoc, Info->Namespace);
1981 PP.EnterTokenStream(Info->Tokens,
false,
1983 ConsumeAnnotationToken();
1985 ParsedAttributes &Attrs = Info->Attributes;
1988 auto SkipToEnd = [
this]() {
1993 if ((Tok.is(tok::l_square) &&
NextToken().
is(tok::l_square)) ||
1994 Tok.isRegularKeywordAttribute()) {
1996 SourceLocation EndLoc = Tok.getLocation();
1997 ParseCXX11AttributeSpecifier(Attrs, &EndLoc);
1998 }
else if (Tok.is(tok::kw___attribute)) {
2000 if (ExpectAndConsume(tok::l_paren, diag::err_expected_lparen_after,
2003 if (ExpectAndConsume(tok::l_paren, diag::err_expected_lparen_after,
"("))
2008 if (Tok.is(tok::code_completion)) {
2011 Actions.CodeCompletion().CodeCompleteAttribute(
2018 if (Tok.isNot(tok::identifier)) {
2019 Diag(Tok, diag::err_pragma_attribute_expected_attribute_name);
2023 IdentifierInfo *
AttrName = Tok.getIdentifierInfo();
2026 if (Tok.isNot(tok::l_paren))
2027 Attrs.
addNew(AttrName, AttrNameLoc, AttributeScopeInfo(),
nullptr, 0,
2028 ParsedAttr::Form::GNU());
2030 ParseGNUAttributeArgs(AttrName, AttrNameLoc, Attrs,
nullptr,
2033 ParsedAttr::Form::GNU(),
2037 if (ExpectAndConsume(tok::r_paren))
2039 if (ExpectAndConsume(tok::r_paren))
2041 }
else if (Tok.is(tok::kw___declspec)) {
2042 ParseMicrosoftDeclSpecs(Attrs);
2044 Diag(Tok, diag::err_pragma_attribute_expected_attribute_syntax);
2045 if (Tok.getIdentifierInfo()) {
2049 Tok.getIdentifierInfo(),
nullptr,
2051 SourceLocation InsertStartLoc = Tok.getLocation();
2053 if (Tok.is(tok::l_paren)) {
2056 if (Tok.isNot(tok::r_paren))
2059 Diag(Tok, diag::note_pragma_attribute_use_attribute_kw)
2068 if (Attrs.
empty() || Attrs.
begin()->isInvalid()) {
2073 for (
const ParsedAttr &Attribute : Attrs) {
2074 if (!Attribute.isSupportedByPragmaAttribute()) {
2075 Diag(PragmaLoc, diag::err_pragma_attribute_unsupported_attribute)
2084 createExpectedAttributeSubjectRulesTokenDiagnostic(
2085 diag::err_expected, Attrs,
2086 MissingAttributeSubjectRulesRecoveryPoint::Comma, *
this)
2092 if (Tok.isNot(tok::identifier)) {
2093 createExpectedAttributeSubjectRulesTokenDiagnostic(
2094 diag::err_pragma_attribute_invalid_subject_set_specifier, Attrs,
2095 MissingAttributeSubjectRulesRecoveryPoint::ApplyTo, *
this);
2099 const IdentifierInfo *II = Tok.getIdentifierInfo();
2100 if (!II->
isStr(
"apply_to")) {
2101 createExpectedAttributeSubjectRulesTokenDiagnostic(
2102 diag::err_pragma_attribute_invalid_subject_set_specifier, Attrs,
2103 MissingAttributeSubjectRulesRecoveryPoint::ApplyTo, *
this);
2110 createExpectedAttributeSubjectRulesTokenDiagnostic(
2111 diag::err_expected, Attrs,
2112 MissingAttributeSubjectRulesRecoveryPoint::Equals, *
this)
2119 SourceLocation AnyLoc, LastMatchRuleEndLoc;
2120 if (ParsePragmaAttributeSubjectMatchRuleSet(SubjectMatchRules, AnyLoc,
2121 LastMatchRuleEndLoc)) {
2128 if (Tok.isNot(tok::eof)) {
2129 Diag(Tok, diag::err_pragma_attribute_extra_tokens_after_attribute);
2138 if (Info->Action == PragmaAttributeInfo::Push)
2139 Actions.ActOnPragmaAttributeEmptyPush(PragmaLoc, Info->Namespace);
2141 for (ParsedAttr &Attribute : Attrs) {
2142 Actions.ActOnPragmaAttributeAttribute(Attribute, PragmaLoc,
2150void PragmaGCCVisibilityHandler::HandlePragma(
Preprocessor &PP,
2161 if (PushPop && PushPop->
isStr(
"pop")) {
2163 }
else if (PushPop && PushPop->
isStr(
"push")) {
2196 auto Toks = std::make_unique<Token[]>(1);
2198 tok::annot_pragma_vis,
SourceRange(VisLoc, EndLoc),
2199 const_cast<void *
>(
static_cast<const void *
>(VisType)));
2200 PP.EnterTokenStream(std::move(Toks), 1,
true,
2222 StringRef SlotLabel;
2226 if (
Tok.
is(tok::numeric_constant)) {
2237 }
else if (
Tok.
is(tok::identifier)) {
2239 auto MapPack = [&](
const char *
Literal) {
2242 Alignment.
setKind(tok::numeric_constant);
2248 if (II->
isStr(
"show")) {
2268 if (II->
isStr(
"push")) {
2270 }
else if (II->
isStr(
"pop")) {
2278 if (
Tok.
is(tok::comma)) {
2281 if (
Tok.
is(tok::numeric_constant)) {
2286 }
else if (
Tok.
is(tok::identifier)) {
2290 if (
Tok.
is(tok::comma)) {
2293 if (
Tok.
isNot(tok::numeric_constant)) {
2340 static_cast<void *
>(Info));
2341 PP.EnterTokenStream(Toks,
true,
2347void PragmaMSStructHandler::HandlePragma(
Preprocessor &PP,
2349 Token &MSStructTok) {
2360 if (II->
isStr(
"on")) {
2364 else if (II->
isStr(
"off") || II->
isStr(
"reset"))
2380 tok::annot_pragma_msstruct,
2382 reinterpret_cast<void *
>(
static_cast<uintptr_t>(Kind)));
2383 PP.EnterTokenStream(Toks,
true,
2388void PragmaClangSectionHandler::HandlePragma(
Preprocessor &PP,
2390 Token &FirstToken) {
2398 PP.
Diag(
Tok.
getLocation(), diag::err_pragma_expected_clang_section_name) <<
"clang section";
2403 if (SecType->
isStr(
"bss"))
2405 else if (SecType->
isStr(
"data"))
2407 else if (SecType->
isStr(
"rodata"))
2409 else if (SecType->
isStr(
"relro"))
2411 else if (SecType->
isStr(
"text"))
2414 PP.
Diag(
Tok.
getLocation(), diag::err_pragma_expected_clang_section_name) <<
"clang section";
2426 std::string SecName;
2430 Actions.ActOnPragmaClangSection(PragmaLocation,
2447 if (
Tok.isNot(tok::identifier) ||
2448 !
Tok.getIdentifierInfo()->isStr(
"align")) {
2449 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_options_expected_align);
2456 if (
Tok.isNot(tok::l_paren)) {
2457 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_expected_lparen) <<
"align";
2460 }
else if (
Tok.isNot(tok::equal)) {
2461 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_align_expected_equal)
2467 if (
Tok.isNot(tok::identifier)) {
2468 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_expected_identifier)
2469 << (IsOptions ?
"options" :
"align");
2475 if (II->
isStr(
"native"))
2477 else if (II->
isStr(
"natural"))
2479 else if (II->
isStr(
"packed"))
2481 else if (II->
isStr(
"power"))
2483 else if (II->
isStr(
"mac68k"))
2485 else if (II->
isStr(
"reset"))
2488 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_align_invalid_option)
2495 if (
Tok.isNot(tok::r_paren)) {
2496 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_expected_rparen) <<
"align";
2503 if (
Tok.isNot(tok::eod)) {
2504 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
2505 << (IsOptions ?
"options" :
"align");
2513 reinterpret_cast<void *
>(
static_cast<uintptr_t>(Kind)));
2514 PP.EnterTokenStream(Toks,
true,
2524void PragmaOptionsHandler::HandlePragma(
Preprocessor &PP,
2526 Token &OptionsTok) {
2531void PragmaUnusedHandler::HandlePragma(
Preprocessor &PP,
2554 if (
Tok.
is(tok::identifier)) {
2555 Identifiers.push_back(
Tok);
2566 if (
Tok.
is(tok::comma)) {
2571 if (
Tok.
is(tok::r_paren)) {
2589 assert(RParenLoc.
isValid() &&
"Valid '#pragma unused' must have ')'");
2590 assert(!Identifiers.empty() &&
"Valid '#pragma unused' must have arguments");
2599 2 * Identifiers.size());
2600 for (
unsigned i=0; i != Identifiers.size(); i++) {
2601 Token &pragmaUnusedTok = Toks[2*i], &idTok = Toks[2*i+1];
2604 idTok = Identifiers[i];
2606 PP.EnterTokenStream(Toks,
true,
2625 bool HasAlias =
false;
2629 if (
Tok.
is(tok::equal)) {
2649 Token &pragmaUnusedTok = Toks[0];
2654 Toks[2] = AliasName;
2655 PP.EnterTokenStream(Toks,
true,
2660 Token &pragmaUnusedTok = Toks[0];
2663 PP.EnterTokenStream(Toks,
true,
2669void PragmaRedefineExtnameHandler::HandlePragma(
Preprocessor &PP,
2671 Token &RedefToken) {
2687 <<
"redefine_extname";
2702 Token &pragmaRedefTok = Toks[0];
2706 Toks[1] = RedefName;
2707 Toks[2] = AliasName;
2708 PP.EnterTokenStream(Toks,
true,
2712void PragmaFPContractHandler::HandlePragma(
Preprocessor &PP,
2723 reinterpret_cast<void *
>(
static_cast<uintptr_t>(OOS)));
2724 PP.EnterTokenStream(Toks,
true,
2728void PragmaOpenCLExtensionHandler::HandlePragma(
Preprocessor &PP,
2753 OpenCLExtState State;
2754 if (Pred->
isStr(
"enable")) {
2756 }
else if (Pred->
isStr(
"disable")) {
2758 }
else if (Pred->
isStr(
"begin"))
2760 else if (Pred->
isStr(
"end"))
2764 << Ext->
isStr(
"all");
2778 Info->second = State;
2783 static_cast<void *
>(Info));
2784 PP.EnterTokenStream(Toks,
true,
2794template <diag::kind IgnoredDiag>
2795void PragmaNoSupportHandler<IgnoredDiag>::HandlePragma(
2798 PP.
Diag(FirstTok, IgnoredDiag);
2809void PragmaSupportHandler<StartTok, EndTok, UnexpectedDiag>::HandlePragma(
2815 Pragma.push_back(
Tok);
2817 if (
Tok.
is(StartTok)) {
2818 PP.
Diag(
Tok, UnexpectedDiag) << 0;
2819 unsigned InnerPragmaCnt = 1;
2820 while (InnerPragmaCnt != 0) {
2822 if (
Tok.
is(StartTok))
2824 else if (
Tok.
is(EndTok))
2832 Pragma.push_back(
Tok);
2834 auto Toks = std::make_unique<Token[]>(Pragma.size());
2835 std::copy(Pragma.begin(), Pragma.end(), Toks.get());
2836 PP.EnterTokenStream(std::move(Toks), Pragma.size(),
2848void PragmaMSPointersToMembers::HandlePragma(
Preprocessor &PP,
2854 PP.
Diag(PointersToMembersLoc, diag::warn_pragma_expected_lparen)
2855 <<
"pointers_to_members";
2862 <<
"pointers_to_members";
2868 if (Arg->
isStr(
"best_case")) {
2871 if (Arg->
isStr(
"full_generality")) {
2872 if (
Tok.
is(tok::comma)) {
2878 diag::err_pragma_pointers_to_members_unknown_kind)
2883 }
else if (
Tok.
is(tok::r_paren)) {
2890 <<
"full_generality";
2896 if (Arg->
isStr(
"single_inheritance")) {
2897 RepresentationMethod =
2899 }
else if (Arg->
isStr(
"multiple_inheritance")) {
2900 RepresentationMethod =
2902 }
else if (Arg->
isStr(
"virtual_inheritance")) {
2903 RepresentationMethod =
2907 diag::err_pragma_pointers_to_members_unknown_kind)
2916 << (Arg ? Arg->
getName() :
"full_generality");
2924 <<
"pointers_to_members";
2929 tok::annot_pragma_ms_pointers_to_members,
2931 reinterpret_cast<void *
>(
static_cast<uintptr_t>(RepresentationMethod)));
2948 PP.
Diag(VtorDispLoc, diag::warn_pragma_expected_lparen) <<
"vtordisp";
2956 if (II->
isStr(
"push")) {
2960 PP.
Diag(VtorDispLoc, diag::warn_pragma_expected_punc) <<
"vtordisp";
2966 }
else if (II->
isStr(
"pop")) {
2973 if (
Tok.
is(tok::r_paren)) {
2983 if (II && II->
isStr(
"off")) {
2986 }
else if (II && II->
isStr(
"on")) {
2989 }
else if (
Tok.
is(tok::numeric_constant) &&
2993 << 0 << 2 <<
"vtordisp";
3005 PP.
Diag(VtorDispLoc, diag::warn_pragma_expected_rparen) <<
"vtordisp";
3018 tok::annot_pragma_ms_vtordisp,
SourceRange(VtorDispLoc, EndLoc),
3019 reinterpret_cast<void *
>(
3034 TokenVector.push_back(
Tok);
3038 TokenVector.push_back(EoF);
3041 markAsReinjectedForRelexing(TokenVector);
3042 auto TokenArray = std::make_unique<Token[]>(TokenVector.size());
3043 std::copy(TokenVector.begin(), TokenVector.end(), TokenArray.get());
3045 std::pair<std::unique_ptr<Token[]>,
size_t>(std::move(TokenArray),
3046 TokenVector.size());
3062void PragmaFloatControlHandler::HandlePragma(
Preprocessor &PP,
3075 PP.
Diag(FloatControlLoc, diag::err_expected) << tok::l_paren;
3089 llvm::StringSwitch<PragmaFloatControlKind>(II->
getName())
3107 if (
Tok.
is(tok::r_paren))
3120 if (PushOnOff ==
"on")
3123 else if (PushOnOff ==
"off") {
3128 }
else if (PushOnOff ==
"push") {
3135 if (
Tok.
is(tok::comma)) {
3142 if (ExpectedPush ==
"push") {
3167 auto TokenArray = std::make_unique<Token[]>(1);
3171 tok::annot_pragma_float_control,
SourceRange(FloatControlLoc, EndLoc),
3172 reinterpret_cast<void *
>(
3173 static_cast<uintptr_t>((Action << 16) | (Kind & 0xFFFF))));
3174 PP.EnterTokenStream(std::move(TokenArray), 1,
3188void PragmaDetectMismatchHandler::HandlePragma(
Preprocessor &PP,
3194 PP.
Diag(DetectMismatchLoc, diag::err_expected) << tok::l_paren;
3199 std::string NameString;
3201 "pragma detect_mismatch",
3206 std::string ValueString;
3232 Actions.ActOnPragmaDetectMismatch(DetectMismatchLoc, NameString, ValueString);
3246void PragmaCommentHandler::HandlePragma(
Preprocessor &PP,
3252 PP.
Diag(CommentLoc, diag::err_pragma_comment_malformed);
3259 PP.
Diag(CommentLoc, diag::err_pragma_comment_malformed);
3266 llvm::StringSwitch<PragmaMSCommentKind>(II->
getName())
3295 if (SeenCopyrightInTU) {
3301 SeenCopyrightInTU =
true;
3306 std::string ArgumentString;
3338 Actions.ActOnPragmaMSComment(CommentLoc, Kind, ArgumentString);
3343void PragmaOptimizeHandler::HandlePragma(
Preprocessor &PP,
3345 Token &FirstToken) {
3348 if (
Tok.
is(tok::eod)) {
3350 <<
"clang optimize" <<
true <<
"'on' or 'off'";
3361 if (II->
isStr(
"on")) {
3363 }
else if (!II->
isStr(
"off")) {
3376 Actions.ActOnPragmaOptimize(IsOn, FirstToken.
getLocation());
3381struct TokFPAnnotValue {
3382 enum FlagValues {
On,
Off, Fast };
3384 std::optional<LangOptions::FPModeKind> ContractValue;
3385 std::optional<LangOptions::FPModeKind> ReassociateValue;
3386 std::optional<LangOptions::FPModeKind> ReciprocalValue;
3387 std::optional<LangOptions::FPExceptionModeKind> ExceptionsValue;
3388 std::optional<LangOptions::FPEvalMethodKind> EvalMethodValue;
3406 while (
Tok.
is(tok::identifier)) {
3410 llvm::StringSwitch<std::optional<PragmaFPKind>>(OptionInfo->
getName())
3416 .Default(std::nullopt);
3419 <<
false << OptionInfo;
3430 bool isEvalMethodDouble =
3434 if (
Tok.
isNot(tok::identifier) && !isEvalMethodDouble) {
3437 <<
static_cast<int>(*FlagKind);
3443 AnnotValue->ContractValue =
3444 llvm::StringSwitch<std::optional<LangOptions::FPModeKind>>(
3449 .Default(std::nullopt);
3450 if (!AnnotValue->ContractValue) {
3457 : AnnotValue->ReciprocalValue;
3458 Value = llvm::StringSwitch<std::optional<LangOptions::FPModeKind>>(
3462 .Default(std::nullopt);
3469 AnnotValue->ExceptionsValue =
3470 llvm::StringSwitch<std::optional<LangOptions::FPExceptionModeKind>>(
3475 .Default(std::nullopt);
3476 if (!AnnotValue->ExceptionsValue) {
3482 AnnotValue->EvalMethodValue =
3483 llvm::StringSwitch<std::optional<LangOptions::FPEvalMethodKind>>(
3488 .Default(std::nullopt);
3489 if (!AnnotValue->EvalMethodValue) {
3513 reinterpret_cast<void *
>(AnnotValue));
3514 TokenList.push_back(FPTok);
3516 auto TokenArray = std::make_unique<Token[]>(TokenList.size());
3517 std::copy(TokenList.begin(), TokenList.end(), TokenArray.get());
3519 PP.EnterTokenStream(std::move(TokenArray), TokenList.size(),
3523void PragmaSTDC_FENV_ROUNDHandler::HandlePragma(
Preprocessor &PP,
3542 llvm::StringSwitch<llvm::RoundingMode>(II->
getName())
3543 .Case(
"FE_TOWARDZERO", llvm::RoundingMode::TowardZero)
3544 .Case(
"FE_TONEAREST", llvm::RoundingMode::NearestTiesToEven)
3545 .Case(
"FE_UPWARD", llvm::RoundingMode::TowardPositive)
3546 .Case(
"FE_DOWNWARD", llvm::RoundingMode::TowardNegative)
3547 .Case(
"FE_TONEARESTFROMZERO", llvm::RoundingMode::NearestTiesToAway)
3548 .Case(
"FE_DYNAMIC", llvm::RoundingMode::Dynamic)
3549 .Default(llvm::RoundingMode::Invalid);
3550 if (RM == llvm::RoundingMode::Invalid) {
3558 <<
"STDC FENV_ROUND";
3569 reinterpret_cast<void *
>(
static_cast<uintptr_t>(RM)));
3570 PP.EnterTokenStream(Toks,
true,
3574void Parser::HandlePragmaFP() {
3575 assert(Tok.is(tok::annot_pragma_fp));
3577 reinterpret_cast<TokFPAnnotValue *
>(Tok.getAnnotationValue());
3579 if (AnnotValue->ReassociateValue)
3580 Actions.ActOnPragmaFPValueChangingOption(
3584 if (AnnotValue->ReciprocalValue)
3585 Actions.ActOnPragmaFPValueChangingOption(
3589 if (AnnotValue->ContractValue)
3590 Actions.ActOnPragmaFPContract(Tok.getLocation(),
3591 *AnnotValue->ContractValue);
3592 if (AnnotValue->ExceptionsValue)
3593 Actions.ActOnPragmaFPExceptions(Tok.getLocation(),
3594 *AnnotValue->ExceptionsValue);
3595 if (AnnotValue->EvalMethodValue)
3596 Actions.ActOnPragmaFPEvalMethod(Tok.getLocation(),
3597 *AnnotValue->EvalMethodValue);
3598 ConsumeAnnotationToken();
3603 Token Option,
bool ValueInParens,
3606 int OpenParens = ValueInParens ? 1 : 0;
3608 while (
Tok.isNot(tok::eod)) {
3609 if (
Tok.is(tok::l_paren))
3611 else if (
Tok.is(tok::r_paren)) {
3613 if (OpenParens == 0 && ValueInParens)
3621 if (ValueInParens) {
3623 if (
Tok.isNot(tok::r_paren)) {
3624 PP.
Diag(
Tok.getLocation(), diag::err_expected) << tok::r_paren;
3689void PragmaLoopHintHandler::HandlePragma(
Preprocessor &PP,
3704 while (
Tok.
is(tok::identifier)) {
3708 bool OptionValid = llvm::StringSwitch<bool>(OptionInfo->
getName())
3709 .Case(
"vectorize",
true)
3710 .Case(
"interleave",
true)
3711 .Case(
"unroll",
true)
3712 .Case(
"distribute",
true)
3713 .Case(
"vectorize_predicate",
true)
3714 .Case(
"vectorize_width",
true)
3715 .Case(
"interleave_count",
true)
3716 .Case(
"unroll_count",
true)
3717 .Case(
"pipeline",
true)
3718 .Case(
"pipeline_initiation_interval",
true)
3723 <<
false << OptionInfo;
3742 tok::annot_pragma_loop_hint,
3744 static_cast<void *
>(Info));
3745 TokenList.push_back(LoopHintTok);
3754 auto TokenArray = std::make_unique<Token[]>(TokenList.size());
3755 std::copy(TokenList.begin(), TokenList.end(), TokenArray.get());
3757 PP.EnterTokenStream(std::move(TokenArray), TokenList.size(),
3782void PragmaUnrollHintHandler::HandlePragma(
Preprocessor &PP,
3790 if (
Tok.
is(tok::eod)) {
3792 Info->PragmaName = PragmaName;
3793 Info->Option.startToken();
3803 bool ValueInParens =
Tok.
is(tok::l_paren);
3820 auto TokenArray = std::make_unique<Token[]>(1);
3822 tok::annot_pragma_loop_hint,
3824 static_cast<void *
>(Info));
3825 PP.EnterTokenStream(std::move(TokenArray), 1,
3829bool Parser::HandlePragmaMSFunction(StringRef PragmaName,
3831 Token FirstTok = Tok;
3833 if (ExpectAndConsume(tok::l_paren, diag::warn_pragma_expected_lparen,
3837 bool SuggestIntrinH = !PP.isMacroDefined(
"__INTRIN_H");
3839 llvm::SmallVector<StringRef> NoBuiltins;
3840 while (Tok.is(tok::identifier)) {
3841 IdentifierInfo *II = Tok.getIdentifierInfo();
3843 PP.Diag(Tok.getLocation(), diag::warn_pragma_intrinsic_builtin)
3844 << II << SuggestIntrinH;
3846 NoBuiltins.emplace_back(II->
getName());
3849 if (Tok.isNot(tok::comma))
3854 if (ExpectAndConsume(tok::r_paren, diag::warn_pragma_expected_rparen,
3856 ExpectAndConsume(tok::eof, diag::warn_pragma_extra_tokens_at_eol,
3860 Actions.ActOnPragmaMSFunction(FirstTok.
getLocation(), NoBuiltins);
3864bool Parser::HandlePragmaMSOptimize(StringRef PragmaName,
3866 Token FirstTok = Tok;
3867 if (ExpectAndConsume(tok::l_paren, diag::warn_pragma_expected_lparen,
3871 if (Tok.isNot(tok::string_literal)) {
3872 PP.Diag(PragmaLocation, diag::warn_pragma_expected_string) << PragmaName;
3880 PP.Diag(PragmaLocation, diag::warn_pragma_expected_non_wide_string)
3885 if (ExpectAndConsume(tok::comma, diag::warn_pragma_expected_comma,
3889 if (Tok.is(tok::eof) || Tok.is(tok::r_paren)) {
3890 PP.Diag(PragmaLocation, diag::warn_pragma_missing_argument)
3891 << PragmaName <<
true <<
"'on' or 'off'";
3894 IdentifierInfo *II = Tok.getIdentifierInfo();
3895 if (!II || (!II->
isStr(
"on") && !II->
isStr(
"off"))) {
3896 PP.Diag(PragmaLocation, diag::warn_pragma_invalid_argument)
3897 << PP.getSpelling(Tok) << PragmaName <<
true
3901 bool IsOn = II->
isStr(
"on");
3904 if (ExpectAndConsume(tok::r_paren, diag::warn_pragma_expected_rparen,
3909 if (!OptimizationList->
getString().empty()) {
3910 PP.Diag(PragmaLocation, diag::warn_pragma_invalid_argument)
3911 << OptimizationList->
getString() << PragmaName <<
true
3916 if (ExpectAndConsume(tok::eof, diag::warn_pragma_extra_tokens_at_eol,
3920 Actions.ActOnPragmaMSOptimize(FirstTok.
getLocation(), IsOn);
3937bool Parser::HandlePragmaMSIntrinsic(StringRef PragmaName,
3939 if (ExpectAndConsume(tok::l_paren, diag::warn_pragma_expected_lparen,
3943 bool SuggestIntrinH = !PP.isMacroDefined(
"__INTRIN_H");
3945 while (Tok.is(tok::identifier)) {
3946 IdentifierInfo *II = Tok.getIdentifierInfo();
3948 PP.Diag(Tok.getLocation(), diag::warn_pragma_intrinsic_builtin)
3949 << II << SuggestIntrinH;
3951 DeclarationNameInfo NameInfo(II, Tok.getLocation());
3954 Actions.LookupName(
Previous, Actions.getCurScope(),
3957 Actions.LazilyCreateBuiltin(II, II->
getBuiltinID(), Actions.getCurScope(),
3958 true, Tok.getLocation());
3960 if (Tok.isNot(tok::comma))
3964 if (ExpectAndConsume(tok::r_paren, diag::warn_pragma_expected_rparen,
3968 if (ExpectAndConsume(tok::eof, diag::warn_pragma_extra_tokens_at_eol,
3974void PragmaForceCUDAHostDeviceHandler::HandlePragma(
3980 if (!Info || (!Info->
isStr(
"begin") && !Info->
isStr(
"end"))) {
3982 diag::warn_pragma_force_cuda_host_device_bad_arg);
3986 if (Info->
isStr(
"begin"))
3987 Actions.CUDA().PushForceHostDevice();
3988 else if (!Actions.CUDA().PopForceHostDevice())
3990 diag::err_pragma_cannot_end_force_cuda_host_device);
3993 if (!
Tok.
is(tok::eod))
3995 diag::warn_pragma_force_cuda_host_device_bad_arg);
4025void PragmaAttributeHandler::HandlePragma(
Preprocessor &PP,
4027 Token &FirstToken) {
4031 PragmaAttributeInfo(AttributesForPragmaAttribute);
4034 if (
Tok.
is(tok::identifier)) {
4036 if (!II->
isStr(
"push") && !II->
isStr(
"pop")) {
4037 Info->Namespace = II;
4040 if (!
Tok.
is(tok::period)) {
4049 if (!
Tok.
isOneOf(tok::identifier, tok::l_paren)) {
4051 diag::err_pragma_attribute_expected_push_pop_paren);
4056 if (
Tok.
is(tok::l_paren)) {
4057 if (Info->Namespace) {
4059 diag::err_pragma_attribute_namespace_on_attribute);
4061 diag::note_pragma_attribute_namespace_on_attribute);
4064 Info->Action = PragmaAttributeInfo::Attribute;
4067 if (II->
isStr(
"push"))
4068 Info->Action = PragmaAttributeInfo::Push;
4069 else if (II->
isStr(
"pop"))
4070 Info->Action = PragmaAttributeInfo::Pop;
4081 if ((Info->Action == PragmaAttributeInfo::Push &&
Tok.
isNot(tok::eod)) ||
4082 Info->Action == PragmaAttributeInfo::Attribute) {
4093 if (
Tok.
is(tok::l_paren))
4095 else if (
Tok.
is(tok::r_paren)) {
4097 if (OpenParens == 0)
4101 AttributeTokens.push_back(
Tok);
4105 if (AttributeTokens.empty()) {
4118 AttributeTokens.push_back(EOFTok);
4120 markAsReinjectedForRelexing(AttributeTokens);
4127 <<
"clang attribute";
4130 auto TokenArray = std::make_unique<Token[]>(1);
4133 static_cast<void *
>(Info));
4134 PP.EnterTokenStream(std::move(TokenArray), 1,
4139void PragmaMaxTokensHereHandler::HandlePragma(
Preprocessor &PP,
4143 if (
Tok.
is(tok::eod)) {
4145 <<
"clang max_tokens_here" <<
true <<
"integer";
4151 if (
Tok.
isNot(tok::numeric_constant) ||
4154 <<
"clang max_tokens_here";
4160 <<
"clang max_tokens_here";
4165 PP.
Diag(Loc, diag::warn_max_tokens)
4171void PragmaMaxTokensTotalHandler::HandlePragma(
Preprocessor &PP,
4175 if (
Tok.
is(tok::eod)) {
4177 <<
"clang max_tokens_total" <<
true <<
"integer";
4183 if (
Tok.
isNot(tok::numeric_constant) ||
4186 <<
"clang max_tokens_total";
4192 <<
"clang max_tokens_total";
4204 for (;
Tok.isNot(tok::eod); PP.
Lex(
Tok)) {
4205 TokenVector.push_back(
Tok);
4210 TokenVector.push_back(EoF);
4213 markAsReinjectedForRelexing(TokenVector);
4214 auto TokenArray = std::make_unique<Token[]>(TokenVector.size());
4215 std::copy(TokenVector.begin(), TokenVector.end(), TokenArray.get());
4217 std::pair<std::unique_ptr<Token[]>,
size_t>(std::move(TokenArray),
4218 TokenVector.size());
4224void PragmaExportHandler::HandlePragma(
Preprocessor &PP,
4226 Token &FirstToken) {
4235 Token &FirstToken) {
4240 if (!II || !II->
isStr(
"intrinsic")) {
4248 if (!II || !(II->
isStr(
"vector") || II->
isStr(
"sifive_vector") ||
4249 II->
isStr(
"andes_vector"))) {
4252 <<
"'vector', 'sifive_vector' or 'andes_vector'";
4259 <<
"clang riscv intrinsic";
4263 if (II->
isStr(
"vector"))
4264 Actions.RISCV().DeclareRVVBuiltins =
true;
4265 else if (II->
isStr(
"sifive_vector"))
4266 Actions.RISCV().DeclareSiFiveVectorBuiltins =
true;
4267 else if (II->
isStr(
"andes_vector"))
4268 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.
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...
__builtin_elementwise_add_sat __builtin_elementwise_sub_sat uint32_t uint64_t __builtin_riscv_ssha_i32 __builtin_riscv_sshl_u32 unsigned
__builtin_elementwise_add_sat __builtin_elementwise_sub_sat uint32_t uint64_t __builtin_riscv_ssha_i32 __builtin_riscv_sshl_u32 uint64_t
Loop optimization hint for loop and unroll pragmas.
IdentifierLoc * OptionLoc
IdentifierLoc * PragmaNameLoc
Describes how and where the pragma was introduced.
PragmaMsStackAction Action