Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:41

0001 //===--- SelectorLocationsKind.h - Kind of selector locations ---*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // Describes whether the identifier locations for a selector are "standard"
0010 // or not.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_CLANG_AST_SELECTORLOCATIONSKIND_H
0015 #define LLVM_CLANG_AST_SELECTORLOCATIONSKIND_H
0016 
0017 #include "clang/Basic/LLVM.h"
0018 
0019 namespace clang {
0020   class Selector;
0021   class SourceLocation;
0022   class Expr;
0023   class ParmVarDecl;
0024 
0025 /// Whether all locations of the selector identifiers are in a
0026 /// "standard" position.
0027 enum SelectorLocationsKind {
0028   /// Non-standard.
0029   SelLoc_NonStandard = 0,
0030 
0031   /// For nullary selectors, immediately before the end:
0032   ///    "[foo release]" / "-(void)release;"
0033   /// Or immediately before the arguments:
0034   ///    "[foo first:1 second:2]" / "-(id)first:(int)x second:(int)y;
0035   SelLoc_StandardNoSpace = 1,
0036 
0037   /// For nullary selectors, immediately before the end:
0038   ///    "[foo release]" / "-(void)release;"
0039   /// Or with a space between the arguments:
0040   ///    "[foo first: 1 second: 2]" / "-(id)first: (int)x second: (int)y;
0041   SelLoc_StandardWithSpace = 2
0042 };
0043 
0044 /// Returns true if all \p SelLocs are in a "standard" location.
0045 SelectorLocationsKind hasStandardSelectorLocs(Selector Sel,
0046                                               ArrayRef<SourceLocation> SelLocs,
0047                                               ArrayRef<Expr *> Args,
0048                                               SourceLocation EndLoc);
0049 
0050 /// Get the "standard" location of a selector identifier, e.g:
0051 /// For nullary selectors, immediately before ']': "[foo release]"
0052 ///
0053 /// \param WithArgSpace if true the standard location is with a space apart
0054 /// before arguments: "[foo first: 1 second: 2]"
0055 /// If false: "[foo first:1 second:2]"
0056 SourceLocation getStandardSelectorLoc(unsigned Index,
0057                                       Selector Sel,
0058                                       bool WithArgSpace,
0059                                       ArrayRef<Expr *> Args,
0060                                       SourceLocation EndLoc);
0061 
0062 /// Returns true if all \p SelLocs are in a "standard" location.
0063 SelectorLocationsKind hasStandardSelectorLocs(Selector Sel,
0064                                               ArrayRef<SourceLocation> SelLocs,
0065                                               ArrayRef<ParmVarDecl *> Args,
0066                                               SourceLocation EndLoc);
0067 
0068 /// Get the "standard" location of a selector identifier, e.g:
0069 /// For nullary selectors, immediately before ']': "[foo release]"
0070 ///
0071 /// \param WithArgSpace if true the standard location is with a space apart
0072 /// before arguments: "-(id)first: (int)x second: (int)y;"
0073 /// If false: "-(id)first:(int)x second:(int)y;"
0074 SourceLocation getStandardSelectorLoc(unsigned Index,
0075                                       Selector Sel,
0076                                       bool WithArgSpace,
0077                                       ArrayRef<ParmVarDecl *> Args,
0078                                       SourceLocation EndLoc);
0079 
0080 } // end namespace clang
0081 
0082 #endif