<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/clang/test/Preprocessor/has_attribute.cpp, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[clang] Clear `NeedsCleaning` flag after `ExpandBuiltinMacro` (#133574)</title>
<updated>2025-04-15T19:13:56+00:00</updated>
<author>
<name>marius doerner</name>
<email>marius.doerner1@icloud.com</email>
</author>
<published>2025-04-15T19:13:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=9a1ece26126363c64c67d9a6e357076e814acf9e'/>
<id>9a1ece26126363c64c67d9a6e357076e814acf9e</id>
<content type='text'>
After builtin macro expansion in `Preprocessor::ExpandBuiltinMacro` the
result token may have the `Token::NeedsCleaning` flag set which causes
an assertion failure later on when the lexer retrieves the spelling of
the token in `getSpellingSlow`.

This commit adds an `Tok.clearFlag(Token::NeedsCleaning)` call to the
end of `ExpandBuiltinMacro`.

Closes #128384</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
After builtin macro expansion in `Preprocessor::ExpandBuiltinMacro` the
result token may have the `Token::NeedsCleaning` flag set which causes
an assertion failure later on when the lexer retrieves the spelling of
the token in `getSpellingSlow`.

This commit adds an `Tok.clearFlag(Token::NeedsCleaning)` call to the
end of `ExpandBuiltinMacro`.

Closes #128384</pre>
</div>
</content>
</entry>
<entry>
<title>[Clang] Fix __has_cpp_attribute and C++11 attributes with arguments in C++03 (#83065)</title>
<updated>2024-03-01T14:15:11+00:00</updated>
<author>
<name>Nikolas Klauser</name>
<email>nikolasklauser@berlin.de</email>
</author>
<published>2024-03-01T14:15:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b873847a53ae638e2146e3657fe33efe30c2afe1'/>
<id>b873847a53ae638e2146e3657fe33efe30c2afe1</id>
<content type='text'>
The values for `__has_cpp_attribute` don't have to be guarded behind
`LangOpts.CPlusPlus` because `__has_cpp_attribute` isn't available if
Clang isn't in a C++ mode.

Fixes #82995</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The values for `__has_cpp_attribute` don't have to be guarded behind
`LangOpts.CPlusPlus` because `__has_cpp_attribute` isn't available if
Clang isn't in a C++ mode.

Fixes #82995</pre>
</div>
</content>
</entry>
<entry>
<title>[clang] Fix several issues in the generated AttrHasAttributeImpl.inc</title>
<updated>2023-10-10T06:03:55+00:00</updated>
<author>
<name>Sergei Barannikov</name>
<email>barannikov88@gmail.com</email>
</author>
<published>2023-09-02T02:22:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=79f87be6888d13a94661be9d8908c83dd2229c9b'/>
<id>79f87be6888d13a94661be9d8908c83dd2229c9b</id>
<content type='text'>
1. The generated file contained a lot of duplicate switch cases, e.g.:
```
switch (Syntax) {
case AttributeCommonInfo::Syntax::AS_GNU:
  return llvm::StringSwitch&lt;int&gt;(Name)
...
    .Case("error", 1)
    .Case("warning", 1)
    .Case("error", 1)
    .Case("warning", 1)
```

2. Some attributes were listed in wrong places, e.g.:
```
case AttributeCommonInfo::Syntax::AS_CXX11: {
if (ScopeName == "") {
  return llvm::StringSwitch&lt;int&gt;(Name)
...
    .Case("warn_unused_result", LangOpts.CPlusPlus11 ? 201907 : 0)
```

`warn_unused_result` is a non-standard attribute and should not be
available as [[warn_unused_result]].

3. Some attributes had the wrong version, e.g.:
```
case AttributeCommonInfo::Syntax::AS_CXX11: {
} else if (ScopeName == "gnu") {
  return llvm::StringSwitch&lt;int&gt;(Name)
...
    .Case("fallthrough", LangOpts.CPlusPlus11 ? 201603 : 0)
```

[[gnu::fallthrough]] is a non-standard spelling and should not have the
standard version. Instead, __has_cpp_attribute should return 1 for it.

There is another issue with attributes that share spellings, e.g.:
```
    .Case("interrupt", true &amp;&amp; (T.getArch() == llvm::Triple::arm || ...) ? 1 : 0)
    .Case("interrupt", true &amp;&amp; (T.getArch() == llvm::Triple::avr) ? 1 : 0)
...
    .Case("interrupt", true &amp;&amp; (T.getArch() == llvm::Triple::riscv32 || ...) ? 1 : 0)
```
As can be seen, __has_attribute(interrupt) would only return true for
ARM targets. This patch does not address this issue.

Differential Revision: https://reviews.llvm.org/D159393
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
1. The generated file contained a lot of duplicate switch cases, e.g.:
```
switch (Syntax) {
case AttributeCommonInfo::Syntax::AS_GNU:
  return llvm::StringSwitch&lt;int&gt;(Name)
...
    .Case("error", 1)
    .Case("warning", 1)
    .Case("error", 1)
    .Case("warning", 1)
```

2. Some attributes were listed in wrong places, e.g.:
```
case AttributeCommonInfo::Syntax::AS_CXX11: {
if (ScopeName == "") {
  return llvm::StringSwitch&lt;int&gt;(Name)
...
    .Case("warn_unused_result", LangOpts.CPlusPlus11 ? 201907 : 0)
```

`warn_unused_result` is a non-standard attribute and should not be
available as [[warn_unused_result]].

3. Some attributes had the wrong version, e.g.:
```
case AttributeCommonInfo::Syntax::AS_CXX11: {
} else if (ScopeName == "gnu") {
  return llvm::StringSwitch&lt;int&gt;(Name)
...
    .Case("fallthrough", LangOpts.CPlusPlus11 ? 201603 : 0)
```

[[gnu::fallthrough]] is a non-standard spelling and should not have the
standard version. Instead, __has_cpp_attribute should return 1 for it.

There is another issue with attributes that share spellings, e.g.:
```
    .Case("interrupt", true &amp;&amp; (T.getArch() == llvm::Triple::arm || ...) ? 1 : 0)
    .Case("interrupt", true &amp;&amp; (T.getArch() == llvm::Triple::avr) ? 1 : 0)
...
    .Case("interrupt", true &amp;&amp; (T.getArch() == llvm::Triple::riscv32 || ...) ? 1 : 0)
```
As can be seen, __has_attribute(interrupt) would only return true for
ARM targets. This patch does not address this issue.

Differential Revision: https://reviews.llvm.org/D159393
</pre>
</div>
</content>
</entry>
<entry>
<title>Recommit "Implement [[msvc::no_unique_address]] (#65675)" (#67199)</title>
<updated>2023-09-28T21:29:32+00:00</updated>
<author>
<name>Amy Huang</name>
<email>akhuang@google.com</email>
</author>
<published>2023-09-28T21:29:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=0faee97a924adec76d5c7cd680c289ced51e6b5a'/>
<id>0faee97a924adec76d5c7cd680c289ced51e6b5a</id>
<content type='text'>
This implements the [[msvc::no_unique_address]] attribute.

There is not ABI compatibility in this patch because the attribute is
relatively new and there's still some uncertainty in the MSVC version.

The recommit changes the attribute definitions so that instead of making
two separate attributes for no_unique_address
and msvc::no_unique_address, it modifies the attributes tablegen emitter
to allow spellings to be target-specific.

This reverts commit 71f9e7695b87298f9855d8890f0e6a3b89381eb5.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This implements the [[msvc::no_unique_address]] attribute.

There is not ABI compatibility in this patch because the attribute is
relatively new and there's still some uncertainty in the MSVC version.

The recommit changes the attribute definitions so that instead of making
two separate attributes for no_unique_address
and msvc::no_unique_address, it modifies the attributes tablegen emitter
to allow spellings to be target-specific.

This reverts commit 71f9e7695b87298f9855d8890f0e6a3b89381eb5.</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "Implement [[msvc::no_unique_address]] (#65675)" (#67198)</title>
<updated>2023-09-22T21:39:00+00:00</updated>
<author>
<name>Amy Huang</name>
<email>akhuang@google.com</email>
</author>
<published>2023-09-22T21:39:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=71f9e7695b87298f9855d8890f0e6a3b89381eb5'/>
<id>71f9e7695b87298f9855d8890f0e6a3b89381eb5</id>
<content type='text'>
This reverts commit 4a55d426967b9c70f5dea7b3a389e11393a4f4c4.

Reverting because this breaks sphinx documentation, and even with it
fixed the format of the attribute makes the no_unique_address
documentation show up twice.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 4a55d426967b9c70f5dea7b3a389e11393a4f4c4.

Reverting because this breaks sphinx documentation, and even with it
fixed the format of the attribute makes the no_unique_address
documentation show up twice.</pre>
</div>
</content>
</entry>
<entry>
<title>Implement [[msvc::no_unique_address]] (#65675)</title>
<updated>2023-09-22T20:28:38+00:00</updated>
<author>
<name>Amy Huang</name>
<email>akhuang@google.com</email>
</author>
<published>2023-09-22T20:28:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4a55d426967b9c70f5dea7b3a389e11393a4f4c4'/>
<id>4a55d426967b9c70f5dea7b3a389e11393a4f4c4</id>
<content type='text'>
This implements the [[msvc::no_unique_address]] attribute.

There is not ABI compatibility in this patch because the attribute is
relatively new and there's still some uncertainty in the MSVC version.

Bug: https://github.com/llvm/llvm-project/issues/49358

Also see https://reviews.llvm.org/D157762.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This implements the [[msvc::no_unique_address]] attribute.

There is not ABI compatibility in this patch because the attribute is
relatively new and there's still some uncertainty in the MSVC version.

Bug: https://github.com/llvm/llvm-project/issues/49358

Also see https://reviews.llvm.org/D157762.
</pre>
</div>
</content>
</entry>
<entry>
<title>Lex arguments for __has_cpp_attribute and friends as expanded tokens</title>
<updated>2021-10-17T11:54:48+00:00</updated>
<author>
<name>Aaron Ballman</name>
<email>aaron@aaronballman.com</email>
</author>
<published>2021-10-17T11:54:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=2edb89c746848c52964537268bf03e7906bf2542'/>
<id>2edb89c746848c52964537268bf03e7906bf2542</id>
<content type='text'>
The C and C++ standards require the argument to __has_cpp_attribute and
__has_c_attribute to be expanded ([cpp.cond]p5). It would make little sense
to expand the argument to those operators but not expand the argument to
__has_attribute and __has_declspec, so those were both also changed in this
patch.

Note that it might make sense for the other builtins to also expand their
argument, but it wasn't as clear to me whether the behavior would be correct
there, and so they were left for a future revision.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The C and C++ standards require the argument to __has_cpp_attribute and
__has_c_attribute to be expanded ([cpp.cond]p5). It would make little sense
to expand the argument to those operators but not expand the argument to
__has_attribute and __has_declspec, so those were both also changed in this
patch.

Note that it might make sense for the other builtins to also expand their
argument, but it wasn't as clear to me whether the behavior would be correct
there, and so they were left for a future revision.
</pre>
</div>
</content>
</entry>
<entry>
<title>[Sema, CodeGen] Implement [[likely]] and [[unlikely]] in SwitchStmt</title>
<updated>2020-10-18T11:48:42+00:00</updated>
<author>
<name>Mark de Wever</name>
<email>koraq@xs4all.nl</email>
</author>
<published>2020-10-18T11:34:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=2bcda6bb2896f0f8daf67343edfc64fb226f3e3f'/>
<id>2bcda6bb2896f0f8daf67343edfc64fb226f3e3f</id>
<content type='text'>
This implements the likelihood attribute for the switch statement. Based on the
discussion in D85091 and D86559 it only handles the attribute when placed on
the case labels or the default labels.

It also marks the likelihood attribute as feature complete. There are more QoI
patches in the pipeline.

Differential Revision: https://reviews.llvm.org/D89210</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This implements the likelihood attribute for the switch statement. Based on the
discussion in D85091 and D86559 it only handles the attribute when placed on
the case labels or the default labels.

It also marks the likelihood attribute as feature complete. There are more QoI
patches in the pipeline.

Differential Revision: https://reviews.llvm.org/D89210</pre>
</div>
</content>
</entry>
<entry>
<title>Implements [[likely]] and [[unlikely]] in IfStmt.</title>
<updated>2020-09-09T18:48:37+00:00</updated>
<author>
<name>Mark de Wever</name>
<email>koraq@xs4all.nl</email>
</author>
<published>2020-09-09T17:12:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=08196e0b2e1f8aaa8a854585335c17ba479114df'/>
<id>08196e0b2e1f8aaa8a854585335c17ba479114df</id>
<content type='text'>
This is the initial part of the implementation of the C++20 likelihood
attributes. It handles the attributes in an if statement.

Differential Revision: https://reviews.llvm.org/D85091
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is the initial part of the implementation of the C++20 likelihood
attributes. It handles the attributes in an if statement.

Differential Revision: https://reviews.llvm.org/D85091
</pre>
</div>
</content>
</entry>
<entry>
<title>Allow standards-based attributes to have leading and trailing underscores.</title>
<updated>2019-08-15T18:35:44+00:00</updated>
<author>
<name>Aaron Ballman</name>
<email>aaron@aaronballman.com</email>
</author>
<published>2019-08-15T18:35:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=2ed4573e8f8619dc67647256ac070bf91f461392'/>
<id>2ed4573e8f8619dc67647256ac070bf91f461392</id>
<content type='text'>
This gives library implementers a way to use standards-based attributes that do not conflict with user-defined macros of the same name. Attributes in C2x require this behavior normatively (C2x 6.7.11p4), but there's no reason to not have the same behavior in C++, especially given that such attributes may be used by a C library consumed by a C++ compilation.

llvm-svn: 369033
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This gives library implementers a way to use standards-based attributes that do not conflict with user-defined macros of the same name. Attributes in C2x require this behavior normatively (C2x 6.7.11p4), but there's no reason to not have the same behavior in C++, especially given that such attributes may be used by a C library consumed by a C++ compilation.

llvm-svn: 369033
</pre>
</div>
</content>
</entry>
</feed>
