forked from OSchip/llvm-project
<rdar://problem/13170740> Be a little more careful when instantiating 'this' expressions.
llvm-svn: 176731
This commit is contained in:
parent
058927b8d4
commit
f9b76cd8b5
|
@ -7167,9 +7167,14 @@ TreeTransform<Derived>::TransformCXXThisExpr(CXXThisExpr *E) {
|
|||
QualType T;
|
||||
if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(DC))
|
||||
T = MD->getThisType(getSema().Context);
|
||||
else
|
||||
else if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(DC)) {
|
||||
T = getSema().Context.getPointerType(
|
||||
getSema().Context.getRecordType(cast<CXXRecordDecl>(DC)));
|
||||
getSema().Context.getRecordType(Record));
|
||||
} else {
|
||||
assert(SemaRef.Context.getDiagnostics().hasErrorOccurred() &&
|
||||
"this in the wrong scope?");
|
||||
return ExprError();
|
||||
}
|
||||
|
||||
if (!getDerived().AlwaysRebuild() && T == E->getType()) {
|
||||
// Make sure that we capture 'this'.
|
||||
|
|
Loading…
Reference in New Issue