[all-commits] [llvm/llvm-project] 5e28af: [C] Fix parsing of [[clang::assume]] (#141747)

Aaron Ballman via All-commits all-commits at lists.llvm.org
Wed May 28 07:07:37 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5e28af04f32455f93975e227d08f502faa45247c
      https://github.com/llvm/llvm-project/commit/5e28af04f32455f93975e227d08f502faa45247c
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2025-05-28 (Wed, 28 May 2025)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Parse/Parser.h
    M clang/lib/Parse/ParseDecl.cpp
    M clang/lib/Parse/ParseDeclCXX.cpp
    A clang/test/Sema/assume.c

  Log Message:
  -----------
  [C] Fix parsing of [[clang::assume]] (#141747)

The assumption attribute is exposed with a Clang spelling, which means
we support __attribute__((assume)) as well as [[clang::assume]] as
spellings for the attribute.

In C++, the [[clang::assume]] spelling worked as expected. In C, that
spelling would emit an "unknown attribute ignored" diagnostic. This was
happening because we were failing to pass in the scope name and source
location when creating the attribute. In C++, this worked by chance
because [[assume]] is a known attribute in C++. But in C, where there is
thankfully no [[assume]] standard attribute, the lack of a scope meant
we would set the attribute kind to "unknown".



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list