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 !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: !16, scopeLine: 20, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !21) +!16 = !DISubroutineType(types: !17) +!17 = !{null, !18} +!18 = !DIDerivedType(tag: DW_TAG_typedef, name: "nullptr_t", scope: !5, file: !19, line: 235, baseType: !20) +!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 = !{!22} +!22 = !DILocalVariable(arg: 1, scope: !15, file: !1, line: 20, type: !18) +!23 = distinct !DIAssignID() +!24 = !DILocation(line: 0, scope: !15) +!29 = distinct !DIAssignID() +!30 = !DILocation(line: 20, column: 27, scope: !15) !1000 = !{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 <stddef.h> #include <stdint.h> // 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 =================================================================== --- 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 =================================================================== --- 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/Basic/Module.cpp =================================================================== --- clang/lib/Basic/Module.cpp +++ clang/lib/Basic/Module.cpp @@ -298,8 +298,9 @@ if (Requested->isSubModuleOf(Use)) return true; - // Anyone is allowed to use our builtin stddef.h and its accompanying module. - if (!Requested->Parent && Requested->Name == "_Builtin_stddef_max_align_t") + // Anyone is allowed to use our builtin stddef.h and its accompanying modules. + if (!Requested->Parent && (Requested->Name == "_Builtin_stddef_max_align_t" || + Requested->Name == "_Builtin_stddef_null")) return true; if (NoUndeclaredIncludes) Index: clang/docs/tools/clang-formatted-files.txt =================================================================== --- clang/docs/tools/clang-formatted-files.txt +++ clang/docs/tools/clang-formatted-files.txt @@ -492,6 +492,7 @@ clang/lib/Headers/__clang_cuda_texture_intrinsics.h clang/lib/Headers/__clang_hip_libdevice_declares.h clang/lib/Headers/__stddef_max_align_t.h +clang/lib/Headers/__stddef_null.h clang/lib/Headers/openmp_wrappers/complex.h clang/lib/Headers/openmp_wrappers/complex_cmath.h clang/lib/Headers/openmp_wrappers/math.h Index: clang-tools-extra/clangd/index/CanonicalIncludes.cpp =================================================================== --- clang-tools-extra/clangd/index/CanonicalIncludes.cpp +++ clang-tools-extra/clangd/index/CanonicalIncludes.cpp @@ -20,6 +20,7 @@ namespace { const std::pair<llvm::StringRef, llvm::StringRef> IncludeMappings[] = { {"include/__stddef_max_align_t.h", "<cstddef>"}, + {"include/__stddef_null.h", "<cstddef>"}, {"include/__wmmintrin_aes.h", "<wmmintrin.h>"}, {"include/__wmmintrin_pclmul.h", "<wmmintrin.h>"}, {"include/adxintrin.h", "<immintrin.h>"}, Index: clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp =================================================================== --- clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp +++ clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp @@ -14,6 +14,7 @@ const HeaderMapCollector::RegexHeaderMap *getSTLPostfixHeaderMap() { static const HeaderMapCollector::RegexHeaderMap STLPostfixHeaderMap = { {"include/__stddef_max_align_t.h$", "<cstddef>"}, + {"include/__stddef_null.h$", "<cstddef>"}, {"include/__wmmintrin_aes.h$", "<wmmintrin.h>"}, {"include/__wmmintrin_pclmul.h$", "<wmmintrin.h>"}, {"include/adxintrin.h$", "<immintrin.h>"},
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits