;
31: S(S), SlotLabel(SlotLabel), ShouldAct(ShouldAct) {
66}
else if(IsPackSet) {
68RD->
addAttr(MaxFieldAlignmentAttr::CreateImplicit(
81 if(AlignPackedInclude.CurrentPragmaLocation !=
84 if(AlignPackedInclude.HasNonDefaultValue)
85AlignPackedInclude.ShouldWarnOnInclude =
true;
97RD->
addAttr(MSVtorDispAttr::CreateImplicit(
101template<
typenameAttribute>
104 if(
Record->hasAttr<OwnerAttr>() ||
Record->hasAttr<PointerAttr>())
108Redecl->addAttr(Attribute::CreateImplicit(
Context,
nullptr));
113 if(!UnderlyingRecord)
120 static constllvm::StringSet<> Containers{
136 "unordered_multiset",
137 "unordered_multimap",
140 static constllvm::StringSet<> Iterators{
"iterator",
"const_iterator",
142 "const_reverse_iterator"};
144 if(
Parent->isInStdNamespace() && Iterators.count(ND->
getName()) &&
145Containers.count(
Parent->getName()))
146addGslOwnerPointerAttributeIfNotExisting<PointerAttr>(
Context,
157dyn_cast<TemplateSpecializationType>(Canonical.
getTypePtr())) {
159RD = dyn_cast_or_null<CXXRecordDecl>(
160TST->getTemplateName().getAsTemplateDecl()->getTemplatedDecl());
168 static constllvm::StringSet<> StdOwners{
188 "unordered_multiset",
189 "unordered_multimap",
192 static constllvm::StringSet<> StdPointers{
193 "basic_string_view",
194 "reference_wrapper",
199 if(!
Record->getIdentifier())
203 if(
Record->isInStdNamespace()) {
204 if(
Record->hasAttr<OwnerAttr>() ||
Record->hasAttr<PointerAttr>())
207 if(StdOwners.count(
Record->getName()))
208addGslOwnerPointerAttributeIfNotExisting<OwnerAttr>(
Context,
Record);
209 else if(StdPointers.count(
Record->getName()))
210addGslOwnerPointerAttributeIfNotExisting<PointerAttr>(
Context,
Record);
226 caseBuiltin::BIaddressof:
227 caseBuiltin::BI__addressof:
228 caseBuiltin::BI__builtin_addressof:
229 caseBuiltin::BIas_const:
230 caseBuiltin::BIforward:
231 caseBuiltin::BIforward_like:
232 caseBuiltin::BImove:
233 caseBuiltin::BImove_if_noexcept:
235!
P->hasAttr<LifetimeBoundAttr>())
244 if(
auto*CMD = dyn_cast<CXXMethodDecl>(FD)) {
245 const auto*CRD = CMD->getParent();
246 if(!CRD->isInStdNamespace() || !CRD->getIdentifier())
249 if(isa<CXXConstructorDecl>(CMD)) {
250 auto*Param = CMD->getParamDecl(0);
251 if(Param->hasAttr<LifetimeBoundAttr>())
253 if(CRD->getName() ==
"basic_string_view"&&
254Param->getType()->isPointerType()) {
260}
else if(CRD->getName() ==
"span") {
264 if(LRT && LRT->getPointeeType().IgnoreParens()->isArrayType())
273 auto*MD = dyn_cast_if_present<CXXMethodDecl>(FD);
274 if(!MD || !MD->getParent()->isInStdNamespace())
279 if(PVD->hasAttr<LifetimeCaptureByAttr>())
286 if(PVD->getType()->isReferenceType() &&
288 intCaptureByThis[] = {LifetimeCaptureByAttr::THIS};
290LifetimeCaptureByAttr::CreateImplicit(
Context, CaptureByThis, 1));
295 if(!MD->getIdentifier()) {
296 static constllvm::StringSet<> MapLikeContainer{
300 "unordered_multimap",
305 if(MD->getOverloadedOperator() == OO_Subscript &&
306MapLikeContainer.contains(MD->getParent()->getName()))
310 static constllvm::StringSet<> CapturingMethods{
311 "insert",
"insert_or_assign",
"push",
"push_front",
"push_back"};
312 if(!CapturingMethods.contains(MD->getName()))
318 static constllvm::StringSet<>
Nullable{
319 "auto_ptr",
"shared_ptr",
"unique_ptr",
"exception_ptr",
320 "coroutine_handle",
"function",
"move_only_function",
324!CRD->
hasAttr<TypeNullableAttr>())
326Redecl->addAttr(TypeNullableAttr::CreateImplicit(
Context));
356 Diag(PragmaLoc, diag::err_pragma_options_align_mac68k_target_unsupported);
371 Diag(PragmaLoc, diag::warn_pragma_options_align_reset_failed)
410llvm_unreachable(
"invalid clang section kind");
414CSec->
Valid=
false;
419 Diag(PragmaLoc, diag::err_pragma_section_invalid_for_target)
421CSec->
Valid=
false;
428CSec->
Valid=
true;
434StringRef SlotLabel,
Expr*alignment) {
437 if(IsXLPragma && !SlotLabel.empty()) {
438 Diag(PragmaLoc, diag::err_pragma_pack_identifer_not_supported);
443 Expr*Alignment =
static_cast<Expr*
>(alignment);
446 unsignedAlignmentVal = 0;
450std::optional<llvm::APSInt> Val;
456!(*Val == 0 || Val->isPowerOf2()) || Val->getZExtValue() > 16) {
457 Diag(PragmaLoc, diag::warn_pragma_pack_invalid_alignment);
461 if(IsXLPragma && *Val == 0) {
463 Diag(PragmaLoc, diag::err_pragma_pack_invalid_alignment);
467AlignmentVal = (
unsigned)Val->getZExtValue();
477 Diag(PragmaLoc, diag::warn_pragma_pack_show) <<
"mac68k";
479 Diag(PragmaLoc, diag::warn_pragma_pack_show) << AlignmentVal;
485 if(Alignment && !SlotLabel.empty())
486 Diag(PragmaLoc, diag::warn_pragma_pack_pop_identifier_and_alignment);
489 "Empty pack stack can only be at Native alignment mode.");
490 Diag(PragmaLoc, diag::warn_pragma_pop_failed) <<
"pack"<<
"stack empty";
502 for(
unsignedIdx = 0; Idx < Args.size(); Idx++) {
503 Expr*&
E= Args.begin()[Idx];
504assert(
E&&
"error are handled before");
512clang::CK_ArrayToPointerDecay)
517clang::CK_FunctionToPointerDecay,
E,
nullptr,
521clang::CK_LValueToRValue,
E,
nullptr,
533 if(!
Result|| !Notes.empty()) {
536 for(
auto&
Note: Notes)
556 boolHasNonDefaultValue =
563HasNonDefaultValue,
false});
576 Diag(IncludeLoc, diag::warn_pragma_pack_non_default_at_include);
581 Diag(IncludeLoc, diag::warn_pragma_pack_modified_after_include);
589 boolIsInnermost =
true;
594 for(
const auto&StackSlot : llvm::reverse(
AlignPackStack.Stack)) {
595 Diag(StackSlot.PragmaPushLocation, diag::warn_pragma_pack_no_pop_eof);
601diag::note_pragma_pack_pop_instead_reset);
609IsInnermost =
false;
638llvm_unreachable(
"invalid pragma eval_method kind");
650 Diag(
Loc, diag::err_setting_eval_method_used_in_unsafe_context) << 0 << 0;
652 Diag(
Loc, diag::err_setting_eval_method_used_in_unsafe_context) << 0 << 1;
654 Diag(
Loc, diag::err_setting_eval_method_used_in_unsafe_context) << 0 << 2;
668 Diag(
Loc, diag::err_pragma_fc_pp_scope);
673llvm_unreachable(
"invalid pragma float_control kind");
680 Diag(
Loc, diag::err_pragma_fc_noprecise_requires_noexcept);
682 Diag(
Loc, diag::err_pragma_fc_noprecise_requires_nofenv);
689 Diag(
Loc, diag::err_pragma_fc_except_requires_precise);
703 Diag(
Loc, diag::warn_pragma_pop_failed) <<
"float_control" 725 Diag(PragmaLoc, diag::warn_pragma_pop_failed) <<
"vtordisp" 733llvm::StringRef StackSlotLabel,
734AlignPackInfo
Value) {
736CurrentValue = DefaultValue;
737CurrentPragmaLocation = PragmaLocation;
741Stack.emplace_back(Slot(StackSlotLabel, CurrentValue, CurrentPragmaLocation,
744 if(!StackSlotLabel.empty()) {
746 autoI = llvm::find_if(llvm::reverse(Stack), [&](
constSlot &x) {
747 returnx.StackSlotLabel == StackSlotLabel;
750 if(I != Stack.rend()) {
751CurrentValue = I->Value;
752CurrentPragmaLocation = I->PragmaLocation;
753Stack.erase(std::prev(I.base()), Stack.end());
755}
else if(
Value.IsXLStack() &&
Value.IsAlignAttr() &&
756CurrentValue.IsPackAttr()) {
759 autoI = llvm::find_if(llvm::reverse(Stack), [&](
constSlot &x) {
760 returnx.Value.IsAlignAttr();
763 if(I != Stack.rend()) {
764Stack.erase(std::prev(I.base()), Stack.end());
766CurrentValue = DefaultValue;
767CurrentPragmaLocation = PragmaLocation;
769CurrentValue = Stack.back().Value;
770CurrentPragmaLocation = Stack.back().PragmaLocation;
774}
else if(!Stack.empty()) {
777 if(
Value.IsXLStack() &&
Value.IsPackAttr() && CurrentValue.IsAlignAttr())
781CurrentValue = Stack.back().Value;
782CurrentPragmaLocation = Stack.back().PragmaLocation;
787CurrentValue =
Value;
788CurrentPragmaLocation = PragmaLocation;
797PragmaLocation = A->getLocation();
799SectionName,
Decl, PragmaLocation, SectionFlags);
803 const auto&Section = SectionIt->second;
804 if(Section.SectionFlags == SectionFlags ||
810 Diag(Section.
Decl->getLocation(), diag::note_declared_at)
811<< Section.
Decl->getName();
812 if(PragmaLocation.
isValid())
813 Diag(PragmaLocation, diag::note_pragma_entered_here);
814 if(Section.PragmaSectionLocation.isValid())
815 Diag(Section.PragmaSectionLocation, diag::note_pragma_entered_here);
824 const auto&Section = SectionIt->second;
825 if(Section.SectionFlags == SectionFlags)
828 Diag(PragmaSectionLocation, diag::err_section_conflict)
829<<
"this"<< Section;
831 Diag(Section.Decl->getLocation(), diag::note_declared_at)
832<< Section.Decl->getName();
833 if(Section.PragmaSectionLocation.isValid())
834 Diag(Section.PragmaSectionLocation, diag::note_pragma_entered_here);
846llvm::StringRef StackSlotLabel,
848llvm::StringRef PragmaName) {
850llvm::StringSwitch<PragmaStack<StringLiteral *> *>(PragmaName)
855 if(Action &
PSK_Pop&& Stack->Stack.empty())
856 Diag(PragmaLocation, diag::warn_pragma_pop_failed) << PragmaName
862 if(SegmentName->
getString() ==
".drectve"&&
864 Diag(PragmaLocation, diag::warn_attribute_section_drectve) << PragmaName;
867Stack->Act(PragmaLocation, Action, StackSlotLabel, SegmentName);
875 Diag(PragmaLocation, diag::warn_pragma_pop_failed) <<
"strict_gs_check" 898 const SmallVector<std::tuple<IdentifierInfo *, SourceLocation>>
901 Diag(PragmaLocation, diag::err_pragma_expected_file_scope) <<
"alloc_text";
905 for(
auto&
Function: Functions) {
919 Diag(
Loc, diag::err_pragma_alloc_text_not_function);
924 Diag(
Loc, diag::err_pragma_alloc_text_c_linkage);
939 if(Lookup.
empty()) {
940 Diag(PragmaLoc, diag::warn_pragma_unused_undeclared_var)
947 Diag(PragmaLoc, diag::warn_pragma_unused_expected_var_arg)
954 Diag(PragmaLoc, diag::warn_used_but_marked_unused) << Name;
957UnusedAttr::GNU_unused));
962std::optional<attr::SubjectMatchRule>
964 using namespace attr;
968#define ATTR_MATCH_RULE(Value, Spelling, IsAbstract) 969#define ATTR_MATCH_SUB_RULE(Value, Spelling, IsAbstract, Parent, IsNegated) \ 972#include "clang/Basic/AttrSubMatchRulesList.inc" 977 using namespace attr;
981#define ATTR_MATCH_RULE(Value, Spelling, IsAbstract) 982#define ATTR_MATCH_SUB_RULE(Value, Spelling, IsAbstract, Parent, IsNegated) \ 985#include "clang/Basic/AttrSubMatchRulesList.inc" 1004llvm::raw_string_ostream
OS(
Result);
1005 for(
const auto&I : llvm::enumerate(Rules)) {
1007 OS<< (I.index() == Rules.size() - 1 ?
", and ":
", ");
1022StrictSubjectMatchRuleSet;
1026 if(StrictSubjectMatchRuleSet.empty()) {
1033llvm::SmallDenseMap<int, std::pair<int, SourceRange>, 2>
1034RulesToFirstSpecifiedNegatedSubRule;
1035 for(
const auto&Rule : Rules) {
1037std::optional<attr::SubjectMatchRule> ParentRule =
1038getParentAttrMatcherRule(MatchRule);
1041 autoIt = Rules.find(*ParentRule);
1042 if(It != Rules.end()) {
1044 Diag(Rule.second.getBegin(),
1045diag::err_pragma_attribute_matcher_subrule_contradicts_rule)
1049replacementRangeForListElement(*
this, Rule.second));
1054 if(isNegatedAttrMatcherSubRule(MatchRule))
1055RulesToFirstSpecifiedNegatedSubRule.insert(
1056std::make_pair(*ParentRule, Rule));
1058 boolIgnoreNegatedSubRules =
false;
1059 for(
const auto&Rule : Rules) {
1061std::optional<attr::SubjectMatchRule> ParentRule =
1062getParentAttrMatcherRule(MatchRule);
1065 autoIt = RulesToFirstSpecifiedNegatedSubRule.find(*ParentRule);
1066 if(It != RulesToFirstSpecifiedNegatedSubRule.end() &&
1067It->second != Rule) {
1070It->second.second.getBegin(),
1072err_pragma_attribute_matcher_negated_subrule_contradicts_subrule)
1077replacementRangeForListElement(*
this, It->second.second));
1079IgnoreNegatedSubRules =
true;
1080RulesToFirstSpecifiedNegatedSubRule.erase(It);
1084 if(!IgnoreNegatedSubRules) {
1085 for(
const auto&Rule : Rules)
1088 for(
const auto&Rule : Rules) {
1100 for(
const auto&StrictRule : StrictSubjectMatchRuleSet) {
1102 if(Rules.erase(StrictRule.first)) {
1105 if(StrictRule.second)
1106SubjectMatchRules.push_back(StrictRule.first);
1110 autoRulesToCheck = Rules;
1111 for(
const auto&Rule : RulesToCheck) {
1113 if(
autoParentRule = getParentAttrMatcherRule(MatchRule)) {
1114 if(llvm::any_of(StrictSubjectMatchRuleSet,
1115[ParentRule](
const auto&StrictRule) {
1116 returnStrictRule.first == *ParentRule &&
1119SubjectMatchRules.push_back(MatchRule);
1120Rules.erase(MatchRule);
1126 if(!Rules.empty()) {
1128 Diag(PragmaLoc, diag::err_pragma_attribute_invalid_matchers)
1131 for(
const auto&Rule : Rules) {
1134replacementRangeForListElement(*
this, Rule.second));
1136 Diagnostic<< attrMatcherRuleListToString(ExtraRules);
1140 Diag(PragmaLoc, diag::err_pragma_attr_attr_no_push);
1145{PragmaLoc, &Attribute, std::move(SubjectMatchRules),
false});
1158 Diag(PragmaLoc, diag::err_pragma_attribute_stack_mismatch) << 1;
1171 if(!Entry.IsUsed) {
1172assert(Entry.Attribute &&
"Expected an attribute");
1173 Diag(Entry.Attribute->getLoc(), diag::warn_pragma_attribute_unused)
1174<< *Entry.Attribute;
1175 Diag(PragmaLoc, diag::note_pragma_attribute_region_ends_here);
1184 Diag(PragmaLoc, diag::err_pragma_attribute_stack_mismatch)
1185<< 0 << Namespace->getName();
1187 Diag(PragmaLoc, diag::err_pragma_attribute_stack_mismatch) << 1;
1194 for(
auto&Entry : Group.Entries) {
1196assert(Attribute &&
"Expected an attribute");
1198 "expected #pragma clang attribute");
1201 boolApplies =
false;
1202 for(
const auto&Rule : Entry.MatchRules) {
1210Entry.IsUsed =
true;
1223diag::note_pragma_attribute_applied_decl_here);
1229 "expected a valid source location");
1231diag::warn_excess_precision_not_supported)
1232<<
static_cast<bool>(
Num);
1251 Diag(
Loc, diag::err_pragma_expected_file_scope) <<
"optimize";
1261 Diag(
Loc, diag::err_pragma_expected_file_scope) <<
"function";
1279StringRef Name = FD->
getName();
1284std::tie(Section,
Loc) = It->second;
1286 if(!FD->
hasAttr<SectionAttr>())
1301 if(FD->
hasAttr<MinSizeAttr>() || FD->
hasAttr<AlwaysInlineAttr>())
1306 if(!FD->
hasAttr<OptimizeNoneAttr>())
1308 if(!FD->
hasAttr<NoInlineAttr>())
1318FD->
addAttr(NoBuiltinAttr::CreateImplicit(
Context,
V.data(),
V.size()));
1321typedefstd::vector<std::pair<unsigned, SourceLocation> >
VisStack;
1333 unsignedrawType = Stack->back().first;
1336VisibilityAttr::VisibilityType
type 1337= (VisibilityAttr::VisibilityType) rawType;
1354Stack->push_back(std::make_pair(
type, loc));
1361VisibilityAttr::VisibilityType
T;
1362 if(!VisibilityAttr::ConvertStrToVisibilityType(VisType->
getName(),
T)) {
1363 Diag(PragmaLoc, diag::warn_attribute_unknown_visibility) << VisType;
1407 Diag(
Loc, diag::err_setting_eval_method_used_in_unsafe_context)
1414NewFPFeatures.setAllowFPReassociateOverride(IsEnabled);
1417NewFPFeatures.setAllowReciprocalOverride(IsEnabled);
1420llvm_unreachable(
"unhandled value changing pragma fp");
1429NewFPFeatures.setConstRoundingModeOverride(FPR);
1437NewFPFeatures.setSpecifiedExceptionModeOverride(FPE);
1450 Diag(
Loc, diag::err_pragma_fenv_requires_precise);
1452NewFPFeatures.setAllowFEnvAccessOverride(IsEnabled);
1453NewFPFeatures.setRoundingMathOverride(IsEnabled);
1461NewFPFeatures.setComplexRangeOverride(
Range);
1482 Diag(EndLoc, diag::err_pragma_pop_visibility_mismatch);
1489 conststd::pair<unsigned, SourceLocation> *Back = &Stack->back();
1491 if(StartsWithPragma && IsNamespaceEnd) {
1492 Diag(Back->second, diag::err_pragma_push_visibility_mismatch);
1493 Diag(EndLoc, diag::note_surrounding_namespace_ends_here);
1498Back = &Stack->back();
1500}
while(StartsWithPragma);
1501}
else if(!StartsWithPragma && !IsNamespaceEnd) {
1502 Diag(EndLoc, diag::err_pragma_pop_visibility_mismatch);
1503 Diag(Back->second, diag::note_surrounding_namespace_starts_here);
1513template<
typenameTy>
1516 boolSkipArgCountCheck) {
1542 if(!SkipArgCountCheck) {
1562 boolSkipArgCountCheck) {
1563return ::checkCommonAttributeFeatures(*
this,
D, A, SkipArgCountCheck);
1566 boolSkipArgCountCheck) {
1567return ::checkCommonAttributeFeatures(*
this, S, A, SkipArgCountCheck);
llvm::MachO::Record Record
Defines the clang::Preprocessor interface.
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
std::vector< std::pair< unsigned, SourceLocation > > VisStack
static void PushPragmaVisibility(Sema &S, unsigned type, SourceLocation loc)
static void addGslOwnerPointerAttributeIfNotExisting(ASTContext &Context, CXXRecordDecl *Record)
virtual bool HandleTopLevelDecl(DeclGroupRef D)
HandleTopLevelDecl - Handle the specified top-level declaration.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TranslationUnitDecl * getTranslationUnitDecl() const
llvm::StringMap< SectionInfo > SectionInfos
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
const TargetInfo & getTargetInfo() const
Attr - This represents one attribute.
Represents a C++ struct/union/class.
Represents a character-granular source range.
static CharSourceRange getCharRange(SourceRange R)
static CharSourceRange getTokenRange(SourceRange R)
static ConstantExpr * Create(const ASTContext &Context, Expr *E, const APValue &Result)
bool isFileContext() const
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
void addDecl(Decl *D)
Add the declaration D into this context.
Decl - This represents one declaration (or definition), e.g.
bool isInStdNamespace() const
SourceLocation getLocation() const
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required.
DeclContext * getDeclContext()
SourceLocation getBeginLoc() const LLVM_READONLY
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
The name of a declaration.
SourceLocation getBeginLoc() const LLVM_READONLY
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine a...
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
bool isLValue() const
isLValue - True if this expression is an "l-value" according to the rules of the current language.
bool EvaluateAsConstantExpr(EvalResult &Result, const ASTContext &Ctx, ConstantExprKind Kind=ConstantExprKind::Normal) const
Evaluate an expression that is required to be a constant expression.
std::optional< llvm::APSInt > getIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc=nullptr) const
isIntegerConstantExpr - Return the value if this expression is a valid integer constant expression.
Represents difference between two FPOptions values.
void setAllowFPContractAcrossStatement()
void setFPPreciseEnabled(bool Value)
void setAllowFPContractWithinStatement()
FPOptions applyOverrides(FPOptions Base)
void setDisallowFPContract()
LangOptions::FPExceptionModeKind getExceptionMode() const
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.
Represents a function declaration or definition.
const ParmVarDecl * getParamDecl(unsigned i) const
unsigned getBuiltinID(bool ConsiderWrapperFunctions=false) const
Returns a value indicating whether this function corresponds to a builtin function.
bool isDeleted() const
Whether this function has been deleted.
bool isDefaulted() const
Whether this function is defaulted.
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
One of these records is kept for each identifier that is lexed.
StringRef getName() const
Return the actual identifier string.
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat, FPOptionsOverride FPO)
An lvalue reference type, per C++11 [dcl.ref].
ComplexRangeKind
Controls the various implementations for complex multiplication and.
FPEvalMethodKind
Possible float expression evaluation method choices.
@ FEM_Extended
Use extended type for fp arithmetic.
@ FEM_Double
Use the type double for fp arithmetic.
@ FEM_UnsetOnCommandLine
Used only for FE option processing; this is only used to indicate that the user did not specify an ex...
@ FEM_Source
Use the declared type for fp arithmetic.
PragmaMSPointersToMembersKind
FPExceptionModeKind
Possible floating point exception behavior.
@ FPE_Strict
Strictly preserve the floating-point exception semantics.
@ FPE_Ignore
Assume that floating-point exceptions are masked.
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...
Represents the results of name lookup.
DeclClass * getAsSingle() const
bool empty() const
Return true if no decls were found.
This represents a decl that may have a name.
@ VisibilityForValue
Do an LV computation for, ultimately, a non-type declaration.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
std::optional< Visibility > getExplicitVisibility(ExplicitVisibilityKind kind) const
If visibility was explicitly specified for this declaration, return that visibility.
Represents a parameter to a function.
ParsedAttr - Represents a syntactic attribute.
bool hasCustomParsing() const
bool appliesToDecl(const Decl *D, attr::SubjectMatchRule MatchRule) const
unsigned getMinArgs() const
bool checkExactlyNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has exactly as many args as Num.
bool hasVariadicArg() const
bool diagnoseMutualExclusion(class Sema &S, const Decl *D) const
bool diagnoseAppertainsTo(class Sema &S, const Decl *D) const
bool checkAtLeastNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has at least as many args as Num.
unsigned getMaxArgs() const
bool isPragmaClangAttribute() const
True if the attribute is specified using '#pragma clang attribute'.
AttributeCommonInfo::Kind getKind() const
void getMatchRules(const LangOptions &LangOpts, SmallVectorImpl< std::pair< attr::SubjectMatchRule, bool > > &MatchRules) const
bool diagnoseLangOpts(class Sema &S) const
void setIsPragmaClangAttribute()
bool checkAtMostNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has at most as many args as Num.
void addAtEnd(ParsedAttr *newAttr)
static PragmaDetectMismatchDecl * Create(const ASTContext &C, TranslationUnitDecl *DC, SourceLocation Loc, StringRef Name, StringRef Value)
SourceLocation getLastFPEvalPragmaLocation() const
void setCurrentFPEvalMethod(SourceLocation PragmaLoc, LangOptions::FPEvalMethodKind Val)
A (possibly-)qualified type.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
QualType getCanonicalType() const
Represents a struct/union/class.
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
Scope - A scope is a transient data structure that is used while parsing the program.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
unsigned getPackNumber() const
Mode getAlignMode() const
~PragmaStackSentinelRAII()
PragmaStackSentinelRAII(Sema &S, StringRef SlotLabel, bool ShouldAct)
Sema - This implements semantic analysis and AST building for C.
void ActOnPragmaMSOptimize(SourceLocation Loc, bool IsOn)
#pragma optimize("[optimization-list]", on | off).
bool ConstantFoldAttrArgs(const AttributeCommonInfo &CI, MutableArrayRef< Expr * > Args)
ConstantFoldAttrArgs - Folds attribute arguments into ConstantExprs (unless they are value dependent ...
void ActOnPragmaAttributeEmptyPush(SourceLocation PragmaLoc, const IdentifierInfo *Namespace)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
void ActOnPragmaAttributePop(SourceLocation PragmaLoc, const IdentifierInfo *Namespace)
Called on well-formed '#pragma clang attribute pop'.
void ActOnPragmaDetectMismatch(SourceLocation Loc, StringRef Name, StringRef Value)
ActOnPragmaDetectMismatch - Call on well-formed #pragma detect_mismatch.
const Decl * PragmaAttributeCurrentTargetDecl
The declaration that is currently receiving an attribute from the #pragma attribute stack.
void ActOnPragmaFEnvRound(SourceLocation Loc, llvm::RoundingMode)
Called to set constant rounding mode for floating point operations.
PragmaClangSection PragmaClangRodataSection
bool checkSectionName(SourceLocation LiteralLoc, StringRef Str)
void AddPragmaAttributes(Scope *S, Decl *D)
Adds the attributes that have been specified using the '#pragma clang attribute push' directives to t...
bool checkCommonAttributeFeatures(const Decl *D, const ParsedAttr &A, bool SkipArgCountCheck=false)
Handles semantic checking for features that are common to all attributes, such as checking whether a ...
void AddOptnoneAttributeIfNoConflicts(FunctionDecl *FD, SourceLocation Loc)
Adds the 'optnone' attribute to the function declaration if there are no conflicts; Loc represents th...
SourceLocation LocationOfExcessPrecisionNotSatisfied
void inferLifetimeCaptureByAttribute(FunctionDecl *FD)
Add [[clang:::lifetime_capture_by(this)]] to STL container methods.
PragmaStack< FPOptionsOverride > FpPragmaStack
PragmaStack< StringLiteral * > CodeSegStack
void AddRangeBasedOptnone(FunctionDecl *FD)
Only called on function definitions; if there is a pragma in scope with the effect of a range-based o...
void ActOnPragmaMSComment(SourceLocation CommentLoc, PragmaMSCommentKind Kind, StringRef Arg)
ActOnPragmaMSComment - Called on well formed #pragma comment(kind, "arg").
SmallVector< AlignPackIncludeState, 8 > AlignPackIncludeStack
void AddAlignmentAttributesForRecord(RecordDecl *RD)
AddAlignmentAttributesForRecord - Adds any needed alignment attributes to a the record decl,...
FPOptionsOverride CurFPFeatureOverrides()
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.
NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=RedeclarationKind::NotForRedeclaration)
Look up a name, looking for a single declaration.
void ActOnPragmaFloatControl(SourceLocation Loc, PragmaMsStackAction Action, PragmaFloatControlKind Value)
ActOnPragmaFloatControl - Call on well-formed #pragma float_control.
void ActOnPragmaMSPointersToMembers(LangOptions::PragmaMSPointersToMembersKind Kind, SourceLocation PragmaLoc)
ActOnPragmaMSPointersToMembers - called on well formed #pragma pointers_to_members(representation met...
void DiagnosePrecisionLossInComplexDivision()
void ActOnPragmaUnused(const Token &Identifier, Scope *curScope, SourceLocation PragmaLoc)
ActOnPragmaUnused - Called on well-formed '#pragma unused'.
void ActOnPragmaMSAllocText(SourceLocation PragmaLocation, StringRef Section, const SmallVector< std::tuple< IdentifierInfo *, SourceLocation > > &Functions)
Called on well-formed #pragma alloc_text().
PragmaStack< bool > StrictGuardStackCheckStack
void ActOnPragmaAttributeAttribute(ParsedAttr &Attribute, SourceLocation PragmaLoc, attr::ParsedSubjectMatchRuleSet Rules)
PragmaStack< StringLiteral * > ConstSegStack
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_PRValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CheckedConversionKind::Implicit)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
void ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind, SourceLocation PragmaLoc)
ActOnPragmaOptionsAlign - Called on well formed #pragma options align.
void ActOnPragmaCXLimitedRange(SourceLocation Loc, LangOptions::ComplexRangeKind Range)
ActOnPragmaCXLimitedRange - Called on well formed #pragma STDC CX_LIMITED_RANGE.
void ActOnPragmaFPExceptions(SourceLocation Loc, LangOptions::FPExceptionModeKind)
Called on well formed '#pragma clang fp' that has option 'exceptions'.
void inferGslPointerAttribute(NamedDecl *ND, CXXRecordDecl *UnderlyingRecord)
Add gsl::Pointer attribute to std::container::iterator.
void ActOnPragmaFPEvalMethod(SourceLocation Loc, LangOptions::FPEvalMethodKind Value)
void ActOnPragmaClangSection(SourceLocation PragmaLoc, PragmaClangSectionAction Action, PragmaClangSectionKind SecKind, StringRef SecName)
ActOnPragmaClangSection - Called on well formed #pragma clang section.
bool UnifySection(StringRef SectionName, int SectionFlags, NamedDecl *TheDecl)
void setExceptionMode(SourceLocation Loc, LangOptions::FPExceptionModeKind)
Called to set exception behavior for floating point operations.
void PrintPragmaAttributeInstantiationPoint()
void inferGslOwnerPointerAttribute(CXXRecordDecl *Record)
Add [[gsl::Owner]] and [[gsl::Pointer]] attributes for std:: types.
const LangOptions & getLangOpts() const
SourceLocation CurInitSegLoc
void ActOnPragmaMSVtorDisp(PragmaMsStackAction Action, SourceLocation PragmaLoc, MSVtorDispMode Value)
Called on well formed #pragma vtordisp().
void inferLifetimeBoundAttribute(FunctionDecl *FD)
Add [[clang:::lifetimebound]] attr for std:: functions and methods.
bool MSPragmaOptimizeIsOn
The "on" or "off" argument passed by #pragma optimize, that denotes whether the optimizations in the ...
SmallVector< PragmaAttributeGroup, 2 > PragmaAttributeStack
const LangOptions & LangOpts
PragmaClangSection PragmaClangRelroSection
SourceLocation ImplicitMSInheritanceAttrLoc
Source location for newly created implicit MSInheritanceAttrs.
void ProcessDeclAttributeList(Scope *S, Decl *D, const ParsedAttributesView &AttrList, const ProcessDeclAttributeOptions &Options=ProcessDeclAttributeOptions())
ProcessDeclAttributeList - Apply all the decl attributes in the specified attribute list to the speci...
void AddImplicitMSFunctionNoBuiltinAttr(FunctionDecl *FD)
Only called on function definitions; if there is a pragma in scope with the effect of a range-based n...
PragmaStack< AlignPackInfo > AlignPackStack
PragmaStack< StringLiteral * > BSSSegStack
llvm::StringMap< std::tuple< StringRef, SourceLocation > > FunctionToSectionMap
Sections used with #pragma alloc_text.
llvm::SmallSetVector< StringRef, 4 > MSFunctionNoBuiltins
Set of no-builtin functions listed by #pragma function.
void AddPushedVisibilityAttribute(Decl *RD)
AddPushedVisibilityAttribute - If '#pragma GCC visibility' was used, add an appropriate visibility at...
StringLiteral * CurInitSeg
Last section used with #pragma init_seg.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
void ActOnPragmaMSFunction(SourceLocation Loc, const llvm::SmallVectorImpl< StringRef > &NoBuiltins)
Call on well formed #pragma function.
void ActOnPragmaMSStruct(PragmaMSStructKind Kind)
ActOnPragmaMSStruct - Called on well formed #pragma ms_struct [on|off].
bool isPreciseFPEnabled()
Are precise floating point semantics currently enabled?
void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation, StringLiteral *SegmentName)
Called on well-formed #pragma init_seg().
SourceManager & getSourceManager() const
void DiagnoseNonDefaultPragmaAlignPack(PragmaAlignPackDiagnoseKind Kind, SourceLocation IncludeLoc)
PragmaClangSection PragmaClangTextSection
void ActOnPragmaFPValueChangingOption(SourceLocation Loc, PragmaFPKind Kind, bool IsEnabled)
Called on well formed #pragma clang fp reassociate or #pragma clang fp reciprocal.
std::vector< std::pair< QualType, unsigned > > ExcessPrecisionNotSatisfied
PragmaClangSection PragmaClangDataSection
llvm::Error isValidSectionSpecifier(StringRef Str)
Used to implement to perform semantic checking on attribute((section("foo"))) specifiers.
void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr, SourceLocation Loc)
PushNamespaceVisibilityAttr - Note that we've entered a namespace with a visibility attribute.
PragmaStack< MSVtorDispMode > VtorDispStack
Whether to insert vtordisps prior to virtual bases in the Microsoft C++ ABI.
void AddMsStructLayoutForRecord(RecordDecl *RD)
AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
void * VisContext
VisContext - Manages the stack for #pragma GCC visibility.
bool CheckAttrTarget(const ParsedAttr &CurrAttr)
PragmaAlignPackDiagnoseKind
@ NonDefaultStateAtInclude
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
void DiagnoseUnterminatedPragmaAttribute()
void FreeVisContext()
FreeVisContext - Deallocate and null out VisContext.
void ModifyFnAttributesMSPragmaOptimize(FunctionDecl *FD)
Only called on function definitions; if there is a MSVC #pragma optimize in scope,...
void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc)
PopPragmaVisibility - Pop the top element of the visibility stack; used for '#pragma GCC visibility' ...
SourceManager & SourceMgr
void ActOnPragmaPack(SourceLocation PragmaLoc, PragmaMsStackAction Action, StringRef SlotLabel, Expr *Alignment)
ActOnPragmaPack - Called on well formed #pragma pack(...).
DiagnosticsEngine & Diags
void DiagnoseUnterminatedPragmaAlignPack()
PragmaStack< StringLiteral * > DataSegStack
void ActOnPragmaVisibility(const IdentifierInfo *VisType, SourceLocation PragmaLoc)
ActOnPragmaVisibility - Called on well formed #pragma GCC visibility... .
SourceLocation OptimizeOffPragmaLocation
This represents the last location of a "#pragma clang optimize off" directive if such a directive has...
LangOptions::PragmaMSPointersToMembersKind MSPointerToMemberRepresentationMethod
Controls member pointer representation format under the MS ABI.
void ActOnPragmaMSStrictGuardStackCheck(SourceLocation PragmaLocation, PragmaMsStackAction Action, bool Value)
ActOnPragmaMSStrictGuardStackCheck - Called on well formed #pragma strict_gs_check.
PragmaClangSection PragmaClangBSSSection
void ActOnPragmaFPContract(SourceLocation Loc, LangOptions::FPModeKind FPC)
ActOnPragmaFPContract - Called on well formed #pragma {STDC,OPENCL} FP_CONTRACT and #pragma clang fp ...
void ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc)
Called on well formed #pragma clang optimize.
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false, bool ForceNoCPlusPlus=false)
Perform unqualified name lookup starting from a given scope.
void ActOnPragmaFEnvAccess(SourceLocation Loc, bool IsEnabled)
ActOnPragmaFenvAccess - Called on well formed #pragma STDC FENV_ACCESS.
void AddSectionMSAllocText(FunctionDecl *FD)
Only called on function definitions; if there is a #pragma alloc_text that decides which code section...
void ActOnPragmaMSSection(SourceLocation PragmaLocation, int SectionFlags, StringLiteral *SegmentName)
Called on well formed #pragma section().
PragmaClangSectionKind
pragma clang section kind
void inferNullableClassAttribute(CXXRecordDecl *CRD)
Add _Nullable attributes for std:: types.
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.
SourceLocation getEnd() const
SourceLocation getBegin() const
Stmt - This represents one statement.
SourceLocation getBeginLoc() const LLVM_READONLY
StringLiteral - This represents a string literal expression, e.g.
SourceLocation getBeginLoc() const LLVM_READONLY
StringRef getString() const
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
bool hasAlignMac68kSupport() const
Check whether this target support '#pragma options align=mac68k'.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
Token - This structure provides full information about a lexed token.
IdentifierInfo * getIdentifierInfo() const
SourceLocation getLocation() const
Return a source location identifier for the specified offset in the current file.
The base class of the type hierarchy.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isFunctionType() const
Base class for declarations which introduce a typedef-name.
QualType getUnderlyingType() const
Represents a variable declaration or definition.
Defines the clang::TargetInfo interface.
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
llvm::DenseMap< int, SourceRange > ParsedSubjectMatchRuleSet
SubjectMatchRule
A list of all the recognized kinds of attributes.
const char * getSubjectMatchRuleSpelling(SubjectMatchRule Rule)
bool isGLSPointerType(QualType QT)
The JSON file list parser is used to communicate input to InstallAPI.
@ Nullable
Values of this type can be null.
@ AANT_ArgumentConstantExpr
@ Result
The result type of a method or function.
MSVtorDispMode
In the Microsoft ABI, this controls the placement of virtual displacement members used to implement v...
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
const FunctionProtoType * T
EvalResult is a struct with detailed info about an evaluated expression.
APValue Val
Val - This is the value the expression can be folded to.
SmallVectorImpl< PartialDiagnosticAt > * Diag
Diag - If this is non-null, it will be filled in with a stack of notes indicating why evaluation fail...
AlignPackInfo CurrentValue
SourceLocation CurrentPragmaLocation
This an attribute introduced by #pragma clang attribute.
SourceLocation PragmaLocation
void SentinelAction(PragmaMsStackAction Action, StringRef Label)
SmallVector< Slot, 2 > Stack
void Act(SourceLocation PragmaLocation, PragmaMsStackAction Action, llvm::StringRef StackSlotLabel, ValueType Value)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4