clang  5.0.0
SemaStmtAsm.cpp
Go to the documentation of this file.
1 //===--- SemaStmtAsm.cpp - Semantic Analysis for Asm Statements -----------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements semantic analysis for inline asm statements.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "clang/AST/ExprCXX.h"
15 #include "clang/AST/RecordLayout.h"
16 #include "clang/AST/TypeLoc.h"
17 #include "clang/Basic/TargetInfo.h"
18 #include "clang/Lex/Preprocessor.h"
20 #include "clang/Sema/Lookup.h"
21 #include "clang/Sema/Scope.h"
22 #include "clang/Sema/ScopeInfo.h"
24 #include "llvm/ADT/ArrayRef.h"
25 #include "llvm/ADT/StringSet.h"
26 #include "llvm/MC/MCParser/MCAsmParser.h"
27 using namespace clang;
28 using namespace sema;
29 
30 /// CheckAsmLValue - GNU C has an extremely ugly extension whereby they silently
31 /// ignore "noop" casts in places where an lvalue is required by an inline asm.
32 /// We emulate this behavior when -fheinous-gnu-extensions is specified, but
33 /// provide a strong guidance to not use it.
34 ///
35 /// This method checks to see if the argument is an acceptable l-value and
36 /// returns false if it is a case we can handle.
37 static bool CheckAsmLValue(const Expr *E, Sema &S) {
38  // Type dependent expressions will be checked during instantiation.
39  if (E->isTypeDependent())
40  return false;
41 
42  if (E->isLValue())
43  return false; // Cool, this is an lvalue.
44 
45  // Okay, this is not an lvalue, but perhaps it is the result of a cast that we
46  // are supposed to allow.
47  const Expr *E2 = E->IgnoreParenNoopCasts(S.Context);
48  if (E != E2 && E2->isLValue()) {
49  if (!S.getLangOpts().HeinousExtensions)
50  S.Diag(E2->getLocStart(), diag::err_invalid_asm_cast_lvalue)
51  << E->getSourceRange();
52  else
53  S.Diag(E2->getLocStart(), diag::warn_invalid_asm_cast_lvalue)
54  << E->getSourceRange();
55  // Accept, even if we emitted an error diagnostic.
56  return false;
57  }
58 
59  // None of the above, just randomly invalid non-lvalue.
60  return true;
61 }
62 
63 /// isOperandMentioned - Return true if the specified operand # is mentioned
64 /// anywhere in the decomposed asm string.
65 static bool isOperandMentioned(unsigned OpNo,
67  for (unsigned p = 0, e = AsmStrPieces.size(); p != e; ++p) {
68  const GCCAsmStmt::AsmStringPiece &Piece = AsmStrPieces[p];
69  if (!Piece.isOperand()) continue;
70 
71  // If this is a reference to the input and if the input was the smaller
72  // one, then we have to reject this asm.
73  if (Piece.getOperandNo() == OpNo)
74  return true;
75  }
76  return false;
77 }
78 
79 static bool CheckNakedParmReference(Expr *E, Sema &S) {
80  FunctionDecl *Func = dyn_cast<FunctionDecl>(S.CurContext);
81  if (!Func)
82  return false;
83  if (!Func->hasAttr<NakedAttr>())
84  return false;
85 
86  SmallVector<Expr*, 4> WorkList;
87  WorkList.push_back(E);
88  while (WorkList.size()) {
89  Expr *E = WorkList.pop_back_val();
90  if (isa<CXXThisExpr>(E)) {
91  S.Diag(E->getLocStart(), diag::err_asm_naked_this_ref);
92  S.Diag(Func->getAttr<NakedAttr>()->getLocation(), diag::note_attribute);
93  return true;
94  }
95  if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E)) {
96  if (isa<ParmVarDecl>(DRE->getDecl())) {
97  S.Diag(DRE->getLocStart(), diag::err_asm_naked_parm_ref);
98  S.Diag(Func->getAttr<NakedAttr>()->getLocation(), diag::note_attribute);
99  return true;
100  }
101  }
102  for (Stmt *Child : E->children()) {
103  if (Expr *E = dyn_cast_or_null<Expr>(Child))
104  WorkList.push_back(E);
105  }
106  }
107  return false;
108 }
109 
110 /// \brief Returns true if given expression is not compatible with inline
111 /// assembly's memory constraint; false otherwise.
114  bool is_input_expr) {
115  enum {
116  ExprBitfield = 0,
117  ExprVectorElt,
118  ExprGlobalRegVar,
119  ExprSafeType
120  } EType = ExprSafeType;
121 
122  // Bitfields, vector elements and global register variables are not
123  // compatible.
124  if (E->refersToBitField())
125  EType = ExprBitfield;
126  else if (E->refersToVectorElement())
127  EType = ExprVectorElt;
128  else if (E->refersToGlobalRegisterVar())
129  EType = ExprGlobalRegVar;
130 
131  if (EType != ExprSafeType) {
132  S.Diag(E->getLocStart(), diag::err_asm_non_addr_value_in_memory_constraint)
133  << EType << is_input_expr << Info.getConstraintStr()
134  << E->getSourceRange();
135  return true;
136  }
137 
138  return false;
139 }
140 
141 // Extracting the register name from the Expression value,
142 // if there is no register name to extract, returns ""
143 static StringRef extractRegisterName(const Expr *Expression,
144  const TargetInfo &Target) {
145  Expression = Expression->IgnoreImpCasts();
146  if (const DeclRefExpr *AsmDeclRef = dyn_cast<DeclRefExpr>(Expression)) {
147  // Handle cases where the expression is a variable
148  const VarDecl *Variable = dyn_cast<VarDecl>(AsmDeclRef->getDecl());
149  if (Variable && Variable->getStorageClass() == SC_Register) {
150  if (AsmLabelAttr *Attr = Variable->getAttr<AsmLabelAttr>())
151  if (Target.isValidGCCRegisterName(Attr->getLabel()))
152  return Target.getNormalizedGCCRegisterName(Attr->getLabel(), true);
153  }
154  }
155  return "";
156 }
157 
158 // Checks if there is a conflict between the input and output lists with the
159 // clobbers list. If there's a conflict, returns the location of the
160 // conflicted clobber, else returns nullptr
161 static SourceLocation
163  StringLiteral **Clobbers, int NumClobbers,
164  const TargetInfo &Target, ASTContext &Cont) {
165  llvm::StringSet<> InOutVars;
166  // Collect all the input and output registers from the extended asm
167  // statement in order to check for conflicts with the clobber list
168  for (unsigned int i = 0; i < Exprs.size(); ++i) {
169  StringRef Constraint = Constraints[i]->getString();
170  StringRef InOutReg = Target.getConstraintRegister(
171  Constraint, extractRegisterName(Exprs[i], Target));
172  if (InOutReg != "")
173  InOutVars.insert(InOutReg);
174  }
175  // Check for each item in the clobber list if it conflicts with the input
176  // or output
177  for (int i = 0; i < NumClobbers; ++i) {
178  StringRef Clobber = Clobbers[i]->getString();
179  // We only check registers, therefore we don't check cc and memory
180  // clobbers
181  if (Clobber == "cc" || Clobber == "memory")
182  continue;
183  Clobber = Target.getNormalizedGCCRegisterName(Clobber, true);
184  // Go over the output's registers we collected
185  if (InOutVars.count(Clobber))
186  return Clobbers[i]->getLocStart();
187  }
188  return SourceLocation();
189 }
190 
192  bool IsVolatile, unsigned NumOutputs,
193  unsigned NumInputs, IdentifierInfo **Names,
194  MultiExprArg constraints, MultiExprArg Exprs,
195  Expr *asmString, MultiExprArg clobbers,
196  SourceLocation RParenLoc) {
197  unsigned NumClobbers = clobbers.size();
198  StringLiteral **Constraints =
199  reinterpret_cast<StringLiteral**>(constraints.data());
200  StringLiteral *AsmString = cast<StringLiteral>(asmString);
201  StringLiteral **Clobbers = reinterpret_cast<StringLiteral**>(clobbers.data());
202 
203  SmallVector<TargetInfo::ConstraintInfo, 4> OutputConstraintInfos;
204 
205  // The parser verifies that there is a string literal here.
206  assert(AsmString->isAscii());
207 
208  // If we're compiling CUDA file and function attributes indicate that it's not
209  // for this compilation side, skip all the checks.
210  if (!DeclAttrsMatchCUDAMode(getLangOpts(), getCurFunctionDecl())) {
211  GCCAsmStmt *NS = new (Context) GCCAsmStmt(
212  Context, AsmLoc, IsSimple, IsVolatile, NumOutputs, NumInputs, Names,
213  Constraints, Exprs.data(), AsmString, NumClobbers, Clobbers, RParenLoc);
214  return NS;
215  }
216 
217  for (unsigned i = 0; i != NumOutputs; i++) {
218  StringLiteral *Literal = Constraints[i];
219  assert(Literal->isAscii());
220 
221  StringRef OutputName;
222  if (Names[i])
223  OutputName = Names[i]->getName();
224 
225  TargetInfo::ConstraintInfo Info(Literal->getString(), OutputName);
227  return StmtError(Diag(Literal->getLocStart(),
228  diag::err_asm_invalid_output_constraint)
229  << Info.getConstraintStr());
230 
231  ExprResult ER = CheckPlaceholderExpr(Exprs[i]);
232  if (ER.isInvalid())
233  return StmtError();
234  Exprs[i] = ER.get();
235 
236  // Check that the output exprs are valid lvalues.
237  Expr *OutputExpr = Exprs[i];
238 
239  // Referring to parameters is not allowed in naked functions.
240  if (CheckNakedParmReference(OutputExpr, *this))
241  return StmtError();
242 
243  // Check that the output expression is compatible with memory constraint.
244  if (Info.allowsMemory() &&
245  checkExprMemoryConstraintCompat(*this, OutputExpr, Info, false))
246  return StmtError();
247 
248  OutputConstraintInfos.push_back(Info);
249 
250  // If this is dependent, just continue.
251  if (OutputExpr->isTypeDependent())
252  continue;
253 
255  OutputExpr->isModifiableLvalue(Context, /*Loc=*/nullptr);
256  switch (IsLV) {
257  case Expr::MLV_Valid:
258  // Cool, this is an lvalue.
259  break;
260  case Expr::MLV_ArrayType:
261  // This is OK too.
262  break;
263  case Expr::MLV_LValueCast: {
264  const Expr *LVal = OutputExpr->IgnoreParenNoopCasts(Context);
265  if (!getLangOpts().HeinousExtensions) {
266  Diag(LVal->getLocStart(), diag::err_invalid_asm_cast_lvalue)
267  << OutputExpr->getSourceRange();
268  } else {
269  Diag(LVal->getLocStart(), diag::warn_invalid_asm_cast_lvalue)
270  << OutputExpr->getSourceRange();
271  }
272  // Accept, even if we emitted an error diagnostic.
273  break;
274  }
277  if (RequireCompleteType(OutputExpr->getLocStart(), Exprs[i]->getType(),
278  diag::err_dereference_incomplete_type))
279  return StmtError();
280  LLVM_FALLTHROUGH;
281  default:
282  return StmtError(Diag(OutputExpr->getLocStart(),
283  diag::err_asm_invalid_lvalue_in_output)
284  << OutputExpr->getSourceRange());
285  }
286 
287  unsigned Size = Context.getTypeSize(OutputExpr->getType());
289  Size))
290  return StmtError(Diag(OutputExpr->getLocStart(),
291  diag::err_asm_invalid_output_size)
292  << Info.getConstraintStr());
293  }
294 
295  SmallVector<TargetInfo::ConstraintInfo, 4> InputConstraintInfos;
296 
297  for (unsigned i = NumOutputs, e = NumOutputs + NumInputs; i != e; i++) {
298  StringLiteral *Literal = Constraints[i];
299  assert(Literal->isAscii());
300 
301  StringRef InputName;
302  if (Names[i])
303  InputName = Names[i]->getName();
304 
305  TargetInfo::ConstraintInfo Info(Literal->getString(), InputName);
306  if (!Context.getTargetInfo().validateInputConstraint(OutputConstraintInfos,
307  Info)) {
308  return StmtError(Diag(Literal->getLocStart(),
309  diag::err_asm_invalid_input_constraint)
310  << Info.getConstraintStr());
311  }
312 
313  ExprResult ER = CheckPlaceholderExpr(Exprs[i]);
314  if (ER.isInvalid())
315  return StmtError();
316  Exprs[i] = ER.get();
317 
318  Expr *InputExpr = Exprs[i];
319 
320  // Referring to parameters is not allowed in naked functions.
321  if (CheckNakedParmReference(InputExpr, *this))
322  return StmtError();
323 
324  // Check that the input expression is compatible with memory constraint.
325  if (Info.allowsMemory() &&
326  checkExprMemoryConstraintCompat(*this, InputExpr, Info, true))
327  return StmtError();
328 
329  // Only allow void types for memory constraints.
330  if (Info.allowsMemory() && !Info.allowsRegister()) {
331  if (CheckAsmLValue(InputExpr, *this))
332  return StmtError(Diag(InputExpr->getLocStart(),
333  diag::err_asm_invalid_lvalue_in_input)
334  << Info.getConstraintStr()
335  << InputExpr->getSourceRange());
336  } else if (Info.requiresImmediateConstant() && !Info.allowsRegister()) {
337  if (!InputExpr->isValueDependent()) {
338  llvm::APSInt Result;
339  if (!InputExpr->EvaluateAsInt(Result, Context))
340  return StmtError(
341  Diag(InputExpr->getLocStart(), diag::err_asm_immediate_expected)
342  << Info.getConstraintStr() << InputExpr->getSourceRange());
343  if (!Info.isValidAsmImmediate(Result))
344  return StmtError(Diag(InputExpr->getLocStart(),
345  diag::err_invalid_asm_value_for_constraint)
346  << Result.toString(10) << Info.getConstraintStr()
347  << InputExpr->getSourceRange());
348  }
349 
350  } else {
351  ExprResult Result = DefaultFunctionArrayLvalueConversion(Exprs[i]);
352  if (Result.isInvalid())
353  return StmtError();
354 
355  Exprs[i] = Result.get();
356  }
357 
358  if (Info.allowsRegister()) {
359  if (InputExpr->getType()->isVoidType()) {
360  return StmtError(Diag(InputExpr->getLocStart(),
361  diag::err_asm_invalid_type_in_input)
362  << InputExpr->getType() << Info.getConstraintStr()
363  << InputExpr->getSourceRange());
364  }
365  }
366 
367  InputConstraintInfos.push_back(Info);
368 
369  const Type *Ty = Exprs[i]->getType().getTypePtr();
370  if (Ty->isDependentType())
371  continue;
372 
373  if (!Ty->isVoidType() || !Info.allowsMemory())
374  if (RequireCompleteType(InputExpr->getLocStart(), Exprs[i]->getType(),
375  diag::err_dereference_incomplete_type))
376  return StmtError();
377 
378  unsigned Size = Context.getTypeSize(Ty);
380  Size))
381  return StmtError(Diag(InputExpr->getLocStart(),
382  diag::err_asm_invalid_input_size)
383  << Info.getConstraintStr());
384  }
385 
386  // Check that the clobbers are valid.
387  for (unsigned i = 0; i != NumClobbers; i++) {
388  StringLiteral *Literal = Clobbers[i];
389  assert(Literal->isAscii());
390 
391  StringRef Clobber = Literal->getString();
392 
393  if (!Context.getTargetInfo().isValidClobber(Clobber))
394  return StmtError(Diag(Literal->getLocStart(),
395  diag::err_asm_unknown_register_name) << Clobber);
396  }
397 
398  GCCAsmStmt *NS =
399  new (Context) GCCAsmStmt(Context, AsmLoc, IsSimple, IsVolatile, NumOutputs,
400  NumInputs, Names, Constraints, Exprs.data(),
401  AsmString, NumClobbers, Clobbers, RParenLoc);
402  // Validate the asm string, ensuring it makes sense given the operands we
403  // have.
405  unsigned DiagOffs;
406  if (unsigned DiagID = NS->AnalyzeAsmString(Pieces, Context, DiagOffs)) {
407  Diag(getLocationOfStringLiteralByte(AsmString, DiagOffs), DiagID)
408  << AsmString->getSourceRange();
409  return StmtError();
410  }
411 
412  // Validate constraints and modifiers.
413  for (unsigned i = 0, e = Pieces.size(); i != e; ++i) {
414  GCCAsmStmt::AsmStringPiece &Piece = Pieces[i];
415  if (!Piece.isOperand()) continue;
416 
417  // Look for the correct constraint index.
418  unsigned ConstraintIdx = Piece.getOperandNo();
419  unsigned NumOperands = NS->getNumOutputs() + NS->getNumInputs();
420 
421  // Look for the (ConstraintIdx - NumOperands + 1)th constraint with
422  // modifier '+'.
423  if (ConstraintIdx >= NumOperands) {
424  unsigned I = 0, E = NS->getNumOutputs();
425 
426  for (unsigned Cnt = ConstraintIdx - NumOperands; I != E; ++I)
427  if (OutputConstraintInfos[I].isReadWrite() && Cnt-- == 0) {
428  ConstraintIdx = I;
429  break;
430  }
431 
432  assert(I != E && "Invalid operand number should have been caught in "
433  " AnalyzeAsmString");
434  }
435 
436  // Now that we have the right indexes go ahead and check.
437  StringLiteral *Literal = Constraints[ConstraintIdx];
438  const Type *Ty = Exprs[ConstraintIdx]->getType().getTypePtr();
439  if (Ty->isDependentType() || Ty->isIncompleteType())
440  continue;
441 
442  unsigned Size = Context.getTypeSize(Ty);
443  std::string SuggestedModifier;
445  Literal->getString(), Piece.getModifier(), Size,
446  SuggestedModifier)) {
447  Diag(Exprs[ConstraintIdx]->getLocStart(),
448  diag::warn_asm_mismatched_size_modifier);
449 
450  if (!SuggestedModifier.empty()) {
451  auto B = Diag(Piece.getRange().getBegin(),
452  diag::note_asm_missing_constraint_modifier)
453  << SuggestedModifier;
454  SuggestedModifier = "%" + SuggestedModifier + Piece.getString();
455  B.AddFixItHint(FixItHint::CreateReplacement(Piece.getRange(),
456  SuggestedModifier));
457  }
458  }
459  }
460 
461  // Validate tied input operands for type mismatches.
462  unsigned NumAlternatives = ~0U;
463  for (unsigned i = 0, e = OutputConstraintInfos.size(); i != e; ++i) {
464  TargetInfo::ConstraintInfo &Info = OutputConstraintInfos[i];
465  StringRef ConstraintStr = Info.getConstraintStr();
466  unsigned AltCount = ConstraintStr.count(',') + 1;
467  if (NumAlternatives == ~0U)
468  NumAlternatives = AltCount;
469  else if (NumAlternatives != AltCount)
470  return StmtError(Diag(NS->getOutputExpr(i)->getLocStart(),
471  diag::err_asm_unexpected_constraint_alternatives)
472  << NumAlternatives << AltCount);
473  }
474  SmallVector<size_t, 4> InputMatchedToOutput(OutputConstraintInfos.size(),
475  ~0U);
476  for (unsigned i = 0, e = InputConstraintInfos.size(); i != e; ++i) {
477  TargetInfo::ConstraintInfo &Info = InputConstraintInfos[i];
478  StringRef ConstraintStr = Info.getConstraintStr();
479  unsigned AltCount = ConstraintStr.count(',') + 1;
480  if (NumAlternatives == ~0U)
481  NumAlternatives = AltCount;
482  else if (NumAlternatives != AltCount)
483  return StmtError(Diag(NS->getInputExpr(i)->getLocStart(),
484  diag::err_asm_unexpected_constraint_alternatives)
485  << NumAlternatives << AltCount);
486 
487  // If this is a tied constraint, verify that the output and input have
488  // either exactly the same type, or that they are int/ptr operands with the
489  // same size (int/long, int*/long, are ok etc).
490  if (!Info.hasTiedOperand()) continue;
491 
492  unsigned TiedTo = Info.getTiedOperand();
493  unsigned InputOpNo = i+NumOutputs;
494  Expr *OutputExpr = Exprs[TiedTo];
495  Expr *InputExpr = Exprs[InputOpNo];
496 
497  // Make sure no more than one input constraint matches each output.
498  assert(TiedTo < InputMatchedToOutput.size() && "TiedTo value out of range");
499  if (InputMatchedToOutput[TiedTo] != ~0U) {
500  Diag(NS->getInputExpr(i)->getLocStart(),
501  diag::err_asm_input_duplicate_match)
502  << TiedTo;
503  Diag(NS->getInputExpr(InputMatchedToOutput[TiedTo])->getLocStart(),
504  diag::note_asm_input_duplicate_first)
505  << TiedTo;
506  return StmtError();
507  }
508  InputMatchedToOutput[TiedTo] = i;
509 
510  if (OutputExpr->isTypeDependent() || InputExpr->isTypeDependent())
511  continue;
512 
513  QualType InTy = InputExpr->getType();
514  QualType OutTy = OutputExpr->getType();
515  if (Context.hasSameType(InTy, OutTy))
516  continue; // All types can be tied to themselves.
517 
518  // Decide if the input and output are in the same domain (integer/ptr or
519  // floating point.
520  enum AsmDomain {
521  AD_Int, AD_FP, AD_Other
522  } InputDomain, OutputDomain;
523 
524  if (InTy->isIntegerType() || InTy->isPointerType())
525  InputDomain = AD_Int;
526  else if (InTy->isRealFloatingType())
527  InputDomain = AD_FP;
528  else
529  InputDomain = AD_Other;
530 
531  if (OutTy->isIntegerType() || OutTy->isPointerType())
532  OutputDomain = AD_Int;
533  else if (OutTy->isRealFloatingType())
534  OutputDomain = AD_FP;
535  else
536  OutputDomain = AD_Other;
537 
538  // They are ok if they are the same size and in the same domain. This
539  // allows tying things like:
540  // void* to int*
541  // void* to int if they are the same size.
542  // double to long double if they are the same size.
543  //
544  uint64_t OutSize = Context.getTypeSize(OutTy);
545  uint64_t InSize = Context.getTypeSize(InTy);
546  if (OutSize == InSize && InputDomain == OutputDomain &&
547  InputDomain != AD_Other)
548  continue;
549 
550  // If the smaller input/output operand is not mentioned in the asm string,
551  // then we can promote the smaller one to a larger input and the asm string
552  // won't notice.
553  bool SmallerValueMentioned = false;
554 
555  // If this is a reference to the input and if the input was the smaller
556  // one, then we have to reject this asm.
557  if (isOperandMentioned(InputOpNo, Pieces)) {
558  // This is a use in the asm string of the smaller operand. Since we
559  // codegen this by promoting to a wider value, the asm will get printed
560  // "wrong".
561  SmallerValueMentioned |= InSize < OutSize;
562  }
563  if (isOperandMentioned(TiedTo, Pieces)) {
564  // If this is a reference to the output, and if the output is the larger
565  // value, then it's ok because we'll promote the input to the larger type.
566  SmallerValueMentioned |= OutSize < InSize;
567  }
568 
569  // If the smaller value wasn't mentioned in the asm string, and if the
570  // output was a register, just extend the shorter one to the size of the
571  // larger one.
572  if (!SmallerValueMentioned && InputDomain != AD_Other &&
573  OutputConstraintInfos[TiedTo].allowsRegister())
574  continue;
575 
576  // Either both of the operands were mentioned or the smaller one was
577  // mentioned. One more special case that we'll allow: if the tied input is
578  // integer, unmentioned, and is a constant, then we'll allow truncating it
579  // down to the size of the destination.
580  if (InputDomain == AD_Int && OutputDomain == AD_Int &&
581  !isOperandMentioned(InputOpNo, Pieces) &&
582  InputExpr->isEvaluatable(Context)) {
583  CastKind castKind =
584  (OutTy->isBooleanType() ? CK_IntegralToBoolean : CK_IntegralCast);
585  InputExpr = ImpCastExprToType(InputExpr, OutTy, castKind).get();
586  Exprs[InputOpNo] = InputExpr;
587  NS->setInputExpr(i, InputExpr);
588  continue;
589  }
590 
591  Diag(InputExpr->getLocStart(),
592  diag::err_asm_tying_incompatible_types)
593  << InTy << OutTy << OutputExpr->getSourceRange()
594  << InputExpr->getSourceRange();
595  return StmtError();
596  }
597 
598  // Check for conflicts between clobber list and input or output lists
599  SourceLocation ConstraintLoc =
600  getClobberConflictLocation(Exprs, Constraints, Clobbers, NumClobbers,
602  if (ConstraintLoc.isValid())
603  return Diag(ConstraintLoc, diag::error_inoutput_conflict_with_clobber);
604 
605  return NS;
606 }
607 
609  llvm::InlineAsmIdentifierInfo &Info) {
610  // Compute the type size (and array length if applicable?).
611  Info.Type = Info.Size = Context.getTypeSizeInChars(T).getQuantity();
612  if (T->isArrayType()) {
613  const ArrayType *ATy = Context.getAsArrayType(T);
614  Info.Type = Context.getTypeSizeInChars(ATy->getElementType()).getQuantity();
615  Info.Length = Info.Size / Info.Type;
616  }
617 }
618 
620  SourceLocation TemplateKWLoc,
621  UnqualifiedId &Id,
622  llvm::InlineAsmIdentifierInfo &Info,
623  bool IsUnevaluatedContext) {
624  Info.clear();
625 
626  if (IsUnevaluatedContext)
627  PushExpressionEvaluationContext(
628  ExpressionEvaluationContext::UnevaluatedAbstract,
629  ReuseLambdaContextDecl);
630 
631  ExprResult Result = ActOnIdExpression(getCurScope(), SS, TemplateKWLoc, Id,
632  /*trailing lparen*/ false,
633  /*is & operand*/ false,
634  /*CorrectionCandidateCallback=*/nullptr,
635  /*IsInlineAsmIdentifier=*/ true);
636 
637  if (IsUnevaluatedContext)
638  PopExpressionEvaluationContext();
639 
640  if (!Result.isUsable()) return Result;
641 
642  Result = CheckPlaceholderExpr(Result.get());
643  if (!Result.isUsable()) return Result;
644 
645  // Referring to parameters is not allowed in naked functions.
646  if (CheckNakedParmReference(Result.get(), *this))
647  return ExprError();
648 
649  QualType T = Result.get()->getType();
650 
651  if (T->isDependentType()) {
652  return Result;
653  }
654 
655  // Any sort of function type is fine.
656  if (T->isFunctionType()) {
657  return Result;
658  }
659 
660  // Otherwise, it needs to be a complete type.
661  if (RequireCompleteExprType(Result.get(), diag::err_asm_incomplete_type)) {
662  return ExprError();
663  }
664 
665  fillInlineAsmTypeInfo(Context, T, Info);
666 
667  // We can work with the expression as long as it's not an r-value.
668  if (!Result.get()->isRValue())
669  Info.IsVarDecl = true;
670 
671  return Result;
672 }
673 
674 bool Sema::LookupInlineAsmField(StringRef Base, StringRef Member,
675  unsigned &Offset, SourceLocation AsmLoc) {
676  Offset = 0;
678  Member.split(Members, ".");
679 
681  LookupOrdinaryName);
682 
683  if (!LookupName(BaseResult, getCurScope()))
684  return true;
685 
686  if(!BaseResult.isSingleResult())
687  return true;
688  NamedDecl *FoundDecl = BaseResult.getFoundDecl();
689  for (StringRef NextMember : Members) {
690  const RecordType *RT = nullptr;
691  if (VarDecl *VD = dyn_cast<VarDecl>(FoundDecl))
692  RT = VD->getType()->getAs<RecordType>();
693  else if (TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(FoundDecl)) {
694  MarkAnyDeclReferenced(TD->getLocation(), TD, /*OdrUse=*/false);
695  RT = TD->getUnderlyingType()->getAs<RecordType>();
696  } else if (TypeDecl *TD = dyn_cast<TypeDecl>(FoundDecl))
697  RT = TD->getTypeForDecl()->getAs<RecordType>();
698  else if (FieldDecl *TD = dyn_cast<FieldDecl>(FoundDecl))
699  RT = TD->getType()->getAs<RecordType>();
700  if (!RT)
701  return true;
702 
703  if (RequireCompleteType(AsmLoc, QualType(RT, 0),
704  diag::err_asm_incomplete_type))
705  return true;
706 
707  LookupResult FieldResult(*this, &Context.Idents.get(NextMember),
708  SourceLocation(), LookupMemberName);
709 
710  if (!LookupQualifiedName(FieldResult, RT->getDecl()))
711  return true;
712 
713  if (!FieldResult.isSingleResult())
714  return true;
715  FoundDecl = FieldResult.getFoundDecl();
716 
717  // FIXME: Handle IndirectFieldDecl?
718  FieldDecl *FD = dyn_cast<FieldDecl>(FoundDecl);
719  if (!FD)
720  return true;
721 
723  unsigned i = FD->getFieldIndex();
725  Offset += (unsigned)Result.getQuantity();
726  }
727 
728  return false;
729 }
730 
733  llvm::InlineAsmIdentifierInfo &Info,
734  SourceLocation AsmLoc) {
735  Info.clear();
736 
737  QualType T = E->getType();
738  if (T->isDependentType()) {
739  DeclarationNameInfo NameInfo;
740  NameInfo.setLoc(AsmLoc);
741  NameInfo.setName(&Context.Idents.get(Member));
743  Context, E, T, /*IsArrow=*/false, AsmLoc, NestedNameSpecifierLoc(),
744  SourceLocation(),
745  /*FirstQualifierInScope=*/nullptr, NameInfo, /*TemplateArgs=*/nullptr);
746  }
747 
748  const RecordType *RT = T->getAs<RecordType>();
749  // FIXME: Diagnose this as field access into a scalar type.
750  if (!RT)
751  return ExprResult();
752 
753  LookupResult FieldResult(*this, &Context.Idents.get(Member), AsmLoc,
754  LookupMemberName);
755 
756  if (!LookupQualifiedName(FieldResult, RT->getDecl()))
757  return ExprResult();
758 
759  // Only normal and indirect field results will work.
760  ValueDecl *FD = dyn_cast<FieldDecl>(FieldResult.getFoundDecl());
761  if (!FD)
762  FD = dyn_cast<IndirectFieldDecl>(FieldResult.getFoundDecl());
763  if (!FD)
764  return ExprResult();
765 
766  // Make an Expr to thread through OpDecl.
767  ExprResult Result = BuildMemberReferenceExpr(
768  E, E->getType(), AsmLoc, /*IsArrow=*/false, CXXScopeSpec(),
769  SourceLocation(), nullptr, FieldResult, nullptr, nullptr);
770  if (Result.isInvalid())
771  return Result;
772  Info.OpDecl = Result.get();
773 
774  fillInlineAsmTypeInfo(Context, Result.get()->getType(), Info);
775 
776  // Fields are "variables" as far as inline assembly is concerned.
777  Info.IsVarDecl = true;
778 
779  return Result;
780 }
781 
783  ArrayRef<Token> AsmToks,
784  StringRef AsmString,
785  unsigned NumOutputs, unsigned NumInputs,
786  ArrayRef<StringRef> Constraints,
787  ArrayRef<StringRef> Clobbers,
788  ArrayRef<Expr*> Exprs,
789  SourceLocation EndLoc) {
790  bool IsSimple = (NumOutputs != 0 || NumInputs != 0);
791  getCurFunction()->setHasBranchProtectedScope();
792  MSAsmStmt *NS =
793  new (Context) MSAsmStmt(Context, AsmLoc, LBraceLoc, IsSimple,
794  /*IsVolatile*/ true, AsmToks, NumOutputs, NumInputs,
795  Constraints, Exprs, AsmString,
796  Clobbers, EndLoc);
797  return NS;
798 }
799 
800 LabelDecl *Sema::GetOrCreateMSAsmLabel(StringRef ExternalLabelName,
801  SourceLocation Location,
802  bool AlwaysCreate) {
803  LabelDecl* Label = LookupOrCreateLabel(PP.getIdentifierInfo(ExternalLabelName),
804  Location);
805 
806  if (Label->isMSAsmLabel()) {
807  // If we have previously created this label implicitly, mark it as used.
808  Label->markUsed(Context);
809  } else {
810  // Otherwise, insert it, but only resolve it if we have seen the label itself.
811  std::string InternalName;
812  llvm::raw_string_ostream OS(InternalName);
813  // Create an internal name for the label. The name should not be a valid
814  // mangled name, and should be unique. We use a dot to make the name an
815  // invalid mangled name. We use LLVM's inline asm ${:uid} escape so that a
816  // unique label is generated each time this blob is emitted, even after
817  // inlining or LTO.
818  OS << "__MSASMLABEL_.${:uid}__";
819  for (char C : ExternalLabelName) {
820  OS << C;
821  // We escape '$' in asm strings by replacing it with "$$"
822  if (C == '$')
823  OS << '$';
824  }
825  Label->setMSAsmLabel(OS.str());
826  }
827  if (AlwaysCreate) {
828  // The label might have been created implicitly from a previously encountered
829  // goto statement. So, for both newly created and looked up labels, we mark
830  // them as resolved.
831  Label->setMSAsmLabelResolved();
832  }
833  // Adjust their location for being able to generate accurate diagnostics.
834  Label->setLocation(Location);
835 
836  return Label;
837 }
This represents a GCC inline-assembly statement extension.
Definition: Stmt.h:1591
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
Definition: Decl.h:1618
unsigned getNumOutputs() const
Definition: Stmt.h:1488
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
A (possibly-)qualified type.
Definition: Type.h:616
bool isInvalid() const
Definition: Ownership.h:159
SourceLocation getBegin() const
static CXXDependentScopeMemberExpr * Create(const ASTContext &C, Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierFoundInScope, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs)
Definition: ExprCXX.cpp:1128
const LangOptions & getLangOpts() const
Definition: Sema.h:1166
Stmt - This represents one statement.
Definition: Stmt.h:60
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, SourceLocation RParenLoc)
ActionResult< Expr * > ExprResult
Definition: Ownership.h:252
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
Definition: CharUnits.h:179
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
Definition: Sema.h:1243
PtrTy get() const
Definition: Ownership.h:163
The base class of the type hierarchy.
Definition: Type.h:1303
bool validateOutputConstraint(ConstraintInfo &Info) const
Definition: TargetInfo.cpp:457
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition: Type.h:2497
bool validateInputConstraint(MutableArrayRef< ConstraintInfo > OutputConstraints, ConstraintInfo &info) const
Definition: TargetInfo.cpp:554
bool isBooleanType() const
Definition: Type.h:5969
SourceLocation getLocStart() const LLVM_READONLY
Definition: Expr.h:1642
isModifiableLvalueResult
Definition: Expr.h:268
void setInputExpr(unsigned i, Expr *E)
Definition: Stmt.cpp:411
VarDecl - An instance of this class is created to represent a variable declaration or definition...
Definition: Decl.h:758
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
Definition: ASTContext.h:1924
virtual bool validateConstraintModifier(StringRef, char, unsigned, std::string &) const
Definition: TargetInfo.h:758
Defines the clang::Expr interface and subclasses for C++ expressions.
static void fillInlineAsmTypeInfo(const ASTContext &Context, QualType T, llvm::InlineAsmIdentifierInfo &Info)
bool isVoidType() const
Definition: Type.h:5906
const std::string & getConstraintStr() const
Definition: TargetInfo.h:661
static bool checkExprMemoryConstraintCompat(Sema &S, Expr *E, TargetInfo::ConstraintInfo &Info, bool is_input_expr)
Returns true if given expression is not compatible with inline assembly's memory constraint; false ot...
Expr * IgnoreImpCasts() LLVM_READONLY
IgnoreImpCasts - Skip past any implicit casts which might surround this expression.
Definition: Expr.h:2847
bool refersToGlobalRegisterVar() const
Returns whether this expression refers to a global register variable.
Definition: Expr.cpp:3438
One of these records is kept for each identifier that is lexed.
unsigned getNumInputs() const
Definition: Stmt.h:1510
bool hasAttr() const
Definition: DeclBase.h:521
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:128
A C++ nested-name-specifier augmented with source location information.
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
Definition: Decl.h:2366
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
Definition: ASTContext.h:2103
virtual bool validateOutputSize(StringRef, unsigned) const
Definition: TargetInfo.h:748
bool refersToVectorElement() const
Returns whether this expression refers to a vector element.
Definition: Expr.cpp:3412
static bool isOperandMentioned(unsigned OpNo, ArrayRef< GCCAsmStmt::AsmStringPiece > AsmStrPieces)
isOperandMentioned - Return true if the specified operand # is mentioned anywhere in the decomposed a...
Definition: SemaStmtAsm.cpp:65
IdentifierTable & Idents
Definition: ASTContext.h:513
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:947
LabelDecl * GetOrCreateMSAsmLabel(StringRef ExternalLabelName, SourceLocation Location, bool AlwaysCreate)
virtual bool validateInputSize(StringRef, unsigned) const
Definition: TargetInfo.h:753
T * getAttr() const
Definition: DeclBase.h:518
Type(TypeClass tc, QualType canon, bool Dependent, bool InstantiationDependent, bool VariablyModified, bool ContainsUnexpandedParameterPack)
Definition: Type.h:1524
Represents a C++ unqualified-id that has been parsed.
Definition: DeclSpec.h:899
Represents the results of name lookup.
Definition: Lookup.h:32
const TargetInfo & getTargetInfo() const
Definition: ASTContext.h:643
CharUnits - This is an opaque type for sizes expressed in character units.
Definition: CharUnits.h:38
uint32_t Offset
Definition: CacheTokens.cpp:43
static bool CheckAsmLValue(const Expr *E, Sema &S)
CheckAsmLValue - GNU C has an extremely ugly extension whereby they silently ignore "noop" casts in p...
Definition: SemaStmtAsm.cpp:37
bool isValidGCCRegisterName(StringRef Name) const
Returns whether the passed in string is a valid register name according to GCC.
Definition: TargetInfo.cpp:371
child_range children()
Definition: Stmt.cpp:208
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
StmtResult StmtError()
Definition: Ownership.h:269
TypeDecl - Represents a declaration of a type.
Definition: Decl.h:2642
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
Definition: Expr.h:148
Expr * getOutputExpr(unsigned i)
Definition: Stmt.cpp:397
RecordDecl * getDecl() const
Definition: Type.h:3793
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D...
uint64_t getFieldOffset(unsigned FieldNo) const
getFieldOffset - Get the offset of the given field index, in bits.
Definition: RecordLayout.h:177
Represents a C++ nested-name-specifier or a global scope specifier.
Definition: DeclSpec.h:63
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
Definition: Type.cpp:1930
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
detail::InMemoryDirectory::const_iterator I
ExprResult LookupInlineAsmVarDeclField(Expr *RefExpr, StringRef Member, llvm::InlineAsmIdentifierInfo &Info, SourceLocation AsmLoc)
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:269
Expr * IgnoreParenNoopCasts(ASTContext &Ctx) LLVM_READONLY
IgnoreParenNoopCasts - Ignore parentheses and casts that do not change the value (including ptr->int ...
Definition: Expr.cpp:2519
CastKind
CastKind - The kind of operation required for a conversion.
ASTContext * Context
ExprResult LookupInlineAsmIdentifier(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, llvm::InlineAsmIdentifierInfo &Info, bool IsUnevaluatedContext)
static bool CheckNakedParmReference(Expr *E, Sema &S)
Definition: SemaStmtAsm.cpp:79
bool isRealFloatingType() const
Floating point categories.
Definition: Type.cpp:1837
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
Definition: RecordLayout.h:34
Exposes information about the current target.
Definition: TargetInfo.h:54
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Definition: Decl.h:580
Expr - This represents one expression.
Definition: Expr.h:105
StringRef getName() const
Return the actual identifier string.
std::string Label
static SourceLocation getClobberConflictLocation(MultiExprArg Exprs, StringLiteral **Constraints, StringLiteral **Clobbers, int NumClobbers, const TargetInfo &Target, ASTContext &Cont)
AsmStringPiece - this is part of a decomposed asm string specification (for use with the AnalyzeAsmSt...
Definition: Stmt.h:1625
bool isValidClobber(StringRef Name) const
Returns whether the passed in string is a valid clobber in an inline asm statement.
Definition: TargetInfo.cpp:363
virtual StringRef getConstraintRegister(const StringRef &Constraint, const StringRef &Expression) const
Definition: TargetInfo.h:629
Defines the clang::Preprocessor interface.
bool isMSAsmLabel() const
Definition: Decl.h:449
isModifiableLvalueResult isModifiableLvalue(ASTContext &Ctx, SourceLocation *Loc=nullptr) const
isModifiableLvalue - C99 6.3.2.1: an lvalue that does not have array type, does not have an incomplet...
Defines the clang::TypeLoc interface and its subclasses.
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition: Type.h:1797
bool EvaluateAsInt(llvm::APSInt &Result, const ASTContext &Ctx, SideEffectsKind AllowSideEffects=SE_NoSideEffects) const
EvaluateAsInt - Return true if this is a constant which we can fold and convert to an integer...
This represents a Microsoft inline-assembly statement extension.
Definition: Stmt.h:1770
void setLocation(SourceLocation L)
Definition: DeclBase.h:408
unsigned getTiedOperand() const
Definition: TargetInfo.h:678
const Decl * FoundDecl
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc...
Definition: Ownership.h:145
Encodes a location in the source.
char getModifier() const
getModifier - Get the modifier for this operand, if present.
Definition: Stmt.cpp:388
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
static StringRef extractRegisterName(const Expr *Expression, const TargetInfo &Target)
bool isValid() const
Return true if this is a valid SourceLocation object.
LabelDecl - Represents the declaration of a label.
Definition: Decl.h:414
CharSourceRange getRange() const
Definition: Stmt.h:1658
bool LookupInlineAsmField(StringRef Base, StringRef Member, unsigned &Offset, SourceLocation AsmLoc)
bool isRValue() const
Definition: Expr.h:249
Expr * getInputExpr(unsigned i)
Definition: Stmt.cpp:408
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
Definition: Expr.h:166
bool isAscii() const
Definition: Expr.h:1597
ActionResult< CXXBaseSpecifier * > BaseResult
Definition: Ownership.h:255
bool refersToBitField() const
Returns true if this expression is a gl-value that potentially refers to a bit-field.
Definition: Expr.h:434
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:2682
QualType getType() const
Definition: Expr.h:127
unsigned AnalyzeAsmString(SmallVectorImpl< AsmStringPiece > &Pieces, const ASTContext &C, unsigned &DiagOffs) const
AnalyzeAsmString - Analyze the asm string of the current asm, decomposing it into pieces...
Definition: Stmt.cpp:475
IndirectFieldDecl - An instance of this class is created to represent a field injected from an anonym...
Definition: Decl.h:2594
bool hasTiedOperand() const
Return true if this input operand is a matching constraint that ties it to an output operand...
Definition: TargetInfo.h:677
bool isLValue() const
isLValue - True if this expression is an "l-value" according to the rules of the current language...
Definition: Expr.h:248
StringRef getString() const
Definition: Expr.h:1554
detail::InMemoryDirectory::const_iterator E
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
bool DeclAttrsMatchCUDAMode(const LangOptions &LangOpts, Decl *D)
Definition: SemaInternal.h:54
bool isEvaluatable(const ASTContext &Ctx, SideEffectsKind AllowSideEffects=SE_NoSideEffects) const
isEvaluatable - Call EvaluateAsRValue to see if this expression can be constant folded without side-e...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:3784
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:6042
StringRef getNormalizedGCCRegisterName(StringRef Name, bool ReturnCanonical=false) const
Returns the "normalized" GCC register name.
Definition: TargetInfo.cpp:416
bool isFunctionType() const
Definition: Type.h:5709
unsigned getOperandNo() const
Definition: Stmt.h:1653
unsigned getFieldIndex() const
getFieldIndex - Returns the index of this field within its record, as appropriate for passing to ASTR...
Definition: Decl.cpp:3605
void markUsed(ASTContext &C)
Mark the declaration used, in the sense of odr-use.
Definition: DeclBase.cpp:382
bool isUsable() const
Definition: Ownership.h:160
void setLoc(SourceLocation L)
setLoc - Sets the main location of the declaration name.
const std::string & getString() const
Definition: Stmt.h:1649
void setMSAsmLabel(StringRef Name)
Definition: Decl.cpp:4142
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
Definition: Sema.h:317
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string...
Definition: Diagnostic.h:127
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition: Stmt.cpp:245
bool isArrayType() const
Definition: Type.h:5751
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1506
Defines the clang::TargetInfo interface.
ExprResult ExprError()
Definition: Ownership.h:268
StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, ArrayRef< Token > AsmToks, StringRef AsmString, unsigned NumOutputs, unsigned NumInputs, ArrayRef< StringRef > Constraints, ArrayRef< StringRef > Clobbers, ArrayRef< Expr * > Exprs, SourceLocation EndLoc)
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:953
QualType getElementType() const
Definition: Type.h:2531
void setMSAsmLabelResolved()
Definition: Decl.h:453
ASTContext & Context
Definition: Sema.h:305
NamedDecl - This represents a decl with a name.
Definition: Decl.h:213
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.cpp:257
const NamedDecl * Result
Definition: USRFinder.cpp:70
Attr - This represents one attribute.
Definition: Attr.h:43
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
Definition: Type.h:5928
bool isPointerType() const
Definition: Type.h:5712