[PATCH] D140250: Define NULL in its own header

2023-09-07 Thread Ian Anderson via Phabricator via cfe-commits
iana abandoned this revision.
iana added a comment.

This was succeeded by D158709 .


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-25 Thread Ian Anderson via Phabricator via cfe-commits
iana planned changes to this revision.
iana added a comment.

In D140250#4081133 , @iana wrote:

> In D140250#4081119 , @rsmith wrote:
>
>> In D140250#4081102 , @rsmith wrote:
>>
>>> Our builtin header `stddef.h` shouldn't be built as a module. It 
>>> fundamentally needs to be treated as a textual header, because it consumes 
>>> macros defined by the includer. The module map that we provide with our 
>>> builtin headers does not cover `stddef.h` for that reason.
>>
>> That said... the ` __has_feature(modules)` checks throughout `stddef.h` look 
>> pretty wrong to me. They're probably working around the infelicities of the 
>> `-fno-modules-local-submodule-visibility` mode; maybe we can disable them 
>> when not in that mode?
>
> It ends up being covered by `Darwin.C.stddef` on Apple platforms (due to some 
> builtin shenanigans elsewhere in clang). Maybe we could make stddef.h be a 
> `textual` header in a `_Builtin_stddef` module in clang and that would do the 
> trick instead of splitting it into a bunch of different files.

This seems to work in initial testing. I'll probably drop this diff and make a 
new one to make stddef.h be a `textual` header in a new `_Builtin_stddef` 
module in clang when I do some more testing then.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-25 Thread Ian Anderson via Phabricator via cfe-commits
iana added a comment.

In D140250#4081119 , @rsmith wrote:

> In D140250#4081102 , @rsmith wrote:
>
>> Our builtin header `stddef.h` shouldn't be built as a module. It 
>> fundamentally needs to be treated as a textual header, because it consumes 
>> macros defined by the includer. The module map that we provide with our 
>> builtin headers does not cover `stddef.h` for that reason.
>
> That said... the ` __has_feature(modules)` checks throughout `stddef.h` look 
> pretty wrong to me. They're probably working around the infelicities of the 
> `-fno-modules-local-submodule-visibility` mode; maybe we can disable them 
> when not in that mode?

It ends up being covered by `Darwin.C.stddef` on Apple platforms (due to some 
builtin shenanigans elsewhere in clang). Maybe we could make stddef.h be a 
`textual` header in a `_Builtin_stddef` module in clang and that would do the 
trick instead of splitting it into a bunch of different files.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-25 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment.

In D140250#4081102 , @rsmith wrote:

> Our builtin header `stddef.h` shouldn't be built as a module. It 
> fundamentally needs to be treated as a textual header, because it consumes 
> macros defined by the includer. The module map that we provide with our 
> builtin headers does not cover `stddef.h` for that reason.

That said... the ` __has_feature(modules)` checks throughout `stddef.h` look 
pretty wrong to me. They're probably working around the infelicities of the 
`-fno-modules-local-submodule-visibility` mode; maybe we can disable them when 
not in that mode?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-25 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment.

In D140250#4081009 , @iana wrote:

