clang 8.0.0

Classes | Public Member Functions | List of all members
clang::sema::FunctionScopeInfo::WeakObjectProfileTy Class Reference

Represents a simple identification of a weak object. More...

`#include "clang/Sema/ScopeInfo.h"`

## Classes
class | DenseMapInfo

## Public Member Functions
| WeakObjectProfileTy (const ObjCPropertyRefExpr *RE)
| WeakObjectProfileTy (const Expr *Base, const ObjCPropertyDecl *Property)
| WeakObjectProfileTy (const DeclRefExpr *RE)
| WeakObjectProfileTy (const ObjCIvarRefExpr *RE)
const NamedDecl * | getBase () const
const NamedDecl * | getProperty () const
bool | isExactProfile () const
| Returns true if the object base specifies a known object in memory, rather than, say, an instance variable or property of another object. More...
bool | operator== (const WeakObjectProfileTy &Other) const

## Detailed Description

Represents a simple identification of a weak object.

Part of the implementation of -Wrepeated-use-of-weak.

This is used to determine if two weak accesses refer to the same object. Here are some examples of how various accesses are "profiled":

Access Expression | "Base" Decl | "Property" Decl
--- | --- | ---
self.property | self (VarDecl) | property (ObjCPropertyDecl)
self.implicitProp | self (VarDecl) | -implicitProp (ObjCMethodDecl)
self->ivar.prop | ivar (ObjCIvarDecl) | prop (ObjCPropertyDecl)
cxxObj.obj.prop | obj (FieldDecl) | prop (ObjCPropertyDecl)
[self foo].prop | 0 (unknown) | prop (ObjCPropertyDecl)
self.prop1.prop2 | prop1 (ObjCPropertyDecl) | prop2 (ObjCPropertyDecl)
MyClass.prop | MyClass (ObjCInterfaceDecl) | -prop (ObjCMethodDecl)
MyClass.foo.prop | +foo (ObjCMethodDecl) | -prop (ObjCPropertyDecl)
weakVar | 0 (known) | weakVar (VarDecl)
self->weakIvar | self (VarDecl) | weakIvar (ObjCIvarDecl)

Objects are identified with only two Decls to make it reasonably fast to compare them.

Definition at line 244 of file ScopeInfo.h.

## Constructor & Destructor Documentation

## ◆ WeakObjectProfileTy() [1/4]

FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy | ( | const ObjCPropertyRefExpr * | RE | ) |

Definition at line 131 of file ScopeInfo.cpp.

References clang::ObjCPropertyRefExpr::getBase(), clang::ObjCPropertyRefExpr::getClassReceiver(), clang::OpaqueValueExpr::getSourceExpr(), clang::ObjCPropertyRefExpr::isClassReceiver(), clang::ObjCPropertyRefExpr::isObjectReceiver(), clang::ObjCPropertyRefExpr::isSuperReceiver(), and clang::Property.

## ◆ WeakObjectProfileTy() [2/4]

FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy | ( | const Expr * | Base,
|  | const ObjCPropertyDecl * | Property
| ) |  |

Definition at line 146 of file ScopeInfo.cpp.

## ◆ WeakObjectProfileTy() [3/4]

FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy | ( | const DeclRefExpr * | RE | ) |

Definition at line 154 of file ScopeInfo.cpp.

## ◆ WeakObjectProfileTy() [4/4]

FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy | ( | const ObjCIvarRefExpr * | RE | ) |

Definition at line 160 of file ScopeInfo.cpp.

## Member Function Documentation

## ◆ getBase()

const NamedDecl* clang::sema::FunctionScopeInfo::WeakObjectProfileTy::getBase | ( |  | ) | const
| inline

Definition at line 272 of file ScopeInfo.h.

## ◆ getProperty()

const NamedDecl* clang::sema::FunctionScopeInfo::WeakObjectProfileTy::getProperty | ( |  | ) | const
| inline

Definition at line 273 of file ScopeInfo.h.

## ◆ isExactProfile()

bool clang::sema::FunctionScopeInfo::WeakObjectProfileTy::isExactProfile | ( |  | ) | const
| inline

Returns true if the object base specifies a known object in memory, rather than, say, an instance variable or property of another object.

Note that this ignores the effects of aliasing; that is, `foo.bar` is considered an exact profile if `foo` is a local variable, even if another variable `foo2` refers to the same object as `foo`.

For increased precision, accesses with base variables that are properties or ivars of 'self' (e.g. self.prop1.prop2) are considered to be exact, though this is not true for arbitrary variables (foo.prop1.prop2).

Definition at line 286 of file ScopeInfo.h.

## ◆ operator==()

bool clang::sema::FunctionScopeInfo::WeakObjectProfileTy::operator== | ( | const WeakObjectProfileTy & | Other | ) | const
| inline

Definition at line 290 of file ScopeInfo.h.

The documentation for this class was generated from the following files:

- include/clang/Sema/ScopeInfo.h
- lib/Sema/ScopeInfo.cpp