Commit 91764583 authored by Hans Wennborg's avatar Hans Wennborg
Browse files

Merging r338749:

------------------------------------------------------------------------
r338749 | mstorsjo | 2018-08-02 20:12:08 +0200 (Thu, 02 Aug 2018) | 6 lines

Work around more GCC miscompiles exposed by r338464.

This is the same fix as in r338478, for another occurrance of the
same pattern from r338464.

See gcc.gnu.org/PR86769 for details of the bug.
------------------------------------------------------------------------

llvm-svn: 338845
parent 8c6b6d11
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -6371,8 +6371,12 @@ static bool implicitObjectParamIsLifetimeBound(const FunctionDecl *FD) {
  const TypeSourceInfo *TSI = FD->getTypeSourceInfo();
  if (!TSI)
    return false;
  // Don't declare this variable in the second operand of the for-statement;
  // GCC miscompiles that by ending its lifetime before evaluating the
  // third operand. See gcc.gnu.org/PR86769.
  AttributedTypeLoc ATL;
  for (TypeLoc TL = TSI->getTypeLoc();
       auto ATL = TL.getAsAdjusted<AttributedTypeLoc>();
       (ATL = TL.getAsAdjusted<AttributedTypeLoc>());
       TL = ATL.getModifiedLoc()) {
    if (ATL.getAttrKind() == AttributedType::attr_lifetimebound)
      return true;