aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/include/clang/AST/ExprObjC.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/include/clang/AST/ExprObjC.h')
-rw-r--r--contrib/llvm-project/clang/include/clang/AST/ExprObjC.h60
1 files changed, 35 insertions, 25 deletions
diff --git a/contrib/llvm-project/clang/include/clang/AST/ExprObjC.h b/contrib/llvm-project/clang/include/clang/AST/ExprObjC.h
index b0f057dbaa02..f833916c91aa 100644
--- a/contrib/llvm-project/clang/include/clang/AST/ExprObjC.h
+++ b/contrib/llvm-project/clang/include/clang/AST/ExprObjC.h
@@ -27,8 +27,6 @@
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/Specifiers.h"
#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/None.h"
-#include "llvm/ADT/Optional.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/StringRef.h"
@@ -41,6 +39,7 @@
#include <cassert>
#include <cstddef>
#include <cstdint>
+#include <optional>
namespace clang {
@@ -272,7 +271,7 @@ struct ObjCDictionaryElement {
/// The number of elements this pack expansion will expand to, if
/// this is a pack expansion and is known.
- Optional<unsigned> NumExpansions;
+ std::optional<unsigned> NumExpansions;
/// Determines whether this dictionary element is a pack expansion.
bool isPackExpansion() const { return EllipsisLoc.isValid(); }
@@ -318,6 +317,7 @@ class ObjCDictionaryLiteral final
/// key/value pairs, which provide the locations of the ellipses (if
/// any) and number of elements in the expansion (if known). If
/// there are no pack expansions, we optimize away this storage.
+ LLVM_PREFERRED_TYPE(bool)
unsigned HasPackExpansions : 1;
SourceRange Range;
@@ -362,7 +362,8 @@ public:
ObjCDictionaryElement getKeyValueElement(unsigned Index) const {
assert((Index < NumElements) && "Arg access out of range!");
const KeyValuePair &KV = getTrailingObjects<KeyValuePair>()[Index];
- ObjCDictionaryElement Result = { KV.Key, KV.Value, SourceLocation(), None };
+ ObjCDictionaryElement Result = {KV.Key, KV.Value, SourceLocation(),
+ std::nullopt};
if (HasPackExpansions) {
const ExpansionData &Expansion =
getTrailingObjects<ExpansionData>()[Index];
@@ -554,9 +555,11 @@ class ObjCIvarRefExpr : public Expr {
SourceLocation OpLoc;
// True if this is "X->F", false if this is "X.F".
+ LLVM_PREFERRED_TYPE(bool)
bool IsArrow : 1;
// True if ivar reference has no base (self assumed).
+ LLVM_PREFERRED_TYPE(bool)
bool IsFreeIvar : 1;
public:
@@ -940,6 +943,23 @@ private:
class ObjCMessageExpr final
: public Expr,
private llvm::TrailingObjects<ObjCMessageExpr, void *, SourceLocation> {
+public:
+ /// The kind of receiver this message is sending to.
+ enum ReceiverKind {
+ /// The receiver is a class.
+ Class = 0,
+
+ /// The receiver is an object instance.
+ Instance,
+
+ /// The receiver is a superclass.
+ SuperClass,
+
+ /// The receiver is the instance of the superclass object.
+ SuperInstance
+ };
+
+private:
/// Stores either the selector that this message is sending
/// to (when \c HasMethod is zero) or an \c ObjCMethodDecl pointer
/// referring to the method that we type-checked against.
@@ -955,6 +975,7 @@ class ObjCMessageExpr final
/// ReceiverKind values.
///
/// We pad this out to a byte to avoid excessive masking and shifting.
+ LLVM_PREFERRED_TYPE(ReceiverKind)
unsigned Kind : 8;
/// Whether we have an actual method prototype in \c
@@ -962,18 +983,22 @@ class ObjCMessageExpr final
///
/// When non-zero, we have a method declaration; otherwise, we just
/// have a selector.
+ LLVM_PREFERRED_TYPE(bool)
unsigned HasMethod : 1;
/// Whether this message send is a "delegate init call",
/// i.e. a call of an init method on self from within an init method.
+ LLVM_PREFERRED_TYPE(bool)
unsigned IsDelegateInitCall : 1;
/// Whether this message send was implicitly generated by
/// the implementation rather than explicitly written by the user.
+ LLVM_PREFERRED_TYPE(bool)
unsigned IsImplicit : 1;
/// Whether the locations of the selector identifiers are in a
/// "standard" position, a enum SelectorLocationsKind.
+ LLVM_PREFERRED_TYPE(SelectorLocationsKind)
unsigned SelLocsKind : 2;
/// When the message expression is a send to 'super', this is
@@ -1082,21 +1107,6 @@ public:
friend class ASTStmtWriter;
friend TrailingObjects;
- /// The kind of receiver this message is sending to.
- enum ReceiverKind {
- /// The receiver is a class.
- Class = 0,
-
- /// The receiver is an object instance.
- Instance,
-
- /// The receiver is a superclass.
- SuperClass,
-
- /// The receiver is the instance of the superclass object.
- SuperInstance
- };
-
/// Create a message send to super.
///
/// \param Context The ASTContext in which this expression will be created.
@@ -1415,11 +1425,10 @@ public:
SourceLocation getSelectorLoc(unsigned Index) const {
assert(Index < getNumSelectorLocs() && "Index out of range!");
if (hasStandardSelLocs())
- return getStandardSelectorLoc(Index, getSelector(),
- getSelLocsKind() == SelLoc_StandardWithSpace,
- llvm::makeArrayRef(const_cast<Expr**>(getArgs()),
- getNumArgs()),
- RBracLoc);
+ return getStandardSelectorLoc(
+ Index, getSelector(), getSelLocsKind() == SelLoc_StandardWithSpace,
+ llvm::ArrayRef(const_cast<Expr **>(getArgs()), getNumArgs()),
+ RBracLoc);
return getStoredSelLocs()[Index];
}
@@ -1632,6 +1641,7 @@ class ObjCBridgedCastExpr final
SourceLocation LParenLoc;
SourceLocation BridgeKeywordLoc;
+ LLVM_PREFERRED_TYPE(ObjCBridgeCastKind)
unsigned Kind : 2;
public:
@@ -1706,7 +1716,7 @@ public:
/// This may be '*', in which case this should fold to true.
bool hasVersion() const { return !VersionToCheck.empty(); }
- VersionTuple getVersion() { return VersionToCheck; }
+ VersionTuple getVersion() const { return VersionToCheck; }
child_range children() {
return child_range(child_iterator(), child_iterator());