mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Finalize subprograms after writing them. Correct debug info for C varargs. Add uwtable metadata. Removed visibility from functions.
This commit is contained in:
committed by
Christoffer Lerno
parent
aa216fa510
commit
209d994336
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
@@ -90,14 +90,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
msystem: MINGW64
|
msystem: MINGW64
|
||||||
update: true
|
update: true
|
||||||
install: git binutils mingw-w64-x86_64-ninja mingw-w64-x86_64-cmake mingw-w64-x86_64-toolchain mingw-w64-x86_64-python
|
install: git binutils mingw-w64-x86_64-clang mingw-w64-x86_64-ninja mingw-w64-x86_64-cmake mingw-w64-x86_64-toolchain mingw-w64-x86_64-python
|
||||||
- shell: msys2 {0}
|
- shell: msys2 {0}
|
||||||
run: |
|
run: |
|
||||||
pacman --noconfirm -U https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-llvm-16.0.5-1-any.pkg.tar.zst
|
pacman --noconfirm -U https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-llvm-16.0.5-1-any.pkg.tar.zst
|
||||||
pacman --noconfirm -U https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-lld-16.0.5-1-any.pkg.tar.zst
|
pacman --noconfirm -U https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-lld-16.0.5-1-any.pkg.tar.zst
|
||||||
- name: CMake
|
- name: CMake
|
||||||
run: |
|
run: |
|
||||||
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
|
cmake -B build -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
|
||||||
cmake --build build
|
cmake --build build
|
||||||
|
|
||||||
- name: Compile and run some examples
|
- name: Compile and run some examples
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ message("C3C version: ${CMAKE_PROJECT_VERSION}")
|
|||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
include(FeatureSummary)
|
include(FeatureSummary)
|
||||||
|
|
||||||
|
|
||||||
set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
|
set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
|
||||||
set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
|
set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
|
||||||
|
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ static void linker_setup_windows(const char ***args_ref, LinkerType linker_type)
|
|||||||
add_arg("user32.lib");
|
add_arg("user32.lib");
|
||||||
add_arg("shell32.lib");
|
add_arg("shell32.lib");
|
||||||
add_arg("Shlwapi.lib");
|
add_arg("Shlwapi.lib");
|
||||||
|
add_arg("Ws2_32.lib");
|
||||||
add_arg("legacy_stdio_definitions.lib");
|
add_arg("legacy_stdio_definitions.lib");
|
||||||
|
|
||||||
if (active_target.win.crt_linking == WIN_CRT_STATIC)
|
if (active_target.win.crt_linking == WIN_CRT_STATIC)
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ static inline LLVMMetadataRef llvm_get_debug_struct(GenContext *c, Type *type, c
|
|||||||
|
|
||||||
static inline LLVMMetadataRef llvm_get_debug_member(GenContext *c, Type *type, const char *name, unsigned offset, SourceSpan *loc, LLVMMetadataRef scope, LLVMDIFlags flags)
|
static inline LLVMMetadataRef llvm_get_debug_member(GenContext *c, Type *type, const char *name, unsigned offset, SourceSpan *loc, LLVMMetadataRef scope, LLVMDIFlags flags)
|
||||||
{
|
{
|
||||||
|
assert(name && scope);
|
||||||
return LLVMDIBuilderCreateMemberType(
|
return LLVMDIBuilderCreateMemberType(
|
||||||
c->debug.builder,
|
c->debug.builder,
|
||||||
scope,
|
scope,
|
||||||
@@ -108,32 +109,29 @@ void llvm_emit_debug_function(GenContext *c, Decl *decl)
|
|||||||
{
|
{
|
||||||
LLVMDIFlags flags = LLVMDIFlagZero;
|
LLVMDIFlags flags = LLVMDIFlagZero;
|
||||||
if (!decl->func_decl.body) return;
|
if (!decl->func_decl.body) return;
|
||||||
if (decl_is_externally_visible(decl))
|
|
||||||
{
|
|
||||||
flags |= LLVMDIFlagPublic;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
flags |= LLVMDIFlagPrivate;
|
|
||||||
}
|
|
||||||
flags |= LLVMDIFlagPrototyped;
|
flags |= LLVMDIFlagPrototyped;
|
||||||
if (decl->func_decl.signature.attrs.noreturn) flags |= LLVMDIFlagNoReturn;
|
if (decl->func_decl.signature.attrs.noreturn) flags |= LLVMDIFlagNoReturn;
|
||||||
|
|
||||||
uint32_t row = decl->span.row;
|
uint32_t row = decl->span.row;
|
||||||
if (!row) row = 1;
|
if (!row) row = 1;
|
||||||
|
assert(decl->name);
|
||||||
|
assert(decl->extname);
|
||||||
|
assert(c->debug.file.debug_file);
|
||||||
|
LLVMMetadataRef debug_type = llvm_get_debug_type(c, decl->type);
|
||||||
c->debug.function = LLVMDIBuilderCreateFunction(c->debug.builder,
|
c->debug.function = LLVMDIBuilderCreateFunction(c->debug.builder,
|
||||||
c->debug.file.debug_file,
|
c->debug.file.debug_file,
|
||||||
decl->name, strlen(decl->name),
|
decl->name, strlen(decl->name),
|
||||||
decl->extname, strlen(decl->extname),
|
decl->extname, strlen(decl->extname),
|
||||||
c->debug.file.debug_file,
|
c->debug.file.debug_file,
|
||||||
row,
|
row,
|
||||||
llvm_get_debug_type(c, decl->type),
|
debug_type,
|
||||||
decl_is_local(decl),
|
decl_is_local(decl),
|
||||||
true,
|
true,
|
||||||
row,
|
row,
|
||||||
flags,
|
flags,
|
||||||
active_target.optimization_level != OPTIMIZATION_NONE);
|
active_target.optimization_level != OPTIMIZATION_NONE);
|
||||||
LLVMSetSubprogram(decl->backend_ref, c->debug.function);
|
LLVMSetSubprogram(decl->backend_ref, c->debug.function);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void llvm_emit_debug_local_var(GenContext *c, Decl *decl)
|
void llvm_emit_debug_local_var(GenContext *c, Decl *decl)
|
||||||
@@ -514,6 +512,10 @@ static LLVMMetadataRef llvm_debug_func_type(GenContext *c, Type *type)
|
|||||||
{
|
{
|
||||||
vec_add(buffer, llvm_get_debug_type(c, prototype->param_types[i]));
|
vec_add(buffer, llvm_get_debug_type(c, prototype->param_types[i]));
|
||||||
}
|
}
|
||||||
|
if (prototype->raw_variadic)
|
||||||
|
{
|
||||||
|
vec_add(buffer, LLVMDIBuilderCreateUnspecifiedType(c->debug.builder, "", 0));
|
||||||
|
}
|
||||||
return LLVMDIBuilderCreateSubroutineType(c->debug.builder,
|
return LLVMDIBuilderCreateSubroutineType(c->debug.builder,
|
||||||
c->debug.file.debug_file,
|
c->debug.file.debug_file,
|
||||||
buffer,
|
buffer,
|
||||||
|
|||||||
@@ -4365,9 +4365,6 @@ static void llvm_emit_binary_expr(GenContext *c, BEValue *be_value, Expr *expr)
|
|||||||
|
|
||||||
static inline void llvm_emit_elvis_expr(GenContext *c, BEValue *value, Expr *expr)
|
static inline void llvm_emit_elvis_expr(GenContext *c, BEValue *value, Expr *expr)
|
||||||
{
|
{
|
||||||
// Set up basic blocks, following Cone
|
|
||||||
LLVMBasicBlockRef phi_block = llvm_basic_block_new(c, "cond.phi");
|
|
||||||
LLVMBasicBlockRef rhs_block = llvm_basic_block_new(c, "cond.rhs");
|
|
||||||
|
|
||||||
// Generate condition and conditional branch
|
// Generate condition and conditional branch
|
||||||
Expr *cond = exprptr(expr->ternary_expr.cond);
|
Expr *cond = exprptr(expr->ternary_expr.cond);
|
||||||
@@ -4396,6 +4393,10 @@ static inline void llvm_emit_elvis_expr(GenContext *c, BEValue *value, Expr *exp
|
|||||||
LLVMBasicBlockRef lhs_exit = llvm_get_current_block_if_in_use(c);
|
LLVMBasicBlockRef lhs_exit = llvm_get_current_block_if_in_use(c);
|
||||||
if (!lhs_exit) return;
|
if (!lhs_exit) return;
|
||||||
|
|
||||||
|
// Set up basic blocks, following Cone
|
||||||
|
LLVMBasicBlockRef phi_block = llvm_basic_block_new(c, "cond.phi");
|
||||||
|
LLVMBasicBlockRef rhs_block = llvm_basic_block_new(c, "cond.rhs");
|
||||||
|
|
||||||
llvm_emit_cond_br(c, value, phi_block, rhs_block);
|
llvm_emit_cond_br(c, value, phi_block, rhs_block);
|
||||||
llvm_emit_block(c, rhs_block);
|
llvm_emit_block(c, rhs_block);
|
||||||
BEValue rhs;
|
BEValue rhs;
|
||||||
@@ -4442,10 +4443,6 @@ void gencontext_emit_ternary_expr(GenContext *c, BEValue *value, Expr *expr)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up basic blocks, following Cone
|
|
||||||
LLVMBasicBlockRef phi_block = llvm_basic_block_new(c, "cond.phi");
|
|
||||||
LLVMBasicBlockRef lhs_block = llvm_basic_block_new(c, "cond.lhs");
|
|
||||||
LLVMBasicBlockRef rhs_block = llvm_basic_block_new(c, "cond.rhs");
|
|
||||||
|
|
||||||
bool is_elvis = false;
|
bool is_elvis = false;
|
||||||
|
|
||||||
@@ -4495,6 +4492,10 @@ void gencontext_emit_ternary_expr(GenContext *c, BEValue *value, Expr *expr)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set up basic blocks, following Cone
|
||||||
|
LLVMBasicBlockRef phi_block = llvm_basic_block_new(c, "cond.phi");
|
||||||
|
LLVMBasicBlockRef rhs_block = llvm_basic_block_new(c, "cond.rhs");
|
||||||
|
|
||||||
LLVMBasicBlockRef lhs_exit;
|
LLVMBasicBlockRef lhs_exit;
|
||||||
if (is_elvis)
|
if (is_elvis)
|
||||||
{
|
{
|
||||||
@@ -4504,6 +4505,7 @@ void gencontext_emit_ternary_expr(GenContext *c, BEValue *value, Expr *expr)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
LLVMBasicBlockRef lhs_block = llvm_basic_block_new(c, "cond.lhs");
|
||||||
llvm_emit_cond_br(c, value, lhs_block, rhs_block);
|
llvm_emit_cond_br(c, value, lhs_block, rhs_block);
|
||||||
llvm_emit_block(c, lhs_block);
|
llvm_emit_block(c, lhs_block);
|
||||||
BEValue lhs;
|
BEValue lhs;
|
||||||
|
|||||||
@@ -604,6 +604,7 @@ void llvm_emit_body(GenContext *c, LLVMValueRef function, const char *module_nam
|
|||||||
if (llvm_use_debug(c))
|
if (llvm_use_debug(c))
|
||||||
{
|
{
|
||||||
llvm_debug_scope_pop(c);
|
llvm_debug_scope_pop(c);
|
||||||
|
LLVMDIBuilderFinalizeSubprogram(c->debug.builder, c->debug.function);
|
||||||
}
|
}
|
||||||
|
|
||||||
c->builder = prev_builder;
|
c->builder = prev_builder;
|
||||||
@@ -649,7 +650,7 @@ void llvm_emit_xxlizer(GenContext *c, Decl *decl)
|
|||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
row,
|
row,
|
||||||
LLVMDIFlagPrivate,
|
LLVMDIFlagZero,
|
||||||
active_target.optimization_level != OPTIMIZATION_NONE);
|
active_target.optimization_level != OPTIMIZATION_NONE);
|
||||||
LLVMSetSubprogram(function, c->debug.function);
|
LLVMSetSubprogram(function, c->debug.function);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,6 +153,8 @@ void gencontext_begin_module(GenContext *c)
|
|||||||
llvm_set_module_flag(c, LLVMModuleFlagBehaviorWarning, "Dwarf Version", 4, type_uint);
|
llvm_set_module_flag(c, LLVMModuleFlagBehaviorWarning, "Dwarf Version", 4, type_uint);
|
||||||
llvm_set_module_flag(c, LLVMModuleFlagBehaviorWarning, "Debug Info Version", 3, type_uint);
|
llvm_set_module_flag(c, LLVMModuleFlagBehaviorWarning, "Debug Info Version", 3, type_uint);
|
||||||
}
|
}
|
||||||
|
llvm_set_module_flag(c, LLVMModuleFlagBehaviorError, "uwtable", 2, type_uint);
|
||||||
|
|
||||||
c->debug.runtime_version = 1;
|
c->debug.runtime_version = 1;
|
||||||
c->debug.builder = LLVMCreateDIBuilder(c->module);
|
c->debug.builder = LLVMCreateDIBuilder(c->module);
|
||||||
if (active_target.debug_info == DEBUG_INFO_FULL && active_target.feature.safe_mode)
|
if (active_target.debug_info == DEBUG_INFO_FULL && active_target.feature.safe_mode)
|
||||||
|
|||||||
@@ -546,16 +546,16 @@ void llvm_emit_for_stmt(GenContext *c, Ast *ast)
|
|||||||
// so emit the block
|
// so emit the block
|
||||||
llvm_emit_block(c, body_block);
|
llvm_emit_block(c, body_block);
|
||||||
break;
|
break;
|
||||||
case LOOP_INFINITE:
|
case LOOP_INFINITE:
|
||||||
// In this case we have no cond, so we need to emit the br and
|
// In this case we have no cond, so we need to emit the br and
|
||||||
// then the block
|
// then the block
|
||||||
llvm_emit_br(c, body_block);
|
llvm_emit_br(c, body_block);
|
||||||
llvm_emit_block(c, body_block);
|
llvm_emit_block(c, body_block);
|
||||||
case LOOP_NONE:
|
case LOOP_NONE:
|
||||||
// If there is no loop, then we will just fall through and the
|
// If there is no loop, then we will just fall through and the
|
||||||
// block is needed.
|
// block is needed.
|
||||||
body_block = NULL;
|
body_block = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Now emit the body
|
// Now emit the body
|
||||||
llvm_emit_stmt(c, body);
|
llvm_emit_stmt(c, body);
|
||||||
|
|||||||
@@ -372,15 +372,17 @@ const char *find_lib_dir(void)
|
|||||||
{
|
{
|
||||||
path[strlen_path - 1] = '\0';
|
path[strlen_path - 1] = '\0';
|
||||||
}
|
}
|
||||||
const char *lib_path;
|
const char *lib_path = NULL;
|
||||||
if ((lib_path = lib_find(path, "/../lib/"))) return lib_path;
|
if ((lib_path = lib_find(path, "/../lib/"))) goto DONE;
|
||||||
if ((lib_path = lib_find(path, "/lib/"))) return lib_path;
|
if ((lib_path = lib_find(path, "/lib/"))) goto DONE;
|
||||||
if ((lib_path = lib_find(path, "/"))) return lib_path;
|
if ((lib_path = lib_find(path, "/"))) goto DONE;
|
||||||
if ((lib_path = lib_find(path, "/../"))) return lib_path;
|
if ((lib_path = lib_find(path, "/../"))) goto DONE;
|
||||||
if ((lib_path = lib_find(path, "/../../lib/"))) return lib_path;
|
if ((lib_path = lib_find(path, "/../../lib/"))) goto DONE;
|
||||||
|
|
||||||
DEBUG_LOG("Could not find the standard library /lib/std/");
|
DEBUG_LOG("Could not find the standard library /lib/std/");
|
||||||
return NULL;
|
DONE:;
|
||||||
|
free(path);
|
||||||
|
return lib_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
void file_get_dir_and_filename_from_full(const char *full_path, char **filename, char **dir_path)
|
void file_get_dir_and_filename_from_full(const char *full_path, char **filename, char **dir_path)
|
||||||
|
|||||||
@@ -93,8 +93,23 @@ void memory_release();
|
|||||||
#define idptr(id_) ((void*)(((uintptr_t)id_) * 16 + arena_zero))
|
#define idptr(id_) ((void*)(((uintptr_t)id_) * 16 + arena_zero))
|
||||||
void *calloc_arena(size_t mem);
|
void *calloc_arena(size_t mem);
|
||||||
char *calloc_string(size_t len);
|
char *calloc_string(size_t len);
|
||||||
|
#ifdef NDEBUG
|
||||||
#define malloc_string calloc_string
|
#define malloc_string calloc_string
|
||||||
#define malloc_arena calloc_arena
|
#define malloc_arena calloc_arena
|
||||||
|
#else
|
||||||
|
static inline void *malloc_string(size_t len)
|
||||||
|
{
|
||||||
|
void *data = calloc_string(len);
|
||||||
|
memset(data, 0xaa, len);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
static inline void *malloc_arena(size_t len)
|
||||||
|
{
|
||||||
|
void *data = calloc_arena(len);
|
||||||
|
memset(data, 0xaa, len);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
void free_arena(void);
|
void free_arena(void);
|
||||||
void print_arena_status(void);
|
void print_arena_status(void);
|
||||||
void run_arena_allocator_tests(void);
|
void run_arena_allocator_tests(void);
|
||||||
|
|||||||
120
test/test_suite/concurrency/atomic_load_store_debug.c3t
Normal file
120
test/test_suite/concurrency/atomic_load_store_debug.c3t
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
// #target: macos-x64
|
||||||
|
// #debuginfo: yes
|
||||||
|
module test;
|
||||||
|
import std::io;
|
||||||
|
|
||||||
|
struct Ghh
|
||||||
|
{
|
||||||
|
int a;
|
||||||
|
int b;
|
||||||
|
int c;
|
||||||
|
}
|
||||||
|
fn void main()
|
||||||
|
{
|
||||||
|
int a = 111;
|
||||||
|
int x = @atomic_load(a);
|
||||||
|
int y = @atomic_load(a, MONOTONIC, true);
|
||||||
|
@atomic_store(a, 123 + x);
|
||||||
|
@atomic_store(a, 33 + y, MONOTONIC, true);
|
||||||
|
io::printfn("%d", a);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* #expect: test.ll
|
||||||
|
source_filename = "test"
|
||||||
|
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
||||||
|
target triple = "x86_64-apple-darwin"
|
||||||
|
|
||||||
|
%.introspect = type { i8, ptr, i64, i64, i64, [0 x i64] }
|
||||||
|
%any = type { ptr, i64 }
|
||||||
|
|
||||||
|
@"$ct.test.Ghh" = linkonce global %.introspect { i8 10, ptr null, i64 12, i64 0, i64 3, [0 x i64] zeroinitializer }, align 8
|
||||||
|
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
|
||||||
|
@"$ct.int" = linkonce global %.introspect { i8 2, ptr null, i64 4, i64 0, i64 0, [0 x i64] zeroinitializer }, align 8
|
||||||
|
|
||||||
|
define void @test.main() #0 !dbg !5 {
|
||||||
|
entry:
|
||||||
|
%a = alloca i32, align 4
|
||||||
|
%x = alloca i32, align 4
|
||||||
|
%y = alloca i32, align 4
|
||||||
|
%retparam = alloca i64, align 8
|
||||||
|
%varargslots = alloca [1 x %any], align 16
|
||||||
|
call void @llvm.dbg.declare(metadata ptr %a, metadata !9, metadata !DIExpression()), !dbg !11
|
||||||
|
store i32 111, ptr %a, align 4, !dbg !12
|
||||||
|
call void @llvm.dbg.declare(metadata ptr %x, metadata !13, metadata !DIExpression()), !dbg !14
|
||||||
|
%0 = load atomic i32, ptr %a seq_cst, align 4, !dbg !15
|
||||||
|
store i32 %0, ptr %x, align 4, !dbg !15
|
||||||
|
call void @llvm.dbg.declare(metadata ptr %y, metadata !18, metadata !DIExpression()), !dbg !19
|
||||||
|
%1 = load atomic volatile i32, ptr %a monotonic, align 4, !dbg !20
|
||||||
|
store i32 %1, ptr %y, align 4, !dbg !20
|
||||||
|
%2 = load i32, ptr %x, align 4, !dbg !22
|
||||||
|
%add = add i32 123, %2, !dbg !23
|
||||||
|
store atomic i32 %add, ptr %a seq_cst, align 4, !dbg !24
|
||||||
|
%3 = load i32, ptr %y, align 4, !dbg !26
|
||||||
|
%add1 = add i32 33, %3, !dbg !27
|
||||||
|
store atomic volatile i32 %add1, ptr %a monotonic, align 4, !dbg !28
|
||||||
|
%4 = insertvalue %any undef, ptr %a, 0, !dbg !30
|
||||||
|
%5 = insertvalue %any %4, i64 ptrtoint (ptr @"$ct.int" to i64), 1, !dbg !30
|
||||||
|
%6 = getelementptr inbounds [1 x %any], ptr %varargslots, i64 0, i64 0, !dbg !30
|
||||||
|
store %any %5, ptr %6, align 16, !dbg !30
|
||||||
|
%7 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1), !dbg !31
|
||||||
|
ret void, !dbg !31
|
||||||
|
}
|
||||||
|
|
||||||
|
define i32 @main(i32 %0, ptr %1) #0 !dbg !32 {
|
||||||
|
entry:
|
||||||
|
call void @test.main(), !dbg !38
|
||||||
|
ret i32 0, !dbg !41
|
||||||
|
}
|
||||||
|
|
||||||
|
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
|
||||||
|
|
||||||
|
; Function Attrs: nounwind
|
||||||
|
declare i64 @std.io.printfn(ptr, ptr, i64, ptr, i64) #0
|
||||||
|
|
||||||
|
declare i1 @llvm.expect.i1(i1, i1) #2
|
||||||
|
|
||||||
|
!llvm.module.flags = !{!0, !1, !2}
|
||||||
|
!llvm.dbg.cu = !{!3}
|
||||||
|
|
||||||
|
!0 = !{i32 2, !"Dwarf Version", i32 4}
|
||||||
|
!1 = !{i32 2, !"Debug Info Version", i32 3}
|
||||||
|
!2 = !{i32 1, !"uwtable", i32 2}
|
||||||
|
!3 = distinct !DICompileUnit(language: DW_LANG_C11, file: !4, producer: "c3c", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false)
|
||||||
|
!4 = !DIFile(filename: "atomic_load_store_debug.c3",
|
||||||
|
!5 = distinct !DISubprogram(name: "main", linkageName: "test.main", scope: !4, file: !4, line: 10, type: !6, scopeLine: 10, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !3, retainedNodes: !8)
|
||||||
|
!6 = !DISubroutineType(types: !7)
|
||||||
|
!7 = !{null}
|
||||||
|
!8 = !{}
|
||||||
|
!9 = !DILocalVariable(name: "a", scope: !5, file: !4, line: 12, type: !10, align: 4)
|
||||||
|
!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
||||||
|
!11 = !DILocation(line: 12, column: 6, scope: !5)
|
||||||
|
!12 = !DILocation(line: 12, column: 10, scope: !5)
|
||||||
|
!13 = !DILocalVariable(name: "x", scope: !5, file: !4, line: 13, type: !10, align: 4)
|
||||||
|
!14 = !DILocation(line: 13, column: 6, scope: !5)
|
||||||
|
!15 = !DILocation(line: 47, column: 23, scope: !16)
|
||||||
|
!16 = distinct !DILexicalBlock(scope: !5, file: !17, line: 47, column: 9)
|
||||||
|
!17 = !DIFile(filename: "mem.c3",
|
||||||
|
!18 = !DILocalVariable(name: "y", scope: !5, file: !4, line: 14, type: !10, align: 4)
|
||||||
|
!19 = !DILocation(line: 14, column: 6, scope: !5)
|
||||||
|
!20 = !DILocation(line: 47, column: 23, scope: !21)
|
||||||
|
!21 = distinct !DILexicalBlock(scope: !5, file: !17, line: 47, column: 9)
|
||||||
|
!22 = !DILocation(line: 15, column: 25, scope: !5)
|
||||||
|
!23 = !DILocation(line: 15, column: 19, scope: !5)
|
||||||
|
!24 = !DILocation(line: 62, column: 20, scope: !25)
|
||||||
|
!25 = distinct !DILexicalBlock(scope: !5, file: !17, line: 62, column: 2)
|
||||||
|
!26 = !DILocation(line: 16, column: 24, scope: !5)
|
||||||
|
!27 = !DILocation(line: 16, column: 19, scope: !5)
|
||||||
|
!28 = !DILocation(line: 62, column: 20, scope: !29)
|
||||||
|
!29 = distinct !DILexicalBlock(scope: !5, file: !17, line: 62, column: 2)
|
||||||
|
!30 = !DILocation(line: 17, column: 20, scope: !5)
|
||||||
|
!31 = !DILocation(line: 17, column: 6, scope: !5)
|
||||||
|
!32 = distinct !DISubprogram(name: "_$main", linkageName: "main", scope: !4, file: !4, line: 10, type: !33, scopeLine: 10, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !3, retainedNodes: !8)
|
||||||
|
!33 = !DISubroutineType(types: !34)
|
||||||
|
!34 = !{!10, !10, !35}
|
||||||
|
!35 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "char**", baseType: !36, size: 64, align: 64, dwarfAddressSpace: 0)
|
||||||
|
!36 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "char*", baseType: !37, size: 64, align: 64, dwarfAddressSpace: 0)
|
||||||
|
!37 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_unsigned_char)
|
||||||
|
!38 = !DILocation(line: 18, column: 2, scope: !39)
|
||||||
|
!39 = distinct !DILexicalBlock(scope: !32, file: !40, line: 18, column: 2)
|
||||||
|
!40 = !DIFile(filename: "main_stub.c3",
|
||||||
|
!41 = !DILocation(line: 19, column: 9, scope: !39)
|
||||||
@@ -11,22 +11,21 @@ const FOO @private = ~(uint)(0);
|
|||||||
@constants.BB = local_unnamed_addr constant i8 -56, align 1
|
@constants.BB = local_unnamed_addr constant i8 -56, align 1
|
||||||
@constants.CC = protected unnamed_addr constant i32 -1, align 4
|
@constants.CC = protected unnamed_addr constant i32 -1, align 4
|
||||||
@constants.FOO = protected unnamed_addr constant i32 -1, align 4
|
@constants.FOO = protected unnamed_addr constant i32 -1, align 4
|
||||||
|
!llvm.module.flags = !{!0, !1, !2}
|
||||||
!llvm.module.flags = !{!0, !1}
|
!llvm.dbg.cu = !{!3}
|
||||||
!llvm.dbg.cu = !{!2}
|
|
||||||
|
|
||||||
!0 = !{i32 2, !"Dwarf Version", i32 4}
|
!0 = !{i32 2, !"Dwarf Version", i32 4}
|
||||||
!1 = !{i32 2, !"Debug Info Version", i32 3}
|
!1 = !{i32 2, !"Debug Info Version", i32 3}
|
||||||
!2 = distinct !DICompileUnit(language: DW_LANG_C11, file: !3, producer: "c3c", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false)
|
!2 = !{i32 1, !"uwtable", i32 2}
|
||||||
!3 = !DIFile(filename: "constants.c3",
|
!3 = distinct !DICompileUnit(language: DW_LANG_C11, file: !4, producer: "c3c", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !5, splitDebugInlining: false)
|
||||||
!4 = !{!5, !8, !10, !13}
|
!4 = !DIFile(filename: "constants.c3",
|
||||||
!5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression())
|
!5 = !{!6, !9, !11, !14}
|
||||||
!6 = distinct !DIGlobalVariable(name: "AA", linkageName: "constants.AA", scope: !3
|
!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
|
||||||
!7 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_unsigned_char)
|
!7 = distinct !DIGlobalVariable(name: "AA", linkageName: "constants.AA", scope: !4
|
||||||
!8 = !DIGlobalVariableExpression(var: !9, expr: !DIExpression())
|
!8 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_unsigned_char)
|
||||||
!9 = distinct !DIGlobalVariable(name: "BB", linkageName: "constants.BB", scope: !3, file: !3, line: 2
|
!9 = !DIGlobalVariableExpression(var: !10, expr: !DIExpression())
|
||||||
!10 = !DIGlobalVariableExpression(var: !11, expr: !DIExpression())
|
!10 = distinct !DIGlobalVariable(name: "BB", linkageName: "constants.BB", scope: !4, file: !4, line: 2
|
||||||
!11 = distinct !DIGlobalVariable(name: "CC", linkageName: "constants.CC", scope: !3, file: !3, line: 3
|
!11 = !DIGlobalVariableExpression(var: !12, expr: !DIExpression())
|
||||||
!12 = !DIBasicType(name: "uint", size: 32, encoding: DW_ATE_unsigned)
|
!12 = distinct !DIGlobalVariable(name: "CC", linkageName: "constants.CC", scope: !4, file: !4, line: 3
|
||||||
!13 = !DIGlobalVariableExpression(var: !14, expr: !DIExpression())
|
!13 = !DIBasicType(name: "uint", size: 32, encoding: DW_ATE_unsigned)
|
||||||
!14 = distinct !DIGlobalVariable(name: "FOO", linkageName: "constants.FOO", scope: !3, file: !3, line:
|
!14 = !DIGlobalVariableExpression(var: !15, expr: !DIExpression())
|
||||||
|
!15 = distinct !DIGlobalVariable(name: "FOO", linkageName: "constants.FOO", scope: !4, file: !4, line:
|
||||||
|
|||||||
38
test/test_suite/debug_symbols/constants_mingw.c3t
Normal file
38
test/test_suite/debug_symbols/constants_mingw.c3t
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
// #target: mingw-x64
|
||||||
|
// #debuginfo: yes
|
||||||
|
const char AA @private = 1;
|
||||||
|
const char BB = 200 ;
|
||||||
|
const uint CC @private = ~(uint)(0);
|
||||||
|
const FOO @private = ~(uint)(0);
|
||||||
|
|
||||||
|
/* #expect: constants_mingw.ll
|
||||||
|
|
||||||
|
; ModuleID = 'constants_mingw'
|
||||||
|
|
||||||
|
source_filename = "constants_mingw"
|
||||||
|
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
||||||
|
target triple = "x86_64-w64-windows-gnu"
|
||||||
|
|
||||||
|
@constants_mingw.AA = protected unnamed_addr constant i8 1, align 1
|
||||||
|
@constants_mingw.BB = local_unnamed_addr constant i8 -56, align 1
|
||||||
|
@constants_mingw.CC = protected unnamed_addr constant i32 -1, align 4
|
||||||
|
@constants_mingw.FOO = protected unnamed_addr constant i32 -1, align 4
|
||||||
|
|
||||||
|
!llvm.module.flags = !{!0, !1, !2}
|
||||||
|
!llvm.dbg.cu = !{!3}
|
||||||
|
|
||||||
|
!0 = !{i32 2, !"Dwarf Version", i32 4}
|
||||||
|
!1 = !{i32 2, !"Debug Info Version", i32 3}
|
||||||
|
!2 = !{i32 1, !"uwtable", i32 2}
|
||||||
|
!3 = distinct !DICompileUnit(language: DW_LANG_C11, file: !4, producer: "c3c", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !5, splitDebugInlining: false)
|
||||||
|
!5 = !{!6, !9, !11, !14}
|
||||||
|
!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
|
||||||
|
!7 = distinct !DIGlobalVariable(name: "AA", linkageName: "constants_mingw.AA", scope: !4, file: !4, line: 1, type: !8, isLocal: true, isDefinition: true, align: 1)
|
||||||
|
!8 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_unsigned_char)
|
||||||
|
!9 = !DIGlobalVariableExpression(var: !10, expr: !DIExpression())
|
||||||
|
!10 = distinct !DIGlobalVariable(name: "BB", linkageName: "constants_mingw.BB", scope: !4, file: !4, line: 2, type: !8, isLocal: false, isDefinition: true, align: 1)
|
||||||
|
!11 = !DIGlobalVariableExpression(var: !12, expr: !DIExpression())
|
||||||
|
!12 = distinct !DIGlobalVariable(name: "CC", linkageName: "constants_mingw.CC", scope: !4, file: !4, line: 3, type: !13, isLocal: true, isDefinition: true, align: 4)
|
||||||
|
!13 = !DIBasicType(name: "uint", size: 32, encoding: DW_ATE_unsigned)
|
||||||
|
!14 = !DIGlobalVariableExpression(var: !15, expr: !DIExpression())
|
||||||
|
!15 = distinct !DIGlobalVariable(name: "FOO", linkageName: "constants_mingw.FOO", scope: !4, file: !4, line: 4, type: !13, isLocal: true, isDefinition: true, align: 4)
|
||||||
Reference in New Issue
Block a user