clang  5.0.0
IndexBody.cpp
Go to the documentation of this file.
1 //===- IndexBody.cpp - Indexing 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 #include "IndexingContext.h"
12 
13 using namespace clang;
14 using namespace clang::index;
15 
16 namespace {
17 
18 class BodyIndexer : public RecursiveASTVisitor<BodyIndexer> {
19  IndexingContext &IndexCtx;
20  const NamedDecl *Parent;
21  const DeclContext *ParentDC;
22  SmallVector<Stmt*, 16> StmtStack;
23 
25 
26  Stmt *getParentStmt() const {
27  return StmtStack.size() < 2 ? nullptr : StmtStack.end()[-2];
28  }
29 public:
30  BodyIndexer(IndexingContext &indexCtx,
31  const NamedDecl *Parent, const DeclContext *DC)
32  : IndexCtx(indexCtx), Parent(Parent), ParentDC(DC) { }
33 
34  bool shouldWalkTypesOfTypeLocs() const { return false; }
35 
36  bool dataTraverseStmtPre(Stmt *S) {
37  StmtStack.push_back(S);
38  return true;
39  }
40 
41  bool dataTraverseStmtPost(Stmt *S) {
42  assert(StmtStack.back() == S);
43  StmtStack.pop_back();
44  return true;
45  }
46 
47  bool TraverseTypeLoc(TypeLoc TL) {
48  IndexCtx.indexTypeLoc(TL, Parent, ParentDC);
49  return true;
50  }
51 
52  bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS) {
53  IndexCtx.indexNestedNameSpecifierLoc(NNS, Parent, ParentDC);
54  return true;
55  }
56 
57  SymbolRoleSet getRolesForRef(const Expr *E,
59  SymbolRoleSet Roles{};
60  assert(!StmtStack.empty() && E == StmtStack.back());
61  if (StmtStack.size() == 1)
62  return Roles;
63  auto It = StmtStack.end()-2;
64  while (isa<CastExpr>(*It) || isa<ParenExpr>(*It)) {
65  if (auto ICE = dyn_cast<ImplicitCastExpr>(*It)) {
66  if (ICE->getCastKind() == CK_LValueToRValue)
67  Roles |= (unsigned)(unsigned)SymbolRole::Read;
68  }
69  if (It == StmtStack.begin())
70  break;
71  --It;
72  }
73  const Stmt *Parent = *It;
74 
75  if (auto BO = dyn_cast<BinaryOperator>(Parent)) {
76  if (BO->getOpcode() == BO_Assign && BO->getLHS()->IgnoreParenCasts() == E)
77  Roles |= (unsigned)SymbolRole::Write;
78 
79  } else if (auto UO = dyn_cast<UnaryOperator>(Parent)) {
80  if (UO->isIncrementDecrementOp()) {
81  Roles |= (unsigned)SymbolRole::Read;
82  Roles |= (unsigned)SymbolRole::Write;
83  } else if (UO->getOpcode() == UO_AddrOf) {
85  }
86 
87  } else if (auto CA = dyn_cast<CompoundAssignOperator>(Parent)) {
88  if (CA->getLHS()->IgnoreParenCasts() == E) {
89  Roles |= (unsigned)SymbolRole::Read;
90  Roles |= (unsigned)SymbolRole::Write;
91  }
92 
93  } else if (auto CE = dyn_cast<CallExpr>(Parent)) {
94  if (CE->getCallee()->IgnoreParenCasts() == E) {
95  addCallRole(Roles, Relations);
96  if (auto *ME = dyn_cast<MemberExpr>(E)) {
97  if (auto *CXXMD = dyn_cast_or_null<CXXMethodDecl>(ME->getMemberDecl()))
98  if (CXXMD->isVirtual() && !ME->hasQualifier()) {
99  Roles |= (unsigned)SymbolRole::Dynamic;
100  auto BaseTy = ME->getBase()->IgnoreImpCasts()->getType();
101  if (!BaseTy.isNull())
102  if (auto *CXXRD = BaseTy->getPointeeCXXRecordDecl())
103  Relations.emplace_back((unsigned)SymbolRole::RelationReceivedBy,
104  CXXRD);
105  }
106  }
107  } else if (auto CXXOp = dyn_cast<CXXOperatorCallExpr>(CE)) {
108  if (CXXOp->getNumArgs() > 0 && CXXOp->getArg(0)->IgnoreParenCasts() == E) {
109  OverloadedOperatorKind Op = CXXOp->getOperator();
110  if (Op == OO_Equal) {
111  Roles |= (unsigned)SymbolRole::Write;
112  } else if ((Op >= OO_PlusEqual && Op <= OO_PipeEqual) ||
113  Op == OO_LessLessEqual || Op == OO_GreaterGreaterEqual ||
114  Op == OO_PlusPlus || Op == OO_MinusMinus) {
115  Roles |= (unsigned)SymbolRole::Read;
116  Roles |= (unsigned)SymbolRole::Write;
117  } else if (Op == OO_Amp) {
119  }
120  }
121  }
122  }
123 
124  return Roles;
125  }
126 
127  void addCallRole(SymbolRoleSet &Roles,
128  SmallVectorImpl<SymbolRelation> &Relations) {
129  Roles |= (unsigned)SymbolRole::Call;
130  if (auto *FD = dyn_cast<FunctionDecl>(ParentDC))
131  Relations.emplace_back((unsigned)SymbolRole::RelationCalledBy, FD);
132  else if (auto *MD = dyn_cast<ObjCMethodDecl>(ParentDC))
133  Relations.emplace_back((unsigned)SymbolRole::RelationCalledBy, MD);
134  }
135 
136  bool VisitDeclRefExpr(DeclRefExpr *E) {
138  SymbolRoleSet Roles = getRolesForRef(E, Relations);
139  return IndexCtx.handleReference(E->getDecl(), E->getLocation(),
140  Parent, ParentDC, Roles, Relations, E);
141  }
142 
143  bool VisitMemberExpr(MemberExpr *E) {
144  SourceLocation Loc = E->getMemberLoc();
145  if (Loc.isInvalid())
146  Loc = E->getLocStart();
148  SymbolRoleSet Roles = getRolesForRef(E, Relations);
149  return IndexCtx.handleReference(E->getMemberDecl(), Loc,
150  Parent, ParentDC, Roles, Relations, E);
151  }
152 
153  bool indexDependentReference(
154  const Expr *E, const Type *T, const DeclarationNameInfo &NameInfo,
155  llvm::function_ref<bool(const NamedDecl *ND)> Filter) {
156  if (!T)
157  return true;
158  const TemplateSpecializationType *TST =
160  if (!TST)
161  return true;
162  TemplateName TN = TST->getTemplateName();
163  const ClassTemplateDecl *TD =
164  dyn_cast_or_null<ClassTemplateDecl>(TN.getAsTemplateDecl());
165  if (!TD)
166  return true;
167  CXXRecordDecl *RD = TD->getTemplatedDecl();
168  if (!RD->hasDefinition())
169  return true;
170  RD = RD->getDefinition();
171  std::vector<const NamedDecl *> Symbols =
172  RD->lookupDependentName(NameInfo.getName(), Filter);
173  // FIXME: Improve overload handling.
174  if (Symbols.size() != 1)
175  return true;
176  SourceLocation Loc = NameInfo.getLoc();
177  if (Loc.isInvalid())
178  Loc = E->getLocStart();
180  SymbolRoleSet Roles = getRolesForRef(E, Relations);
181  return IndexCtx.handleReference(Symbols[0], Loc, Parent, ParentDC, Roles,
182  Relations, E);
183  }
184 
185  bool VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E) {
186  const DeclarationNameInfo &Info = E->getMemberNameInfo();
187  return indexDependentReference(
188  E, E->getBaseType().getTypePtrOrNull(), Info,
189  [](const NamedDecl *D) { return D->isCXXInstanceMember(); });
190  }
191 
192  bool VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
193  const DeclarationNameInfo &Info = E->getNameInfo();
194  const NestedNameSpecifier *NNS = E->getQualifier();
195  return indexDependentReference(
196  E, NNS->getAsType(), Info,
197  [](const NamedDecl *D) { return !D->isCXXInstanceMember(); });
198  }
199 
200  bool VisitDesignatedInitExpr(DesignatedInitExpr *E) {
201  for (DesignatedInitExpr::Designator &D : llvm::reverse(E->designators())) {
202  if (D.isFieldDesignator() && D.getField())
203  return IndexCtx.handleReference(D.getField(), D.getFieldLoc(), Parent,
204  ParentDC, SymbolRoleSet(), {}, E);
205  }
206  return true;
207  }
208 
209  bool VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
211  SymbolRoleSet Roles = getRolesForRef(E, Relations);
212  return IndexCtx.handleReference(E->getDecl(), E->getLocation(),
213  Parent, ParentDC, Roles, Relations, E);
214  }
215 
216  bool VisitObjCMessageExpr(ObjCMessageExpr *E) {
217  auto isDynamic = [](const ObjCMessageExpr *MsgE)->bool {
218  if (MsgE->getReceiverKind() != ObjCMessageExpr::Instance)
219  return false;
220  if (auto *RecE = dyn_cast<ObjCMessageExpr>(
221  MsgE->getInstanceReceiver()->IgnoreParenCasts())) {
222  if (RecE->getMethodFamily() == OMF_alloc)
223  return false;
224  }
225  return true;
226  };
227 
228  if (ObjCMethodDecl *MD = E->getMethodDecl()) {
229  SymbolRoleSet Roles{};
231  addCallRole(Roles, Relations);
232  Stmt *Containing = getParentStmt();
233 
234  auto IsImplicitProperty = [](const PseudoObjectExpr *POE) -> bool {
235  const auto *E = POE->getSyntacticForm();
236  if (const auto *BinOp = dyn_cast<BinaryOperator>(E))
237  E = BinOp->getLHS();
238  const auto *PRE = dyn_cast<ObjCPropertyRefExpr>(E);
239  if (!PRE)
240  return false;
241  if (PRE->isExplicitProperty())
242  return false;
243  if (const ObjCMethodDecl *Getter = PRE->getImplicitPropertyGetter()) {
244  // Class properties that are explicitly defined using @property
245  // declarations are represented implicitly as there is no ivar for
246  // class properties.
247  if (Getter->isClassMethod() &&
248  Getter->getCanonicalDecl()->findPropertyDecl())
249  return false;
250  }
251  return true;
252  };
253  bool IsPropCall = Containing && isa<PseudoObjectExpr>(Containing);
254  // Implicit property message sends are not 'implicit'.
255  if ((E->isImplicit() || IsPropCall) &&
256  !(IsPropCall &&
257  IsImplicitProperty(cast<PseudoObjectExpr>(Containing))))
258  Roles |= (unsigned)SymbolRole::Implicit;
259 
260  if (isDynamic(E)) {
261  Roles |= (unsigned)SymbolRole::Dynamic;
262  if (auto *RecD = E->getReceiverInterface())
263  Relations.emplace_back((unsigned)SymbolRole::RelationReceivedBy, RecD);
264  }
265 
266  return IndexCtx.handleReference(MD, E->getSelectorStartLoc(),
267  Parent, ParentDC, Roles, Relations, E);
268  }
269  return true;
270  }
271 
272  bool VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
273  if (E->isClassReceiver())
274  IndexCtx.handleReference(E->getClassReceiver(), E->getReceiverLocation(),
275  Parent, ParentDC);
276  if (E->isExplicitProperty()) {
278  SymbolRoleSet Roles = getRolesForRef(E, Relations);
279  return IndexCtx.handleReference(E->getExplicitProperty(), E->getLocation(),
280  Parent, ParentDC, Roles, Relations, E);
281  } else if (const ObjCMethodDecl *Getter = E->getImplicitPropertyGetter()) {
282  // Class properties that are explicitly defined using @property
283  // declarations are represented implicitly as there is no ivar for class
284  // properties.
285  if (Getter->isClassMethod()) {
286  if (const auto *PD = Getter->getCanonicalDecl()->findPropertyDecl()) {
288  SymbolRoleSet Roles = getRolesForRef(E, Relations);
289  return IndexCtx.handleReference(PD, E->getLocation(), Parent,
290  ParentDC, Roles, Relations, E);
291  }
292  }
293  }
294 
295  // No need to do a handleReference for the objc method, because there will
296  // be a message expr as part of PseudoObjectExpr.
297  return true;
298  }
299 
300  bool VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
301  return IndexCtx.handleReference(E->getPropertyDecl(), E->getMemberLoc(),
302  Parent, ParentDC, SymbolRoleSet(), {}, E);
303  }
304 
305  bool VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
306  return IndexCtx.handleReference(E->getProtocol(), E->getProtocolIdLoc(),
307  Parent, ParentDC, SymbolRoleSet(), {}, E);
308  }
309 
310  bool passObjCLiteralMethodCall(const ObjCMethodDecl *MD, const Expr *E) {
311  SymbolRoleSet Roles{};
313  addCallRole(Roles, Relations);
314  Roles |= (unsigned)SymbolRole::Implicit;
315  return IndexCtx.handleReference(MD, E->getLocStart(),
316  Parent, ParentDC, Roles, Relations, E);
317  }
318 
319  bool VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
320  if (ObjCMethodDecl *MD = E->getBoxingMethod()) {
321  return passObjCLiteralMethodCall(MD, E);
322  }
323  return true;
324  }
325 
326  bool VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
327  if (ObjCMethodDecl *MD = E->getDictWithObjectsMethod()) {
328  return passObjCLiteralMethodCall(MD, E);
329  }
330  return true;
331  }
332 
333  bool VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
334  if (ObjCMethodDecl *MD = E->getArrayWithObjectsMethod()) {
335  return passObjCLiteralMethodCall(MD, E);
336  }
337  return true;
338  }
339 
340  bool VisitCXXConstructExpr(CXXConstructExpr *E) {
341  SymbolRoleSet Roles{};
343  addCallRole(Roles, Relations);
344  return IndexCtx.handleReference(E->getConstructor(), E->getLocation(),
345  Parent, ParentDC, Roles, Relations, E);
346  }
347 
348  bool TraverseCXXOperatorCallExpr(CXXOperatorCallExpr *E,
349  DataRecursionQueue *Q = nullptr) {
350  if (E->getOperatorLoc().isInvalid())
351  return true; // implicit.
352  return base::TraverseCXXOperatorCallExpr(E, Q);
353  }
354 
355  bool VisitDeclStmt(DeclStmt *S) {
356  if (IndexCtx.shouldIndexFunctionLocalSymbols()) {
357  IndexCtx.indexDeclGroupRef(S->getDeclGroup());
358  return true;
359  }
360 
361  DeclGroupRef DG = S->getDeclGroup();
362  for (DeclGroupRef::iterator I = DG.begin(), E = DG.end(); I != E; ++I) {
363  const Decl *D = *I;
364  if (!D)
365  continue;
366  if (!isFunctionLocalSymbol(D))
367  IndexCtx.indexTopLevelDecl(D);
368  }
369 
370  return true;
371  }
372 
373  bool TraverseLambdaCapture(LambdaExpr *LE, const LambdaCapture *C,
374  Expr *Init) {
375  if (C->capturesThis() || C->capturesVLAType())
376  return true;
377 
378  if (C->capturesVariable() && IndexCtx.shouldIndexFunctionLocalSymbols())
379  return IndexCtx.handleReference(C->getCapturedVar(), C->getLocation(),
380  Parent, ParentDC, SymbolRoleSet());
381 
382  // FIXME: Lambda init-captures.
383  return true;
384  }
385 
386  // RecursiveASTVisitor visits both syntactic and semantic forms, duplicating
387  // the things that we visit. Make sure to only visit the semantic form.
388  // Also visit things that are in the syntactic form but not the semantic one,
389  // for example the indices in DesignatedInitExprs.
390  bool TraverseInitListExpr(InitListExpr *S, DataRecursionQueue *Q = nullptr) {
391  auto visitForm = [&](InitListExpr *Form) {
392  for (Stmt *SubStmt : Form->children()) {
393  if (!TraverseStmt(SubStmt, Q))
394  return false;
395  }
396  return true;
397  };
398 
399  auto visitSyntacticDesignatedInitExpr = [&](DesignatedInitExpr *E) -> bool {
400  for (DesignatedInitExpr::Designator &D : llvm::reverse(E->designators())) {
401  if (D.isFieldDesignator())
402  return IndexCtx.handleReference(D.getField(), D.getFieldLoc(),
403  Parent, ParentDC, SymbolRoleSet(),
404  {}, E);
405  }
406  return true;
407  };
408 
409  InitListExpr *SemaForm = S->isSemanticForm() ? S : S->getSemanticForm();
410  InitListExpr *SyntaxForm = S->isSemanticForm() ? S->getSyntacticForm() : S;
411 
412  if (SemaForm) {
413  // Visit things present in syntactic form but not the semantic form.
414  if (SyntaxForm) {
415  for (Expr *init : SyntaxForm->inits()) {
416  if (auto *DIE = dyn_cast<DesignatedInitExpr>(init))
417  visitSyntacticDesignatedInitExpr(DIE);
418  }
419  }
420  return visitForm(SemaForm);
421  }
422 
423  // No semantic, try the syntactic.
424  if (SyntaxForm) {
425  return visitForm(SyntaxForm);
426  }
427 
428  return true;
429  }
430 };
431 
432 } // anonymous namespace
433 
434 void IndexingContext::indexBody(const Stmt *S, const NamedDecl *Parent,
435  const DeclContext *DC) {
436  if (!S)
437  return;
438 
439  if (!DC)
440  DC = Parent->getLexicalDeclContext();
441  BodyIndexer(*this, Parent, DC).TraverseStmt(const_cast<Stmt*>(S));
442 }
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:539
A call to an overloaded operator written using operator syntax.
Definition: ExprCXX.h:52
Represents a single C99 designator.
Definition: Expr.h:4150
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
Definition: Expr.h:2474
The receiver is an object instance.
Definition: ExprObjC.h:1005
const DeclGroupRef getDeclGroup() const
Definition: Stmt.h:488
SourceLocation getLocation() const
Definition: ExprObjC.h:518
Stmt - This represents one statement.
Definition: Stmt.h:60
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
iterator end()
Definition: DeclGroup.h:108
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:81
SourceLocation getProtocolIdLoc() const
Definition: ExprObjC.h:456
bool hasDefinition() const
Definition: DeclCXX.h:702
The base class of the type hierarchy.
Definition: Type.h:1303
InitListExpr * getSyntacticForm() const
Definition: Expr.h:3998
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1177
Describes the capture of a variable or of this, or of a C++1y init-capture.
Definition: LambdaCapture.h:26
bool isExplicitProperty() const
Definition: ExprObjC.h:631
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:113
virtual bool isDynamic(OpenMPScheduleClauseKind ScheduleKind) const
Check if the specified ScheduleKind is dynamic.
SourceLocation getOperatorLoc() const
Returns the location of the operator symbol in the expression.
Definition: ExprCXX.h:95
SourceLocation getLocation() const
Definition: Expr.h:1046
std::vector< const NamedDecl * > lookupDependentName(const DeclarationName &Name, llvm::function_ref< bool(const NamedDecl *ND)> Filter)
Performs an imprecise lookup of a dependent name in this class.
Base wrapper for a particular "section" of type source info.
Definition: TypeLoc.h:40
Represents a C99 designated initializer expression.
Definition: Expr.h:4075
DeclarationName getName() const
getName - Returns the embedded declaration name.
ObjCProtocolDecl * getProtocol() const
Definition: ExprObjC.h:453
A C++ nested-name-specifier augmented with source location information.
ObjCInterfaceDecl * getClassReceiver() const
Definition: ExprObjC.h:696
bool isSemanticForm() const
Definition: Expr.h:3994
bool isFunctionLocalSymbol(const Decl *D)
Definition: IndexSymbol.cpp:52
CXXRecordDecl * getDefinition() const
Definition: DeclCXX.h:695
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp, [NSNumber numberWithInt:42]];.
Definition: ExprObjC.h:144
Describes an C or C++ initializer list.
Definition: Expr.h:3848
ObjCMethodDecl * getBoxingMethod() const
Definition: ExprObjC.h:111
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
Definition: Type.h:4382
child_range children()
Definition: Stmt.cpp:208
iterator begin()
Definition: DeclGroup.h:102
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies this declaration.
Definition: ExprCXX.h:2829
VarDecl * getCapturedVar() const
Retrieve the declaration of the local variable being captured.
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
Definition: DeclBase.h:796
bool capturesVLAType() const
Determine whether this captures a variable length array bound expression.
Definition: LambdaCapture.h:95
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1519
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3112
A class that does preordor or postorder depth-first traversal on the entire Clang AST and visits each...
detail::InMemoryDirectory::const_iterator I
bool isInvalid() const
MSPropertyDecl * getPropertyDecl() const
Definition: ExprCXX.h:724
ObjCIvarDecl * getDecl()
Definition: ExprObjC.h:505
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
SourceLocation getReceiverLocation() const
Definition: ExprObjC.h:691
unsigned SymbolRoleSet
Definition: IndexSymbol.h:113
InitListExpr * getSemanticForm() const
Definition: Expr.h:3995
SourceLocation getMemberLoc() const
Definition: ExprCXX.h:726
const ObjCMethodDecl * getMethodDecl() const
Definition: ExprObjC.h:1251
const Type * getTypePtrOrNull() const
Definition: Type.h:5493
llvm::MutableArrayRef< Designator > designators()
Definition: Expr.h:4278
Expr - This represents one expression.
Definition: Expr.h:105
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
Definition: ExprCXX.h:2813
ObjCMethodDecl * getImplicitPropertyGetter() const
Definition: ExprObjC.h:638
SourceLocation getLocation() const
Definition: ExprCXX.h:1242
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Definition: ExprObjC.h:257
ObjCInterfaceDecl * getReceiverInterface() const
Retrieve the Objective-C interface to which this message is being directed, if known.
Definition: ExprObjC.cpp:327
SourceLocation getLocation() const
Retrieve the source location of the capture.
Represents a C++ template name within the type system.
Definition: TemplateName.h:176
ArrayRef< Expr * > inits()
Definition: Expr.h:3888
SourceLocation getLocation() const
Definition: ExprObjC.h:689
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:860
A member reference to an MSPropertyDecl.
Definition: ExprCXX.h:678
ValueDecl * getDecl()
Definition: Expr.h:1038
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:4938
Encodes a location in the source.
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
Definition: Stmt.h:467
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
const DeclarationNameInfo & getMemberNameInfo() const
Retrieve the name of the member that this expression refers to.
Definition: ExprCXX.h:3235
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:441
QualType getBaseType() const
Definition: ExprCXX.h:3198
SourceLocation getSelectorStartLoc() const
Definition: ExprObjC.h:1313
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:94
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:2775
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1215
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:22
bool isClassReceiver() const
Definition: ExprObjC.h:701
ObjCMethodDecl * getArrayWithObjectsMethod() const
Definition: ExprObjC.h:196
detail::InMemoryDirectory::const_iterator E
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
ObjCMethodDecl * getDictWithObjectsMethod() const
Definition: ExprObjC.h:323
SourceLocation getMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of 'F'...
Definition: Expr.h:2578
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:6042
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
Definition: ExprCXX.h:1240
ObjCPropertyDecl * getExplicitProperty() const
Definition: ExprObjC.h:633
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:479
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:2378
Represents a C++ struct/union/class.
Definition: DeclCXX.h:267
bool isImplicit() const
Indicates whether the message send was implicitly generated by the implementation.
Definition: ExprObjC.h:1132
Declaration of a class template.
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:953
Represents a type template specialization; the template must be a class template, a type alias templa...
Definition: Type.h:4297
bool capturesThis() const
Determine whether this capture handles the C++ this pointer.
Definition: LambdaCapture.h:83
void indexBody(const Stmt *S, const NamedDecl *Parent, const DeclContext *DC=nullptr)
Definition: IndexBody.cpp:434
NamedDecl - This represents a decl with a name.
Definition: Decl.h:213
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.cpp:257
bool capturesVariable() const
Determine whether this capture handles a variable.
Definition: LambdaCapture.h:89
SourceLocation getLocStart() const LLVM_READONLY
Definition: Expr.cpp:1497