Skip to content

Commit

Permalink
[OPENMP] Skip BuildMemberExpr() in BuildFieldReferenceExpr(), NFC, by…
Browse files Browse the repository at this point in the history
… Kai Noda

In the OpenMP mode, we don't need to call BuildMemberExpr() only to discard its
return value. BuildDeclRefExpr() is called instead.

Differential revision: https://reviews.llvm.org/D35201

llvm-svn: 307697
  • Loading branch information
alexey-bataev committed Jul 11, 2017
1 parent 9fd8a63 commit d0c03ca
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions clang/lib/Sema/SemaExprMember.cpp
Expand Up @@ -1842,10 +1842,6 @@ Sema::BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow,
FoundDecl, Field);
if (Base.isInvalid())
return ExprError();
MemberExpr *ME =
BuildMemberExpr(*this, Context, Base.get(), IsArrow, OpLoc, SS,
/*TemplateKWLoc=*/SourceLocation(), Field, FoundDecl,
MemberNameInfo, MemberType, VK, OK);

// Build a reference to a private copy for non-static data members in
// non-static member functions, privatized by OpenMP constructs.
Expand All @@ -1855,7 +1851,10 @@ Sema::BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow,
if (auto *PrivateCopy = IsOpenMPCapturedDecl(Field))
return getOpenMPCapturedExpr(PrivateCopy, VK, OK, OpLoc);
}
return ME;

return BuildMemberExpr(*this, Context, Base.get(), IsArrow, OpLoc, SS,
/*TemplateKWLoc=*/SourceLocation(), Field, FoundDecl,
MemberNameInfo, MemberType, VK, OK);
}

/// Builds an implicit member access expression. The current context
Expand Down

0 comments on commit d0c03ca

Please sign in to comment.