[all-commits] [llvm/llvm-project] bfa2f2: [C11] Correct the resulting type for an assignment...

Aaron Ballman via All-commits all-commits at lists.llvm.org
Sat Mar 26 05:03:49 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bfa2f25d350c1015b74b8a14684e68efa6500bbc
      https://github.com/llvm/llvm-project/commit/bfa2f25d350c1015b74b8a14684e68efa6500bbc
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2022-03-26 (Sat, 26 Mar 2022)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/AST/Type.h
    M clang/lib/Sema/SemaExpr.cpp
    M clang/test/Sema/atomic-expr.c

  Log Message:
  -----------
  [C11] Correct the resulting type for an assignment expression

In C, assignment expressions result in an rvalue whose type is the type
of the lhs of the assignment after it undergoes lvalue to rvalue
conversion. lvalue to rvalue conversion in C strips all qualifiers
including _Atomic.

We used getUnqualifiedType() which does not strip the _Atomic qualifier
when we should have used getAtomicUnqualifiedType(). This corrects the
usage and adds some comments to getUnqualifiedType() to make it more
clear that it does not strip _Atomic and that's on purpose (see C11
6.2.5p27).

This addresses Issue 48742.




More information about the All-commits mailing list