The goal of this change is to clean up some of the code surrounding
HLSL using CXXThisExpr as a non-pointer l-value. This change cleans up
a bunch of assumptions and inconsistencies around how the type of
this is handled through the AST and code generation.
This change is be mostly NFC for HLSL, and completely NFC for other
language modes.
This change introduces a new member to query for the this object's type
and seeks to clarify the normal usages of the this type.
With the introudction of HLSL to clang, CXXThisExpr may now be an
l-value and behave like a reference type rather than C++'s normal
method of it being an r-value of pointer type.
With this change there are now three ways in which a caller might need
to query the type of this:
- The type of the CXXThisExpr
- The type of the object this referrs to
- The type of the implicit (or explicit) this argument
This change codifies those three ways you may need to query
respectively as:
- CXXMethodDecl::getThisType()
- CXXMethodDecl::getThisObjectType()
- CXXMethodDecl::getThisArgType()
This change then revisits all uses of getThisType(), and in cases
where the only use was to resolve the pointee type, it replaces the
call with getThisObjectType(). In other cases it evaluates whether
the desired returned type is the type of the this expr, or the type
of the this function argument. The this expr type is used for
creating additional expr AST nodes and for member lookup, while the
argument type is used mostly for code generation.
Additionally some cases that used getThisType in simple queries could
be substituted for getThisObjectType. Since getThisType is
implemented in terms of getThisObjectType calling the later should be
more efficient if the former isn't needed.
Whitespace only change