clang  15.0.0git
SemaAttr.cpp
Go to the documentation of this file.
1 //===--- SemaAttr.cpp - Semantic Analysis for Attributes ------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements semantic analysis for non-trivial attributes and
10 // pragmas.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "clang/AST/ASTConsumer.h"
15 #include "clang/AST/Attr.h"
16 #include "clang/AST/Expr.h"
17 #include "clang/Basic/TargetInfo.h"
18 #include "clang/Lex/Preprocessor.h"
19 #include "clang/Sema/Lookup.h"
21 using namespace clang;
22 
23 //===----------------------------------------------------------------------===//
24 // Pragma 'pack' and 'options align'
25 //===----------------------------------------------------------------------===//
26 
28  StringRef SlotLabel,
29  bool ShouldAct)
30  : S(S), SlotLabel(SlotLabel), ShouldAct(ShouldAct) {
31  if (ShouldAct) {
33  S.DataSegStack.SentinelAction(PSK_Push, SlotLabel);
34  S.BSSSegStack.SentinelAction(PSK_Push, SlotLabel);
35  S.ConstSegStack.SentinelAction(PSK_Push, SlotLabel);
36  S.CodeSegStack.SentinelAction(PSK_Push, SlotLabel);
37  }
38 }
39 
41  if (ShouldAct) {
42  S.VtorDispStack.SentinelAction(PSK_Pop, SlotLabel);
43  S.DataSegStack.SentinelAction(PSK_Pop, SlotLabel);
44  S.BSSSegStack.SentinelAction(PSK_Pop, SlotLabel);
45  S.ConstSegStack.SentinelAction(PSK_Pop, SlotLabel);
46  S.CodeSegStack.SentinelAction(PSK_Pop, SlotLabel);
47  }
48 }
49 
51  AlignPackInfo InfoVal = AlignPackStack.CurrentValue;
52  AlignPackInfo::Mode M = InfoVal.getAlignMode();
53  bool IsPackSet = InfoVal.IsPackSet();
54  bool IsXLPragma = getLangOpts().XLPragmaPack;
55 
56  // If we are not under mac68k/natural alignment mode and also there is no pack
57  // value, we don't need any attributes.
58  if (!IsPackSet && M != AlignPackInfo::Mac68k && M != AlignPackInfo::Natural)
59  return;
60 
61  if (M == AlignPackInfo::Mac68k && (IsXLPragma || InfoVal.IsAlignAttr())) {
62  RD->addAttr(AlignMac68kAttr::CreateImplicit(Context));
63  } else if (IsPackSet) {
64  // Check to see if we need a max field alignment attribute.
65  RD->addAttr(MaxFieldAlignmentAttr::CreateImplicit(
66  Context, InfoVal.getPackNumber() * 8));
67  }
68 
69  if (IsXLPragma && M == AlignPackInfo::Natural)
70  RD->addAttr(AlignNaturalAttr::CreateImplicit(Context));
71 
72  if (AlignPackIncludeStack.empty())
73  return;
74  // The #pragma align/pack affected a record in an included file, so Clang
75  // should warn when that pragma was written in a file that included the
76  // included file.
77  for (auto &AlignPackedInclude : llvm::reverse(AlignPackIncludeStack)) {
78  if (AlignPackedInclude.CurrentPragmaLocation !=
79  AlignPackStack.CurrentPragmaLocation)
80  break;
81  if (AlignPackedInclude.HasNonDefaultValue)
82  AlignPackedInclude.ShouldWarnOnInclude = true;
83  }
84 }
85 
87  if (MSStructPragmaOn)
88  RD->addAttr(MSStructAttr::CreateImplicit(Context));
89 
90  // FIXME: We should merge AddAlignmentAttributesForRecord with
91  // AddMsStructLayoutForRecord into AddPragmaAttributesForRecord, which takes
92  // all active pragmas and applies them as attributes to class definitions.
93  if (VtorDispStack.CurrentValue != getLangOpts().getVtorDispMode())
94  RD->addAttr(MSVtorDispAttr::CreateImplicit(
95  Context, unsigned(VtorDispStack.CurrentValue)));
96 }
97 
98 template <typename Attribute>
100  CXXRecordDecl *Record) {
101  if (Record->hasAttr<OwnerAttr>() || Record->hasAttr<PointerAttr>())
102  return;
103 
104  for (Decl *Redecl : Record->redecls())
105  Redecl->addAttr(Attribute::CreateImplicit(Context, /*DerefType=*/nullptr));
106 }
107 
109  CXXRecordDecl *UnderlyingRecord) {
110  if (!UnderlyingRecord)
111  return;
112 
113  const auto *Parent = dyn_cast<CXXRecordDecl>(ND->getDeclContext());
114  if (!Parent)
115  return;
116 
117  static llvm::StringSet<> Containers{
118  "array",
119  "basic_string",
120  "deque",
121  "forward_list",
122  "vector",
123  "list",
124  "map",
125  "multiset",
126  "multimap",
127  "priority_queue",
128  "queue",
129  "set",
130  "stack",
131  "unordered_set",
132  "unordered_map",
133  "unordered_multiset",
134  "unordered_multimap",
135  };
136 
137  static llvm::StringSet<> Iterators{"iterator", "const_iterator",
138  "reverse_iterator",
139  "const_reverse_iterator"};
140 
141  if (Parent->isInStdNamespace() && Iterators.count(ND->getName()) &&
142  Containers.count(Parent->getName()))
143  addGslOwnerPointerAttributeIfNotExisting<PointerAttr>(Context,
144  UnderlyingRecord);
145 }
146 
148 
149  QualType Canonical = TD->getUnderlyingType().getCanonicalType();
150 
151  CXXRecordDecl *RD = Canonical->getAsCXXRecordDecl();
152  if (!RD) {
153  if (auto *TST =
154  dyn_cast<TemplateSpecializationType>(Canonical.getTypePtr())) {
155 
156  RD = dyn_cast_or_null<CXXRecordDecl>(
157  TST->getTemplateName().getAsTemplateDecl()->getTemplatedDecl());
158  }
159  }
160 
161  inferGslPointerAttribute(TD, RD);
162 }
163 
165  static llvm::StringSet<> StdOwners{
166  "any",
167  "array",
168  "basic_regex",
169  "basic_string",
170  "deque",
171  "forward_list",
172  "vector",
173  "list",
174  "map",
175  "multiset",
176  "multimap",
177  "optional",
178  "priority_queue",
179  "queue",
180  "set",
181  "stack",
182  "unique_ptr",
183  "unordered_set",
184  "unordered_map",
185  "unordered_multiset",
186  "unordered_multimap",
187  "variant",
188  };
189  static llvm::StringSet<> StdPointers{
190  "basic_string_view",
191  "reference_wrapper",
192  "regex_iterator",
193  };
194 
195  if (!Record->getIdentifier())
196  return;
197 
198  // Handle classes that directly appear in std namespace.
199  if (Record->isInStdNamespace()) {
200  if (Record->hasAttr<OwnerAttr>() || Record->hasAttr<PointerAttr>())
201  return;
202 
203  if (StdOwners.count(Record->getName()))
204  addGslOwnerPointerAttributeIfNotExisting<OwnerAttr>(Context, Record);
205  else if (StdPointers.count(Record->getName()))
206  addGslOwnerPointerAttributeIfNotExisting<PointerAttr>(Context, Record);
207 
208  return;
209  }
210 
211  // Handle nested classes that could be a gsl::Pointer.
212  inferGslPointerAttribute(Record, Record);
213 }
214 
216  SourceLocation PragmaLoc) {
219 
220  switch (Kind) {
221  // For most of the platforms we support, native and natural are the same.
222  // With XL, native is the same as power, natural means something else.
223  //
224  // FIXME: This is not true on Darwin/PPC.
225  case POAK_Native:
226  case POAK_Power:
227  Action = Sema::PSK_Push_Set;
228  break;
229  case POAK_Natural:
230  Action = Sema::PSK_Push_Set;
231  ModeVal = AlignPackInfo::Natural;
232  break;
233 
234  // Note that '#pragma options align=packed' is not equivalent to attribute
235  // packed, it has a different precedence relative to attribute aligned.
236  case POAK_Packed:
237  Action = Sema::PSK_Push_Set;
238  ModeVal = AlignPackInfo::Packed;
239  break;
240 
241  case POAK_Mac68k:
242  // Check if the target supports this.
244  Diag(PragmaLoc, diag::err_pragma_options_align_mac68k_target_unsupported);
245  return;
246  }
247  Action = Sema::PSK_Push_Set;
248  ModeVal = AlignPackInfo::Mac68k;
249  break;
250  case POAK_Reset:
251  // Reset just pops the top of the stack, or resets the current alignment to
252  // default.
253  Action = Sema::PSK_Pop;
254  if (AlignPackStack.Stack.empty()) {
255  if (AlignPackStack.CurrentValue.getAlignMode() != AlignPackInfo::Native ||
256  AlignPackStack.CurrentValue.IsPackAttr()) {
257  Action = Sema::PSK_Reset;
258  } else {
259  Diag(PragmaLoc, diag::warn_pragma_options_align_reset_failed)
260  << "stack empty";
261  return;
262  }
263  }
264  break;
265  }
266 
267  AlignPackInfo Info(ModeVal, getLangOpts().XLPragmaPack);
268 
269  AlignPackStack.Act(PragmaLoc, Action, StringRef(), Info);
270 }
271 
274  PragmaClangSectionKind SecKind,
275  StringRef SecName) {
276  PragmaClangSection *CSec;
277  int SectionFlags = ASTContext::PSF_Read;
278  switch (SecKind) {
279  case PragmaClangSectionKind::PCSK_BSS:
280  CSec = &PragmaClangBSSSection;
282  break;
283  case PragmaClangSectionKind::PCSK_Data:
284  CSec = &PragmaClangDataSection;
285  SectionFlags |= ASTContext::PSF_Write;
286  break;
287  case PragmaClangSectionKind::PCSK_Rodata:
288  CSec = &PragmaClangRodataSection;
289  break;
290  case PragmaClangSectionKind::PCSK_Relro:
291  CSec = &PragmaClangRelroSection;
292  break;
293  case PragmaClangSectionKind::PCSK_Text:
294  CSec = &PragmaClangTextSection;
295  SectionFlags |= ASTContext::PSF_Execute;
296  break;
297  default:
298  llvm_unreachable("invalid clang section kind");
299  }
300 
301  if (Action == PragmaClangSectionAction::PCSA_Clear) {
302  CSec->Valid = false;
303  return;
304  }
305 
306  if (llvm::Error E = isValidSectionSpecifier(SecName)) {
307  Diag(PragmaLoc, diag::err_pragma_section_invalid_for_target)
308  << toString(std::move(E));
309  CSec->Valid = false;
310  return;
311  }
312 
313  if (UnifySection(SecName, SectionFlags, PragmaLoc))
314  return;
315 
316  CSec->Valid = true;
317  CSec->SectionName = std::string(SecName);
318  CSec->PragmaLocation = PragmaLoc;
319 }
320 
322  StringRef SlotLabel, Expr *alignment) {
323  bool IsXLPragma = getLangOpts().XLPragmaPack;
324  // XL pragma pack does not support identifier syntax.
325  if (IsXLPragma && !SlotLabel.empty()) {
326  Diag(PragmaLoc, diag::err_pragma_pack_identifer_not_supported);
327  return;
328  }
329 
330  const AlignPackInfo CurVal = AlignPackStack.CurrentValue;
331  Expr *Alignment = static_cast<Expr *>(alignment);
332 
333  // If specified then alignment must be a "small" power of two.
334  unsigned AlignmentVal = 0;
335  AlignPackInfo::Mode ModeVal = CurVal.getAlignMode();
336 
337  if (Alignment) {
339  Val = Alignment->getIntegerConstantExpr(Context);
340 
341  // pack(0) is like pack(), which just works out since that is what
342  // we use 0 for in PackAttr.
343  if (Alignment->isTypeDependent() || !Val ||
344  !(*Val == 0 || Val->isPowerOf2()) || Val->getZExtValue() > 16) {
345  Diag(PragmaLoc, diag::warn_pragma_pack_invalid_alignment);
346  return; // Ignore
347  }
348 
349  if (IsXLPragma && *Val == 0) {
350  // pack(0) does not work out with XL.
351  Diag(PragmaLoc, diag::err_pragma_pack_invalid_alignment);
352  return; // Ignore
353  }
354 
355  AlignmentVal = (unsigned)Val->getZExtValue();
356  }
357 
358  if (Action == Sema::PSK_Show) {
359  // Show the current alignment, making sure to show the right value
360  // for the default.
361  // FIXME: This should come from the target.
362  AlignmentVal = CurVal.IsPackSet() ? CurVal.getPackNumber() : 8;
363  if (ModeVal == AlignPackInfo::Mac68k &&
364  (IsXLPragma || CurVal.IsAlignAttr()))
365  Diag(PragmaLoc, diag::warn_pragma_pack_show) << "mac68k";
366  else
367  Diag(PragmaLoc, diag::warn_pragma_pack_show) << AlignmentVal;
368  }
369 
370  // MSDN, C/C++ Preprocessor Reference > Pragma Directives > pack:
371  // "#pragma pack(pop, identifier, n) is undefined"
372  if (Action & Sema::PSK_Pop) {
373  if (Alignment && !SlotLabel.empty())
374  Diag(PragmaLoc, diag::warn_pragma_pack_pop_identifier_and_alignment);
375  if (AlignPackStack.Stack.empty()) {
376  assert(CurVal.getAlignMode() == AlignPackInfo::Native &&
377  "Empty pack stack can only be at Native alignment mode.");
378  Diag(PragmaLoc, diag::warn_pragma_pop_failed) << "pack" << "stack empty";
379  }
380  }
381 
382  AlignPackInfo Info(ModeVal, AlignmentVal, IsXLPragma);
383 
384  AlignPackStack.Act(PragmaLoc, Action, SlotLabel, Info);
385 }
386 
388  SourceLocation IncludeLoc) {
390  SourceLocation PrevLocation = AlignPackStack.CurrentPragmaLocation;
391  // Warn about non-default alignment at #includes (without redundant
392  // warnings for the same directive in nested includes).
393  // The warning is delayed until the end of the file to avoid warnings
394  // for files that don't have any records that are affected by the modified
395  // alignment.
396  bool HasNonDefaultValue =
397  AlignPackStack.hasValue() &&
398  (AlignPackIncludeStack.empty() ||
399  AlignPackIncludeStack.back().CurrentPragmaLocation != PrevLocation);
400  AlignPackIncludeStack.push_back(
401  {AlignPackStack.CurrentValue,
402  AlignPackStack.hasValue() ? PrevLocation : SourceLocation(),
403  HasNonDefaultValue, /*ShouldWarnOnInclude*/ false});
404  return;
405  }
406 
408  "invalid kind");
409  AlignPackIncludeState PrevAlignPackState =
410  AlignPackIncludeStack.pop_back_val();
411  // FIXME: AlignPackStack may contain both #pragma align and #pragma pack
412  // information, diagnostics below might not be accurate if we have mixed
413  // pragmas.
414  if (PrevAlignPackState.ShouldWarnOnInclude) {
415  // Emit the delayed non-default alignment at #include warning.
416  Diag(IncludeLoc, diag::warn_pragma_pack_non_default_at_include);
417  Diag(PrevAlignPackState.CurrentPragmaLocation, diag::note_pragma_pack_here);
418  }
419  // Warn about modified alignment after #includes.
420  if (PrevAlignPackState.CurrentValue != AlignPackStack.CurrentValue) {
421  Diag(IncludeLoc, diag::warn_pragma_pack_modified_after_include);
422  Diag(AlignPackStack.CurrentPragmaLocation, diag::note_pragma_pack_here);
423  }
424 }
425 
427  if (AlignPackStack.Stack.empty())
428  return;
429  bool IsInnermost = true;
430 
431  // FIXME: AlignPackStack may contain both #pragma align and #pragma pack
432  // information, diagnostics below might not be accurate if we have mixed
433  // pragmas.
434  for (const auto &StackSlot : llvm::reverse(AlignPackStack.Stack)) {
435  Diag(StackSlot.PragmaPushLocation, diag::warn_pragma_pack_no_pop_eof);
436  // The user might have already reset the alignment, so suggest replacing
437  // the reset with a pop.
438  if (IsInnermost &&
439  AlignPackStack.CurrentValue == AlignPackStack.DefaultValue) {
440  auto DB = Diag(AlignPackStack.CurrentPragmaLocation,
441  diag::note_pragma_pack_pop_instead_reset);
442  SourceLocation FixItLoc =
443  Lexer::findLocationAfterToken(AlignPackStack.CurrentPragmaLocation,
444  tok::l_paren, SourceMgr, LangOpts,
445  /*SkipTrailing=*/false);
446  if (FixItLoc.isValid())
447  DB << FixItHint::CreateInsertion(FixItLoc, "pop");
448  }
449  IsInnermost = false;
450  }
451 }
452 
455 }
456 
458  PragmaMSCommentKind Kind, StringRef Arg) {
459  auto *PCD = PragmaCommentDecl::Create(
460  Context, Context.getTranslationUnitDecl(), CommentLoc, Kind, Arg);
463 }
464 
466  StringRef Value) {
471 }
472 
475  FPOptionsOverride NewFPFeatures = CurFPFeatureOverrides();
476  switch (Value) {
477  default:
478  llvm_unreachable("invalid pragma eval_method kind");
480  NewFPFeatures.setFPEvalMethodOverride(LangOptions::FEM_Source);
481  break;
483  NewFPFeatures.setFPEvalMethodOverride(LangOptions::FEM_Double);
484  break;
486  NewFPFeatures.setFPEvalMethodOverride(LangOptions::FEM_Extended);
487  break;
488  }
489  if (getLangOpts().ApproxFunc)
490  Diag(Loc, diag::err_setting_eval_method_used_in_unsafe_context) << 0 << 0;
491  if (getLangOpts().AllowFPReassoc)
492  Diag(Loc, diag::err_setting_eval_method_used_in_unsafe_context) << 0 << 1;
493  if (getLangOpts().AllowRecip)
494  Diag(Loc, diag::err_setting_eval_method_used_in_unsafe_context) << 0 << 2;
495  FpPragmaStack.Act(Loc, PSK_Set, StringRef(), NewFPFeatures);
496  CurFPFeatures = NewFPFeatures.applyOverrides(getLangOpts());
498 }
499 
501  PragmaMsStackAction Action,
503  FPOptionsOverride NewFPFeatures = CurFPFeatureOverrides();
504  if ((Action == PSK_Push_Set || Action == PSK_Push || Action == PSK_Pop) &&
506  // Push and pop can only occur at file or namespace scope, or within a
507  // language linkage declaration.
508  Diag(Loc, diag::err_pragma_fc_pp_scope);
509  return;
510  }
511  switch (Value) {
512  default:
513  llvm_unreachable("invalid pragma float_control kind");
514  case PFC_Precise:
515  NewFPFeatures.setFPPreciseEnabled(true);
516  FpPragmaStack.Act(Loc, Action, StringRef(), NewFPFeatures);
517  if (PP.getCurrentFPEvalMethod() ==
518  LangOptions::FPEvalMethodKind::FEM_Indeterminable &&
520  // A preceding `pragma float_control(precise,off)` has changed
521  // the value of the evaluation method.
522  // Set it back to its old value.
524  break;
525  case PFC_NoPrecise:
526  if (CurFPFeatures.getFPExceptionMode() == LangOptions::FPE_Strict)
527  Diag(Loc, diag::err_pragma_fc_noprecise_requires_noexcept);
528  else if (CurFPFeatures.getAllowFEnvAccess())
529  Diag(Loc, diag::err_pragma_fc_noprecise_requires_nofenv);
530  else
531  NewFPFeatures.setFPPreciseEnabled(false);
532  FpPragmaStack.Act(Loc, Action, StringRef(), NewFPFeatures);
534  // `AllowFPReassoc` or `AllowReciprocal` option is enabled.
536  Loc, LangOptions::FPEvalMethodKind::FEM_Indeterminable);
537  break;
538  case PFC_Except:
539  if (!isPreciseFPEnabled())
540  Diag(Loc, diag::err_pragma_fc_except_requires_precise);
541  else
542  NewFPFeatures.setFPExceptionModeOverride(LangOptions::FPE_Strict);
543  FpPragmaStack.Act(Loc, Action, StringRef(), NewFPFeatures);
544  break;
545  case PFC_NoExcept:
546  NewFPFeatures.setFPExceptionModeOverride(LangOptions::FPE_Ignore);
547  FpPragmaStack.Act(Loc, Action, StringRef(), NewFPFeatures);
548  break;
549  case PFC_Push:
550  FpPragmaStack.Act(Loc, Sema::PSK_Push_Set, StringRef(), NewFPFeatures);
551  break;
552  case PFC_Pop:
553  if (FpPragmaStack.Stack.empty()) {
554  Diag(Loc, diag::warn_pragma_pop_failed) << "float_control"
555  << "stack empty";
556  return;
557  }
558  FpPragmaStack.Act(Loc, Action, StringRef(), NewFPFeatures);
559  NewFPFeatures = FpPragmaStack.CurrentValue;
560  if (CurFPFeatures.getAllowFPReassociate() ||
561  CurFPFeatures.getAllowReciprocal())
562  // Since we are popping the pragma, we don't want to be passing
563  // a location here.
565  CurFPFeatures.getFPEvalMethod());
566  break;
567  }
568  CurFPFeatures = NewFPFeatures.applyOverrides(getLangOpts());
569 }
570 
572  LangOptions::PragmaMSPointersToMembersKind RepresentationMethod,
573  SourceLocation PragmaLoc) {
574  MSPointerToMemberRepresentationMethod = RepresentationMethod;
575  ImplicitMSInheritanceAttrLoc = PragmaLoc;
576 }
577 
579  SourceLocation PragmaLoc,
580  MSVtorDispMode Mode) {
581  if (Action & PSK_Pop && VtorDispStack.Stack.empty())
582  Diag(PragmaLoc, diag::warn_pragma_pop_failed) << "vtordisp"
583  << "stack empty";
584  VtorDispStack.Act(PragmaLoc, Action, StringRef(), Mode);
585 }
586 
587 template <>
589  PragmaMsStackAction Action,
590  llvm::StringRef StackSlotLabel,
591  AlignPackInfo Value) {
592  if (Action == PSK_Reset) {
593  CurrentValue = DefaultValue;
594  CurrentPragmaLocation = PragmaLocation;
595  return;
596  }
597  if (Action & PSK_Push)
598  Stack.emplace_back(Slot(StackSlotLabel, CurrentValue, CurrentPragmaLocation,
599  PragmaLocation));
600  else if (Action & PSK_Pop) {
601  if (!StackSlotLabel.empty()) {
602  // If we've got a label, try to find it and jump there.
603  auto I = llvm::find_if(llvm::reverse(Stack), [&](const Slot &x) {
604  return x.StackSlotLabel == StackSlotLabel;
605  });
606  // We found the label, so pop from there.
607  if (I != Stack.rend()) {
608  CurrentValue = I->Value;
609  CurrentPragmaLocation = I->PragmaLocation;
610  Stack.erase(std::prev(I.base()), Stack.end());
611  }
612  } else if (Value.IsXLStack() && Value.IsAlignAttr() &&
613  CurrentValue.IsPackAttr()) {
614  // XL '#pragma align(reset)' would pop the stack until
615  // a current in effect pragma align is popped.
616  auto I = llvm::find_if(llvm::reverse(Stack), [&](const Slot &x) {
617  return x.Value.IsAlignAttr();
618  });
619  // If we found pragma align so pop from there.
620  if (I != Stack.rend()) {
621  Stack.erase(std::prev(I.base()), Stack.end());
622  if (Stack.empty()) {
623  CurrentValue = DefaultValue;
624  CurrentPragmaLocation = PragmaLocation;
625  } else {
626  CurrentValue = Stack.back().Value;
627  CurrentPragmaLocation = Stack.back().PragmaLocation;
628  Stack.pop_back();
629  }
630  }
631  } else if (!Stack.empty()) {
632  // xl '#pragma align' sets the baseline, and `#pragma pack` cannot pop
633  // over the baseline.
634  if (Value.IsXLStack() && Value.IsPackAttr() && CurrentValue.IsAlignAttr())
635  return;
636 
637  // We don't have a label, just pop the last entry.
638  CurrentValue = Stack.back().Value;
639  CurrentPragmaLocation = Stack.back().PragmaLocation;
640  Stack.pop_back();
641  }
642  }
643  if (Action & PSK_Set) {
644  CurrentValue = Value;
645  CurrentPragmaLocation = PragmaLocation;
646  }
647 }
648 
649 bool Sema::UnifySection(StringRef SectionName, int SectionFlags,
650  NamedDecl *Decl) {
651  SourceLocation PragmaLocation;
652  if (auto A = Decl->getAttr<SectionAttr>())
653  if (A->isImplicit())
654  PragmaLocation = A->getLocation();
655  auto SectionIt = Context.SectionInfos.find(SectionName);
656  if (SectionIt == Context.SectionInfos.end()) {
657  Context.SectionInfos[SectionName] =
658  ASTContext::SectionInfo(Decl, PragmaLocation, SectionFlags);
659  return false;
660  }
661  // A pre-declared section takes precedence w/o diagnostic.
662  const auto &Section = SectionIt->second;
663  if (Section.SectionFlags == SectionFlags ||
664  ((SectionFlags & ASTContext::PSF_Implicit) &&
665  !(Section.SectionFlags & ASTContext::PSF_Implicit)))
666  return false;
667  Diag(Decl->getLocation(), diag::err_section_conflict) << Decl << Section;
668  if (Section.Decl)
669  Diag(Section.Decl->getLocation(), diag::note_declared_at)
670  << Section.Decl->getName();
671  if (PragmaLocation.isValid())
672  Diag(PragmaLocation, diag::note_pragma_entered_here);
673  if (Section.PragmaSectionLocation.isValid())
674  Diag(Section.PragmaSectionLocation, diag::note_pragma_entered_here);
675  return true;
676 }
677 
678 bool Sema::UnifySection(StringRef SectionName,
679  int SectionFlags,
680  SourceLocation PragmaSectionLocation) {
681  auto SectionIt = Context.SectionInfos.find(SectionName);
682  if (SectionIt != Context.SectionInfos.end()) {
683  const auto &Section = SectionIt->second;
684  if (Section.SectionFlags == SectionFlags)
685  return false;
686  if (!(Section.SectionFlags & ASTContext::PSF_Implicit)) {
687  Diag(PragmaSectionLocation, diag::err_section_conflict)
688  << "this" << Section;
689  if (Section.Decl)
690  Diag(Section.Decl->getLocation(), diag::note_declared_at)
691  << Section.Decl->getName();
692  if (Section.PragmaSectionLocation.isValid())
693  Diag(Section.PragmaSectionLocation, diag::note_pragma_entered_here);
694  return true;
695  }
696  }
697  Context.SectionInfos[SectionName] =
698  ASTContext::SectionInfo(nullptr, PragmaSectionLocation, SectionFlags);
699  return false;
700 }
701 
702 /// Called on well formed \#pragma bss_seg().
704  PragmaMsStackAction Action,
705  llvm::StringRef StackSlotLabel,
706  StringLiteral *SegmentName,
707  llvm::StringRef PragmaName) {
709  llvm::StringSwitch<PragmaStack<StringLiteral *> *>(PragmaName)
710  .Case("data_seg", &DataSegStack)
711  .Case("bss_seg", &BSSSegStack)
712  .Case("const_seg", &ConstSegStack)
713  .Case("code_seg", &CodeSegStack);
714  if (Action & PSK_Pop && Stack->Stack.empty())
715  Diag(PragmaLocation, diag::warn_pragma_pop_failed) << PragmaName
716  << "stack empty";
717  if (SegmentName) {
718  if (!checkSectionName(SegmentName->getBeginLoc(), SegmentName->getString()))
719  return;
720 
721  if (SegmentName->getString() == ".drectve" &&
723  Diag(PragmaLocation, diag::warn_attribute_section_drectve) << PragmaName;
724  }
725 
726  Stack->Act(PragmaLocation, Action, StackSlotLabel, SegmentName);
727 }
728 
729 /// Called on well formed \#pragma bss_seg().
731  int SectionFlags, StringLiteral *SegmentName) {
732  UnifySection(SegmentName->getString(), SectionFlags, PragmaLocation);
733 }
734 
736  StringLiteral *SegmentName) {
737  // There's no stack to maintain, so we just have a current section. When we
738  // see the default section, reset our current section back to null so we stop
739  // tacking on unnecessary attributes.
740  CurInitSeg = SegmentName->getString() == ".CRT$XCU" ? nullptr : SegmentName;
741  CurInitSegLoc = PragmaLocation;
742 }
743 
745  SourceLocation PragmaLocation, StringRef Section,
746  const SmallVector<std::tuple<IdentifierInfo *, SourceLocation>>
747  &Functions) {
749  Diag(PragmaLocation, diag::err_pragma_expected_file_scope) << "alloc_text";
750  return;
751  }
752 
753  for (auto &Function : Functions) {
754  IdentifierInfo *II;
755  SourceLocation Loc;
756  std::tie(II, Loc) = Function;
757 
758  DeclarationName DN(II);
760  if (!ND) {
761  Diag(Loc, diag::err_undeclared_use) << II->getName();
762  return;
763  }
764 
765  DeclContext *DC = ND->getDeclContext();
766  if (!DC->isExternCContext()) {
767  Diag(Loc, diag::err_pragma_alloc_text_c_linkage);
768  return;
769  }
770 
771  FunctionToSectionMap[II->getName()] = std::make_tuple(Section, Loc);
772  }
773 }
774 
775 void Sema::ActOnPragmaUnused(const Token &IdTok, Scope *curScope,
776  SourceLocation PragmaLoc) {
777 
778  IdentifierInfo *Name = IdTok.getIdentifierInfo();
779  LookupResult Lookup(*this, Name, IdTok.getLocation(), LookupOrdinaryName);
780  LookupParsedName(Lookup, curScope, nullptr, true);
781 
782  if (Lookup.empty()) {
783  Diag(PragmaLoc, diag::warn_pragma_unused_undeclared_var)
784  << Name << SourceRange(IdTok.getLocation());
785  return;
786  }
787 
788  VarDecl *VD = Lookup.getAsSingle<VarDecl>();
789  if (!VD) {
790  Diag(PragmaLoc, diag::warn_pragma_unused_expected_var_arg)
791  << Name << SourceRange(IdTok.getLocation());
792  return;
793  }
794 
795  // Warn if this was used before being marked unused.
796  if (VD->isUsed())
797  Diag(PragmaLoc, diag::warn_used_but_marked_unused) << Name;
798 
799  VD->addAttr(UnusedAttr::CreateImplicit(Context, IdTok.getLocation(),
801  UnusedAttr::GNU_unused));
802 }
803 
805  IdentifierInfo *Ident;
806  SourceLocation Loc;
807  std::tie(Ident, Loc) = PP.getPragmaARCCFCodeAuditedInfo();
808  if (!Loc.isValid()) return;
809 
810  // Don't add a redundant or conflicting attribute.
811  if (D->hasAttr<CFAuditedTransferAttr>() ||
812  D->hasAttr<CFUnknownTransferAttr>())
813  return;
814 
815  AttributeCommonInfo Info(Ident, SourceRange(Loc),
817  D->addAttr(CFAuditedTransferAttr::CreateImplicit(Context, Info));
818 }
819 
820 namespace {
821 
823 getParentAttrMatcherRule(attr::SubjectMatchRule Rule) {
824  using namespace attr;
825  switch (Rule) {
826  default:
827  return None;
828 #define ATTR_MATCH_RULE(Value, Spelling, IsAbstract)
829 #define ATTR_MATCH_SUB_RULE(Value, Spelling, IsAbstract, Parent, IsNegated) \
830  case Value: \
831  return Parent;
832 #include "clang/Basic/AttrSubMatchRulesList.inc"
833  }
834 }
835 
836 bool isNegatedAttrMatcherSubRule(attr::SubjectMatchRule Rule) {
837  using namespace attr;
838  switch (Rule) {
839  default:
840  return false;
841 #define ATTR_MATCH_RULE(Value, Spelling, IsAbstract)
842 #define ATTR_MATCH_SUB_RULE(Value, Spelling, IsAbstract, Parent, IsNegated) \
843  case Value: \
844  return IsNegated;
845 #include "clang/Basic/AttrSubMatchRulesList.inc"
846  }
847 }
848 
849 CharSourceRange replacementRangeForListElement(const Sema &S,
850  SourceRange Range) {
851  // Make sure that the ',' is removed as well.
853  Range.getEnd(), tok::comma, S.getSourceManager(), S.getLangOpts(),
854  /*SkipTrailingWhitespaceAndNewLine=*/false);
855  if (AfterCommaLoc.isValid())
856  return CharSourceRange::getCharRange(Range.getBegin(), AfterCommaLoc);
857  else
858  return CharSourceRange::getTokenRange(Range);
859 }
860 
862 attrMatcherRuleListToString(ArrayRef<attr::SubjectMatchRule> Rules) {
863  std::string Result;
864  llvm::raw_string_ostream OS(Result);
865  for (const auto &I : llvm::enumerate(Rules)) {
866  if (I.index())
867  OS << (I.index() == Rules.size() - 1 ? ", and " : ", ");
868  OS << "'" << attr::getSubjectMatchRuleSpelling(I.value()) << "'";
869  }
870  return Result;
871 }
872 
873 } // end anonymous namespace
874 
876  ParsedAttr &Attribute, SourceLocation PragmaLoc,
878  Attribute.setIsPragmaClangAttribute();
879  SmallVector<attr::SubjectMatchRule, 4> SubjectMatchRules;
880  // Gather the subject match rules that are supported by the attribute.
882  StrictSubjectMatchRuleSet;
883  Attribute.getMatchRules(LangOpts, StrictSubjectMatchRuleSet);
884 
885  // Figure out which subject matching rules are valid.
886  if (StrictSubjectMatchRuleSet.empty()) {
887  // Check for contradicting match rules. Contradicting match rules are
888  // either:
889  // - a top-level rule and one of its sub-rules. E.g. variable and
890  // variable(is_parameter).
891  // - a sub-rule and a sibling that's negated. E.g.
892  // variable(is_thread_local) and variable(unless(is_parameter))
893  llvm::SmallDenseMap<int, std::pair<int, SourceRange>, 2>
894  RulesToFirstSpecifiedNegatedSubRule;
895  for (const auto &Rule : Rules) {
896  attr::SubjectMatchRule MatchRule = attr::SubjectMatchRule(Rule.first);
898  getParentAttrMatcherRule(MatchRule);
899  if (!ParentRule)
900  continue;
901  auto It = Rules.find(*ParentRule);
902  if (It != Rules.end()) {
903  // A sub-rule contradicts a parent rule.
904  Diag(Rule.second.getBegin(),
905  diag::err_pragma_attribute_matcher_subrule_contradicts_rule)
907  << attr::getSubjectMatchRuleSpelling(*ParentRule) << It->second
909  replacementRangeForListElement(*this, Rule.second));
910  // Keep going without removing this rule as it won't change the set of
911  // declarations that receive the attribute.
912  continue;
913  }
914  if (isNegatedAttrMatcherSubRule(MatchRule))
915  RulesToFirstSpecifiedNegatedSubRule.insert(
916  std::make_pair(*ParentRule, Rule));
917  }
918  bool IgnoreNegatedSubRules = false;
919  for (const auto &Rule : Rules) {
920  attr::SubjectMatchRule MatchRule = attr::SubjectMatchRule(Rule.first);
922  getParentAttrMatcherRule(MatchRule);
923  if (!ParentRule)
924  continue;
925  auto It = RulesToFirstSpecifiedNegatedSubRule.find(*ParentRule);
926  if (It != RulesToFirstSpecifiedNegatedSubRule.end() &&
927  It->second != Rule) {
928  // Negated sub-rule contradicts another sub-rule.
929  Diag(
930  It->second.second.getBegin(),
931  diag::
932  err_pragma_attribute_matcher_negated_subrule_contradicts_subrule)
934  attr::SubjectMatchRule(It->second.first))
935  << attr::getSubjectMatchRuleSpelling(MatchRule) << Rule.second
937  replacementRangeForListElement(*this, It->second.second));
938  // Keep going but ignore all of the negated sub-rules.
939  IgnoreNegatedSubRules = true;
940  RulesToFirstSpecifiedNegatedSubRule.erase(It);
941  }
942  }
943 
944  if (!IgnoreNegatedSubRules) {
945  for (const auto &Rule : Rules)
946  SubjectMatchRules.push_back(attr::SubjectMatchRule(Rule.first));
947  } else {
948  for (const auto &Rule : Rules) {
949  if (!isNegatedAttrMatcherSubRule(attr::SubjectMatchRule(Rule.first)))
950  SubjectMatchRules.push_back(attr::SubjectMatchRule(Rule.first));
951  }
952  }
953  Rules.clear();
954  } else {
955  // Each rule in Rules must be a strict subset of the attribute's
956  // SubjectMatch rules. I.e. we're allowed to use
957  // `apply_to=variables(is_global)` on an attrubute with SubjectList<[Var]>,
958  // but should not allow `apply_to=variables` on an attribute which has
959  // `SubjectList<[GlobalVar]>`.
960  for (const auto &StrictRule : StrictSubjectMatchRuleSet) {
961  // First, check for exact match.
962  if (Rules.erase(StrictRule.first)) {
963  // Add the rule to the set of attribute receivers only if it's supported
964  // in the current language mode.
965  if (StrictRule.second)
966  SubjectMatchRules.push_back(StrictRule.first);
967  }
968  }
969  // Check remaining rules for subset matches.
970  auto RulesToCheck = Rules;
971  for (const auto &Rule : RulesToCheck) {
972  attr::SubjectMatchRule MatchRule = attr::SubjectMatchRule(Rule.first);
973  if (auto ParentRule = getParentAttrMatcherRule(MatchRule)) {
974  if (llvm::any_of(StrictSubjectMatchRuleSet,
975  [ParentRule](const auto &StrictRule) {
976  return StrictRule.first == *ParentRule &&
977  StrictRule.second; // IsEnabled
978  })) {
979  SubjectMatchRules.push_back(MatchRule);
980  Rules.erase(MatchRule);
981  }
982  }
983  }
984  }
985 
986  if (!Rules.empty()) {
987  auto Diagnostic =
988  Diag(PragmaLoc, diag::err_pragma_attribute_invalid_matchers)
989  << Attribute;
991  for (const auto &Rule : Rules) {
992  ExtraRules.push_back(attr::SubjectMatchRule(Rule.first));
994  replacementRangeForListElement(*this, Rule.second));
995  }
996  Diagnostic << attrMatcherRuleListToString(ExtraRules);
997  }
998 
999  if (PragmaAttributeStack.empty()) {
1000  Diag(PragmaLoc, diag::err_pragma_attr_attr_no_push);
1001  return;
1002  }
1003 
1004  PragmaAttributeStack.back().Entries.push_back(
1005  {PragmaLoc, &Attribute, std::move(SubjectMatchRules), /*IsUsed=*/false});
1006 }
1007 
1009  const IdentifierInfo *Namespace) {
1010  PragmaAttributeStack.emplace_back();
1011  PragmaAttributeStack.back().Loc = PragmaLoc;
1012  PragmaAttributeStack.back().Namespace = Namespace;
1013 }
1014 
1016  const IdentifierInfo *Namespace) {
1017  if (PragmaAttributeStack.empty()) {
1018  Diag(PragmaLoc, diag::err_pragma_attribute_stack_mismatch) << 1;
1019  return;
1020  }
1021 
1022  // Dig back through the stack trying to find the most recently pushed group
1023  // that in Namespace. Note that this works fine if no namespace is present,
1024  // think of push/pops without namespaces as having an implicit "nullptr"
1025  // namespace.
1026  for (size_t Index = PragmaAttributeStack.size(); Index;) {
1027  --Index;
1028  if (PragmaAttributeStack[Index].Namespace == Namespace) {
1029  for (const PragmaAttributeEntry &Entry :
1030  PragmaAttributeStack[Index].Entries) {
1031  if (!Entry.IsUsed) {
1032  assert(Entry.Attribute && "Expected an attribute");
1033  Diag(Entry.Attribute->getLoc(), diag::warn_pragma_attribute_unused)
1034  << *Entry.Attribute;
1035  Diag(PragmaLoc, diag::note_pragma_attribute_region_ends_here);
1036  }
1037  }
1038  PragmaAttributeStack.erase(PragmaAttributeStack.begin() + Index);
1039  return;
1040  }
1041  }
1042 
1043  if (Namespace)
1044  Diag(PragmaLoc, diag::err_pragma_attribute_stack_mismatch)
1045  << 0 << Namespace->getName();
1046  else
1047  Diag(PragmaLoc, diag::err_pragma_attribute_stack_mismatch) << 1;
1048 }
1049 
1051  if (PragmaAttributeStack.empty())
1052  return;
1053  for (auto &Group : PragmaAttributeStack) {
1054  for (auto &Entry : Group.Entries) {
1055  ParsedAttr *Attribute = Entry.Attribute;
1056  assert(Attribute && "Expected an attribute");
1057  assert(Attribute->isPragmaClangAttribute() &&
1058  "expected #pragma clang attribute");
1059 
1060  // Ensure that the attribute can be applied to the given declaration.
1061  bool Applies = false;
1062  for (const auto &Rule : Entry.MatchRules) {
1063  if (Attribute->appliesToDecl(D, Rule)) {
1064  Applies = true;
1065  break;
1066  }
1067  }
1068  if (!Applies)
1069  continue;
1070  Entry.IsUsed = true;
1072  ParsedAttributesView Attrs;
1073  Attrs.addAtEnd(Attribute);
1074  ProcessDeclAttributeList(S, D, Attrs);
1076  }
1077  }
1078 }
1079 
1081  assert(PragmaAttributeCurrentTargetDecl && "Expected an active declaration");
1083  diag::note_pragma_attribute_applied_decl_here);
1084 }
1085 
1087  if (PragmaAttributeStack.empty())
1088  return;
1089  Diag(PragmaAttributeStack.back().Loc, diag::err_pragma_attribute_no_pop_eof);
1090 }
1091 
1092 void Sema::ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc) {
1093  if(On)
1095  else
1096  OptimizeOffPragmaLocation = PragmaLoc;
1097 }
1098 
1100  SourceLocation Loc, const llvm::SmallVectorImpl<StringRef> &NoBuiltins) {
1102  Diag(Loc, diag::err_pragma_expected_file_scope) << "function";
1103  return;
1104  }
1105 
1106  MSFunctionNoBuiltins.insert(NoBuiltins.begin(), NoBuiltins.end());
1107 }
1108 
1110  // In the future, check other pragmas if they're implemented (e.g. pragma
1111  // optimize 0 will probably map to this functionality too).
1114 }
1115 
1117  if (!FD->getIdentifier())
1118  return;
1119 
1120  StringRef Name = FD->getName();
1121  auto It = FunctionToSectionMap.find(Name);
1122  if (It != FunctionToSectionMap.end()) {
1123  StringRef Section;
1124  SourceLocation Loc;
1125  std::tie(Section, Loc) = It->second;
1126 
1127  if (!FD->hasAttr<SectionAttr>())
1128  FD->addAttr(SectionAttr::CreateImplicit(Context, Section));
1129  }
1130 }
1131 
1133  SourceLocation Loc) {
1134  // Don't add a conflicting attribute. No diagnostic is needed.
1135  if (FD->hasAttr<MinSizeAttr>() || FD->hasAttr<AlwaysInlineAttr>())
1136  return;
1137 
1138  // Add attributes only if required. Optnone requires noinline as well, but if
1139  // either is already present then don't bother adding them.
1140  if (!FD->hasAttr<OptimizeNoneAttr>())
1141  FD->addAttr(OptimizeNoneAttr::CreateImplicit(Context, Loc));
1142  if (!FD->hasAttr<NoInlineAttr>())
1143  FD->addAttr(NoInlineAttr::CreateImplicit(Context, Loc));
1144 }
1145 
1148  MSFunctionNoBuiltins.end());
1149  if (!MSFunctionNoBuiltins.empty())
1150  FD->addAttr(NoBuiltinAttr::CreateImplicit(Context, V.data(), V.size()));
1151 }
1152 
1153 typedef std::vector<std::pair<unsigned, SourceLocation> > VisStack;
1154 enum : unsigned { NoVisibility = ~0U };
1155 
1157  if (!VisContext)
1158  return;
1159 
1160  NamedDecl *ND = dyn_cast<NamedDecl>(D);
1162  return;
1163 
1164  VisStack *Stack = static_cast<VisStack*>(VisContext);
1165  unsigned rawType = Stack->back().first;
1166  if (rawType == NoVisibility) return;
1167 
1168  VisibilityAttr::VisibilityType type
1169  = (VisibilityAttr::VisibilityType) rawType;
1170  SourceLocation loc = Stack->back().second;
1171 
1172  D->addAttr(VisibilityAttr::CreateImplicit(Context, type, loc));
1173 }
1174 
1175 /// FreeVisContext - Deallocate and null out VisContext.
1177  delete static_cast<VisStack*>(VisContext);
1178  VisContext = nullptr;
1179 }
1180 
1181 static void PushPragmaVisibility(Sema &S, unsigned type, SourceLocation loc) {
1182  // Put visibility on stack.
1183  if (!S.VisContext)
1184  S.VisContext = new VisStack;
1185 
1186  VisStack *Stack = static_cast<VisStack*>(S.VisContext);
1187  Stack->push_back(std::make_pair(type, loc));
1188 }
1189 
1191  SourceLocation PragmaLoc) {
1192  if (VisType) {
1193  // Compute visibility to use.
1194  VisibilityAttr::VisibilityType T;
1195  if (!VisibilityAttr::ConvertStrToVisibilityType(VisType->getName(), T)) {
1196  Diag(PragmaLoc, diag::warn_attribute_unknown_visibility) << VisType;
1197  return;
1198  }
1199  PushPragmaVisibility(*this, T, PragmaLoc);
1200  } else {
1201  PopPragmaVisibility(false, PragmaLoc);
1202  }
1203 }
1204 
1207  FPOptionsOverride NewFPFeatures = CurFPFeatureOverrides();
1208  switch (FPC) {
1209  case LangOptions::FPM_On:
1210  NewFPFeatures.setAllowFPContractWithinStatement();
1211  break;
1212  case LangOptions::FPM_Fast:
1213  NewFPFeatures.setAllowFPContractAcrossStatement();
1214  break;
1215  case LangOptions::FPM_Off:
1216  NewFPFeatures.setDisallowFPContract();
1217  break;
1219  llvm_unreachable("Should not happen");
1220  }
1221  FpPragmaStack.Act(Loc, Sema::PSK_Set, StringRef(), NewFPFeatures);
1222  CurFPFeatures = NewFPFeatures.applyOverrides(getLangOpts());
1223 }
1224 
1226  if (IsEnabled) {
1227  // For value unsafe context, combining this pragma with eval method
1228  // setting is not recommended. See comment in function FixupInvocation#506.
1229  int Reason = -1;
1230  if (getLangOpts().getFPEvalMethod() != LangOptions::FEM_UnsetOnCommandLine)
1231  // Eval method set using the option 'ffp-eval-method'.
1232  Reason = 1;
1234  // Eval method set using the '#pragma clang fp eval_method'.
1235  // We could have both an option and a pragma used to the set the eval
1236  // method. The pragma overrides the option in the command line. The Reason
1237  // of the diagnostic is overriden too.
1238  Reason = 0;
1239  if (Reason != -1)
1240  Diag(Loc, diag::err_setting_eval_method_used_in_unsafe_context)
1241  << Reason << 4;
1242  }
1243  FPOptionsOverride NewFPFeatures = CurFPFeatureOverrides();
1244  NewFPFeatures.setAllowFPReassociateOverride(IsEnabled);
1245  FpPragmaStack.Act(Loc, PSK_Set, StringRef(), NewFPFeatures);
1246  CurFPFeatures = NewFPFeatures.applyOverrides(getLangOpts());
1247 }
1248 
1249 void Sema::setRoundingMode(SourceLocation Loc, llvm::RoundingMode FPR) {
1250  // C2x: 7.6.2p3 If the FE_DYNAMIC mode is specified and FENV_ACCESS is "off",
1251  // the translator may assume that the default rounding mode is in effect.
1252  if (FPR == llvm::RoundingMode::Dynamic &&
1253  !CurFPFeatures.getAllowFEnvAccess() &&
1254  CurFPFeatures.getFPExceptionMode() == LangOptions::FPE_Ignore)
1255  FPR = llvm::RoundingMode::NearestTiesToEven;
1256 
1257  FPOptionsOverride NewFPFeatures = CurFPFeatureOverrides();
1258  NewFPFeatures.setRoundingModeOverride(FPR);
1259  FpPragmaStack.Act(Loc, PSK_Set, StringRef(), NewFPFeatures);
1260  CurFPFeatures = NewFPFeatures.applyOverrides(getLangOpts());
1261 }
1262 
1265  FPOptionsOverride NewFPFeatures = CurFPFeatureOverrides();
1266  NewFPFeatures.setFPExceptionModeOverride(FPE);
1267  FpPragmaStack.Act(Loc, PSK_Set, StringRef(), NewFPFeatures);
1268  CurFPFeatures = NewFPFeatures.applyOverrides(getLangOpts());
1269 }
1270 
1271 void Sema::ActOnPragmaFEnvAccess(SourceLocation Loc, bool IsEnabled) {
1272  FPOptionsOverride NewFPFeatures = CurFPFeatureOverrides();
1273  auto LO = getLangOpts();
1274  if (IsEnabled) {
1275  // Verify Microsoft restriction:
1276  // You can't enable fenv_access unless precise semantics are enabled.
1277  // Precise semantics can be enabled either by the float_control
1278  // pragma, or by using the /fp:precise or /fp:strict compiler options
1279  if (!isPreciseFPEnabled())
1280  Diag(Loc, diag::err_pragma_fenv_requires_precise);
1281  NewFPFeatures.setAllowFEnvAccessOverride(true);
1282  // Enabling FENV access sets the RoundingMode to Dynamic.
1283  // and ExceptionBehavior to Strict
1284  NewFPFeatures.setRoundingModeOverride(llvm::RoundingMode::Dynamic);
1285  NewFPFeatures.setFPExceptionModeOverride(LangOptions::FPE_Strict);
1286  } else {
1287  NewFPFeatures.setAllowFEnvAccessOverride(false);
1288  }
1289  FpPragmaStack.Act(Loc, PSK_Set, StringRef(), NewFPFeatures);
1290  CurFPFeatures = NewFPFeatures.applyOverrides(LO);
1291 }
1292 
1295  setExceptionMode(Loc, FPE);
1296 }
1297 
1298 void Sema::PushNamespaceVisibilityAttr(const VisibilityAttr *Attr,
1299  SourceLocation Loc) {
1300  // Visibility calculations will consider the namespace's visibility.
1301  // Here we just want to note that we're in a visibility context
1302  // which overrides any enclosing #pragma context, but doesn't itself
1303  // contribute visibility.
1304  PushPragmaVisibility(*this, NoVisibility, Loc);
1305 }
1306 
1307 void Sema::PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc) {
1308  if (!VisContext) {
1309  Diag(EndLoc, diag::err_pragma_pop_visibility_mismatch);
1310  return;
1311  }
1312 
1313  // Pop visibility from stack
1314  VisStack *Stack = static_cast<VisStack*>(VisContext);
1315 
1316  const std::pair<unsigned, SourceLocation> *Back = &Stack->back();
1317  bool StartsWithPragma = Back->first != NoVisibility;
1318  if (StartsWithPragma && IsNamespaceEnd) {
1319  Diag(Back->second, diag::err_pragma_push_visibility_mismatch);
1320  Diag(EndLoc, diag::note_surrounding_namespace_ends_here);
1321 
1322  // For better error recovery, eat all pushes inside the namespace.
1323  do {
1324  Stack->pop_back();
1325  Back = &Stack->back();
1326  StartsWithPragma = Back->first != NoVisibility;
1327  } while (StartsWithPragma);
1328  } else if (!StartsWithPragma && !IsNamespaceEnd) {
1329  Diag(EndLoc, diag::err_pragma_pop_visibility_mismatch);
1330  Diag(Back->second, diag::note_surrounding_namespace_starts_here);
1331  return;
1332  }
1333 
1334  Stack->pop_back();
1335  // To simplify the implementation, never keep around an empty stack.
1336  if (Stack->empty())
1337  FreeVisContext();
1338 }
1339 
1340 template <typename Ty>
1341 static bool checkCommonAttributeFeatures(Sema &S, const Ty *Node,
1342  const ParsedAttr &A,
1343  bool SkipArgCountCheck) {
1344  // Several attributes carry different semantics than the parsing requires, so
1345  // those are opted out of the common argument checks.
1346  //
1347  // We also bail on unknown and ignored attributes because those are handled
1348  // as part of the target-specific handling logic.
1350  return false;
1351  // Check whether the attribute requires specific language extensions to be
1352  // enabled.
1353  if (!A.diagnoseLangOpts(S))
1354  return true;
1355  // Check whether the attribute appertains to the given subject.
1356  if (!A.diagnoseAppertainsTo(S, Node))
1357  return true;
1358  // Check whether the attribute is mutually exclusive with other attributes
1359  // that have already been applied to the declaration.
1360  if (!A.diagnoseMutualExclusion(S, Node))
1361  return true;
1362  // Check whether the attribute exists in the target architecture.
1363  if (S.CheckAttrTarget(A))
1364  return true;
1365 
1366  if (A.hasCustomParsing())
1367  return false;
1368 
1369  if (!SkipArgCountCheck) {
1370  if (A.getMinArgs() == A.getMaxArgs()) {
1371  // If there are no optional arguments, then checking for the argument
1372  // count is trivial.
1373  if (!A.checkExactlyNumArgs(S, A.getMinArgs()))
1374  return true;
1375  } else {
1376  // There are optional arguments, so checking is slightly more involved.
1377  if (A.getMinArgs() && !A.checkAtLeastNumArgs(S, A.getMinArgs()))
1378  return true;
1379  else if (!A.hasVariadicArg() && A.getMaxArgs() &&
1380  !A.checkAtMostNumArgs(S, A.getMaxArgs()))
1381  return true;
1382  }
1383  }
1384 
1385  return false;
1386 }
1387 
1389  bool SkipArgCountCheck) {
1390  return ::checkCommonAttributeFeatures(*this, D, A, SkipArgCountCheck);
1391 }
1393  bool SkipArgCountCheck) {
1394  return ::checkCommonAttributeFeatures(*this, S, A, SkipArgCountCheck);
1395 }
clang::Sema::AddSectionMSAllocText
void AddSectionMSAllocText(FunctionDecl *FD)
Only called on function definitions; if there is a #pragma alloc_text that decides which code section...
Definition: SemaAttr.cpp:1116
clang::Sema::UnifySection
bool UnifySection(StringRef SectionName, int SectionFlags, NamedDecl *TheDecl)
Definition: SemaAttr.cpp:649
clang::Sema::CurContext
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
Definition: Sema.h:422
clang::ParsedAttr::getMinArgs
unsigned getMinArgs() const
Definition: ParsedAttr.cpp:152
clang::FPOptionsOverride::setAllowFPContractAcrossStatement
void setAllowFPContractAcrossStatement()
Definition: LangOptions.h:743
clang::Sema::PragmaOptionsAlignKind
PragmaOptionsAlignKind
Definition: Sema.h:10127
clang::Sema::PragmaClangRelroSection
PragmaClangSection PragmaClangRelroSection
Definition: Sema.h:474
clang::Preprocessor::getCurrentFPEvalMethod
LangOptions::FPEvalMethodKind getCurrentFPEvalMethod() const
Definition: Preprocessor.h:2091
clang::Decl::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: DeclBase.h:417
type
clang::ParsedAttr::getKind
AttributeCommonInfo::Kind getKind() const
Definition: ParsedAttr.h:704
clang::Sema::ActOnPragmaUnused
void ActOnPragmaUnused(const Token &Identifier, Scope *curScope, SourceLocation PragmaLoc)
ActOnPragmaUnused - Called on well-formed '#pragma unused'.
Definition: SemaAttr.cpp:775
clang::Sema::inferGslOwnerPointerAttribute
void inferGslOwnerPointerAttribute(CXXRecordDecl *Record)
Add [[gsl::Owner]] and [[gsl::Pointer]] attributes for std:: types.
Definition: SemaAttr.cpp:164
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:210
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::DeclContext
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1356
clang::Decl::hasAttr
bool hasAttr() const
Definition: DeclBase.h:542
clang::Sema::ActOnPragmaMSInitSeg
void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation, StringLiteral *SegmentName)
Called on well-formed #pragma init_seg().
Definition: SemaAttr.cpp:735
clang::FixItHint::CreateInsertion
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.
Definition: Diagnostic.h:97
clang::Sema::CurInitSeg
StringLiteral * CurInitSeg
Last section used with #pragma init_seg.
Definition: Sema.h:724
clang::Sema::FreeVisContext
void FreeVisContext()
FreeVisContext - Deallocate and null out VisContext.
Definition: SemaAttr.cpp:1176
clang::Decl::Decl
Decl()=delete
clang::Sema::SourceMgr
SourceManager & SourceMgr
Definition: Sema.h:413
clang::Sema::DataSegStack
PragmaStack< StringLiteral * > DataSegStack
Definition: Sema.h:690
clang::PFC_Pop
@ PFC_Pop
Definition: PragmaKinds.h:35
clang::Sema::AlignPackInfo::IsPackSet
bool IsPackSet() const
Definition: Sema.h:547
clang::Sema::ActOnPragmaMSSeg
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.
Definition: SemaAttr.cpp:703
SemaInternal.h
clang::Sema::ActOnPragmaFloatControl
void ActOnPragmaFloatControl(SourceLocation Loc, PragmaMsStackAction Action, PragmaFloatControlKind Value)
ActOnPragmaFloatControl - Call on well-formed #pragma float_control.
Definition: SemaAttr.cpp:500
clang::StringLiteral::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:1942
llvm::SmallVector
Definition: LLVM.h:38
Lookup.h
clang::ParsedAttr::appliesToDecl
bool appliesToDecl(const Decl *D, attr::SubjectMatchRule MatchRule) const
Definition: ParsedAttr.cpp:178
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::Sema::ActOnPragmaDetectMismatch
void ActOnPragmaDetectMismatch(SourceLocation Loc, StringRef Name, StringRef Value)
ActOnPragmaDetectMismatch - Call on well-formed #pragma detect_mismatch.
Definition: SemaAttr.cpp:465
clang::Sema::CodeSegStack
PragmaStack< StringLiteral * > CodeSegStack
Definition: Sema.h:693
clang::TargetCXXABI::isMicrosoft
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
Definition: TargetCXXABI.h:138
clang::Sema::AddPushedVisibilityAttribute
void AddPushedVisibilityAttribute(Decl *RD)
AddPushedVisibilityAttribute - If '#pragma GCC visibility' was used, add an appropriate visibility at...
Definition: SemaAttr.cpp:1156
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:247
TargetInfo.h
clang::Sema::DiagnoseUnterminatedPragmaAttribute
void DiagnoseUnterminatedPragmaAttribute()
Definition: SemaAttr.cpp:1086
clang::Sema::PragmaStack::Stack
SmallVector< Slot, 2 > Stack
Definition: Sema.h:664
clang::Sema::FpPragmaStack
PragmaStack< FPOptionsOverride > FpPragmaStack
Definition: Sema.h:696
clang::Sema::checkSectionName
bool checkSectionName(SourceLocation LiteralLoc, StringRef Str)
Definition: SemaDeclAttr.cpp:3298
clang::Sema::ProcessDeclAttributeList
void ProcessDeclAttributeList(Scope *S, Decl *D, const ParsedAttributesView &AL, bool IncludeCXX11Attributes=true)
ProcessDeclAttributeList - Apply all the decl attributes in the specified attribute list to the speci...
Definition: SemaDeclAttr.cpp:9043
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:675
Attr.h
clang::Sema::AlignPackInfo::Packed
@ Packed
Definition: Sema.h:492
clang::Sema::PragmaStack
Definition: Sema.h:590
clang::Token::getIdentifierInfo
IdentifierInfo * getIdentifierInfo() const
Definition: Token.h:178
clang::QualType::getCanonicalType
QualType getCanonicalType() const
Definition: Type.h:6539
clang::LookupResult
Represents the results of name lookup.
Definition: Lookup.h:46
clang::TargetInfo::getCXXABI
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
Definition: TargetInfo.h:1233
clang::Sema::Diag
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
Definition: Sema.cpp:1871
clang::Sema::TUScope
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
Definition: Sema.h:1118
clang::Decl::isUsed
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required.
Definition: DeclBase.cpp:443
clang::Preprocessor::setLastFPEvalMethod
void setLastFPEvalMethod(LangOptions::FPEvalMethodKind Val)
Definition: Preprocessor.h:2110
clang::LangOptions::FPM_On
@ FPM_On
Definition: LangOptions.h:252
clang::ASTContext::PSF_Execute
@ PSF_Execute
Definition: ASTContext.h:3274
clang::ASTContext::PSF_Write
@ PSF_Write
Definition: ASTContext.h:3273
clang::Sema::getSourceManager
SourceManager & getSourceManager() const
Definition: Sema.h:1612
clang::Sema::ActOnPragmaAttributePop
void ActOnPragmaAttributePop(SourceLocation PragmaLoc, const IdentifierInfo *Namespace)
Called on well-formed '#pragma clang attribute pop'.
Definition: SemaAttr.cpp:1015
clang::Sema::PSK_Push_Set
@ PSK_Push_Set
Definition: Sema.h:483
llvm::Optional
Definition: LLVM.h:40
clang::Sema::setRoundingMode
void setRoundingMode(SourceLocation Loc, llvm::RoundingMode)
Called to set constant rounding mode for floating point operations.
Definition: SemaAttr.cpp:1249
clang::Sema::AddMsStructLayoutForRecord
void AddMsStructLayoutForRecord(RecordDecl *RD)
AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
Definition: SemaAttr.cpp:86
clang::Sema::ActOnPragmaFPEvalMethod
void ActOnPragmaFPEvalMethod(SourceLocation Loc, LangOptions::FPEvalMethodKind Value)
Definition: SemaAttr.cpp:473
clang::Sema::AlignPackIncludeState::CurrentValue
AlignPackInfo CurrentValue
Definition: Sema.h:684
clang::Decl::getAttr
T * getAttr() const
Definition: DeclBase.h:538
clang::diag::Group
Group
Definition: DiagnosticCategories.h:23
clang::Sema::AlignPackInfo::Mode
Mode
Definition: Sema.h:492
clang::Sema::ActOnPragmaMSSection
void ActOnPragmaMSSection(SourceLocation PragmaLocation, int SectionFlags, StringLiteral *SegmentName)
Called on well formed #pragma section().
Definition: SemaAttr.cpp:730
clang::FPOptionsOverride::setFPPreciseEnabled
void setFPPreciseEnabled(bool Value)
Definition: LangOptions.h:751
VisStack
std::vector< std::pair< unsigned, SourceLocation > > VisStack
Definition: SemaAttr.cpp:1153
clang::MSVtorDispMode
MSVtorDispMode
In the Microsoft ABI, this controls the placement of virtual displacement members used to implement v...
Definition: LangOptions.h:54
clang::Sema::ActOnPragmaAttributeEmptyPush
void ActOnPragmaAttributeEmptyPush(SourceLocation PragmaLoc, const IdentifierInfo *Namespace)
Definition: SemaAttr.cpp:1008
clang::Token
Token - This structure provides full information about a lexed token.
Definition: Token.h:34
clang::ParsedAttr::checkAtLeastNumArgs
bool checkAtLeastNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has at least as many args as Num.
Definition: ParsedAttr.cpp:258
clang::ParsedAttr::setIsPragmaClangAttribute
void setIsPragmaClangAttribute()
Definition: ParsedAttr.h:486
clang::Sema::POAK_Natural
@ POAK_Natural
Definition: Sema.h:10129
clang::DeclarationName
The name of a declaration.
Definition: DeclarationName.h:144
clang::ASTContext::getTranslationUnitDecl
TranslationUnitDecl * getTranslationUnitDecl() const
Definition: ASTContext.h:1078
clang::Sema::setExceptionMode
void setExceptionMode(SourceLocation Loc, LangOptions::FPExceptionModeKind)
Called to set exception behavior for floating point operations.
Definition: SemaAttr.cpp:1263
clang::PFC_Except
@ PFC_Except
Definition: PragmaKinds.h:32
clang::Sema::ActOnPragmaFEnvAccess
void ActOnPragmaFEnvAccess(SourceLocation Loc, bool IsEnabled)
ActOnPragmaFenvAccess - Called on well formed #pragma STDC FENV_ACCESS.
Definition: SemaAttr.cpp:1271
clang::attr::SubjectMatchRule
SubjectMatchRule
A list of all the recognized kinds of attributes.
Definition: AttrSubjectMatchRules.h:19
clang::ParsedAttr::checkExactlyNumArgs
bool checkExactlyNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has exactly as many args as Num.
Definition: ParsedAttr.cpp:253
clang::Sema::Context
ASTContext & Context
Definition: Sema.h:410
Preprocessor.h
clang::Sema::ActOnPragmaOptimize
void ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc)
Called on well formed #pragma clang optimize.
Definition: SemaAttr.cpp:1092
clang::Sema::PSK_Set
@ PSK_Set
Definition: Sema.h:479
clang::Sema::PushNamespaceVisibilityAttr
void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr, SourceLocation Loc)
PushNamespaceVisibilityAttr - Note that we've entered a namespace with a visibility attribute.
Definition: SemaAttr.cpp:1298
clang::Sema::AddPragmaAttributes
void AddPragmaAttributes(Scope *S, Decl *D)
Adds the attributes that have been specified using the '#pragma clang attribute push' directives to t...
Definition: SemaAttr.cpp:1050
clang::Diagnostic
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine) ...
Definition: Diagnostic.h:1560
clang::Sema::getLangOpts
const LangOptions & getLangOpts() const
Definition: Sema.h:1607
clang::ASTContext::PSF_ZeroInit
@ PSF_ZeroInit
Definition: ASTContext.h:3276
U
clang::CharSourceRange::getCharRange
static CharSourceRange getCharRange(SourceRange R)
Definition: SourceLocation.h:265
clang::Expr::getIntegerConstantExpr
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.
Definition: ExprConstant.cpp:15760
V
#define V(N, I)
Definition: ASTContext.h:3176
clang::AttributeCommonInfo::UnknownAttribute
@ UnknownAttribute
Definition: AttributeCommonInfo.h:61
clang::ast_matchers::attr
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
Definition: ASTMatchersInternal.cpp:1030
clang::NamedDecl::getExplicitVisibility
Optional< Visibility > getExplicitVisibility(ExplicitVisibilityKind kind) const
If visibility was explicitly specified for this declaration, return that visibility.
Definition: Decl.cpp:1238
clang::Sema::isPreciseFPEnabled
bool isPreciseFPEnabled()
Are precise floating point semantics currently enabled?
Definition: Sema.h:10220
clang::Expr::isTypeDependent
bool isTypeDependent() const
Determines whether the type of this expression depends on.
Definition: Expr.h:185
clang::PragmaFloatControlKind
PragmaFloatControlKind
Definition: PragmaKinds.h:28
clang::Sema::CurFPFeatures
FPOptions CurFPFeatures
Definition: Sema.h:406
clang::Sema::ActOnPragmaMSAllocText
void ActOnPragmaMSAllocText(SourceLocation PragmaLocation, StringRef Section, const SmallVector< std::tuple< IdentifierInfo *, SourceLocation >> &Functions)
Called on well-formed #pragma alloc_text().
Definition: SemaAttr.cpp:744
clang::Sema::PSK_Reset
@ PSK_Reset
Definition: Sema.h:478
clang::Sema::CurFPFeatureOverrides
FPOptionsOverride CurFPFeatureOverrides()
Definition: Sema.h:697
Node
DynTypedNode Node
Definition: ASTMatchFinder.cpp:68
clang::ParsedAttr::getMaxArgs
unsigned getMaxArgs() const
Definition: ParsedAttr.cpp:154
clang::Sema::ActOnPragmaOptionsAlign
void ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind, SourceLocation PragmaLoc)
ActOnPragmaOptionsAlign - Called on well formed #pragma options align.
Definition: SemaAttr.cpp:215
clang::Scope
Scope - A scope is a transient data structure that is used while parsing the program.
Definition: Scope.h:40
clang::Decl::isInStdNamespace
bool isInStdNamespace() const
Definition: DeclBase.cpp:394
clang::Sema::VisContext
void * VisContext
VisContext - Manages the stack for #pragma GCC visibility.
Definition: Sema.h:731
clang::threadSafety::sx::toString
std::string toString(const til::SExpr *E)
Definition: ThreadSafetyCommon.h:90
clang::ASTContext::PSF_Read
@ PSF_Read
Definition: ASTContext.h:3272
clang::FPOptionsOverride
Represents difference between two FPOptions values.
Definition: LangOptions.h:713
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:208
clang::LangOptions::FPExceptionModeKind
FPExceptionModeKind
Possible floating point exception behavior.
Definition: LangOptions.h:266
clang::Preprocessor::getLastFPEvalPragmaLocation
SourceLocation getLastFPEvalPragmaLocation() const
Definition: Preprocessor.h:2102
clang::Sema::AlignPackInfo::Native
@ Native
Definition: Sema.h:492
clang::Sema::PragmaStackSentinelRAII::PragmaStackSentinelRAII
PragmaStackSentinelRAII(Sema &S, StringRef SlotLabel, bool ShouldAct)
Definition: SemaAttr.cpp:27
clang::LangOptions::FPEvalMethodKind
FPEvalMethodKind
Possible float expression evaluation method choices.
Definition: LangOptions.h:276
clang::Sema::isValidSectionSpecifier
llvm::Error isValidSectionSpecifier(StringRef Str)
Used to implement to perform semantic checking on attribute((section("foo"))) specifiers.
Definition: SemaDeclAttr.cpp:3286
clang::Sema::ActOnPragmaPack
void ActOnPragmaPack(SourceLocation PragmaLoc, PragmaMsStackAction Action, StringRef SlotLabel, Expr *Alignment)
ActOnPragmaPack - Called on well formed #pragma pack(...).
Definition: SemaAttr.cpp:321
clang::FPOptionsOverride::applyOverrides
FPOptions applyOverrides(FPOptions Base)
Definition: LangOptions.h:778
clang::Sema::AlignPackInfo
Definition: Sema.h:488
clang::Sema::MSStructPragmaOn
bool MSStructPragmaOn
Definition: Sema.h:432
clang::Sema::PragmaClangSection::SectionName
std::string SectionName
Definition: Sema.h:466
clang::Sema::Diags
DiagnosticsEngine & Diags
Definition: Sema.h:412
clang::Sema::ActOnPragmaFPContract
void ActOnPragmaFPContract(SourceLocation Loc, LangOptions::FPModeKind FPC)
ActOnPragmaFPContract - Called on well formed #pragma {STDC,OPENCL} FP_CONTRACT and #pragma clang fp ...
Definition: SemaAttr.cpp:1205
clang::TypedefNameDecl::getUnderlyingType
QualType getUnderlyingType() const
Definition: Decl.h:3255
clang::Sema::PSK_Push
@ PSK_Push
Definition: Sema.h:480
clang::ParsedAttr
ParsedAttr - Represents a syntactic attribute.
Definition: ParsedAttr.h:234
clang::attr::getSubjectMatchRuleSpelling
const char * getSubjectMatchRuleSpelling(SubjectMatchRule Rule)
Definition: Attributes.cpp:36
clang::ParsedAttributesView::addAtEnd
void addAtEnd(ParsedAttr *newAttr)
Definition: ParsedAttr.h:909
Expr.h
clang::Redeclarable::redecls
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
Definition: Redeclarable.h:296
clang::PragmaDetectMismatchDecl::Create
static PragmaDetectMismatchDecl * Create(const ASTContext &C, TranslationUnitDecl *DC, SourceLocation Loc, StringRef Name, StringRef Value)
Definition: Decl.cpp:4885
clang::Sema::PragmaClangTextSection
PragmaClangSection PragmaClangTextSection
Definition: Sema.h:475
clang::VarDecl
Represents a variable declaration or definition.
Definition: Decl.h:874
clang::PFC_Precise
@ PFC_Precise
Definition: PragmaKinds.h:30
clang::StringLiteral
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1767
clang::Sema::AlignPackIncludeStack
SmallVector< AlignPackIncludeState, 8 > AlignPackIncludeStack
Definition: Sema.h:688
clang::Type::getAsCXXRecordDecl
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Definition: Type.cpp:1759
clang::Sema::LookupParsedName
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...
Definition: SemaLookup.cpp:2477
clang::Sema::PragmaStackSentinelRAII::~PragmaStackSentinelRAII
~PragmaStackSentinelRAII()
Definition: SemaAttr.cpp:40
clang::PFC_Push
@ PFC_Push
Definition: PragmaKinds.h:34
checkCommonAttributeFeatures
static bool checkCommonAttributeFeatures(Sema &S, const Ty *Node, const ParsedAttr &A, bool SkipArgCountCheck)
Definition: SemaAttr.cpp:1341
x
IRgen optimization opportunities The common pattern of short x
Definition: README.txt:7
clang::Sema::AddImplicitMSFunctionNoBuiltinAttr
void AddImplicitMSFunctionNoBuiltinAttr(FunctionDecl *FD)
Only called on function definitions; if there is a pragma in scope with the effect of a range-based n...
Definition: SemaAttr.cpp:1146
clang::Sema::PragmaClangSectionAction
PragmaClangSectionAction
Definition: Sema.h:460
clang::Sema::AlignPackInfo::Natural
@ Natural
Definition: Sema.h:492
clang::Sema::CurInitSegLoc
SourceLocation CurInitSegLoc
Definition: Sema.h:725
clang::Sema::ActOnPragmaVisibility
void ActOnPragmaVisibility(const IdentifierInfo *VisType, SourceLocation PragmaLoc)
ActOnPragmaVisibility - Called on well formed #pragma GCC visibility... .
Definition: SemaAttr.cpp:1190
clang::ASTConsumer::HandleTopLevelDecl
virtual bool HandleTopLevelDecl(DeclGroupRef D)
HandleTopLevelDecl - Handle the specified top-level declaration.
Definition: ASTConsumer.cpp:18
clang::Sema::LangOpts
const LangOptions & LangOpts
Definition: Sema.h:408
clang::PragmaCommentDecl::Create
static PragmaCommentDecl * Create(const ASTContext &C, TranslationUnitDecl *DC, SourceLocation CommentLoc, PragmaMSCommentKind CommentKind, StringRef Arg)
Definition: Decl.cpp:4862
clang::PFC_NoExcept
@ PFC_NoExcept
Definition: PragmaKinds.h:33
clang::LangOptions::FEM_UnsetOnCommandLine
@ FEM_UnsetOnCommandLine
Used only for FE option processing; this is only used to indicate that the user did not specify an ex...
Definition: LangOptions.h:290
clang::Sema::PragmaStack::Act
void Act(SourceLocation PragmaLocation, PragmaMsStackAction Action, llvm::StringRef StackSlotLabel, ValueType Value)
Definition: Sema.h:603
clang::Sema::PSK_Show
@ PSK_Show
Definition: Sema.h:482
clang::transformer::EditKind::Range
@ Range
clang::LangOptions::FPModeKind
FPModeKind
Definition: LangOptions.h:247
clang::Sema::PragmaClangSection
Definition: Sema.h:465
clang::Sema::ActOnPragmaFPExceptions
void ActOnPragmaFPExceptions(SourceLocation Loc, LangOptions::FPExceptionModeKind)
Called on well formed '#pragma clang fp' that has option 'exceptions'.
Definition: SemaAttr.cpp:1293
clang::Sema::PragmaClangBSSSection
PragmaClangSection PragmaClangBSSSection
Definition: Sema.h:471
clang::ParsedAttr::hasVariadicArg
bool hasVariadicArg() const
Definition: ParsedAttr.cpp:221
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:254
clang::ParsedAttr::checkAtMostNumArgs
bool checkAtMostNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has at most as many args as Num.
Definition: ParsedAttr.cpp:263
clang::Sema::BSSSegStack
PragmaStack< StringLiteral * > BSSSegStack
Definition: Sema.h:691
clang::TargetInfo::hasAlignMac68kSupport
bool hasAlignMac68kSupport() const
Check whether this target support '#pragma options align=mac68k'.
Definition: TargetInfo.h:860
clang::DeclContext::getRedeclContext
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
Definition: DeclBase.cpp:1793
clang::ParsedAttr::diagnoseMutualExclusion
bool diagnoseMutualExclusion(class Sema &S, const Decl *D) const
Definition: ParsedAttr.cpp:174
clang::Sema::POAK_Reset
@ POAK_Reset
Definition: Sema.h:10133
clang::LangOptions::FEM_Source
@ FEM_Source
Use the declared type for fp arithmetic.
Definition: LangOptions.h:281
clang::LookupResult::empty
bool empty() const
Return true if no decls were found.
Definition: Lookup.h:339
clang::Sema::AlignPackIncludeState::CurrentPragmaLocation
SourceLocation CurrentPragmaLocation
Definition: Sema.h:685
clang::Sema::PrintPragmaAttributeInstantiationPoint
void PrintPragmaAttributeInstantiationPoint()
Definition: SemaAttr.cpp:1080
clang::Sema::ActOnPragmaMSVtorDisp
void ActOnPragmaMSVtorDisp(PragmaMsStackAction Action, SourceLocation PragmaLoc, MSVtorDispMode Value)
Called on well formed #pragma vtordisp().
Definition: SemaAttr.cpp:578
clang::Sema::ActOnPragmaMSStruct
void ActOnPragmaMSStruct(PragmaMSStructKind Kind)
ActOnPragmaMSStruct - Called on well formed #pragma ms_struct [on|off].
Definition: SemaAttr.cpp:453
clang::Sema::PragmaAttributeEntry
This an attribute introduced by #pragma clang attribute.
Definition: Sema.h:734
clang::NamedDecl::getIdentifier
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
Definition: Decl.h:268
clang::ASTContext::PSF_Implicit
@ PSF_Implicit
Definition: ASTContext.h:3275
clang::Sema::MSPointerToMemberRepresentationMethod
LangOptions::PragmaMSPointersToMembersKind MSPointerToMemberRepresentationMethod
Controls member pointer representation format under the MS ABI.
Definition: Sema.h:436
clang::DeclContext::addDecl
void addDecl(Decl *D)
Add the declaration D into this context.
Definition: DeclBase.cpp:1572
clang::Sema::AlignPackInfo::IsAlignAttr
bool IsAlignAttr() const
Definition: Sema.h:541
clang::CharSourceRange::getTokenRange
static CharSourceRange getTokenRange(SourceRange R)
Definition: SourceLocation.h:261
clang::Preprocessor::getPragmaARCCFCodeAuditedInfo
std::pair< IdentifierInfo *, SourceLocation > getPragmaARCCFCodeAuditedInfo() const
The location of the currently-active #pragma clang arc_cf_code_audited begin.
Definition: Preprocessor.h:1746
clang::Sema::DiagnoseNonDefaultPragmaAlignPack
void DiagnoseNonDefaultPragmaAlignPack(PragmaAlignPackDiagnoseKind Kind, SourceLocation IncludeLoc)
Definition: SemaAttr.cpp:387
llvm::ArrayRef
Definition: LLVM.h:34
Value
Value
Definition: UninitializedValues.cpp:102
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:83
clang::AttributeCommonInfo
Definition: AttributeCommonInfo.h:22
clang::Sema::PragmaAttributeStack
SmallVector< PragmaAttributeGroup, 2 > PragmaAttributeStack
Definition: Sema.h:750
clang::Sema::ActOnPragmaMSComment
void ActOnPragmaMSComment(SourceLocation CommentLoc, PragmaMSCommentKind Kind, StringRef Arg)
ActOnPragmaMSComment - Called on well formed #pragma comment(kind, "arg").
Definition: SemaAttr.cpp:457
clang::DeclGroupRef
Definition: DeclGroup.h:51
clang::Sema::Consumer
ASTConsumer & Consumer
Definition: Sema.h:411
clang::PFC_NoPrecise
@ PFC_NoPrecise
Definition: PragmaKinds.h:31
clang::CharSourceRange
Represents a character-granular source range.
Definition: SourceLocation.h:253
clang::Sema
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:354
clang::Preprocessor::setCurrentFPEvalMethod
void setCurrentFPEvalMethod(SourceLocation PragmaLoc, LangOptions::FPEvalMethodKind Val)
Definition: Preprocessor.h:2114
clang::LangOptions::FPM_FastHonorPragmas
@ FPM_FastHonorPragmas
Definition: LangOptions.h:258
ASTConsumer.h
clang::DeclContext::isFileContext
bool isFileContext() const
Definition: DeclBase.h:1946
clang::Sema::LookupSingleName
NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=NotForRedeclaration)
Look up a name, looking for a single declaration.
Definition: SemaLookup.cpp:3051
clang::ParsedAttr::diagnoseAppertainsTo
bool diagnoseAppertainsTo(class Sema &S, const Decl *D) const
Definition: ParsedAttr.cpp:166
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:84
clang::Sema::ImplicitMSInheritanceAttrLoc
SourceLocation ImplicitMSInheritanceAttrLoc
Source location for newly created implicit MSInheritanceAttrs.
Definition: Sema.h:442
clang::Token::getLocation
SourceLocation getLocation() const
Return a source location identifier for the specified offset in the current file.
Definition: Token.h:125
clang::ASTContext::getTargetInfo
const TargetInfo & getTargetInfo() const
Definition: ASTContext.h:768
clang::Sema::ActOnPragmaMSFunction
void ActOnPragmaMSFunction(SourceLocation Loc, const llvm::SmallVectorImpl< StringRef > &NoBuiltins)
Call on well formed #pragma function.
Definition: SemaAttr.cpp:1099
clang::Sema::DiagnoseUnterminatedPragmaAlignPack
void DiagnoseUnterminatedPragmaAlignPack()
Definition: SemaAttr.cpp:426
clang::Sema::PragmaStack::CurrentValue
ValueType CurrentValue
Definition: Sema.h:666
clang::ObjCPropertyAttribute::Kind
Kind
Definition: DeclObjCCommon.h:22
clang::ParsedAttr::isPragmaClangAttribute
bool isPragmaClangAttribute() const
True if the attribute is specified using '#pragma clang attribute'.
Definition: ParsedAttr.h:484
clang::Sema::POAK_Power
@ POAK_Power
Definition: Sema.h:10131
clang::attr::ParsedSubjectMatchRuleSet
llvm::DenseMap< int, SourceRange > ParsedSubjectMatchRuleSet
Definition: AttrSubjectMatchRules.h:29
clang::Sema::ActOnPragmaClangSection
void ActOnPragmaClangSection(SourceLocation PragmaLoc, PragmaClangSectionAction Action, PragmaClangSectionKind SecKind, StringRef SecName)
ActOnPragmaClangSection - Called on well formed #pragma clang section.
Definition: SemaAttr.cpp:272
clang::ASTContext::SectionInfos
llvm::StringMap< SectionInfo > SectionInfos
Definition: ASTContext.h:3292
clang::Sema::PragmaMsStackAction
PragmaMsStackAction
Definition: Sema.h:477
clang::Sema::PopPragmaVisibility
void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc)
PopPragmaVisibility - Pop the top element of the visibility stack; used for '#pragma GCC visibility' ...
Definition: SemaAttr.cpp:1307
addGslOwnerPointerAttributeIfNotExisting
static void addGslOwnerPointerAttributeIfNotExisting(ASTContext &Context, CXXRecordDecl *Record)
Definition: SemaAttr.cpp:99
clang::Sema::ConstSegStack
PragmaStack< StringLiteral * > ConstSegStack
Definition: Sema.h:692
clang::IdentifierInfo::getName
StringRef getName() const
Return the actual identifier string.
Definition: IdentifierTable.h:195
clang::LangOptions::PragmaMSPointersToMembersKind
PragmaMSPointersToMembersKind
Definition: LangOptions.h:120
clang::LangOptions::FEM_Double
@ FEM_Double
Use the type double for fp arithmetic.
Definition: LangOptions.h:283
clang
Definition: CalledOnceCheck.h:17
clang::ParsedAttr::hasCustomParsing
bool hasCustomParsing() const
Definition: ParsedAttr.cpp:162
clang::Sema::inferGslPointerAttribute
void inferGslPointerAttribute(NamedDecl *ND, CXXRecordDecl *UnderlyingRecord)
Add gsl::Pointer attribute to std::container::iterator.
Definition: SemaAttr.cpp:108
clang::Sema::PragmaClangSection::Valid
bool Valid
Definition: Sema.h:467
clang::Sema::AlignPackInfo::Mac68k
@ Mac68k
Definition: Sema.h:492
clang::Sema::POAK_Packed
@ POAK_Packed
Definition: Sema.h:10130
PushPragmaVisibility
static void PushPragmaVisibility(Sema &S, unsigned type, SourceLocation loc)
Definition: SemaAttr.cpp:1181
clang::Sema::PSK_Pop
@ PSK_Pop
Definition: Sema.h:481
clang::Sema::checkCommonAttributeFeatures
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 ...
Definition: SemaAttr.cpp:1388
clang::Sema::AlignPackInfo::getPackNumber
unsigned getPackNumber() const
Definition: Sema.h:545
clang::Stmt
Stmt - This represents one statement.
Definition: Stmt.h:69
clang::Sema::PragmaAlignPackDiagnoseKind::NonDefaultStateAtInclude
@ NonDefaultStateAtInclude
NoVisibility
@ NoVisibility
Definition: SemaAttr.cpp:1154
clang::Sema::PragmaClangSection::PragmaLocation
SourceLocation PragmaLocation
Definition: Sema.h:468
clang::Sema::AddOptnoneAttributeIfNoConflicts
void AddOptnoneAttributeIfNoConflicts(FunctionDecl *FD, SourceLocation Loc)
Adds the 'optnone' attribute to the function declaration if there are no conflicts; Loc represents th...
Definition: SemaAttr.cpp:1132
clang::Preprocessor::getLastFPEvalMethod
LangOptions::FPEvalMethodKind getLastFPEvalMethod() const
Definition: Preprocessor.h:2106
clang::Sema::PragmaClangSectionKind
PragmaClangSectionKind
pragma clang section kind
Definition: Sema.h:451
clang::ParsedAttr::diagnoseLangOpts
bool diagnoseLangOpts(class Sema &S) const
Definition: ParsedAttr.cpp:190
clang::FPOptionsOverride::setDisallowFPContract
void setDisallowFPContract()
Definition: LangOptions.h:747
clang::Sema::FunctionToSectionMap
llvm::StringMap< std::tuple< StringRef, SourceLocation > > FunctionToSectionMap
Sections used with #pragma alloc_text.
Definition: Sema.h:728
clang::ParsedAttr::getMatchRules
void getMatchRules(const LangOptions &LangOpts, SmallVectorImpl< std::pair< attr::SubjectMatchRule, bool >> &MatchRules) const
Definition: ParsedAttr.cpp:183
clang::Sema::AddCFAuditedAttribute
void AddCFAuditedAttribute(Decl *D)
AddCFAuditedAttribute - Check whether we're currently within '#pragma clang arc_cf_code_audited' and,...
Definition: SemaAttr.cpp:804
clang::SourceLocation::isValid
bool isValid() const
Return true if this is a valid SourceLocation object.
Definition: SourceLocation.h:110
clang::LangOptions::FPE_Ignore
@ FPE_Ignore
Assume that floating-point exceptions are masked.
Definition: LangOptions.h:268
clang::Attr
Attr - This represents one attribute.
Definition: Attr.h:41
clang::FixItHint::CreateRemoval
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
Definition: Diagnostic.h:123
clang::LangOptions::FPE_Strict
@ FPE_Strict
Strictly preserve the floating-point exception semantics.
Definition: LangOptions.h:272
unsigned
clang::Sema::OptimizeOffPragmaLocation
SourceLocation OptimizeOffPragmaLocation
This represents the last location of a "#pragma clang optimize off" directive if such a directive has...
Definition: Sema.h:759
clang::AttributeCommonInfo::AS_Pragma
@ AS_Pragma
#pragma ...
Definition: AttributeCommonInfo.h:45
clang::TypedefNameDecl
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:3200
clang::PragmaMSStructKind
PragmaMSStructKind
Definition: PragmaKinds.h:23
clang::Sema::AlignPackStack
PragmaStack< AlignPackInfo > AlignPackStack
Definition: Sema.h:681
clang::LookupResult::getAsSingle
DeclClass * getAsSingle() const
Definition: Lookup.h:507
clang::Sema::AlignPackInfo::getAlignMode
Mode getAlignMode() const
Definition: Sema.h:543
clang::Sema::POAK_Mac68k
@ POAK_Mac68k
Definition: Sema.h:10132
clang::QualType::getTypePtr
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Definition: Type.h:6500
clang::Sema::PragmaAlignPackDiagnoseKind
PragmaAlignPackDiagnoseKind
Definition: Sema.h:10149
clang::Sema::ActOnPragmaMSPointersToMembers
void ActOnPragmaMSPointersToMembers(LangOptions::PragmaMSPointersToMembersKind Kind, SourceLocation PragmaLoc)
ActOnPragmaMSPointersToMembers - called on well formed #pragma pointers_to_members(representation met...
Definition: SemaAttr.cpp:571
Parent
NodeId Parent
Definition: ASTDiff.cpp:192
clang::NamedDecl::VisibilityForValue
@ VisibilityForValue
Do an LV computation for, ultimately, a non-type declaration.
Definition: Decl.h:433
clang::DeclContext::isExternCContext
bool isExternCContext() const
Determines whether this context or some of its ancestors is a linkage specification context that spec...
Definition: DeclBase.cpp:1203
clang::Sema::CheckAttrTarget
bool CheckAttrTarget(const ParsedAttr &CurrAttr)
Definition: SemaDeclAttr.cpp:2218
clang::LangOptions::FPM_Off
@ FPM_Off
Definition: LangOptions.h:249
clang::LangOptions::FEM_Extended
@ FEM_Extended
Use extended type for fp arithmetic.
Definition: LangOptions.h:285
clang::Sema::PragmaClangDataSection
PragmaClangSection PragmaClangDataSection
Definition: Sema.h:472
clang::PragmaMSCommentKind
PragmaMSCommentKind
Definition: PragmaKinds.h:14
clang::Sema::LookupOrdinaryName
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
Definition: Sema.h:4084
clang::Sema::AlignPackIncludeState
Definition: Sema.h:683
llvm::SmallVectorImpl
Definition: Randstruct.h:18
clang::Sema::AddRangeBasedOptnone
void AddRangeBasedOptnone(FunctionDecl *FD)
Only called on function definitions; if there is a pragma in scope with the effect of a range-based o...
Definition: SemaAttr.cpp:1109
clang::Lexer::findLocationAfterToken
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...
Definition: Lexer.cpp:1293
clang::Sema::PragmaAttributeCurrentTargetDecl
const Decl * PragmaAttributeCurrentTargetDecl
The declaration that is currently receiving an attribute from the #pragma attribute stack.
Definition: Sema.h:754
clang::ParsedAttributesView
Definition: ParsedAttr.h:898
clang::Expr
This represents one expression.
Definition: Expr.h:109
clang::Sema::AddAlignmentAttributesForRecord
void AddAlignmentAttributesForRecord(RecordDecl *RD)
AddAlignmentAttributesForRecord - Adds any needed alignment attributes to a the record decl,...
Definition: SemaAttr.cpp:50
clang::FPOptionsOverride::setAllowFPContractWithinStatement
void setAllowFPContractWithinStatement()
Definition: LangOptions.h:739
clang::PMSST_ON
@ PMSST_ON
Definition: PragmaKinds.h:25
clang::Sema::PragmaClangRodataSection
PragmaClangSection PragmaClangRodataSection
Definition: Sema.h:473
clang::Sema::PP
Preprocessor & PP
Definition: Sema.h:409
clang::Sema::AlignPackIncludeState::ShouldWarnOnInclude
bool ShouldWarnOnInclude
Definition: Sema.h:686
clang::Decl::getLocation
SourceLocation getLocation() const
Definition: DeclBase.h:425
clang::ASTContext::SectionInfo
Definition: ASTContext.h:3280
clang::Decl::addAttr
void addAttr(Attr *A)
Definition: DeclBase.cpp:886
clang::FunctionDecl
Represents a function declaration or definition.
Definition: Decl.h:1872
clang::RecordDecl
Represents a struct/union/class.
Definition: Decl.h:3901
clang::LangOptions::FPM_Fast
@ FPM_Fast
Definition: LangOptions.h:255
clang::Sema::VtorDispStack
PragmaStack< MSVtorDispMode > VtorDispStack
Whether to insert vtordisps prior to virtual bases in the Microsoft C++ ABI.
Definition: Sema.h:680
clang::Sema::PragmaAlignPackDiagnoseKind::ChangedStateAtExit
@ ChangedStateAtExit
clang::StringLiteral::getString
StringRef getString() const
Definition: Expr.h:1850
clang::Sema::POAK_Native
@ POAK_Native
Definition: Sema.h:10128
clang::Sema::PragmaStack::SentinelAction
void SentinelAction(PragmaMsStackAction Action, StringRef Label)
Definition: Sema.h:652
clang::ento::ObjKind::OS
@ OS
Indicates that the tracking object is a descendant of a referenced-counted OSObject,...
clang::Sema::MSFunctionNoBuiltins
llvm::SmallSetVector< StringRef, 4 > MSFunctionNoBuiltins
Set of no-builtin functions listed by #pragma function.
Definition: Sema.h:762
clang::DiagnosticsEngine::Report
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
Definition: Diagnostic.h:1536
clang::Sema::ActOnPragmaFPReassociate
void ActOnPragmaFPReassociate(SourceLocation Loc, bool IsEnabled)
Called on well formed #pragma clang fp reassociate.
Definition: SemaAttr.cpp:1225
clang::Sema::ActOnPragmaAttributeAttribute
void ActOnPragmaAttributeAttribute(ParsedAttr &Attribute, SourceLocation PragmaLoc, attr::ParsedSubjectMatchRuleSet Rules)
Definition: SemaAttr.cpp:875
clang::Decl::getDeclContext
DeclContext * getDeclContext()
Definition: DeclBase.h:434
clang::NamedDecl::getName
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Definition: Decl.h:274