[all-commits] [llvm/llvm-project] 956582: [Sema] Iteratively strip sugar when removing addre...

Gousemoodhin Nadaf via All-commits all-commits at lists.llvm.org
Tue Aug 11 08:30:59 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 956582aa165804dd8335879c3a7f833901e5424c
      https://github.com/llvm/llvm-project/commit/956582aa165804dd8335879c3a7f833901e5424c
  Author: Bevin Hansson <bevin.hansson at ericsson.com>
  Date:   2020-08-11 (Tue, 11 Aug 2020)

  Changed paths:
    M clang/lib/AST/ASTContext.cpp
    M clang/test/CodeGenCXX/address-space-cast.cpp

  Log Message:
  -----------
  [Sema] Iteratively strip sugar when removing address spaces.

ASTContext::removeAddrSpaceQualType does not properly deal
with sugar. QualTypes derive their ASes from the AS on the
canonical type, not the type itself. However,
removeAddrSpaceQualType only strips the outermost qualifiers,
which means that it can fail to remove addrspace qualifiers
if there is sugar in the way.

Change the function to desugar types until the address space
really no longer exists on the corresponding QualType. This
should guarantee the removal of the address space.

This fixes the erroneous behavior in D62574.

Reviewed By: rjmccall, svenvh

Differential Revision: https://reviews.llvm.org/D83325


  Commit: d4408fe17f33bcd664ec8f468abfd1094e84a7c1
      https://github.com/llvm/llvm-project/commit/d4408fe17f33bcd664ec8f468abfd1094e84a7c1
  Author: Gousemoodhin Nadaf <nadafgouse5 at gmail.com>
  Date:   2020-08-11 (Tue, 11 Aug 2020)

  Changed paths:
    M clang/lib/Sema/SemaExpr.cpp
    M clang/test/Frontend/fixed_point_errors.c

  Log Message:
  -----------
  [clang] Do not crash for unsupported fixed point to floating point conversion

- Fixed point to floating point conversion is unimplemented.
- If one of the operands has a floating type and the other operand has a fixed-point type, the function
   handleFloatConversion() is called because one of the operands has a floating type, but we do not handle fixed
   point type in this function (Implementation of fixed point to floating point conversion is missing), due to this
   compiler crashes. In order to avoid compiler crash, when one of the operands has a floating type and the other
   operand has a fixed-point type, return NULL.
- FIXME: Implementation of fixed point to floating point conversion.
- I am going to resolve FIXME in followup patches.
- Add the test case.

Reviewed By: ebevhan

Differential Revision: https://reviews.llvm.org/D81904


Compare: https://github.com/llvm/llvm-project/compare/1470ce4a76fc...d4408fe17f33


More information about the All-commits mailing list