1*06f32e7eSjoerg //===--- SelectorLocationsKind.h - Kind of selector locations ---*- C++ -*-===// 2*06f32e7eSjoerg // 3*06f32e7eSjoerg // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*06f32e7eSjoerg // See https://llvm.org/LICENSE.txt for license information. 5*06f32e7eSjoerg // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*06f32e7eSjoerg // 7*06f32e7eSjoerg //===----------------------------------------------------------------------===// 8*06f32e7eSjoerg // 9*06f32e7eSjoerg // Describes whether the identifier locations for a selector are "standard" 10*06f32e7eSjoerg // or not. 11*06f32e7eSjoerg // 12*06f32e7eSjoerg //===----------------------------------------------------------------------===// 13*06f32e7eSjoerg 14*06f32e7eSjoerg #ifndef LLVM_CLANG_AST_SELECTORLOCATIONSKIND_H 15*06f32e7eSjoerg #define LLVM_CLANG_AST_SELECTORLOCATIONSKIND_H 16*06f32e7eSjoerg 17*06f32e7eSjoerg #include "clang/Basic/LLVM.h" 18*06f32e7eSjoerg 19*06f32e7eSjoerg namespace clang { 20*06f32e7eSjoerg class Selector; 21*06f32e7eSjoerg class SourceLocation; 22*06f32e7eSjoerg class Expr; 23*06f32e7eSjoerg class ParmVarDecl; 24*06f32e7eSjoerg 25*06f32e7eSjoerg /// Whether all locations of the selector identifiers are in a 26*06f32e7eSjoerg /// "standard" position. 27*06f32e7eSjoerg enum SelectorLocationsKind { 28*06f32e7eSjoerg /// Non-standard. 29*06f32e7eSjoerg SelLoc_NonStandard = 0, 30*06f32e7eSjoerg 31*06f32e7eSjoerg /// For nullary selectors, immediately before the end: 32*06f32e7eSjoerg /// "[foo release]" / "-(void)release;" 33*06f32e7eSjoerg /// Or immediately before the arguments: 34*06f32e7eSjoerg /// "[foo first:1 second:2]" / "-(id)first:(int)x second:(int)y; 35*06f32e7eSjoerg SelLoc_StandardNoSpace = 1, 36*06f32e7eSjoerg 37*06f32e7eSjoerg /// For nullary selectors, immediately before the end: 38*06f32e7eSjoerg /// "[foo release]" / "-(void)release;" 39*06f32e7eSjoerg /// Or with a space between the arguments: 40*06f32e7eSjoerg /// "[foo first: 1 second: 2]" / "-(id)first: (int)x second: (int)y; 41*06f32e7eSjoerg SelLoc_StandardWithSpace = 2 42*06f32e7eSjoerg }; 43*06f32e7eSjoerg 44*06f32e7eSjoerg /// Returns true if all \p SelLocs are in a "standard" location. 45*06f32e7eSjoerg SelectorLocationsKind hasStandardSelectorLocs(Selector Sel, 46*06f32e7eSjoerg ArrayRef<SourceLocation> SelLocs, 47*06f32e7eSjoerg ArrayRef<Expr *> Args, 48*06f32e7eSjoerg SourceLocation EndLoc); 49*06f32e7eSjoerg 50*06f32e7eSjoerg /// Get the "standard" location of a selector identifier, e.g: 51*06f32e7eSjoerg /// For nullary selectors, immediately before ']': "[foo release]" 52*06f32e7eSjoerg /// 53*06f32e7eSjoerg /// \param WithArgSpace if true the standard location is with a space apart 54*06f32e7eSjoerg /// before arguments: "[foo first: 1 second: 2]" 55*06f32e7eSjoerg /// If false: "[foo first:1 second:2]" 56*06f32e7eSjoerg SourceLocation getStandardSelectorLoc(unsigned Index, 57*06f32e7eSjoerg Selector Sel, 58*06f32e7eSjoerg bool WithArgSpace, 59*06f32e7eSjoerg ArrayRef<Expr *> Args, 60*06f32e7eSjoerg SourceLocation EndLoc); 61*06f32e7eSjoerg 62*06f32e7eSjoerg /// Returns true if all \p SelLocs are in a "standard" location. 63*06f32e7eSjoerg SelectorLocationsKind hasStandardSelectorLocs(Selector Sel, 64*06f32e7eSjoerg ArrayRef<SourceLocation> SelLocs, 65*06f32e7eSjoerg ArrayRef<ParmVarDecl *> Args, 66*06f32e7eSjoerg SourceLocation EndLoc); 67*06f32e7eSjoerg 68*06f32e7eSjoerg /// Get the "standard" location of a selector identifier, e.g: 69*06f32e7eSjoerg /// For nullary selectors, immediately before ']': "[foo release]" 70*06f32e7eSjoerg /// 71*06f32e7eSjoerg /// \param WithArgSpace if true the standard location is with a space apart 72*06f32e7eSjoerg /// before arguments: "-(id)first: (int)x second: (int)y;" 73*06f32e7eSjoerg /// If false: "-(id)first:(int)x second:(int)y;" 74*06f32e7eSjoerg SourceLocation getStandardSelectorLoc(unsigned Index, 75*06f32e7eSjoerg Selector Sel, 76*06f32e7eSjoerg bool WithArgSpace, 77*06f32e7eSjoerg ArrayRef<ParmVarDecl *> Args, 78*06f32e7eSjoerg SourceLocation EndLoc); 79*06f32e7eSjoerg 80*06f32e7eSjoerg } // end namespace clang 81*06f32e7eSjoerg 82*06f32e7eSjoerg #endif 83