> In D140250#4080990 , @rsmith wrote:
>
>> Wait a second... if an OS wants only `NULL`, we already have a supported way 
>> of achieving that, which is compatible with GCC and glibc and other POSIX 
>> compilers -- define `__need_NULL` before including the header.
>>
>> We shouldn't be providing internal headers with `__mangled_names` for OSes 
>> to include, those should be implementation details.
>
> You can't do that with modules though, `#define __need_NULL #include 
> ` doesn't work.

Our builtin header `stddef.h` shouldn't be built as a module. It fundamentally 
needs to be treated as a textual header, because it consumers macros defined by 
the includer. The module map that we provide with our builtin headers does not 
cover `stddef.h` for that reason.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-25 Thread Ian Anderson via Phabricator via cfe-commits
iana added a comment.

In D140250#4081044 , @aaron.ballman 
wrote:

> In D140250#4081009 , @iana wrote:
>
>> In D140250#4080990 , @rsmith wrote:
>>
>>> Wait a second... if an OS wants only `NULL`, we already have a supported 
>>> way of achieving that, which is compatible with GCC and glibc and other 
>>> POSIX compilers -- define `__need_NULL` before including the header.
>>>
>>> We shouldn't be providing internal headers with `__mangled_names` for OSes 
>>> to include, those should be implementation details.
>>
>> You can't do that with modules though, `#define __need_NULL #include 
>> ` doesn't work.
>
> Also, from the patch summary: ` i.e. in POSIX headers that are required to 
> define NULL but not the rest of stddef.h.` -- I don't think `__need_NULL` 
> works for this because it gets you `NULL` but it also gets you the rest of 
> the stddef.h header, right?

Once you set one of the `__need` macros, then stddef.h will //only// give you 
those definitions. (Or I'm interpreting the file gravely wrong... it's kind of 
a weird header and its customizations don't really work with modules either.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-25 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D140250#4081009 , @iana wrote:

> In D140250#4080990 , @rsmith wrote:
>
>> Wait a second... if an OS wants only `NULL`, we already have a supported way 
>> of achieving that, which is compatible with GCC and glibc and other POSIX 
>> compilers -- define `__need_NULL` before including the header.
>>
>> We shouldn't be providing internal headers with `__mangled_names` for OSes 
>> to include, those should be implementation details.
>
> You can't do that with modules though, `#define __need_NULL #include 
> ` doesn't work.

Also, from the patch summary: ` i.e. in POSIX headers that are required to 
define NULL but not the rest of stddef.h.` -- I don't think `__need_NULL` works 
for this because it gets you `NULL` but it also gets you the rest of the 
stddef.h header, right?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-25 Thread Ian Anderson via Phabricator via cfe-commits
iana added a comment.

In D140250#4080990 , @rsmith wrote:

> Wait a second... if an OS wants only `NULL`, we already have a supported way 
> of achieving that, which is compatible with GCC and glibc and other POSIX 
> compilers -- define `__need_NULL` before including the header.
>
> We shouldn't be providing internal headers with `__mangled_names` for OSes to 
> include, those should be implementation details.

You can't do that with modules though, `#define __need_NULL #include 
` doesn't work.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-25 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment.

Wait a second... if an OS wants only `NULL`, we already have a supported way of 
achieving that, which is compatible with GCC and glibc and other POSIX 
compilers -- define `__need_NULL` before including the header.

We shouldn't be providing internal headers with `__mangled_names` for OSes to 
include, those should be implementation details.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-25 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

Please be sure to add a release note when landing the changes, btw.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-25 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-25 Thread Ian Anderson via Phabricator via cfe-commits
iana updated this revision to Diff 492179.
iana added a comment.

Revert the unnecessary changes to unspecified-var-size.ll


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

Files:
  clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
  clang-tools-extra/clangd/index/CanonicalIncludes.cpp
  clang/docs/tools/clang-formatted-files.txt
  clang/lib/Basic/Module.cpp
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/__stddef_null.h
  clang/lib/Headers/module.modulemap
  clang/lib/Headers/stddef.h
  clang/test/Headers/stddef_null.cpp
  compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
  llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn

Index: llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
===
--- llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
+++ llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
@@ -88,6 +88,7 @@
 "__clang_hip_runtime_wrapper.h",
 "__clang_hip_stdlib.h",
 "__stddef_max_align_t.h",
+"__stddef_null.h",
 "__wmmintrin_aes.h",
 "__wmmintrin_pclmul.h",
 "adxintrin.h",
Index: compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
===
--- compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
+++ compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
@@ -20,6 +20,7 @@
 #include 
 #include 
 // IWYU pragma: no_include <__stddef_max_align_t.h>
+// IWYU pragma: no_include <__stddef_null.h>
 
 namespace gwp_asan {
 // This class is the primary implementation of the allocator portion of GWP-
Index: clang/test/Headers/stddef_null.cpp
===
--- /dev/null
+++ clang/test/Headers/stddef_null.cpp
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-macosx10.9.0 -verify -Wsentinel -std=c++11 %s
+
+void *v0 = NULL; // expected-error{{undeclared}}
+
+// Shouldn't bring in anything else from stddef.h
+#include <__stddef_null.h>
+void *v1 = NULL;
+ptrdiff_t p1; // expected-error{{unknown}}
+size_t s1; // expected-error{{unknown}}
+wint_t w1; // expected-error{{unknown}}
+max_align_t m1; // expected-error{{unknown}}
+
+
+// linux/stddef.h does something like this for cpp files:
+#undef NULL
+#define NULL 0
+
+// glibc (and other) headers then define __need_NULL and rely on stddef.h
+// to redefine NULL to the correct value again.
+#define __need_NULL
+#include <__stddef_null.h>
+
+// gtk headers then use __attribute__((sentinel)), which doesn't work if NULL
+// is 0.
+void f(const char* c, ...) __attribute__((sentinel));
+void g() {
+  f("", NULL);  // Shouldn't warn.
+}
Index: clang/lib/Headers/stddef.h
===
--- clang/lib/Headers/stddef.h
+++ clang/lib/Headers/stddef.h
@@ -78,22 +78,7 @@
 #endif /* defined(__need_wchar_t) */
 
 #if defined(__need_NULL)
-#undef NULL
-#ifdef __cplusplus
-#  if !defined(__MINGW32__) && !defined(_MSC_VER)
-#define NULL __null
-#  else
-#define NULL 0
-#  endif
-#else
-#  define NULL ((void*)0)
-#endif
-#ifdef __cplusplus
-#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED)
-namespace std { typedef decltype(nullptr) nullptr_t; }
-using ::std::nullptr_t;
-#endif
-#endif
+#include <__stddef_null.h>
 #undef __need_NULL
 #endif /* defined(__need_NULL) */
 
Index: clang/lib/Headers/module.modulemap
===
--- clang/lib/Headers/module.modulemap
+++ clang/lib/Headers/module.modulemap
@@ -157,6 +157,11 @@
   header "__stddef_max_align_t.h"
 }
 
+module _Builtin_stddef_null [system] {
+  header "__stddef_null.h"
+  export *
+}
+
 module opencl_c {
   requires opencl
   header "opencl-c.h"
Index: clang/lib/Headers/__stddef_null.h
===
--- /dev/null
+++ clang/lib/Headers/__stddef_null.h
@@ -0,0 +1,35 @@
+/*=== __stddef_null.h - Definition of NULL -===
+ *
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ *
+ *===---===
+ */
+
+#if !defined(__STDDEF_NULL_H) || defined(__need_NULL)
+
+#ifndef __STDDEF_NULL_H
+#define __STDDEF_NULL_H
+#endif
+
+#undef NULL
+#ifdef __cplusplus
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
+#define NULL __null
+#else
+#define NULL 0
+#endif
+#else
+#define NULL ((void *)0)
+#endif
+#ifdef __cplusplus
+#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED)
+namespace std {
+typedef decltype(nullptr) nullptr_t;
+}
+using ::std::nullptr_t;
+#endif
+#endif
+
+#endif
Index: clang/lib/Headers/CMakeLists.txt

[PATCH] D140250: Define NULL in its own header

2023-01-25 Thread Ian Anderson via Phabricator via cfe-commits
iana added inline comments.



Comment at: 
llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll:37
 !7 = !DIFile(filename: "clang/12.0.0/include/__stddef_max_align_t.h", 
directory: "/")
-!8 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 
256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")
-!9 = !DIFile(filename: "include/c++/7.5.0/cstddef", directory: "")
-!10 = !{i32 7, !"Dwarf Version", i32 4}
-!11 = !{i32 2, !"Debug Info Version", i32 3}
-!12 = !{i32 1, !"wchar_size", i32 4}
-!13 = !{!"clang version 12.0.0"}
-!14 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funDn", scope: !1, 
file: !1, line: 20, type: !15, scopeLine: 20, flags: DIFlagPrototyped | 
DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: 
!0, retainedNodes: !20)
-!15 = !DISubroutineType(types: !16)
-!16 = !{null, !17}
-!17 = !DIDerivedType(tag: DW_TAG_typedef, name: "nullptr_t", scope: !5, file: 
!18, line: 235, baseType: !19)
-!18 = !DIFile(filename: "include/x86_64-linux-gnu/c++/7.5.0/bits/c++config.h", 
directory: "")
-!19 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
-!20 = !{!21}
-!21 = !DILocalVariable(arg: 1, scope: !14, file: !1, line: 20, type: !17)
-!22 = distinct !DIAssignID()
-!23 = !DILocation(line: 0, scope: !14)
-!28 = distinct !DIAssignID()
-!29 = !DILocation(line: 20, column: 27, scope: !14)
+!8 = !DIFile(filename: "clang/12.0.0/include/__stddef_null.h", directory: "/")
+!9 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 
256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")

dblaikie wrote:
> aaron.ballman wrote:
> > iana wrote:
> > > dblaikie wrote:
> > > > aaron.ballman wrote:
> > > > > iana wrote:
> > > > > > Adding this line is the only reason I changed this file. I'm not 
> > > > > > familiar at all with how these tests work, so I don't really know 
> > > > > > if it's necessary. The test passes with and without these changes.
> > > > > CC @dblaikie and @echristo for questions about whether we should be 
> > > > > updating this debug info test or not.
> > > > Don't think there's any reason/need to - what motivated changing this 
> > > > file?
> > > I found it when I was checking for places that handled 
> > > `__stddef_max_align_t.h` specially. I'm not sure if that's in here to 
> > > check `_ZTS11max_align_t` under it, or if it's just there because 
> > > stddef.h includes it. __stddef_null.h doesn't define any types like that, 
> > > so maybe it's fine to just revert this file?
> > Yeah, I think it's reasonable to revert the changes to this file.
> Yeah, that's just some incidental debug info (because clang doesn't track use 
> of using decls, we emit them rather unconditionally into DWARF, and it's 
> often easier to create/manitain DWARF testing by compiling real code rather 
> than hand crafting the IR metadata) - no need to update it for this case, I 
> think.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-25 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added inline comments.



Comment at: 
llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll:37
 !7 = !DIFile(filename: "clang/12.0.0/include/__stddef_max_align_t.h", 
directory: "/")
-!8 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 
256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")
-!9 = !DIFile(filename: "include/c++/7.5.0/cstddef", directory: "")
-!10 = !{i32 7, !"Dwarf Version", i32 4}
-!11 = !{i32 2, !"Debug Info Version", i32 3}
-!12 = !{i32 1, !"wchar_size", i32 4}
-!13 = !{!"clang version 12.0.0"}
-!14 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funDn", scope: !1, 
file: !1, line: 20, type: !15, scopeLine: 20, flags: DIFlagPrototyped | 
DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: 
!0, retainedNodes: !20)
-!15 = !DISubroutineType(types: !16)
-!16 = !{null, !17}
-!17 = !DIDerivedType(tag: DW_TAG_typedef, name: "nullptr_t", scope: !5, file: 
!18, line: 235, baseType: !19)
-!18 = !DIFile(filename: "include/x86_64-linux-gnu/c++/7.5.0/bits/c++config.h", 
directory: "")
-!19 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
-!20 = !{!21}
-!21 = !DILocalVariable(arg: 1, scope: !14, file: !1, line: 20, type: !17)
-!22 = distinct !DIAssignID()
-!23 = !DILocation(line: 0, scope: !14)
-!28 = distinct !DIAssignID()
-!29 = !DILocation(line: 20, column: 27, scope: !14)
+!8 = !DIFile(filename: "clang/12.0.0/include/__stddef_null.h", directory: "/")
+!9 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 
256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")

aaron.ballman wrote:
> iana wrote:
> > dblaikie wrote:
> > > aaron.ballman wrote:
> > > > iana wrote:
> > > > > Adding this line is the only reason I changed this file. I'm not 
> > > > > familiar at all with how these tests work, so I don't really know if 
> > > > > it's necessary. The test passes with and without these changes.
> > > > CC @dblaikie and @echristo for questions about whether we should be 
> > > > updating this debug info test or not.
> > > Don't think there's any reason/need to - what motivated changing this 
> > > file?
> > I found it when I was checking for places that handled 
> > `__stddef_max_align_t.h` specially. I'm not sure if that's in here to check 
> > `_ZTS11max_align_t` under it, or if it's just there because stddef.h 
> > includes it. __stddef_null.h doesn't define any types like that, so maybe 
> > it's fine to just revert this file?
> Yeah, I think it's reasonable to revert the changes to this file.
Yeah, that's just some incidental debug info (because clang doesn't track use 
of using decls, we emit them rather unconditionally into DWARF, and it's often 
easier to create/manitain DWARF testing by compiling real code rather than hand 
crafting the IR metadata) - no need to update it for this case, I think.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-25 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: 
llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll:37
 !7 = !DIFile(filename: "clang/12.0.0/include/__stddef_max_align_t.h", 
directory: "/")
-!8 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 
256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")
-!9 = !DIFile(filename: "include/c++/7.5.0/cstddef", directory: "")
-!10 = !{i32 7, !"Dwarf Version", i32 4}
-!11 = !{i32 2, !"Debug Info Version", i32 3}
-!12 = !{i32 1, !"wchar_size", i32 4}
-!13 = !{!"clang version 12.0.0"}
-!14 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funDn", scope: !1, 
file: !1, line: 20, type: !15, scopeLine: 20, flags: DIFlagPrototyped | 
DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: 
!0, retainedNodes: !20)
-!15 = !DISubroutineType(types: !16)
-!16 = !{null, !17}
-!17 = !DIDerivedType(tag: DW_TAG_typedef, name: "nullptr_t", scope: !5, file: 
!18, line: 235, baseType: !19)
-!18 = !DIFile(filename: "include/x86_64-linux-gnu/c++/7.5.0/bits/c++config.h", 
directory: "")
-!19 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
-!20 = !{!21}
-!21 = !DILocalVariable(arg: 1, scope: !14, file: !1, line: 20, type: !17)
-!22 = distinct !DIAssignID()
-!23 = !DILocation(line: 0, scope: !14)
-!28 = distinct !DIAssignID()
-!29 = !DILocation(line: 20, column: 27, scope: !14)
+!8 = !DIFile(filename: "clang/12.0.0/include/__stddef_null.h", directory: "/")
+!9 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 
256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")

iana wrote:
> dblaikie wrote:
> > aaron.ballman wrote:
> > > iana wrote:
> > > > Adding this line is the only reason I changed this file. I'm not 
> > > > familiar at all with how these tests work, so I don't really know if 
> > > > it's necessary. The test passes with and without these changes.
> > > CC @dblaikie and @echristo for questions about whether we should be 
> > > updating this debug info test or not.
> > Don't think there's any reason/need to - what motivated changing this file?
> I found it when I was checking for places that handled 
> `__stddef_max_align_t.h` specially. I'm not sure if that's in here to check 
> `_ZTS11max_align_t` under it, or if it's just there because stddef.h includes 
> it. __stddef_null.h doesn't define any types like that, so maybe it's fine to 
> just revert this file?
Yeah, I think it's reasonable to revert the changes to this file.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-24 Thread Ian Anderson via Phabricator via cfe-commits
iana added inline comments.



Comment at: 
llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll:37
 !7 = !DIFile(filename: "clang/12.0.0/include/__stddef_max_align_t.h", 
directory: "/")
-!8 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 
256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")
-!9 = !DIFile(filename: "include/c++/7.5.0/cstddef", directory: "")
-!10 = !{i32 7, !"Dwarf Version", i32 4}
-!11 = !{i32 2, !"Debug Info Version", i32 3}
-!12 = !{i32 1, !"wchar_size", i32 4}
-!13 = !{!"clang version 12.0.0"}
-!14 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funDn", scope: !1, 
file: !1, line: 20, type: !15, scopeLine: 20, flags: DIFlagPrototyped | 
DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: 
!0, retainedNodes: !20)
-!15 = !DISubroutineType(types: !16)
-!16 = !{null, !17}
-!17 = !DIDerivedType(tag: DW_TAG_typedef, name: "nullptr_t", scope: !5, file: 
!18, line: 235, baseType: !19)
-!18 = !DIFile(filename: "include/x86_64-linux-gnu/c++/7.5.0/bits/c++config.h", 
directory: "")
-!19 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
-!20 = !{!21}
-!21 = !DILocalVariable(arg: 1, scope: !14, file: !1, line: 20, type: !17)
-!22 = distinct !DIAssignID()
-!23 = !DILocation(line: 0, scope: !14)
-!28 = distinct !DIAssignID()
-!29 = !DILocation(line: 20, column: 27, scope: !14)
+!8 = !DIFile(filename: "clang/12.0.0/include/__stddef_null.h", directory: "/")
+!9 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 
256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")

dblaikie wrote:
> aaron.ballman wrote:
> > iana wrote:
> > > Adding this line is the only reason I changed this file. I'm not familiar 
> > > at all with how these tests work, so I don't really know if it's 
> > > necessary. The test passes with and without these changes.
> > CC @dblaikie and @echristo for questions about whether we should be 
> > updating this debug info test or not.
> Don't think there's any reason/need to - what motivated changing this file?
I found it when I was checking for places that handled `__stddef_max_align_t.h` 
specially. I'm not sure if that's in here to check `_ZTS11max_align_t` under 
it, or if it's just there because stddef.h includes it. __stddef_null.h doesn't 
define any types like that, so maybe it's fine to just revert this file?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-24 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added inline comments.



Comment at: 
llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll:37
 !7 = !DIFile(filename: "clang/12.0.0/include/__stddef_max_align_t.h", 
directory: "/")
-!8 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 
256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")
-!9 = !DIFile(filename: "include/c++/7.5.0/cstddef", directory: "")
-!10 = !{i32 7, !"Dwarf Version", i32 4}
-!11 = !{i32 2, !"Debug Info Version", i32 3}
-!12 = !{i32 1, !"wchar_size", i32 4}
-!13 = !{!"clang version 12.0.0"}
-!14 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funDn", scope: !1, 
file: !1, line: 20, type: !15, scopeLine: 20, flags: DIFlagPrototyped | 
DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: 
!0, retainedNodes: !20)
-!15 = !DISubroutineType(types: !16)
-!16 = !{null, !17}
-!17 = !DIDerivedType(tag: DW_TAG_typedef, name: "nullptr_t", scope: !5, file: 
!18, line: 235, baseType: !19)
-!18 = !DIFile(filename: "include/x86_64-linux-gnu/c++/7.5.0/bits/c++config.h", 
directory: "")
-!19 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
-!20 = !{!21}
-!21 = !DILocalVariable(arg: 1, scope: !14, file: !1, line: 20, type: !17)
-!22 = distinct !DIAssignID()
-!23 = !DILocation(line: 0, scope: !14)
-!28 = distinct !DIAssignID()
-!29 = !DILocation(line: 20, column: 27, scope: !14)
+!8 = !DIFile(filename: "clang/12.0.0/include/__stddef_null.h", directory: "/")
+!9 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 
256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")

aaron.ballman wrote:
> iana wrote:
> > Adding this line is the only reason I changed this file. I'm not familiar 
> > at all with how these tests work, so I don't really know if it's necessary. 
> > The test passes with and without these changes.
> CC @dblaikie and @echristo for questions about whether we should be updating 
> this debug info test or not.
Don't think there's any reason/need to - what motivated changing this file?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-24 Thread Ian Anderson via Phabricator via cfe-commits
iana added a comment.

In D140250#4077974 , @iana wrote:

> In D140250#4077956 , @aaron.ballman 
> wrote:
>
>> In D140250#4077826 , @iana wrote:
>>
>>> In D140250#4076851 , 
>>> @aaron.ballman wrote:
>>>
 I'd expect there to be a test under `clang/test/Headers/` showing that 
 this new header works as expected.
>>>
>>> It's covered pretty well by stddefneeds.cpp already. I can add a new one if 
>>> you want, but it'd pretty much be a copy/paste
>>
>> I was thinking of one similar to that but includes the new header and *not* 
>> stddef.h to demonstrate that this works entirely standalone. WDYT?
>
> Yeah ok sure

Added, let me know if it's missing anything please!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-24 Thread Ian Anderson via Phabricator via cfe-commits
iana updated this revision to Diff 491869.
iana added a comment.

Add an explicit header test for __stddef_null.h


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

Files:
  clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
  clang-tools-extra/clangd/index/CanonicalIncludes.cpp
  clang/docs/tools/clang-formatted-files.txt
  clang/lib/Basic/Module.cpp
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/__stddef_null.h
  clang/lib/Headers/module.modulemap
  clang/lib/Headers/stddef.h
  clang/test/Headers/stddef_null.cpp
  compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
  llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
  llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn

Index: llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
===
--- llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
+++ llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
@@ -88,6 +88,7 @@
 "__clang_hip_runtime_wrapper.h",
 "__clang_hip_stdlib.h",
 "__stddef_max_align_t.h",
+"__stddef_null.h",
 "__wmmintrin_aes.h",
 "__wmmintrin_pclmul.h",
 "adxintrin.h",
Index: llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
===
--- llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
+++ llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
@@ -10,46 +10,47 @@
 ; CHECK: @llvm.dbg.assign(metadata ptr %0,{{.+}}, metadata !DIExpression(),{{.+}}, metadata ptr undef, {{.+}})
 ;; There should be no new fragment and the value component should remain as %0.
 
-define dso_local void @_Z3funDn(ptr %0) #0 !dbg !14 {
+define dso_local void @_Z3funDn(ptr %0) #0 !dbg !15 {
 entry:
-  %.addr = alloca i8*, align 8, !DIAssignID !22
-  call void @llvm.dbg.assign(metadata i1 undef, metadata !21, metadata !DIExpression(), metadata !22, metadata ptr %.addr, metadata !DIExpression()), !dbg !23
-  store ptr %0, ptr %.addr, align 8, !DIAssignID !28
-  call void @llvm.dbg.assign(metadata ptr %0, metadata !21, metadata !DIExpression(), metadata !28, metadata ptr %.addr, metadata !DIExpression()), !dbg !23
-  ret void, !dbg !29
+  %.addr = alloca i8*, align 8, !DIAssignID !23
+  call void @llvm.dbg.assign(metadata i1 undef, metadata !22, metadata !DIExpression(), metadata !23, metadata ptr %.addr, metadata !DIExpression()), !dbg !24
+  store ptr %0, ptr %.addr, align 8, !DIAssignID !29
+  call void @llvm.dbg.assign(metadata ptr %0, metadata !22, metadata !DIExpression(), metadata !29, metadata ptr %.addr, metadata !DIExpression()), !dbg !24
+  ret void, !dbg !30
 }
 
 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
 declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) #1
 
 !llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!10, !11, !12, !1000}
-!llvm.ident = !{!13}
+!llvm.module.flags = !{!11, !12, !13, !1000}
+!llvm.ident = !{!14}
 
 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, imports: !3, splitDebugInlining: false, nameTableKind: None)
 !1 = !DIFile(filename: "test.cpp", directory: "/")
 !2 = !{}
 !3 = !{!4}
-!4 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !5, entity: !6, file: !9, line: 56)
+!4 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !5, entity: !6, file: !10, line: 56)
 !5 = !DINamespace(name: "std", scope: null)
-!6 = !DIDerivedType(tag: DW_TAG_typedef, name: "max_align_t", file: !7, line: 24, baseType: !8)
+!6 = !DIDerivedType(tag: DW_TAG_typedef, name: "max_align_t", file: !7, line: 24, baseType: !9)
 !7 = !DIFile(filename: "clang/12.0.0/include/__stddef_max_align_t.h", directory: "/")
-!8 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")
-!9 = !DIFile(filename: "include/c++/7.5.0/cstddef", directory: "")
-!10 = !{i32 7, !"Dwarf Version", i32 4}
-!11 = !{i32 2, !"Debug Info Version", i32 3}
-!12 = !{i32 1, !"wchar_size", i32 4}
-!13 = !{!"clang version 12.0.0"}
-!14 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funDn", scope: !1, file: !1, line: 20, type: !15, scopeLine: 20, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !20)
-!15 = !DISubroutineType(types: !16)
-!16 = !{null, !17}
-!17 = !DIDerivedType(tag: DW_TAG_typedef, name: "nullptr_t", scope: !5, file: !18, line: 235, baseType: !19)
-!18 = !DIFile(filename: "include/x86_64-linux-gnu/c++/7.5.0/bits/c++config.h", directory: "")
-!19 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
-!20 = !{!21}
-!21 = !DILocalVariable(arg: 1, scope: 

[PATCH] D140250: Define NULL in its own header

2023-01-24 Thread Ian Anderson via Phabricator via cfe-commits
iana added a comment.

In D140250#4077956 , @aaron.ballman 
wrote:

> In D140250#4077826 , @iana wrote:
>
>> In D140250#4076851 , 
>> @aaron.ballman wrote:
>>
>>> I'd expect there to be a test under `clang/test/Headers/` showing that this 
>>> new header works as expected.
>>
>> It's covered pretty well by stddefneeds.cpp already. I can add a new one if 
>> you want, but it'd pretty much be a copy/paste
>
> I was thinking of one similar to that but includes the new header and *not* 
> stddef.h to demonstrate that this works entirely standalone. WDYT?

Yeah ok sure


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-24 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D140250#4077826 , @iana wrote:

> In D140250#4076851 , @aaron.ballman 
> wrote:
>
>> I'd expect there to be a test under `clang/test/Headers/` showing that this 
>> new header works as expected.
>
> It's covered pretty well by stddefneeds.cpp already. I can add a new one if 
> you want, but it'd pretty much be a copy/paste

I was thinking of one similar to that but includes the new header and *not* 
stddef.h to demonstrate that this works entirely standalone. WDYT?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-24 Thread Ian Anderson via Phabricator via cfe-commits
iana added a comment.

In D140250#4076851 , @aaron.ballman 
wrote:

> I'd expect there to be a test under `clang/test/Headers/` showing that this 
> new header works as expected.

It's covered pretty well by stddefneeds.cpp already. I can add a new one if you 
want, but it'd pretty much be a copy/paste


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-24 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added subscribers: echristo, dblaikie, aaron.ballman.
aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added a comment.

I'd expect there to be a test under `clang/test/Headers/` showing that this new 
header works as expected.




Comment at: 
llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll:37
 !7 = !DIFile(filename: "clang/12.0.0/include/__stddef_max_align_t.h", 
directory: "/")
-!8 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 
256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")
-!9 = !DIFile(filename: "include/c++/7.5.0/cstddef", directory: "")
-!10 = !{i32 7, !"Dwarf Version", i32 4}
-!11 = !{i32 2, !"Debug Info Version", i32 3}
-!12 = !{i32 1, !"wchar_size", i32 4}
-!13 = !{!"clang version 12.0.0"}
-!14 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funDn", scope: !1, 
file: !1, line: 20, type: !15, scopeLine: 20, flags: DIFlagPrototyped | 
DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: 
!0, retainedNodes: !20)
-!15 = !DISubroutineType(types: !16)
-!16 = !{null, !17}
-!17 = !DIDerivedType(tag: DW_TAG_typedef, name: "nullptr_t", scope: !5, file: 
!18, line: 235, baseType: !19)
-!18 = !DIFile(filename: "include/x86_64-linux-gnu/c++/7.5.0/bits/c++config.h", 
directory: "")
-!19 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
-!20 = !{!21}
-!21 = !DILocalVariable(arg: 1, scope: !14, file: !1, line: 20, type: !17)
-!22 = distinct !DIAssignID()
-!23 = !DILocation(line: 0, scope: !14)
-!28 = distinct !DIAssignID()
-!29 = !DILocation(line: 20, column: 27, scope: !14)
+!8 = !DIFile(filename: "clang/12.0.0/include/__stddef_null.h", directory: "/")
+!9 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 
256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")

iana wrote:
> Adding this line is the only reason I changed this file. I'm not familiar at 
> all with how these tests work, so I don't really know if it's necessary. The 
> test passes with and without these changes.
CC @dblaikie and @echristo for questions about whether we should be updating 
this debug info test or not.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-24 Thread Ian Anderson via Phabricator via cfe-commits
iana updated this revision to Diff 491644.
iana added a comment.

Fix the broken tests


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

Files:
  clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
  clang-tools-extra/clangd/index/CanonicalIncludes.cpp
  clang/docs/tools/clang-formatted-files.txt
  clang/lib/Basic/Module.cpp
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/__stddef_null.h
  clang/lib/Headers/module.modulemap
  clang/lib/Headers/stddef.h
  compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
  llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
  llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn

Index: llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
===
--- llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
+++ llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
@@ -88,6 +88,7 @@
 "__clang_hip_runtime_wrapper.h",
 "__clang_hip_stdlib.h",
 "__stddef_max_align_t.h",
+"__stddef_null.h",
 "__wmmintrin_aes.h",
 "__wmmintrin_pclmul.h",
 "adxintrin.h",
Index: llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
===
--- llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
+++ llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
@@ -10,46 +10,47 @@
 ; CHECK: @llvm.dbg.assign(metadata ptr %0,{{.+}}, metadata !DIExpression(),{{.+}}, metadata ptr undef, {{.+}})
 ;; There should be no new fragment and the value component should remain as %0.
 
-define dso_local void @_Z3funDn(ptr %0) #0 !dbg !14 {
+define dso_local void @_Z3funDn(ptr %0) #0 !dbg !15 {
 entry:
-  %.addr = alloca i8*, align 8, !DIAssignID !22
-  call void @llvm.dbg.assign(metadata i1 undef, metadata !21, metadata !DIExpression(), metadata !22, metadata ptr %.addr, metadata !DIExpression()), !dbg !23
-  store ptr %0, ptr %.addr, align 8, !DIAssignID !28
-  call void @llvm.dbg.assign(metadata ptr %0, metadata !21, metadata !DIExpression(), metadata !28, metadata ptr %.addr, metadata !DIExpression()), !dbg !23
-  ret void, !dbg !29
+  %.addr = alloca i8*, align 8, !DIAssignID !23
+  call void @llvm.dbg.assign(metadata i1 undef, metadata !22, metadata !DIExpression(), metadata !23, metadata ptr %.addr, metadata !DIExpression()), !dbg !24
+  store ptr %0, ptr %.addr, align 8, !DIAssignID !29
+  call void @llvm.dbg.assign(metadata ptr %0, metadata !22, metadata !DIExpression(), metadata !29, metadata ptr %.addr, metadata !DIExpression()), !dbg !24
+  ret void, !dbg !30
 }
 
 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
 declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) #1
 
 !llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!10, !11, !12, !1000}
-!llvm.ident = !{!13}
+!llvm.module.flags = !{!11, !12, !13, !1000}
+!llvm.ident = !{!14}
 
 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, imports: !3, splitDebugInlining: false, nameTableKind: None)
 !1 = !DIFile(filename: "test.cpp", directory: "/")
 !2 = !{}
 !3 = !{!4}
-!4 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !5, entity: !6, file: !9, line: 56)
+!4 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !5, entity: !6, file: !10, line: 56)
 !5 = !DINamespace(name: "std", scope: null)
-!6 = !DIDerivedType(tag: DW_TAG_typedef, name: "max_align_t", file: !7, line: 24, baseType: !8)
+!6 = !DIDerivedType(tag: DW_TAG_typedef, name: "max_align_t", file: !7, line: 24, baseType: !9)
 !7 = !DIFile(filename: "clang/12.0.0/include/__stddef_max_align_t.h", directory: "/")
-!8 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")
-!9 = !DIFile(filename: "include/c++/7.5.0/cstddef", directory: "")
-!10 = !{i32 7, !"Dwarf Version", i32 4}
-!11 = !{i32 2, !"Debug Info Version", i32 3}
-!12 = !{i32 1, !"wchar_size", i32 4}
-!13 = !{!"clang version 12.0.0"}
-!14 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funDn", scope: !1, file: !1, line: 20, type: !15, scopeLine: 20, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !20)
-!15 = !DISubroutineType(types: !16)
-!16 = !{null, !17}
-!17 = !DIDerivedType(tag: DW_TAG_typedef, name: "nullptr_t", scope: !5, file: !18, line: 235, baseType: !19)
-!18 = !DIFile(filename: "include/x86_64-linux-gnu/c++/7.5.0/bits/c++config.h", directory: "")
-!19 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
-!20 = !{!21}
-!21 = !DILocalVariable(arg: 1, scope: !14, file: !1, line: 20, type: !17)
-!22 = distinct 

[PATCH] D140250: Define NULL in its own header

2023-01-23 Thread Ian Anderson via Phabricator via cfe-commits
iana added inline comments.



Comment at: 
llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll:37
 !7 = !DIFile(filename: "clang/12.0.0/include/__stddef_max_align_t.h", 
directory: "/")
-!8 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 
256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")
-!9 = !DIFile(filename: "include/c++/7.5.0/cstddef", directory: "")
-!10 = !{i32 7, !"Dwarf Version", i32 4}
-!11 = !{i32 2, !"Debug Info Version", i32 3}
-!12 = !{i32 1, !"wchar_size", i32 4}
-!13 = !{!"clang version 12.0.0"}
-!14 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funDn", scope: !1, 
file: !1, line: 20, type: !15, scopeLine: 20, flags: DIFlagPrototyped | 
DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: 
!0, retainedNodes: !20)
-!15 = !DISubroutineType(types: !16)
-!16 = !{null, !17}
-!17 = !DIDerivedType(tag: DW_TAG_typedef, name: "nullptr_t", scope: !5, file: 
!18, line: 235, baseType: !19)
-!18 = !DIFile(filename: "include/x86_64-linux-gnu/c++/7.5.0/bits/c++config.h", 
directory: "")
-!19 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
-!20 = !{!21}
-!21 = !DILocalVariable(arg: 1, scope: !14, file: !1, line: 20, type: !17)
-!22 = distinct !DIAssignID()
-!23 = !DILocation(line: 0, scope: !14)
-!28 = distinct !DIAssignID()
-!29 = !DILocation(line: 20, column: 27, scope: !14)
+!8 = !DIFile(filename: "clang/12.0.0/include/__stddef_null.h", directory: "/")
+!9 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 
256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")

Adding this line is the only reason I changed this file. I'm not familiar at 
all with how these tests work, so I don't really know if it's necessary. The 
test passes with and without these changes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-23 Thread Ian Anderson via Phabricator via cfe-commits
iana updated this revision to Diff 491607.
iana added a comment.

Fix the debuginfo-generic-assignment-tracking-sroa test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

Files:
  clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
  clang-tools-extra/clangd/index/CanonicalIncludes.cpp
  clang/docs/tools/clang-formatted-files.txt
  clang/lib/Basic/Module.cpp
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/__stddef_null.h
  clang/lib/Headers/module.modulemap
  clang/lib/Headers/stddef.h
  clang/lib/Lex/ModuleMap.cpp
  compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
  llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
  llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn

Index: llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
===
--- llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
+++ llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
@@ -88,6 +88,7 @@
 "__clang_hip_runtime_wrapper.h",
 "__clang_hip_stdlib.h",
 "__stddef_max_align_t.h",
+"__stddef_null.h",
 "__wmmintrin_aes.h",
 "__wmmintrin_pclmul.h",
 "adxintrin.h",
Index: llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
===
--- llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
+++ llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
@@ -10,46 +10,47 @@
 ; CHECK: @llvm.dbg.assign(metadata ptr %0,{{.+}}, metadata !DIExpression(),{{.+}}, metadata ptr undef, {{.+}})
 ;; There should be no new fragment and the value component should remain as %0.
 
-define dso_local void @_Z3funDn(ptr %0) #0 !dbg !14 {
+define dso_local void @_Z3funDn(ptr %0) #0 !dbg !15 {
 entry:
-  %.addr = alloca i8*, align 8, !DIAssignID !22
-  call void @llvm.dbg.assign(metadata i1 undef, metadata !21, metadata !DIExpression(), metadata !22, metadata ptr %.addr, metadata !DIExpression()), !dbg !23
-  store ptr %0, ptr %.addr, align 8, !DIAssignID !28
-  call void @llvm.dbg.assign(metadata ptr %0, metadata !21, metadata !DIExpression(), metadata !28, metadata ptr %.addr, metadata !DIExpression()), !dbg !23
-  ret void, !dbg !29
+  %.addr = alloca i8*, align 8, !DIAssignID !23
+  call void @llvm.dbg.assign(metadata i1 undef, metadata !22, metadata !DIExpression(), metadata !23, metadata ptr %.addr, metadata !DIExpression()), !dbg !24
+  store ptr %0, ptr %.addr, align 8, !DIAssignID !29
+  call void @llvm.dbg.assign(metadata ptr %0, metadata !22, metadata !DIExpression(), metadata !29, metadata ptr %.addr, metadata !DIExpression()), !dbg !24
+  ret void, !dbg !30
 }
 
 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
 declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) #1
 
 !llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!10, !11, !12, !1000}
-!llvm.ident = !{!13}
+!llvm.module.flags = !{!11, !12, !13, !1000}
+!llvm.ident = !{!14}
 
 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, imports: !3, splitDebugInlining: false, nameTableKind: None)
 !1 = !DIFile(filename: "test.cpp", directory: "/")
 !2 = !{}
 !3 = !{!4}
-!4 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !5, entity: !6, file: !9, line: 56)
+!4 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !5, entity: !6, file: !10, line: 56)
 !5 = !DINamespace(name: "std", scope: null)
-!6 = !DIDerivedType(tag: DW_TAG_typedef, name: "max_align_t", file: !7, line: 24, baseType: !8)
+!6 = !DIDerivedType(tag: DW_TAG_typedef, name: "max_align_t", file: !7, line: 24, baseType: !9)
 !7 = !DIFile(filename: "clang/12.0.0/include/__stddef_max_align_t.h", directory: "/")
-!8 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")
-!9 = !DIFile(filename: "include/c++/7.5.0/cstddef", directory: "")
-!10 = !{i32 7, !"Dwarf Version", i32 4}
-!11 = !{i32 2, !"Debug Info Version", i32 3}
-!12 = !{i32 1, !"wchar_size", i32 4}
-!13 = !{!"clang version 12.0.0"}
-!14 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funDn", scope: !1, file: !1, line: 20, type: !15, scopeLine: 20, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !20)
-!15 = !DISubroutineType(types: !16)
-!16 = !{null, !17}
-!17 = !DIDerivedType(tag: DW_TAG_typedef, name: "nullptr_t", scope: !5, file: !18, line: 235, baseType: !19)
-!18 = !DIFile(filename: "include/x86_64-linux-gnu/c++/7.5.0/bits/c++config.h", directory: "")
-!19 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
-!20 = !{!21}
-!21 = !DILocalVariable(arg: 1, 

[PATCH] D140250: Define NULL in its own header

2023-01-23 Thread Ian Anderson via Phabricator via cfe-commits
iana updated this revision to Diff 491604.
iana added a comment.

Rebase, update diagnostic to include the full module name instead of just the 
top level.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

Files:
  clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
  clang-tools-extra/clangd/index/CanonicalIncludes.cpp
  clang/docs/tools/clang-formatted-files.txt
  clang/lib/Basic/Module.cpp
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/__stddef_null.h
  clang/lib/Headers/module.modulemap
  clang/lib/Headers/stddef.h
  clang/lib/Lex/ModuleMap.cpp
  compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
  llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
  llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn

Index: llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
===
--- llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
+++ llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
@@ -88,6 +88,7 @@
 "__clang_hip_runtime_wrapper.h",
 "__clang_hip_stdlib.h",
 "__stddef_max_align_t.h",
+"__stddef_null.h",
 "__wmmintrin_aes.h",
 "__wmmintrin_pclmul.h",
 "adxintrin.h",
Index: llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
===
--- llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
+++ llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
@@ -34,22 +34,23 @@
 !5 = !DINamespace(name: "std", scope: null)
 !6 = !DIDerivedType(tag: DW_TAG_typedef, name: "max_align_t", file: !7, line: 24, baseType: !8)
 !7 = !DIFile(filename: "clang/12.0.0/include/__stddef_max_align_t.h", directory: "/")
-!8 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")
-!9 = !DIFile(filename: "include/c++/7.5.0/cstddef", directory: "")
-!10 = !{i32 7, !"Dwarf Version", i32 4}
-!11 = !{i32 2, !"Debug Info Version", i32 3}
-!12 = !{i32 1, !"wchar_size", i32 4}
-!13 = !{!"clang version 12.0.0"}
-!14 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funDn", scope: !1, file: !1, line: 20, type: !15, scopeLine: 20, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !20)
-!15 = !DISubroutineType(types: !16)
-!16 = !{null, !17}
-!17 = !DIDerivedType(tag: DW_TAG_typedef, name: "nullptr_t", scope: !5, file: !18, line: 235, baseType: !19)
-!18 = !DIFile(filename: "include/x86_64-linux-gnu/c++/7.5.0/bits/c++config.h", directory: "")
-!19 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
-!20 = !{!21}
-!21 = !DILocalVariable(arg: 1, scope: !14, file: !1, line: 20, type: !17)
-!22 = distinct !DIAssignID()
-!23 = !DILocation(line: 0, scope: !14)
-!28 = distinct !DIAssignID()
-!29 = !DILocation(line: 20, column: 27, scope: !14)
-!1000 = !{i32 7, !"debug-info-assignment-tracking", i1 true}
+!8 = !DIFile(filename: "clang/12.0.0/include/__stddef_null.h", directory: "/")
+!9 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")
+!10 = !DIFile(filename: "include/c++/7.5.0/cstddef", directory: "")
+!11 = !{i32 7, !"Dwarf Version", i32 4}
+!12 = !{i32 2, !"Debug Info Version", i32 3}
+!13 = !{i32 1, !"wchar_size", i32 4}
+!14 = !{!"clang version 12.0.0"}
+!15 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funDn", scope: !1, file: !1, line: 20, type: !15, scopeLine: 20, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !20)
+!16 = !DISubroutineType(types: !16)
+!17 = !{null, !17}
+!18 = !DIDerivedType(tag: DW_TAG_typedef, name: "nullptr_t", scope: !5, file: !18, line: 235, baseType: !19)
+!19 = !DIFile(filename: "include/x86_64-linux-gnu/c++/7.5.0/bits/c++config.h", directory: "")
+!20 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
+!21 = !{!21}
+!22 = !DILocalVariable(arg: 1, scope: !14, file: !1, line: 20, type: !17)
+!23 = distinct !DIAssignID()
+!24 = !DILocation(line: 0, scope: !14)
+!29 = distinct !DIAssignID()
+!30 = !DILocation(line: 20, column: 27, scope: !14)
+!1001 = !{i32 7, !"debug-info-assignment-tracking", i1 true}
Index: compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
===
--- compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
+++ compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
@@ -20,6 +20,7 @@
 #include 
 #include 
 // IWYU pragma: no_include <__stddef_max_align_t.h>
+// IWYU pragma: no_include <__stddef_null.h>
 
 namespace gwp_asan {
 // This class is the primary implementation of the allocator portion of GWP-
Index: clang/lib/Lex/ModuleMap.cpp

[PATCH] D140250: Define NULL in its own header

2023-01-03 Thread Ian Anderson via Phabricator via cfe-commits
iana planned changes to this revision.
iana added a comment.

I think this should be all we need, but I'm still running tests.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2023-01-03 Thread Ian Anderson via Phabricator via cfe-commits
iana updated this revision to Diff 486100.
iana added a comment.
Herald added subscribers: llvm-commits, Sanitizers, Enna1, kadircet, arphaman.
Herald added projects: Sanitizers, LLVM, clang-tools-extra.

Add a module for __stddef_null.h and give it the same special treatment as 
__stddef_max_align_t.h.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

Files:
  clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
  clang-tools-extra/clangd/index/CanonicalIncludes.cpp
  clang/docs/tools/clang-formatted-files.txt
  clang/lib/Basic/Module.cpp
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/__stddef_null.h
  clang/lib/Headers/module.modulemap
  clang/lib/Headers/stddef.h
  compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
  llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
  llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn

Index: llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
===
--- llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
+++ llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
@@ -88,6 +88,7 @@
 "__clang_hip_runtime_wrapper.h",
 "__clang_hip_stdlib.h",
 "__stddef_max_align_t.h",
+"__stddef_null.h",
 "__wmmintrin_aes.h",
 "__wmmintrin_pclmul.h",
 "adxintrin.h",
Index: llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
===
--- llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
+++ llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
@@ -34,21 +34,22 @@
 !5 = !DINamespace(name: "std", scope: null)
 !6 = !DIDerivedType(tag: DW_TAG_typedef, name: "max_align_t", file: !7, line: 24, baseType: !8)
 !7 = !DIFile(filename: "clang/12.0.0/include/__stddef_max_align_t.h", directory: "/")
-!8 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")
-!9 = !DIFile(filename: "include/c++/7.5.0/cstddef", directory: "")
-!10 = !{i32 7, !"Dwarf Version", i32 4}
-!11 = !{i32 2, !"Debug Info Version", i32 3}
-!12 = !{i32 1, !"wchar_size", i32 4}
-!13 = !{!"clang version 12.0.0"}
-!14 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funDn", scope: !1, file: !1, line: 20, type: !15, scopeLine: 20, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !20)
-!15 = !DISubroutineType(types: !16)
-!16 = !{null, !17}
-!17 = !DIDerivedType(tag: DW_TAG_typedef, name: "nullptr_t", scope: !5, file: !18, line: 235, baseType: !19)
-!18 = !DIFile(filename: "include/x86_64-linux-gnu/c++/7.5.0/bits/c++config.h", directory: "")
-!19 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
-!20 = !{!21}
-!21 = !DILocalVariable(arg: 1, scope: !14, file: !1, line: 20, type: !17)
-!22 = distinct !DIAssignID()
-!23 = !DILocation(line: 0, scope: !14)
-!28 = distinct !DIAssignID()
-!29 = !DILocation(line: 20, column: 27, scope: !14)
+!8 = !DIFile(filename: "clang/12.0.0/include/__stddef_null.h", directory: "/")
+!9 = !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 19, size: 256, flags: DIFlagFwdDecl, identifier: "_ZTS11max_align_t")
+!10 = !DIFile(filename: "include/c++/7.5.0/cstddef", directory: "")
+!11 = !{i32 7, !"Dwarf Version", i32 4}
+!12 = !{i32 2, !"Debug Info Version", i32 3}
+!13 = !{i32 1, !"wchar_size", i32 4}
+!14 = !{!"clang version 12.0.0"}
+!15 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funDn", scope: !1, file: !1, line: 20, type: !15, scopeLine: 20, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !20)
+!16 = !DISubroutineType(types: !16)
+!17 = !{null, !17}
+!18 = !DIDerivedType(tag: DW_TAG_typedef, name: "nullptr_t", scope: !5, file: !18, line: 235, baseType: !19)
+!19 = !DIFile(filename: "include/x86_64-linux-gnu/c++/7.5.0/bits/c++config.h", directory: "")
+!20 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
+!21 = !{!21}
+!22 = !DILocalVariable(arg: 1, scope: !14, file: !1, line: 20, type: !17)
+!23 = distinct !DIAssignID()
+!24 = !DILocation(line: 0, scope: !14)
+!29 = distinct !DIAssignID()
+!30 = !DILocation(line: 20, column: 27, scope: !14)
Index: compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
===
--- compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
+++ compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
@@ -20,6 +20,7 @@
 #include 
 #include 
 // IWYU pragma: no_include <__stddef_max_align_t.h>
+// IWYU pragma: no_include <__stddef_null.h>
 
 namespace gwp_asan {
 // This class is the primary implementation of the allocator portion of GWP-
Index: clang/lib/Headers/stddef.h

[PATCH] D140250: Define NULL in its own header

2023-01-03 Thread Ian Anderson via Phabricator via cfe-commits
iana planned changes to this revision.
iana added a comment.

This needs a bit more work, it looks like it's not enough to just add a header.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2022-12-16 Thread Ian Anderson via Phabricator via cfe-commits
iana added inline comments.



Comment at: clang/lib/Headers/__stddef_null.h:15
+#ifdef __cplusplus
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
+#define NULL __null

`arc lint` wanted to remove all of the indentation that was in stddef.h.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140250/new/

https://reviews.llvm.org/D140250

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


[PATCH] D140250: Define NULL in its own header

2022-12-16 Thread Ian Anderson via Phabricator via cfe-commits
iana created this revision.
iana added reviewers: ributzka, vsapsai, Bigcheese.
Herald added a subscriber: mstorsjo.
Herald added a project: All.
iana requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Make a new header to define NULL so that the OS can use it independent of 
stddef.h, i.e. in POSIX headers that are required to define NULL but not the 
rest of stddef.h.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140250

Files:
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/__stddef_null.h
  clang/lib/Headers/stddef.h


Index: clang/lib/Headers/stddef.h
===
--- clang/lib/Headers/stddef.h
+++ clang/lib/Headers/stddef.h
@@ -78,22 +78,7 @@
 #endif /* defined(__need_wchar_t) */
 
 #if defined(__need_NULL)
-#undef NULL
-#ifdef __cplusplus
-#  if !defined(__MINGW32__) && !defined(_MSC_VER)
-#define NULL __null
-#  else
-#define NULL 0
-#  endif
-#else
-#  define NULL ((void*)0)
-#endif
-#ifdef __cplusplus
-#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED)
-namespace std { typedef decltype(nullptr) nullptr_t; }
-using ::std::nullptr_t;
-#endif
-#endif
+#include <__stddef_null.h>
 #undef __need_NULL
 #endif /* defined(__need_NULL) */
 
Index: clang/lib/Headers/__stddef_null.h
===
--- /dev/null
+++ clang/lib/Headers/__stddef_null.h
@@ -0,0 +1,32 @@
+/*=== __stddef_null.h - Definition of NULL -===
+ *
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ *
+ *===---===
+ */
+
+#ifndef __STDDEF_NULL_H
+#define __STDDEF_NULL_H
+
+#undef NULL
+#ifdef __cplusplus
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
+#define NULL __null
+#else
+#define NULL 0
+#endif
+#else
+#define NULL ((void *)0)
+#endif
+#ifdef __cplusplus
+#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED)
+namespace std {
+typedef decltype(nullptr) nullptr_t;
+}
+using ::std::nullptr_t;
+#endif
+#endif
+
+#endif
Index: clang/lib/Headers/CMakeLists.txt
===
--- clang/lib/Headers/CMakeLists.txt
+++ clang/lib/Headers/CMakeLists.txt
@@ -14,6 +14,7 @@
   stdbool.h
   stddef.h
   __stddef_max_align_t.h
+  __stddef_null.h
   stdint.h
   stdnoreturn.h
   tgmath.h


Index: clang/lib/Headers/stddef.h
===
--- clang/lib/Headers/stddef.h
+++ clang/lib/Headers/stddef.h
@@ -78,22 +78,7 @@
 #endif /* defined(__need_wchar_t) */
 
 #if defined(__need_NULL)
-#undef NULL
-#ifdef __cplusplus
-#  if !defined(__MINGW32__) && !defined(_MSC_VER)
-#define NULL __null
-#  else
-#define NULL 0
-#  endif
-#else
-#  define NULL ((void*)0)
-#endif
-#ifdef __cplusplus
-#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED)
-namespace std { typedef decltype(nullptr) nullptr_t; }
-using ::std::nullptr_t;
-#endif
-#endif
+#include <__stddef_null.h>
 #undef __need_NULL
 #endif /* defined(__need_NULL) */
 
Index: clang/lib/Headers/__stddef_null.h
===
--- /dev/null
+++ clang/lib/Headers/__stddef_null.h
@@ -0,0 +1,32 @@
+/*=== __stddef_null.h - Definition of NULL -===
+ *
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ *
+ *===---===
+ */
+
+#ifndef __STDDEF_NULL_H
+#define __STDDEF_NULL_H
+
+#undef NULL
+#ifdef __cplusplus
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
+#define NULL __null
+#else
+#define NULL 0
+#endif
+#else
+#define NULL ((void *)0)
+#endif
+#ifdef __cplusplus
+#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED)
+namespace std {
+typedef decltype(nullptr) nullptr_t;
+}
+using ::std::nullptr_t;
+#endif
+#endif
+
+#endif
Index: clang/lib/Headers/CMakeLists.txt
===
--- clang/lib/Headers/CMakeLists.txt
+++ clang/lib/Headers/CMakeLists.txt
@@ -14,6 +14,7 @@
   stdbool.h
   stddef.h
   __stddef_max_align_t.h
+  __stddef_null.h
   stdint.h
   stdnoreturn.h
   tgmath.h
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits