[all-commits] [llvm/llvm-project] f75b73: [Clang][Attribute] Improve the AST/diagnoses fidel...

黄金橘子猫 via All-commits all-commits at lists.llvm.org
Thu May 25 16:42:28 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f75b73549d4adb7e111444f4144af7bffb532f91
      https://github.com/llvm/llvm-project/commit/f75b73549d4adb7e111444f4144af7bffb532f91
  Author: yronglin <yronglin777 at gmail.com>
  Date:   2023-05-26 (Fri, 26 May 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Parse/Parser.h
    M clang/include/clang/Sema/ParsedAttr.h
    M clang/include/clang/Sema/Sema.h
    M clang/lib/AST/AttrImpl.cpp
    M clang/lib/AST/ExprConstant.cpp
    M clang/lib/Parse/ParseDecl.cpp
    M clang/lib/Sema/SemaDeclAttr.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
    M clang/test/AST/ast-dump-attr.cpp
    M clang/test/Sema/aix-attr-aligned-vector-warn.c
    A clang/test/Sema/aix-attr-aligned-vector-warn.cpp
    M clang/test/Sema/sizeless-1.c
    M clang/test/SemaCXX/attr-cxx0x.cpp
    M clang/test/SemaCXX/builtin-align-cxx.cpp
    M clang/test/SemaCXX/cxx11-attr-print.cpp
    M clang/test/SemaCXX/sizeless-1.cpp
    M clang/utils/TableGen/ClangAttrEmitter.cpp

  Log Message:
  -----------
  [Clang][Attribute] Improve the AST/diagnoses fidelity of alignas and _Alignas

- Fix diagnoses when the argument to `alignas` or `_Alignas` is an incomplete type.

Before:
```
./alignas.cpp:1:15: error: invalid application of 'alignof' to an incomplete type 'void'
class alignas(void) Foo {};
             ~^~~~~
1 error generated.
```
Now:
```
./alignas.cpp:1:15: error: invalid application of 'alignas' to an incomplete type 'void'
class alignas(void) Foo {};
             ~^~~~~
1 error generated.
```

- Improve the AST fidelity of `alignas` and `_Alignas` attribute.

Before:
```
AlignedAttr 0x13f07f278 <col:7> alignas
    `-ConstantExpr 0x13f07f258 <col:15, col:21> 'unsigned long'
      |-value: Int 8
      `-UnaryExprOrTypeTraitExpr 0x13f07f118 <col:15, col:21> 'unsigned long' alignof 'void *'
```

Now:
```
AlignedAttr 0x14288c608 <col:7> alignas 'void *'
```

Reviewed By: erichkeane

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




More information about the All-commits mailing list