[libc-commits] [libc] [libc][hdrgen] Extend guard attribute support for types (PR #191663)
Victor Campos via libc-commits
libc-commits at lists.llvm.org
Tue Apr 14 03:24:15 PDT 2026
================
@@ -295,32 +315,11 @@ def public_api(self):
# elide the blank line between the declarations.
if last_name == function.name_without_underscores():
content.pop()
- if function.guard == None and current_guard == None:
- content.append(str(function) + " __NOEXCEPT;")
- content.append("")
- else:
- if current_guard == None:
- current_guard = function.guard
- content.append(f"#ifdef {current_guard}")
- content.append(str(function) + " __NOEXCEPT;")
- content.append("")
- elif current_guard == function.guard:
- content.append(str(function) + " __NOEXCEPT;")
- content.append("")
- else:
- content.pop()
- content.append(f"#endif // {current_guard}")
- content.append("")
- current_guard = function.guard
- if current_guard is not None:
- content.append(f"#ifdef {current_guard}")
- content.append(str(function) + " __NOEXCEPT;")
- content.append("")
- last_name = function.name_without_underscores()
- if current_guard != None:
- content.pop()
- content.append(f"#endif // {current_guard}")
+ current_guard = self.__emit_guard(content, current_guard, function.guard)
----------------
vhscampos wrote:
Based on my other comment, this would look like this:
```python
self.emit_guard(content, current_guard, function.guard)
current_guard = function.guard
```
https://github.com/llvm/llvm-project/pull/191663
More information about the libc-commits
mailing list