#include "clang/AST/ASTContext.h"
#include "clang/Basic/PragmaKinds.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/Token.h"
#include "clang/Parse/LoopHint.h"
#include "clang/Parse/ParseDiagnostic.h"
#include "clang/Parse/Parser.h"
#include "clang/Parse/RAIIObjectsForParser.h"
#include "clang/Sema/EnterExpressionEvaluationContext.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/SemaCUDA.h"
#include "clang/Sema/SemaCodeCompletion.h"
#include "clang/Sema/SemaRISCV.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringSwitch.h"
#include <optional>
usingnamespaceclang;
namespace {
struct PragmaAlignHandler : public PragmaHandler { … };
struct PragmaGCCVisibilityHandler : public PragmaHandler { … };
struct PragmaOptionsHandler : public PragmaHandler { … };
struct PragmaPackHandler : public PragmaHandler { … };
struct PragmaClangSectionHandler : public PragmaHandler { … };
struct PragmaMSStructHandler : public PragmaHandler { … };
struct PragmaUnusedHandler : public PragmaHandler { … };
struct PragmaWeakHandler : public PragmaHandler { … };
struct PragmaRedefineExtnameHandler : public PragmaHandler { … };
struct PragmaOpenCLExtensionHandler : public PragmaHandler { … };
struct PragmaFPContractHandler : public PragmaHandler { … };
struct PragmaSTDC_FENV_ACCESSHandler : public PragmaHandler { … };
struct PragmaSTDC_CX_LIMITED_RANGEHandler : public PragmaHandler { … };
struct PragmaSTDC_FENV_ROUNDHandler : public PragmaHandler { … };
struct PragmaSTDC_UnknownHandler : public PragmaHandler { … };
struct PragmaFPHandler : public PragmaHandler { … };
template <diag::kind IgnoredDiag>
struct PragmaNoSupportHandler : public PragmaHandler { … };
struct PragmaNoOpenMPHandler
: public PragmaNoSupportHandler<diag::warn_pragma_omp_ignored> { … };
struct PragmaNoOpenACCHandler
: public PragmaNoSupportHandler<diag::warn_pragma_acc_ignored> { … };
template <tok::TokenKind StartTok, tok::TokenKind EndTok,
diag::kind UnexpectedDiag>
struct PragmaSupportHandler : public PragmaHandler { … };
struct PragmaOpenMPHandler
: public PragmaSupportHandler<tok::annot_pragma_openmp,
tok::annot_pragma_openmp_end,
diag::err_omp_unexpected_directive> { … };
struct PragmaOpenACCHandler
: public PragmaSupportHandler<tok::annot_pragma_openacc,
tok::annot_pragma_openacc_end,
diag::err_acc_unexpected_directive> { … };
struct PragmaCommentHandler : public PragmaHandler { … };
struct PragmaDetectMismatchHandler : public PragmaHandler { … };
struct PragmaFloatControlHandler : public PragmaHandler { … };
struct PragmaMSPointersToMembers : public PragmaHandler { … };
struct PragmaMSVtorDisp : public PragmaHandler { … };
struct PragmaMSPragma : public PragmaHandler { … };
struct PragmaOptimizeHandler : public PragmaHandler { … };
struct PragmaLoopHintHandler : public PragmaHandler { … };
struct PragmaUnrollHintHandler : public PragmaHandler { … };
struct PragmaMSRuntimeChecksHandler : public EmptyPragmaHandler { … };
struct PragmaMSIntrinsicHandler : public PragmaHandler { … };
struct PragmaMSFenvAccessHandler : public PragmaHandler { … };
struct PragmaForceCUDAHostDeviceHandler : public PragmaHandler { … };
struct PragmaAttributeHandler : public PragmaHandler { … };
struct PragmaMaxTokensHereHandler : public PragmaHandler { … };
struct PragmaMaxTokensTotalHandler : public PragmaHandler { … };
struct PragmaRISCVHandler : public PragmaHandler { … };
void markAsReinjectedForRelexing(llvm::MutableArrayRef<clang::Token> Toks) { … }
}
void Parser::initializePragmaHandlers() { … }
void Parser::resetPragmaHandlers() { … }
void Parser::HandlePragmaUnused() { … }
void Parser::HandlePragmaVisibility() { … }
void Parser::HandlePragmaPack() { … }
void Parser::HandlePragmaMSStruct() { … }
void Parser::HandlePragmaAlign() { … }
void Parser::HandlePragmaDump() { … }
void Parser::HandlePragmaWeak() { … }
void Parser::HandlePragmaWeakAlias() { … }
void Parser::HandlePragmaRedefineExtname() { … }
void Parser::HandlePragmaFPContract() { … }
void Parser::HandlePragmaFloatControl() { … }
void Parser::HandlePragmaFEnvAccess() { … }
void Parser::HandlePragmaFEnvRound() { … }
void Parser::HandlePragmaCXLimitedRange() { … }
StmtResult Parser::HandlePragmaCaptured()
{ … }
namespace {
enum OpenCLExtState : char { … };
OpenCLExtData;
}
void Parser::HandlePragmaOpenCLExtension() { … }
void Parser::HandlePragmaMSPointersToMembers() { … }
void Parser::HandlePragmaMSVtorDisp() { … }
void Parser::HandlePragmaMSPragma() { … }
bool Parser::HandlePragmaMSSection(StringRef PragmaName,
SourceLocation PragmaLocation) { … }
bool Parser::HandlePragmaMSSegment(StringRef PragmaName,
SourceLocation PragmaLocation) { … }
bool Parser::HandlePragmaMSInitSeg(StringRef PragmaName,
SourceLocation PragmaLocation) { … }
bool Parser::HandlePragmaMSStrictGuardStackCheck(
StringRef PragmaName, SourceLocation PragmaLocation) { … }
bool Parser::HandlePragmaMSAllocText(StringRef PragmaName,
SourceLocation PragmaLocation) { … }
static std::string PragmaLoopHintString(Token PragmaName, Token Option) { … }
bool Parser::HandlePragmaLoopHint(LoopHint &Hint) { … }
namespace {
struct PragmaAttributeInfo { … };
#include "clang/Parse/AttrSubMatchRulesParserStringSwitches.inc"
}
static StringRef getIdentifier(const Token &Tok) { … }
static bool isAbstractAttrMatcherRule(attr::SubjectMatchRule Rule) { … }
static void diagnoseExpectedAttributeSubjectSubRule(
Parser &PRef, attr::SubjectMatchRule PrimaryRule, StringRef PrimaryRuleName,
SourceLocation SubRuleLoc) { … }
static void diagnoseUnknownAttributeSubjectSubRule(
Parser &PRef, attr::SubjectMatchRule PrimaryRule, StringRef PrimaryRuleName,
StringRef SubRuleName, SourceLocation SubRuleLoc) { … }
bool Parser::ParsePragmaAttributeSubjectMatchRuleSet(
attr::ParsedSubjectMatchRuleSet &SubjectMatchRules, SourceLocation &AnyLoc,
SourceLocation &LastMatchRuleEndLoc) { … }
namespace {
enum class MissingAttributeSubjectRulesRecoveryPoint { … };
MissingAttributeSubjectRulesRecoveryPoint
getAttributeSubjectRulesRecoveryPointForToken(const Token &Tok) { … }
DiagnosticBuilder createExpectedAttributeSubjectRulesTokenDiagnostic(
unsigned DiagID, ParsedAttributes &Attrs,
MissingAttributeSubjectRulesRecoveryPoint Point, Parser &PRef) { … }
}
void Parser::HandlePragmaAttribute() { … }
void PragmaGCCVisibilityHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &VisTok) { … }
void PragmaPackHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &PackTok) { … }
void PragmaMSStructHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &MSStructTok) { … }
void PragmaClangSectionHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &FirstToken) { … }
static void ParseAlignPragma(Preprocessor &PP, Token &FirstTok,
bool IsOptions) { … }
void PragmaAlignHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &AlignTok) { … }
void PragmaOptionsHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &OptionsTok) { … }
void PragmaUnusedHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &UnusedTok) { … }
void PragmaWeakHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &WeakTok) { … }
void PragmaRedefineExtnameHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &RedefToken) { … }
void PragmaFPContractHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &Tok) { … }
void PragmaOpenCLExtensionHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &Tok) { … }
template <diag::kind IgnoredDiag>
void PragmaNoSupportHandler<IgnoredDiag>::HandlePragma(
Preprocessor &PP, PragmaIntroducer Introducer, Token &FirstTok) { … }
template <tok::TokenKind StartTok, tok::TokenKind EndTok,
diag::kind UnexpectedDiag>
void PragmaSupportHandler<StartTok, EndTok, UnexpectedDiag>::HandlePragma(
Preprocessor &PP, PragmaIntroducer Introducer, Token &FirstTok) { … }
void PragmaMSPointersToMembers::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &Tok) { … }
void PragmaMSVtorDisp::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer, Token &Tok) { … }
void PragmaMSPragma::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer, Token &Tok) { … }
void PragmaFloatControlHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &Tok) { … }
void PragmaDetectMismatchHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &Tok) { … }
void PragmaCommentHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &Tok) { … }
void PragmaOptimizeHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &FirstToken) { … }
namespace {
struct TokFPAnnotValue { … };
}
void PragmaFPHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer, Token &Tok) { … }
void PragmaSTDC_FENV_ROUNDHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &Tok) { … }
void Parser::HandlePragmaFP() { … }
static bool ParseLoopHintValue(Preprocessor &PP, Token &Tok, Token PragmaName,
Token Option, bool ValueInParens,
PragmaLoopHintInfo &Info) { … }
void PragmaLoopHintHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &Tok) { … }
void PragmaUnrollHintHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &Tok) { … }
void PragmaMSIntrinsicHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &Tok) { … }
bool Parser::HandlePragmaMSFunction(StringRef PragmaName,
SourceLocation PragmaLocation) { … }
bool Parser::HandlePragmaMSOptimize(StringRef PragmaName,
SourceLocation PragmaLocation) { … }
void PragmaForceCUDAHostDeviceHandler::HandlePragma(
Preprocessor &PP, PragmaIntroducer Introducer, Token &Tok) { … }
void PragmaAttributeHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &FirstToken) { … }
void PragmaMaxTokensHereHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &Tok) { … }
void PragmaMaxTokensTotalHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &Tok) { … }
void PragmaRISCVHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &FirstToken) { … }