[all-commits] [llvm/llvm-project] 3caedf: [clang] Fix pretty-printing assume_aligned attribu...

Balazs Benics via All-commits all-commits at lists.llvm.org
Tue Sep 26 07:55:18 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3caedfd1f2f012738fbd86008e190b95673e605c
      https://github.com/llvm/llvm-project/commit/3caedfd1f2f012738fbd86008e190b95673e605c
  Author: Balazs Benics <benicsbalazs at gmail.com>
  Date:   2023-09-26 (Tue, 26 Sep 2023)

  Changed paths:
    M clang/test/AST/attr-print-emit.cpp
    M clang/utils/TableGen/ClangAttrEmitter.cpp

  Log Message:
  -----------
  [clang] Fix pretty-printing assume_aligned attributes (#67331)

Inside `writePrettyPrintFunction()`, we check if we need to emit the
given argument:
```C++
if (!arg->isOptional() || arg->getIsOmitted() == "false") {
    FoundNonOptArg = true;
    continue;
}
```
For the `AssumeAligned` attribute, the second argument was optional, but
the `getIsOmitted()` returned `false`, thus we treated this argument as
**non-optional** in the end because of that disjunction.

It was because `getIsOmitted()` did not account for `Expr *` type, and
returned `false` on the fallthrough branch.

Fixes #67156




More information about the All-commits mailing list