Go to the documentation of this file.
21 using namespace clang;
30 : S(S), SlotLabel(SlotLabel), ShouldAct(ShouldAct) {
63 }
else if (IsPackSet) {
65 RD->
addAttr(MaxFieldAlignmentAttr::CreateImplicit(
78 if (AlignPackedInclude.CurrentPragmaLocation !=
81 if (AlignPackedInclude.HasNonDefaultValue)
82 AlignPackedInclude.ShouldWarnOnInclude =
true;
94 RD->
addAttr(MSVtorDispAttr::CreateImplicit(
98 template <
typename Attribute>
101 if (Record->
hasAttr<OwnerAttr>() || Record->
hasAttr<PointerAttr>())
105 Redecl->addAttr(Attribute::CreateImplicit(
Context,
nullptr));
110 if (!UnderlyingRecord)
117 static llvm::StringSet<> Containers{
133 "unordered_multiset",
134 "unordered_multimap",
137 static llvm::StringSet<> Iterators{
"iterator",
"const_iterator",
139 "const_reverse_iterator"};
141 if (
Parent->isInStdNamespace() && Iterators.count(ND->
getName()) &&
142 Containers.count(
Parent->getName()))
143 addGslOwnerPointerAttributeIfNotExisting<PointerAttr>(
Context,
154 dyn_cast<TemplateSpecializationType>(Canonical.
getTypePtr())) {
156 RD = dyn_cast_or_null<CXXRecordDecl>(
157 TST->getTemplateName().getAsTemplateDecl()->getTemplatedDecl());
165 static llvm::StringSet<> StdOwners{
185 "unordered_multiset",
186 "unordered_multimap",
189 static llvm::StringSet<> StdPointers{
200 if (Record->
hasAttr<OwnerAttr>() || Record->
hasAttr<PointerAttr>())
203 if (StdOwners.count(Record->
getName()))
204 addGslOwnerPointerAttributeIfNotExisting<OwnerAttr>(
Context, Record);
205 else if (StdPointers.count(Record->
getName()))
206 addGslOwnerPointerAttributeIfNotExisting<PointerAttr>(
Context, Record);
244 Diag(PragmaLoc, diag::err_pragma_options_align_mac68k_target_unsupported);
259 Diag(PragmaLoc, diag::warn_pragma_options_align_reset_failed)
277 case PragmaClangSectionKind::PCSK_BSS:
281 case PragmaClangSectionKind::PCSK_Data:
285 case PragmaClangSectionKind::PCSK_Rodata:
288 case PragmaClangSectionKind::PCSK_Relro:
291 case PragmaClangSectionKind::PCSK_Text:
296 llvm_unreachable(
"invalid clang section kind");
299 if (Action == PragmaClangSectionAction::PCSA_Clear) {
306 Diag(PragmaLoc, diag::err_pragma_section_invalid_for_target)
321 StringRef SlotLabel,
Expr *alignment) {
324 if (IsXLPragma && !SlotLabel.empty()) {
325 Diag(PragmaLoc, diag::err_pragma_pack_identifer_not_supported);
330 Expr *Alignment =
static_cast<Expr *
>(alignment);
333 unsigned AlignmentVal = 0;
343 !(*Val == 0 || Val->isPowerOf2()) || Val->getZExtValue() > 16) {
344 Diag(PragmaLoc, diag::warn_pragma_pack_invalid_alignment);
348 if (IsXLPragma && *Val == 0) {
350 Diag(PragmaLoc, diag::err_pragma_pack_invalid_alignment);
354 AlignmentVal = (
unsigned)Val->getZExtValue();
364 Diag(PragmaLoc, diag::warn_pragma_pack_show) <<
"mac68k";
366 Diag(PragmaLoc, diag::warn_pragma_pack_show) << AlignmentVal;
372 if (Alignment && !SlotLabel.empty())
373 Diag(PragmaLoc, diag::warn_pragma_pack_pop_identifier_and_alignment);
376 "Empty pack stack can only be at Native alignment mode.");
377 Diag(PragmaLoc, diag::warn_pragma_pop_failed) <<
"pack" <<
"stack empty";
395 bool HasNonDefaultValue =
402 HasNonDefaultValue,
false});
415 Diag(IncludeLoc, diag::warn_pragma_pack_non_default_at_include);
420 Diag(IncludeLoc, diag::warn_pragma_pack_modified_after_include);
428 bool IsInnermost =
true;
433 for (
const auto &StackSlot : llvm::reverse(
AlignPackStack.Stack)) {
434 Diag(StackSlot.PragmaPushLocation, diag::warn_pragma_pack_no_pop_eof);
440 diag::note_pragma_pack_pop_instead_reset);
479 Diag(Loc, diag::err_pragma_fc_pp_scope);
484 llvm_unreachable(
"invalid pragma float_control kind");
491 Diag(Loc, diag::err_pragma_fc_noprecise_requires_noexcept);
493 Diag(Loc, diag::err_pragma_fc_noprecise_requires_nofenv);
500 Diag(Loc, diag::err_pragma_fc_except_requires_precise);
514 Diag(Loc, diag::warn_pragma_pop_failed) <<
"float_control"
536 Diag(PragmaLoc, diag::warn_pragma_pop_failed) <<
"vtordisp"
544 llvm::StringRef StackSlotLabel,
545 AlignPackInfo
Value) {
547 CurrentValue = DefaultValue;
548 CurrentPragmaLocation = PragmaLocation;
552 Stack.emplace_back(Slot(StackSlotLabel, CurrentValue, CurrentPragmaLocation,
555 if (!StackSlotLabel.empty()) {
557 auto I = llvm::find_if(llvm::reverse(Stack), [&](
const Slot &
x) {
558 return x.StackSlotLabel == StackSlotLabel;
561 if (I != Stack.rend()) {
562 CurrentValue = I->Value;
563 CurrentPragmaLocation = I->PragmaLocation;
564 Stack.erase(std::prev(I.base()), Stack.end());
566 }
else if (
Value.IsXLStack() &&
Value.IsAlignAttr() &&
567 CurrentValue.IsPackAttr()) {
570 auto I = llvm::find_if(llvm::reverse(Stack), [&](
const Slot &
x) {
571 return x.Value.IsAlignAttr();
574 if (I != Stack.rend()) {
575 Stack.erase(std::prev(I.base()), Stack.end());
577 CurrentValue = DefaultValue;
578 CurrentPragmaLocation = PragmaLocation;
580 CurrentValue = Stack.back().Value;
581 CurrentPragmaLocation = Stack.back().PragmaLocation;
585 }
else if (!Stack.empty()) {
588 if (
Value.IsXLStack() &&
Value.IsPackAttr() && CurrentValue.IsAlignAttr())
592 CurrentValue = Stack.back().Value;
593 CurrentPragmaLocation = Stack.back().PragmaLocation;
598 CurrentValue =
Value;
599 CurrentPragmaLocation = PragmaLocation;
608 PragmaLocation = A->getLocation();
616 const auto &Section = SectionIt->second;
617 if (Section.SectionFlags == SectionFlags ||
623 Diag(Section.
Decl->getLocation(), diag::note_declared_at)
624 << Section.
Decl->getName();
626 Diag(PragmaLocation, diag::note_pragma_entered_here);
627 if (Section.PragmaSectionLocation.isValid())
628 Diag(Section.PragmaSectionLocation, diag::note_pragma_entered_here);
637 const auto &Section = SectionIt->second;
638 if (Section.SectionFlags == SectionFlags)
641 Diag(PragmaSectionLocation, diag::err_section_conflict)
642 <<
"this" << Section;
644 Diag(Section.Decl->getLocation(), diag::note_declared_at)
645 << Section.Decl->getName();
646 if (Section.PragmaSectionLocation.isValid())
647 Diag(Section.PragmaSectionLocation, diag::note_pragma_entered_here);
659 llvm::StringRef StackSlotLabel,
661 llvm::StringRef PragmaName) {
663 llvm::StringSwitch<PragmaStack<StringLiteral *> *>(PragmaName)
668 if (Action &
PSK_Pop && Stack->Stack.empty())
669 Diag(PragmaLocation, diag::warn_pragma_pop_failed) << PragmaName
675 if (SegmentName->
getString() ==
".drectve" &&
677 Diag(PragmaLocation, diag::warn_attribute_section_drectve) << PragmaName;
680 Stack->Act(PragmaLocation, Action, StackSlotLabel, SegmentName);
705 if (Lookup.
empty()) {
706 Diag(PragmaLoc, diag::warn_pragma_unused_undeclared_var)
713 Diag(PragmaLoc, diag::warn_pragma_unused_expected_var_arg)
720 Diag(PragmaLoc, diag::warn_used_but_marked_unused) << Name;
724 UnusedAttr::GNU_unused));
734 if (D->
hasAttr<CFAuditedTransferAttr>() ||
735 D->
hasAttr<CFUnknownTransferAttr>())
747 using namespace attr;
751 #define ATTR_MATCH_RULE(Value, Spelling, IsAbstract)
752 #define ATTR_MATCH_SUB_RULE(Value, Spelling, IsAbstract, Parent, IsNegated) \
755 #include "clang/Basic/AttrSubMatchRulesList.inc"
760 using namespace attr;
764 #define ATTR_MATCH_RULE(Value, Spelling, IsAbstract)
765 #define ATTR_MATCH_SUB_RULE(Value, Spelling, IsAbstract, Parent, IsNegated) \
768 #include "clang/Basic/AttrSubMatchRulesList.inc"
787 llvm::raw_string_ostream
OS(Result);
788 for (
const auto &I : llvm::enumerate(Rules)) {
790 OS << (I.index() == Rules.size() - 1 ?
", and " :
", ");
805 StrictSubjectMatchRuleSet;
809 if (StrictSubjectMatchRuleSet.empty()) {
816 llvm::SmallDenseMap<int, std::pair<int, SourceRange>, 2>
817 RulesToFirstSpecifiedNegatedSubRule;
818 for (
const auto &Rule : Rules) {
821 getParentAttrMatcherRule(MatchRule);
824 auto It = Rules.find(*ParentRule);
825 if (It != Rules.end()) {
827 Diag(Rule.second.getBegin(),
828 diag::err_pragma_attribute_matcher_subrule_contradicts_rule)
832 replacementRangeForListElement(*
this, Rule.second));
837 if (isNegatedAttrMatcherSubRule(MatchRule))
838 RulesToFirstSpecifiedNegatedSubRule.insert(
839 std::make_pair(*ParentRule, Rule));
841 bool IgnoreNegatedSubRules =
false;
842 for (
const auto &Rule : Rules) {
845 getParentAttrMatcherRule(MatchRule);
848 auto It = RulesToFirstSpecifiedNegatedSubRule.find(*ParentRule);
849 if (It != RulesToFirstSpecifiedNegatedSubRule.end() &&
850 It->second != Rule) {
853 It->second.second.getBegin(),
855 err_pragma_attribute_matcher_negated_subrule_contradicts_subrule)
860 replacementRangeForListElement(*
this, It->second.second));
862 IgnoreNegatedSubRules =
true;
863 RulesToFirstSpecifiedNegatedSubRule.erase(It);
867 if (!IgnoreNegatedSubRules) {
868 for (
const auto &Rule : Rules)
871 for (
const auto &Rule : Rules) {
878 for (
const auto &Rule : StrictSubjectMatchRuleSet) {
879 if (Rules.erase(Rule.first)) {
883 SubjectMatchRules.push_back(Rule.first);
888 if (!Rules.empty()) {
890 Diag(PragmaLoc, diag::err_pragma_attribute_invalid_matchers)
893 for (
const auto &Rule : Rules) {
896 replacementRangeForListElement(*
this, Rule.second));
898 Diagnostic << attrMatcherRuleListToString(ExtraRules);
902 Diag(PragmaLoc, diag::err_pragma_attr_attr_no_push);
907 {PragmaLoc, &Attribute, std::move(SubjectMatchRules),
false});
920 Diag(PragmaLoc, diag::err_pragma_attribute_stack_mismatch) << 1;
934 assert(Entry.Attribute &&
"Expected an attribute");
935 Diag(Entry.Attribute->getLoc(), diag::warn_pragma_attribute_unused)
937 Diag(PragmaLoc, diag::note_pragma_attribute_region_ends_here);
946 Diag(PragmaLoc, diag::err_pragma_attribute_stack_mismatch)
947 << 0 << Namespace->getName();
949 Diag(PragmaLoc, diag::err_pragma_attribute_stack_mismatch) << 1;
956 for (
auto &Entry : Group.Entries) {
958 assert(Attribute &&
"Expected an attribute");
960 "expected #pragma clang attribute");
963 bool Applies =
false;
964 for (
const auto &Rule : Entry.MatchRules) {
985 diag::note_pragma_attribute_applied_decl_here);
1011 if (FD->
hasAttr<MinSizeAttr>() || FD->
hasAttr<AlwaysInlineAttr>())
1016 if (!FD->
hasAttr<OptimizeNoneAttr>())
1018 if (!FD->
hasAttr<NoInlineAttr>())
1022 typedef std::vector<std::pair<unsigned, SourceLocation> >
VisStack;
1034 unsigned rawType = Stack->back().first;
1037 VisibilityAttr::VisibilityType
type
1038 = (VisibilityAttr::VisibilityType) rawType;
1056 Stack->push_back(std::make_pair(
type, loc));
1063 VisibilityAttr::VisibilityType T;
1064 if (!VisibilityAttr::ConvertStrToVisibilityType(VisType->
getName(), T)) {
1065 Diag(PragmaLoc, diag::warn_attribute_unknown_visibility) << VisType;
1088 llvm_unreachable(
"Should not happen");
1096 NewFPFeatures.setAllowFPReassociateOverride(IsEnabled);
1104 if (FPR == llvm::RoundingMode::Dynamic &&
1107 FPR = llvm::RoundingMode::NearestTiesToEven;
1110 NewFPFeatures.setRoundingModeOverride(FPR);
1118 NewFPFeatures.setFPExceptionModeOverride(FPE);
1132 Diag(Loc, diag::err_pragma_fenv_requires_precise);
1133 NewFPFeatures.setAllowFEnvAccessOverride(
true);
1136 NewFPFeatures.setRoundingModeOverride(llvm::RoundingMode::Dynamic);
1139 NewFPFeatures.setAllowFEnvAccessOverride(
false);
1161 Diag(EndLoc, diag::err_pragma_pop_visibility_mismatch);
1168 const std::pair<unsigned, SourceLocation> *Back = &Stack->back();
1170 if (StartsWithPragma && IsNamespaceEnd) {
1171 Diag(Back->second, diag::err_pragma_push_visibility_mismatch);
1172 Diag(EndLoc, diag::note_surrounding_namespace_ends_here);
1177 Back = &Stack->back();
1179 }
while (StartsWithPragma);
1180 }
else if (!StartsWithPragma && !IsNamespaceEnd) {
1181 Diag(EndLoc, diag::err_pragma_pop_visibility_mismatch);
1182 Diag(Back->second, diag::note_surrounding_namespace_starts_here);
bool UnifySection(StringRef SectionName, int SectionFlags, NamedDecl *TheDecl)
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
void setAllowFPContractAcrossStatement()
PragmaClangSection PragmaClangRelroSection
SourceLocation getBeginLoc() const LLVM_READONLY
void ActOnPragmaUnused(const Token &Identifier, Scope *curScope, SourceLocation PragmaLoc)
ActOnPragmaUnused - Called on well-formed '#pragma unused'.
void inferGslOwnerPointerAttribute(CXXRecordDecl *Record)
Add [[gsl::Owner]] and [[gsl::Pointer]] attributes for std:: types.
A trivial tuple used to represent a source range.
void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation, StringLiteral *SegmentName)
Called on well-formed #pragma init_seg().
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.
StringLiteral * CurInitSeg
Last section used with #pragma init_seg.
void FreeVisContext()
FreeVisContext - Deallocate and null out VisContext.
SourceManager & SourceMgr
PragmaStack< StringLiteral * > DataSegStack
void ActOnPragmaMSSeg(SourceLocation PragmaLocation, PragmaMsStackAction Action, llvm::StringRef StackSlotLabel, StringLiteral *SegmentName, llvm::StringRef PragmaName)
Called on well formed #pragma bss_seg/data_seg/const_seg/code_seg.
void ActOnPragmaFloatControl(SourceLocation Loc, PragmaMsStackAction Action, PragmaFloatControlKind Value)
ActOnPragmaFloatControl - Call on well-formed #pragma float_control.
SourceLocation getBeginLoc() const LLVM_READONLY
bool appliesToDecl(const Decl *D, attr::SubjectMatchRule MatchRule) const
Encodes a location in the source.
void ActOnPragmaDetectMismatch(SourceLocation Loc, StringRef Name, StringRef Value)
ActOnPragmaDetectMismatch - Call on well-formed #pragma detect_mismatch.
PragmaStack< StringLiteral * > CodeSegStack
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
void AddPushedVisibilityAttribute(Decl *RD)
AddPushedVisibilityAttribute - If '#pragma GCC visibility' was used, add an appropriate visibility at...
This represents a decl that may have a name.
void DiagnoseUnterminatedPragmaAttribute()
SmallVector< Slot, 2 > Stack
PragmaStack< FPOptionsOverride > FpPragmaStack
A (possibly-)qualified type.
IdentifierInfo * getIdentifierInfo() const
QualType getCanonicalType() const
Represents the results of name lookup.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required.
SourceManager & getSourceManager() const
void ActOnPragmaAttributePop(SourceLocation PragmaLoc, const IdentifierInfo *Namespace)
Called on well-formed '#pragma clang attribute pop'.
void setRoundingMode(SourceLocation Loc, llvm::RoundingMode)
Called to set constant rounding mode for floating point operations.
void AddMsStructLayoutForRecord(RecordDecl *RD)
AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
AlignPackInfo CurrentValue
void ActOnPragmaMSSection(SourceLocation PragmaLocation, int SectionFlags, StringLiteral *SegmentName)
Called on well formed #pragma section().
void setFPPreciseEnabled(bool Value)
std::vector< std::pair< unsigned, SourceLocation > > VisStack
MSVtorDispMode
In the Microsoft ABI, this controls the placement of virtual displacement members used to implement v...
void ActOnPragmaAttributeEmptyPush(SourceLocation PragmaLoc, const IdentifierInfo *Namespace)
Token - This structure provides full information about a lexed token.
void setIsPragmaClangAttribute()
TranslationUnitDecl * getTranslationUnitDecl() const
void setExceptionMode(SourceLocation Loc, LangOptions::FPExceptionModeKind)
Called to set exception behavior for floating point operations.
void ActOnPragmaFEnvAccess(SourceLocation Loc, bool IsEnabled)
ActOnPragmaFenvAccess - Called on well formed #pragma STDC FENV_ACCESS.
SubjectMatchRule
A list of all the recognized kinds of attributes.
void ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc)
Called on well formed #pragma clang optimize.
void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr, SourceLocation Loc)
PushNamespaceVisibilityAttr - Note that we've entered a namespace with a visibility attribute.
void AddPragmaAttributes(Scope *S, Decl *D)
Adds the attributes that have been specified using the '#pragma clang attribute push' directives to t...
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine) ...
const LangOptions & getLangOpts() const
static CharSourceRange getCharRange(SourceRange R)
Optional< llvm::APSInt > getIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc=nullptr, bool isEvaluated=true) const
isIntegerConstantExpr - Return the value if this expression is a valid integer constant expression.
Optional< Visibility > getExplicitVisibility(ExplicitVisibilityKind kind) const
If visibility was explicitly specified for this declaration, return that visibility.
bool isPreciseFPEnabled()
Are precise floating point semantics currently enabled?
bool isTypeDependent() const
Determines whether the type of this expression depends on.
FPOptionsOverride CurFPFeatureOverrides()
void ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind, SourceLocation PragmaLoc)
ActOnPragmaOptionsAlign - Called on well formed #pragma options align.
Scope - A scope is a transient data structure that is used while parsing the program.
bool isInStdNamespace() const
void * VisContext
VisContext - Manages the stack for #pragma GCC visibility.
std::string toString(const til::SExpr *E)
Represents difference between two FPOptions values.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
FPExceptionModeKind
Possible floating point exception behavior.
PragmaStackSentinelRAII(Sema &S, StringRef SlotLabel, bool ShouldAct)
void ActOnPragmaPack(SourceLocation PragmaLoc, PragmaMsStackAction Action, StringRef SlotLabel, Expr *Alignment)
ActOnPragmaPack - Called on well formed #pragma pack(...).
FPOptions applyOverrides(FPOptions Base)
DiagnosticsEngine & Diags
void ActOnPragmaFPContract(SourceLocation Loc, LangOptions::FPModeKind FPC)
ActOnPragmaFPContract - Called on well formed #pragma {STDC,OPENCL} FP_CONTRACT and #pragma clang fp ...
QualType getUnderlyingType() const
bool isTranslationUnit() const
ParsedAttr - Represents a syntactic attribute.
const char * getSubjectMatchRuleSpelling(SubjectMatchRule Rule)
void addAtEnd(ParsedAttr *newAttr)
void ProcessDeclAttributeList(Scope *S, Decl *D, const ParsedAttributesView &AL, bool IncludeCXX11Attributes=true)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
static PragmaDetectMismatchDecl * Create(const ASTContext &C, TranslationUnitDecl *DC, SourceLocation Loc, StringRef Name, StringRef Value)
PragmaClangSection PragmaClangTextSection
Represents a variable declaration or definition.
StringLiteral - This represents a string literal expression, e.g.
SmallVector< AlignPackIncludeState, 8 > AlignPackIncludeStack
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS, bool AllowBuiltinCreation=false, bool EnteringContext=false)
Performs name lookup for a name that was parsed in the source code, and may contain a C++ scope speci...
~PragmaStackSentinelRAII()
IRgen optimization opportunities The common pattern of short x
SourceLocation CurInitSegLoc
void ActOnPragmaVisibility(const IdentifierInfo *VisType, SourceLocation PragmaLoc)
ActOnPragmaVisibility - Called on well formed #pragma GCC visibility... .
virtual bool HandleTopLevelDecl(DeclGroupRef D)
HandleTopLevelDecl - Handle the specified top-level declaration.
const LangOptions & LangOpts
void Act(SourceLocation PragmaLocation, PragmaMsStackAction Action, llvm::StringRef StackSlotLabel, ValueType Value)
void ActOnPragmaFPExceptions(SourceLocation Loc, LangOptions::FPExceptionModeKind)
Called on well formed '#pragma clang fp' that has option 'exceptions'.
PragmaClangSection PragmaClangBSSSection
Represents a C++ struct/union/class.
PragmaStack< StringLiteral * > BSSSegStack
bool hasAlignMac68kSupport() const
Check whether this target support '#pragma options align=mac68k'.
bool empty() const
Return true if no decls were found.
SourceLocation CurrentPragmaLocation
void PrintPragmaAttributeInstantiationPoint()
void ActOnPragmaMSVtorDisp(PragmaMsStackAction Action, SourceLocation PragmaLoc, MSVtorDispMode Value)
Called on well formed #pragma vtordisp().
void ActOnPragmaMSStruct(PragmaMSStructKind Kind)
ActOnPragmaMSStruct - Called on well formed #pragma ms_struct [on|off].
This an attribute introduced by #pragma clang attribute.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
LangOptions::PragmaMSPointersToMembersKind MSPointerToMemberRepresentationMethod
Controls member pointer representation format under the MS ABI.
void addDecl(Decl *D)
Add the declaration D into this context.
static CharSourceRange getTokenRange(SourceRange R)
std::pair< IdentifierInfo *, SourceLocation > getPragmaARCCFCodeAuditedInfo() const
The location of the currently-active #pragma clang arc_cf_code_audited begin.
void DiagnoseNonDefaultPragmaAlignPack(PragmaAlignPackDiagnoseKind Kind, SourceLocation IncludeLoc)
Decl - This represents one declaration (or definition), e.g.
SmallVector< PragmaAttributeGroup, 2 > PragmaAttributeStack
void ActOnPragmaMSComment(SourceLocation CommentLoc, PragmaMSCommentKind Kind, StringRef Arg)
ActOnPragmaMSComment - Called on well formed #pragma comment(kind, "arg").
Represents a character-granular source range.
Sema - This implements semantic analysis and AST building for C.
bool isValueDependent() const
Determines whether the value of this expression depends on.
One of these records is kept for each identifier that is lexed.
SourceLocation ImplicitMSInheritanceAttrLoc
Source location for newly created implicit MSInheritanceAttrs.
SourceLocation getLocation() const
Return a source location identifier for the specified offset in the current file.
const TargetInfo & getTargetInfo() const
void DiagnoseUnterminatedPragmaAlignPack()
bool isPragmaClangAttribute() const
True if the attribute is specified using '#pragma clang attribute'.
llvm::DenseMap< int, SourceRange > ParsedSubjectMatchRuleSet
void ActOnPragmaClangSection(SourceLocation PragmaLoc, PragmaClangSectionAction Action, PragmaClangSectionKind SecKind, StringRef SecName)
ActOnPragmaClangSection - Called on well formed #pragma clang section.
llvm::StringMap< SectionInfo > SectionInfos
void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc)
PopPragmaVisibility - Pop the top element of the visibility stack; used for '#pragma GCC visibility' ...
static void addGslOwnerPointerAttributeIfNotExisting(ASTContext &Context, CXXRecordDecl *Record)
PragmaStack< StringLiteral * > ConstSegStack
StringRef getName() const
Return the actual identifier string.
PragmaMSPointersToMembersKind
Dataflow Directional Tag Classes.
void inferGslPointerAttribute(NamedDecl *ND, CXXRecordDecl *UnderlyingRecord)
Add gsl::Pointer attribute to std::container::iterator.
static void PushPragmaVisibility(Sema &S, unsigned type, SourceLocation loc)
unsigned getPackNumber() const
@ NonDefaultStateAtInclude
SourceLocation PragmaLocation
void AddOptnoneAttributeIfNoConflicts(FunctionDecl *FD, SourceLocation Loc)
Adds the 'optnone' attribute to the function declaration if there are no conflicts; Loc represents th...
PragmaClangSectionKind
pragma clang section kind
void setDisallowFPContract()
void getMatchRules(const LangOptions &LangOpts, SmallVectorImpl< std::pair< attr::SubjectMatchRule, bool >> &MatchRules) const
void AddCFAuditedAttribute(Decl *D)
AddCFAuditedAttribute - Check whether we're currently within '#pragma clang arc_cf_code_audited' and,...
bool isValid() const
Return true if this is a valid SourceLocation object.
@ FPE_Ignore
Assume that floating-point exceptions are masked.
Attr - This represents one attribute.
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
@ FPE_Strict
Strictly preserve the floating-point exception semantics.
SourceLocation OptimizeOffPragmaLocation
This represents the last location of a "#pragma clang optimize off" directive if such a directive has...
virtual llvm::Error isValidSectionSpecifier(StringRef SR) const
An optional hook that targets can implement to perform semantic checking on attribute((section("foo")...
Base class for declarations which introduce a typedef-name.
PragmaStack< AlignPackInfo > AlignPackStack
DeclClass * getAsSingle() const
Mode getAlignMode() const
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
bool checkSectionName(SourceLocation LiteralLoc, StringRef Str)
PragmaAlignPackDiagnoseKind
void ActOnPragmaMSPointersToMembers(LangOptions::PragmaMSPointersToMembersKind Kind, SourceLocation PragmaLoc)
ActOnPragmaMSPointersToMembers - called on well formed #pragma pointers_to_members(representation met...
@ VisibilityForValue
Do an LV computation for, ultimately, a non-type declaration.
PragmaClangSection PragmaClangDataSection
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
void AddRangeBasedOptnone(FunctionDecl *FD)
Only called on function definitions; if there is a pragma in scope with the effect of a range-based o...
static SourceLocation findLocationAfterToken(SourceLocation loc, tok::TokenKind TKind, const SourceManager &SM, const LangOptions &LangOpts, bool SkipTrailingWhitespaceAndNewLine)
Checks that the given token is the first token that occurs after the given location (this excludes co...
const Decl * PragmaAttributeCurrentTargetDecl
The declaration that is currently receiving an attribute from the #pragma attribute stack.
This represents one expression.
void AddAlignmentAttributesForRecord(RecordDecl *RD)
AddAlignmentAttributesForRecord - Adds any needed alignment attributes to a the record decl,...
void setAllowFPContractWithinStatement()
PragmaClangSection PragmaClangRodataSection
SourceLocation getLocation() const
Represents a function declaration or definition.
Represents a struct/union/class.
PragmaStack< MSVtorDispMode > VtorDispStack
Whether to insert vtordisps prior to virtual bases in the Microsoft C++ ABI.
StringRef getString() const
void SentinelAction(PragmaMsStackAction Action, StringRef Label)
@ OS
Indicates that the tracking object is a descendant of a referenced-counted OSObject,...
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
void ActOnPragmaFPReassociate(SourceLocation Loc, bool IsEnabled)
Called on well formed #pragma clang fp reassociate.
void ActOnPragmaAttributeAttribute(ParsedAttr &Attribute, SourceLocation PragmaLoc, attr::ParsedSubjectMatchRuleSet Rules)
DeclContext * getDeclContext()
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.