SelectorLocationsKind.h 3.4 KB

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