[clang-tools-extra] [clang-tools-extra] Add include mappings for getopt.h (PR #140726)

2025-05-21 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `fuchsia-x86_64-linux` 
running on `fuchsia-debian-64-us-central1-a-1` while building 
`clang-tools-extra` at step 4 "annotate".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/11/builds/15608


Here is the relevant piece of the build log for the reference

```
Step 4 (annotate) failure: 'python 
../llvm-zorg/zorg/buildbot/builders/annotated/fuchsia-linux.py ...' (failure)
...
[274/2504] Copying CXX header __bit/bit_log2.h
[275/2504] Copying CXX header __algorithm/minmax_element.h
[276/2504] Copying CXX header __algorithm/stable_partition.h
[277/2504] Generating header strings.h from 
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/strings.yaml
[278/2504] Generating header fenv.h from 
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/fenv.yaml
[279/2504] Generating header uchar.h from 
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/uchar.yaml
[280/2504] Generating header complex.h from 
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/complex.yaml
[281/2504] Generating header locale.h from 
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/locale.yaml
[282/2504] Generating header setjmp.h from 
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/setjmp.yaml
[283/2504] Building CXX object 
libc/src/string/CMakeFiles/libc.src.string.strstr.dir/strstr.cpp.obj
FAILED: libc/src/string/CMakeFiles/libc.src.string.strstr.dir/strstr.cpp.obj 
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-_t5b9pf0/./bin/clang++ 
--target=armv7em-none-eabi -DLIBC_NAMESPACE=__llvm_libc_21_0_0_git 
-I/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc -isystem 
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-_t5b9pf0/include/armv7em-unknown-none-eabi
 --target=armv7em-none-eabi -Wno-atomic-alignment "-Dvfprintf(stream, format, 
vlist)=vprintf(format, vlist)" "-Dfprintf(stream, format, ...)=printf(format)" 
-D_LIBCPP_PRINT=1 -mthumb -fPIC -fno-semantic-interposition 
-fvisibility-inlines-hidden -Werror=date-time 
-Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter 
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough 
-Wcovered-switch-default -Wno-noexcept-type -Wno-unnecessary-virtual-specifier 
-Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override 
-Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported 
-ffunction-sections -fdata-sections 
-ffile-prefix-map=/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-_t5b9pf0/runtimes/runtimes-armv7em-none-eabi-bins=../../../../llvm-project
 -ffile-prefix-map=/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/= 
-no-canonical-prefixes -Os -DNDEBUG --target=armv7em-none-eabi 
-DLIBC_QSORT_IMPL=LIBC_QSORT_HEAP_SORT -DLIBC_TYPES_TIME_T_IS_32_BIT 
-DLIBC_ADD_NULL_CHECKS "-DLIBC_MATH=(LIBC_MATH_SKIP_ACCURATE_PASS | 
LIBC_MATH_SMALL_TABLES)" -fpie -ffreestanding -DLIBC_FULL_BUILD -nostdlibinc 
-ffixed-point -fno-builtin -fno-exceptions -fno-lax-vector-conversions 
-fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti 
-ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -Wall -Wextra -Werror 
-Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions 
-Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough 
-Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path 
-Wstrict-prototypes -Wthread-safety -Wglobal-constructors 
-DLIBC_COPT_PUBLIC_PACKAGING -MD -MT 
libc/src/string/CMakeFiles/libc.src.string.strstr.dir/strstr.cpp.obj -MF 
libc/src/string/CMakeFiles/libc.src.string.strstr.dir/strstr.cpp.obj.d -o 
libc/src/string/CMakeFiles/libc.src.string.strstr.dir/strstr.cpp.obj -c 
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/src/string/strstr.cpp
In file included from 
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/src/string/strstr.cpp:13:
In file included from 
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/src/string/memory_utils/inline_strstr.h:15:
In file included from 
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/src/string/string_utils.h:22:
In file included from 
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/src/string/memory_utils/inline_bzero.h:15:
In file included from 
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/src/string/memory_utils/inline_memset.h:14:
In file included from 
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/src/string/memory_utils/utils.h:15:
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/src/__support/endian_internal.h:43:13:
 error: unknown type name 'uint8_t'
   43 | LIBC_INLINE uint8_t
  | ^
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/src/__support/endian_internal.h:44:48:
 error: use of undeclared identifier 'uint8_t'
   44 | Endian<__ORDER_LITTLE_ENDIAN__

[clang-tools-extra] [clang-tools-extra] Add include mappings for getopt.h (PR #140726)

2025-05-21 Thread Daan De Meyer via cfe-commits

DaanDeMeyer wrote:

> unfortunately neither is used by include-cleaner. we only support mappings 
> for c++ STL, through 
> https://github.com/llvm/llvm-project/blob/main/clang/lib/Tooling/Inclusions/Stdlib/StdSymbolMap.inc
>  and friends.
> 
> we didn't want to add any system specific libraries, especially based on file 
> path mappings, because some of these are platform-specific and dependent on 
> the version of the library. Hence we were worried about accuracy.
> 
> you can use `-ignore-headers` to prevent analysis for such headers (e.g. 
> `-ignore-headers=/usr/lib/.*`), or we might actually be more clever in 
> include-cleaner and try to disable these based on system-headerness of a 
> header, but that's also a losing battle since people can have various include 
> search paths in their command line.
> 
> (still happy to land this once you ack the message though, as it should be an 
> improvement for other tools)

Sure, makes sense to me, but yeah, this will still be useful for other tools, 
so feel free to land.

https://github.com/llvm/llvm-project/pull/140726
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tools-extra] Add include mappings for getopt.h (PR #140726)

2025-05-21 Thread kadir çetinkaya via cfe-commits

kadircet wrote:

unfortunately neither is used by include-cleaner. we only support mappings for 
c++ STL, through 
https://github.com/llvm/llvm-project/blob/main/clang/lib/Tooling/Inclusions/Stdlib/StdSymbolMap.inc
 and friends.

we didn't want to add any system specific libraries, especially based on file 
path mappings, because some of these are platform-specific and dependent on the 
version of the library. Hence we were worried about accuracy.

you can use `-ignore-headers` to prevent analysis for such headers (e.g. 
`-ignore-headers=/usr/lib/.*`), or we might actually be more clever in 
include-cleaner and try to disable these based on system-headerness of a 
header, but that's also a losing battle since people can have various include 
search paths in their command line.

(still happy to land this once you ack the message though, as it should be an 
improvement for other tools)

https://github.com/llvm/llvm-project/pull/140726
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tools-extra] Add include mappings for getopt.h (PR #140726)

2025-05-20 Thread via cfe-commits

llvmbot wrote:



@llvm/pr-subscribers-clang-tools-extra

@llvm/pr-subscribers-clangd

Author: Daan De Meyer (DaanDeMeyer)


Changes



---
Full diff: https://github.com/llvm/llvm-project/pull/140726.diff


2 Files Affected:

- (modified) 
clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp 
(+3) 
- (modified) clang-tools-extra/clangd/index/CanonicalIncludes.cpp (+3) 


``diff
diff --git 
a/clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
 
b/clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
index 469323f0ee9d7..5b6919d446304 100644
--- 
a/clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
+++ 
b/clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
@@ -606,6 +606,9 @@ const HeaderMapCollector::RegexHeaderMap 
*getSTLPostfixHeaderMap() {
   {"sys/xattr.h$", ""},
   {"bits/epoll.h$", ""},
   {"bits/eventfd.h$", ""},
+  {"bits/getopt_core.h$", ""},
+  {"bits/getopt_ext.h$", ""},
+  {"bits/getopt_posix.h$", ""},
   {"bits/inotify.h$", ""},
   {"bits/ipc.h$", ""},
   {"bits/ipctypes.h$", ""},
diff --git a/clang-tools-extra/clangd/index/CanonicalIncludes.cpp 
b/clang-tools-extra/clangd/index/CanonicalIncludes.cpp
index 785ec4086ea76..e3518e9beb6d2 100644
--- a/clang-tools-extra/clangd/index/CanonicalIncludes.cpp
+++ b/clang-tools-extra/clangd/index/CanonicalIncludes.cpp
@@ -621,6 +621,9 @@ const std::pair 
IncludeMappings[] = {
 {"sys/xattr.h", ""},
 {"bits/epoll.h", ""},
 {"bits/eventfd.h", ""},
+{"bits/getopt_core.h", ""},
+{"bits/getopt_ext.h", ""},
+{"bits/getopt_posix.h", ""},
 {"bits/inotify.h", ""},
 {"bits/ipc.h", ""},
 {"bits/ipctypes.h", ""},

``




https://github.com/llvm/llvm-project/pull/140726
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tools-extra] Add include mappings for getopt.h (PR #140726)

2025-05-20 Thread Daan De Meyer via cfe-commits

DaanDeMeyer wrote:

@kadircet Do you know if either of these two mappings get used by 
clang-include-cleaner? I couldn't find out where it does the mapping from glibc 
internal headers to public ones.

https://github.com/llvm/llvm-project/pull/140726
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tools-extra] Add include mappings for getopt.h (PR #140726)

2025-05-20 Thread Daan De Meyer via cfe-commits

https://github.com/DaanDeMeyer created 
https://github.com/llvm/llvm-project/pull/140726

None

>From 6345651bcbcee651922b04121662763e4cec48a3 Mon Sep 17 00:00:00 2001
From: Daan De Meyer 
Date: Tue, 20 May 2025 15:05:21 +0200
Subject: [PATCH] [clang-tools-extra] Add include mappings for getopt.h

---
 .../find-all-symbols/STLPostfixHeaderMap.cpp   | 3 +++
 clang-tools-extra/clangd/index/CanonicalIncludes.cpp   | 3 +++
 2 files changed, 6 insertions(+)

diff --git 
a/clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
 
b/clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
index 469323f0ee9d7..5b6919d446304 100644
--- 
a/clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
+++ 
b/clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
@@ -606,6 +606,9 @@ const HeaderMapCollector::RegexHeaderMap 
*getSTLPostfixHeaderMap() {
   {"sys/xattr.h$", ""},
   {"bits/epoll.h$", ""},
   {"bits/eventfd.h$", ""},
+  {"bits/getopt_core.h$", ""},
+  {"bits/getopt_ext.h$", ""},
+  {"bits/getopt_posix.h$", ""},
   {"bits/inotify.h$", ""},
   {"bits/ipc.h$", ""},
   {"bits/ipctypes.h$", ""},
diff --git a/clang-tools-extra/clangd/index/CanonicalIncludes.cpp 
b/clang-tools-extra/clangd/index/CanonicalIncludes.cpp
index 785ec4086ea76..e3518e9beb6d2 100644
--- a/clang-tools-extra/clangd/index/CanonicalIncludes.cpp
+++ b/clang-tools-extra/clangd/index/CanonicalIncludes.cpp
@@ -621,6 +621,9 @@ const std::pair 
IncludeMappings[] = {
 {"sys/xattr.h", ""},
 {"bits/epoll.h", ""},
 {"bits/eventfd.h", ""},
+{"bits/getopt_core.h", ""},
+{"bits/getopt_ext.h", ""},
+{"bits/getopt_posix.h", ""},
 {"bits/inotify.h", ""},
 {"bits/ipc.h", ""},
 {"bits/ipctypes.h", ""},

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits