clang: lib/AST/SelectorLocationsKind.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
16
17using namespace clang;
18
21 bool WithArgSpace,
24 unsigned NumSelArgs = Sel.getNumArgs();
25 if (NumSelArgs == 0) {
26 assert(Index == 0);
30 unsigned Len = II ? II->getLength() : 0;
32 }
33
34 assert(Index < NumSelArgs);
38 unsigned Len = (II ? II->getLength() : 0) + 1;
39 if (WithArgSpace)
40 ++Len;
42}
43
44namespace {
45
46template
48
49template <>
52}
53
54template <>
58 return Loc;
59
61}
62
63template
65 return Index < Args.size() ? getArgLoc(Args[Index]) : SourceLocation();
66}
67
68template
73
74 unsigned i;
75 for (i = 0; i != SelLocs.size(); ++i) {
77 Args, EndLoc))
78 break;
79 }
80 if (i == SelLocs.size())
82
83
84 for (i = 0; i != SelLocs.size(); ++i) {
86 Args, EndLoc))
88 }
89
91}
92
93}
94
100 return hasStandardSelLocs(Sel, SelLocs, Args, EndLoc);
101}
102
105 bool WithArgSpace,
109 getArgLoc(Index, Args), EndLoc);
110}
111
117 return hasStandardSelLocs(Sel, SelLocs, Args, EndLoc);
118}
119
122 bool WithArgSpace,
126 getArgLoc(Index, Args), EndLoc);
127}
static SourceLocation getStandardSelLoc(unsigned Index, Selector Sel, bool WithArgSpace, SourceLocation ArgLoc, SourceLocation EndLoc)
SourceLocation getBeginLoc() const LLVM_READONLY
This represents one expression.
One of these records is kept for each identifier that is lexed.
unsigned getLength() const
Efficiently return the length of this identifier info.
Represents a parameter to a function.
Smart pointer class that efficiently represents Objective-C method names.
const IdentifierInfo * getIdentifierInfoForSlot(unsigned argIndex) const
Retrieve the identifier at a given position in the selector.
unsigned getNumArgs() const
Encodes a location in the source.
SourceLocation getLocWithOffset(IntTy Offset) const
Return a source location with the specified offset from this SourceLocation.
SourceLocation getBeginLoc() const LLVM_READONLY
The JSON file list parser is used to communicate input to InstallAPI.
SelectorLocationsKind
Whether all locations of the selector identifiers are in a "standard" position.
@ SelLoc_StandardWithSpace
For nullary selectors, immediately before the end: "[foo release]" / "-(void)release;" Or with a spac...
@ SelLoc_NonStandard
Non-standard.
@ SelLoc_StandardNoSpace
For nullary selectors, immediately before the end: "[foo release]" / "-(void)release;" Or immediately...
SelectorLocationsKind hasStandardSelectorLocs(Selector Sel, ArrayRef< SourceLocation > SelLocs, ArrayRef< Expr * > Args, SourceLocation EndLoc)
Returns true if all SelLocs are in a "standard" location.
SourceLocation getStandardSelectorLoc(unsigned Index, Selector Sel, bool WithArgSpace, ArrayRef< Expr * > Args, SourceLocation EndLoc)
Get the "standard" location of a selector identifier, e.g: For nullary selectors, immediately before ...
const FunctionProtoType * T