Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix common linkage #734

Merged
merged 2 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/vast/CodeGen/CodeGenPolicy.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022-present, Trail of Bits, Inc.

Check notice on line 1 in include/vast/CodeGen/CodeGenPolicy.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter (18, 22.04)

Run clang-format on include/vast/CodeGen/CodeGenPolicy.hpp

File include/vast/CodeGen/CodeGenPolicy.hpp does not conform to Custom style guidelines. (lines 19)

#pragma once

Expand All @@ -16,6 +16,7 @@
virtual missing_return_policy get_missing_return_policy(const clang_function *decl) const = 0;
virtual bool skip_function_body(const clang_function *decl) const = 0;
virtual bool skip_global_initializer(const clang_var_decl *decl) const = 0;
virtual bool get_no_common() const = 0;
};

} // namespace vast::cg
4 changes: 4 additions & 0 deletions include/vast/CodeGen/DefaultCodeGenPolicy.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once

Check notice on line 1 in include/vast/CodeGen/DefaultCodeGenPolicy.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter (18, 22.04)

Run clang-format on include/vast/CodeGen/DefaultCodeGenPolicy.hpp

File include/vast/CodeGen/DefaultCodeGenPolicy.hpp does not conform to Custom style guidelines. (lines 35, 36)

#include "vast/CodeGen/CodeGenPolicy.hpp"
#include "vast/CodeGen/Common.hpp"
Expand Down Expand Up @@ -32,6 +32,10 @@
return false;
};

bool get_no_common() const override {
return opts.codegen.NoCommon;
}

protected:
cc::action_options &opts;
};
Expand Down
2 changes: 1 addition & 1 deletion include/vast/Dialect/Core/Linkage.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021-present, Trail of Bits, Inc.

Check notice on line 1 in include/vast/Dialect/Core/Linkage.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter (18, 22.04)

Run clang-format on include/vast/Dialect/Core/Linkage.hpp

File include/vast/Dialect/Core/Linkage.hpp does not conform to Custom style guidelines. (lines 20)

#pragma once

Expand All @@ -17,7 +17,7 @@
mlir::SymbolTable::Visibility get_visibility_from_linkage(core::GlobalLinkageKind linkage);

core::GlobalLinkageKind get_declarator_linkage(
const clang::DeclaratorDecl *decl, clang::GVALinkage linkage, bool is_constant
const clang::DeclaratorDecl *decl, clang::GVALinkage linkage, bool is_constant, bool no_common
);

std::optional< core::GlobalLinkageKind > get_function_linkage(clang::GlobalDecl glob);
Expand Down
5 changes: 3 additions & 2 deletions lib/vast/CodeGen/DefaultDeclVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,13 @@ namespace vast::cg {
.freeze();
};

auto linkage_builder = [](const clang::VarDecl *decl) {
auto linkage_builder = [&](const clang::VarDecl *decl) {
auto gva_linkage = decl->getASTContext().GetGVALinkageForVariable(decl);
return core::get_declarator_linkage(
decl,
gva_linkage,
decl->getType().isConstQualified()
decl->getType().isConstQualified(),
this->policy->get_no_common()
);
};

Expand Down
11 changes: 4 additions & 7 deletions lib/vast/Dialect/Core/Linkage.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022-present, Trail of Bits, Inc.

Check notice on line 1 in lib/vast/Dialect/Core/Linkage.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter (18, 22.04)

Run clang-format on lib/vast/Dialect/Core/Linkage.cpp

File lib/vast/Dialect/Core/Linkage.cpp does not conform to Custom style guidelines. (lines 45, 154, 280)

#include <vast/Dialect/Core/Linkage.hpp>

Expand Down Expand Up @@ -42,12 +42,9 @@
VAST_FATAL("No such linkage");
}

bool is_vardecl_strong_definition(const clang::VarDecl* decl) {
bool is_vardecl_strong_definition(const clang::VarDecl* decl, bool nocommon) {
auto &actx = decl->getASTContext();

// TODO: auto nocommon = actx.getCodeGenOpts().NoCommon;
bool nocommon = false;

// Don't give variables common linkage if -fno-common was specified unless it
// was overridden by a NoCommon attribute.
if ((nocommon || decl->hasAttr< clang::NoCommonAttr >()) && !decl->hasAttr< clang::CommonAttr >()) {
Expand Down Expand Up @@ -154,7 +151,7 @@
}

GlobalLinkageKind get_declarator_linkage(
const clang::DeclaratorDecl *decl, clang::GVALinkage linkage, bool is_constant
const clang::DeclaratorDecl *decl, clang::GVALinkage linkage, bool is_constant, bool no_common
) {
if (linkage == clang::GVA_Internal) {
return GlobalLinkageKind::InternalLinkage;
Expand Down Expand Up @@ -239,7 +236,7 @@
// linkage.
if (!opts.CPlusPlus) {
if (auto var = clang::dyn_cast< clang::VarDecl >(decl)) {
if (!is_vardecl_strong_definition(var)) {
if (!is_vardecl_strong_definition(var, no_common)) {
return GlobalLinkageKind::CommonLinkage;
}
}
Expand Down Expand Up @@ -280,7 +277,7 @@
}
}

return get_declarator_linkage(decl, linkage, /* is const variable */ false);
return get_declarator_linkage(decl, linkage, /* is const variable */ false, /*no common linkage */ true);
}

mlir::LLVM::Linkage convert_linkage_to_llvm(core::GlobalLinkageKind linkage) {
Expand Down
16 changes: 8 additions & 8 deletions test/vast/Dialect/HighLevel/array-a.c
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o - | %file-check %s
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o %t && %vast-opt %t | diff -B %t -

// CHECK: hl.var @ai, <common> : !hl.lvalue<!hl.array<10, !hl.int>>
// CHECK: hl.var @ai, <external> : !hl.lvalue<!hl.array<10, !hl.int>>
int ai[10];

// CHECK: hl.var @aci, <common> : !hl.lvalue<!hl.array<5, !hl.int< const >>>
// CHECK: hl.var @aci, <external> : !hl.lvalue<!hl.array<5, !hl.int< const >>>
const int aci[5];

// CHECK: hl.var @avi, <common> : !hl.lvalue<!hl.array<5, !hl.int< volatile >>>
// CHECK: hl.var @avi, <external> : !hl.lvalue<!hl.array<5, !hl.int< volatile >>>
volatile int avi[5];

// CHECK: hl.var @acvi, <common> : !hl.lvalue<!hl.array<5, !hl.int< const, volatile >>>
// CHECK: hl.var @acvi, <external> : !hl.lvalue<!hl.array<5, !hl.int< const, volatile >>>
const volatile int acvi[5];

// CHECK: hl.var @acvui, <common> : !hl.lvalue<!hl.array<5, !hl.int< unsigned, const, volatile >>>
// CHECK: hl.var @acvui, <external> : !hl.lvalue<!hl.array<5, !hl.int< unsigned, const, volatile >>>
const volatile unsigned int acvui[5];

// CHECK: hl.var @af, <common> : !hl.lvalue<!hl.array<10, !hl.float>>
// CHECK: hl.var @af, <external> : !hl.lvalue<!hl.array<10, !hl.float>>
float af[10];

// CHECK: hl.var @a3d, <common> : !hl.lvalue<!hl.array<2, !hl.array<4, !hl.array<3, !hl.float>>>>
// CHECK: hl.var @a3d, <external> : !hl.lvalue<!hl.array<2, !hl.array<4, !hl.array<3, !hl.float>>>>
float a3d[2][4][3];

// CHECK: hl.var @ae, <common> : !hl.lvalue<!hl.array<404, !hl.int>>
// CHECK: hl.var @ae, <external> : !hl.lvalue<!hl.array<404, !hl.int>>
int ae[4 + 4*100];
2 changes: 1 addition & 1 deletion test/vast/Dialect/HighLevel/cast-b.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// CHECK: hl.typedef @function_type : !core.fn<(!hl.lvalue<!hl.int>, !hl.lvalue<!hl.int>) -> (!hl.int)>
typedef int function_type(int a, int b);

// CHECK: hl.var @p, <common> : !hl.lvalue<!hl.array<2, !hl.ptr<!hl.elaborated<!hl.typedef<@function_type>>>>>
// CHECK: hl.var @p, <external> : !hl.lvalue<!hl.array<2, !hl.ptr<!hl.elaborated<!hl.typedef<@function_type>>>>>
function_type *p[2];

int test_func(void) {
Expand Down
2 changes: 1 addition & 1 deletion test/vast/Dialect/HighLevel/enum-a.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ enum color c = GREEN;
// CHECK: hl.typedef @color : !hl.elaborated<!hl.enum<@color>>
typedef enum color color;

// CHECK: hl.var @tc, <common> : !hl.lvalue<!hl.elaborated<!hl.typedef<@color>>>
// CHECK: hl.var @tc, <external> : !hl.lvalue<!hl.elaborated<!hl.typedef<@color>>>
color tc;
2 changes: 1 addition & 1 deletion test/vast/Dialect/HighLevel/glob-linkage-a.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ int __attribute__((weak)) wdef = 5;
extern int __attribute__((weak)) ewdef = 5;
// CHECK: hl.var @edef, <external>
extern int edef = 5;
// CHECK: hl.var @undef, <common>
// CHECK: hl.var @undef, <external>
int undef;
// CHECK: hl.var @def, <external>
int def = 5;
6 changes: 3 additions & 3 deletions test/vast/Dialect/HighLevel/pointers-b.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o - | %file-check %s
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o %t && %vast-opt %t | diff -B %t -

// CHECK: hl.var @p, <common> : !hl.lvalue<!hl.ptr<!hl.float>>
// CHECK: hl.var @pp, <common> : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.float>>>
// CHECK: hl.var @p, <external> : !hl.lvalue<!hl.ptr<!hl.float>>
// CHECK: hl.var @pp, <external> : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.float>>>
float *p, **pp; // p is a pointer to float
// pp is a pointer to a pointer to float

// CHECK: hl.var @fp, <common> : !hl.lvalue<!hl.ptr<!hl.paren<!core.fn<(!hl.lvalue<!hl.int>) -> (!hl.int)>>>>
// CHECK: hl.var @fp, <external> : !hl.lvalue<!hl.ptr<!hl.paren<!core.fn<(!hl.lvalue<!hl.int>) -> (!hl.int)>>>>
int (*fp)(int); // fp is a pointer to function with type int(int)

// CHECK: hl.var @pc, <external> : !hl.lvalue<!hl.ptr<!hl.int< const >>>
Expand Down
8 changes: 4 additions & 4 deletions test/vast/Dialect/HighLevel/qualifiers-e.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o - | %file-check %s
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o %t && %vast-opt %t | diff -B %t -

// CHECK: hl.var @ia, <common> : !hl.lvalue<!hl.array<10, !hl.int>>
// CHECK: hl.var @ia, <external> : !hl.lvalue<!hl.array<10, !hl.int>>
int ia[10];

// CHECK: hl.var @cia, <common> : !hl.lvalue<!hl.array<10, !hl.int< const >>>
// CHECK: hl.var @cia, <external> : !hl.lvalue<!hl.array<10, !hl.int< const >>>
const int cia[10];

// CHECK: hl.var @via, <common> : !hl.lvalue<!hl.array<10, !hl.int< volatile >>>
// CHECK: hl.var @via, <external> : !hl.lvalue<!hl.array<10, !hl.int< volatile >>>
volatile int via[10];

// CHECK: hl.var @cvia, <common> : !hl.lvalue<!hl.array<10, !hl.int< const, volatile >>>
// CHECK: hl.var @cvia, <external> : !hl.lvalue<!hl.array<10, !hl.int< const, volatile >>>
const volatile int cvia[10];
4 changes: 2 additions & 2 deletions test/vast/Dialect/HighLevel/qualifiers-g.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o - | %file-check %s
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o %t && %vast-opt %t | diff -B %t -

// CHECK: hl.var @a, <common> : !hl.lvalue<!hl.ptr<!hl.float, restrict >>
// CHECK: hl.var @b, <common> : !hl.lvalue<!hl.ptr<!hl.float, restrict >>
// CHECK: hl.var @a, <external> : !hl.lvalue<!hl.ptr<!hl.float, restrict >>
// CHECK: hl.var @b, <external> : !hl.lvalue<!hl.ptr<!hl.float, restrict >>
float * restrict a, * restrict b;

// CHECK: @f {{.*}} (!hl.lvalue<!hl.int>, !hl.lvalue<!hl.ptr<!hl.float, restrict >>, !hl.lvalue<!hl.ptr<!hl.float, const >>)
Expand Down
14 changes: 7 additions & 7 deletions test/vast/Dialect/HighLevel/qualifiers-h.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@
// CHECK: hl.enum @e : !hl.int< unsigned >
enum e { a, b, c };

// CHECK: hl.var @v, <common> : !hl.lvalue<!hl.elaborated<!hl.enum<@e>>>
// CHECK: hl.var @v, <external> : !hl.lvalue<!hl.elaborated<!hl.enum<@e>>>
enum e v;

// CHECK: hl.var @cv, <common> : !hl.lvalue<!hl.elaborated<!hl.enum<@e>, const >>
// CHECK: hl.var @cv, <external> : !hl.lvalue<!hl.elaborated<!hl.enum<@e>, const >>
const enum e cv;

// CHECK: hl.var @cvv, <common> : !hl.lvalue<!hl.elaborated<!hl.enum<@e>, const, volatile >>
// CHECK: hl.var @cvv, <external> : !hl.lvalue<!hl.elaborated<!hl.enum<@e>, const, volatile >>
const volatile enum e cvv;

// CHECK: hl.typedef @def : !hl.elaborated<!hl.enum<@e>>
typedef enum e def;

// CHECK: hl.var @d, <common> : !hl.lvalue<!hl.elaborated<!hl.typedef<@def>>>
// CHECK: hl.var @d, <external> : !hl.lvalue<!hl.elaborated<!hl.typedef<@def>>>
def d;

// CHECK: hl.var @cd, <common> : !hl.lvalue<!hl.elaborated<!hl.typedef<@def>, const >>
// CHECK: hl.var @cd, <external> : !hl.lvalue<!hl.elaborated<!hl.typedef<@def>, const >>
const def cd;

// CHECK: hl.var @vd, <common> : !hl.lvalue<!hl.elaborated<!hl.typedef<@def>, volatile >>
// CHECK: hl.var @vd, <external> : !hl.lvalue<!hl.elaborated<!hl.typedef<@def>, volatile >>
volatile def vd;

// CHECK: hl.var @cvd, <common> : !hl.lvalue<!hl.elaborated<!hl.typedef<@def>, const, volatile >>
// CHECK: hl.var @cvd, <external> : !hl.lvalue<!hl.elaborated<!hl.typedef<@def>, const, volatile >>
const volatile def cvd;
14 changes: 7 additions & 7 deletions test/vast/Dialect/HighLevel/qualifiers-i.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@
// CHECK: hl.union @u
union u { int i; double d; };

// CHECK: hl.var @v, <common> : !hl.lvalue<!hl.elaborated<!hl.record<@u>>>
// CHECK: hl.var @v, <external> : !hl.lvalue<!hl.elaborated<!hl.record<@u>>>
union u v;

// CHECK: hl.var @cv, <common> : !hl.lvalue<!hl.elaborated<!hl.record<@u>, const >>
// CHECK: hl.var @cv, <external> : !hl.lvalue<!hl.elaborated<!hl.record<@u>, const >>
const union u cv;

// CHECK: hl.var @cvv, <common> : !hl.lvalue<!hl.elaborated<!hl.record<@u>, const, volatile >>
// CHECK: hl.var @cvv, <external> : !hl.lvalue<!hl.elaborated<!hl.record<@u>, const, volatile >>
const volatile union u cvv;

// CHECK: hl.typedef @e : !hl.elaborated<!hl.record<@u>>
typedef union u e;

// CHECK: hl.var @v, <common> : !hl.lvalue<!hl.elaborated<!hl.typedef<@e>>>
// CHECK: hl.var @v, <external> : !hl.lvalue<!hl.elaborated<!hl.typedef<@e>>>
e v;

// CHECK: hl.var @cv, <common> : !hl.lvalue<!hl.elaborated<!hl.typedef<@e>, const >>
// CHECK: hl.var @cv, <external> : !hl.lvalue<!hl.elaborated<!hl.typedef<@e>, const >>
const e cv;

// CHECK: hl.var @vv, <common> : !hl.lvalue<!hl.elaborated<!hl.typedef<@e>, volatile >>
// CHECK: hl.var @vv, <external> : !hl.lvalue<!hl.elaborated<!hl.typedef<@e>, volatile >>
volatile e vv;

// CHECK: hl.var @cvv, <common> : !hl.lvalue<!hl.elaborated<!hl.typedef<@e>, const, volatile >>
// CHECK: hl.var @cvv, <external> : !hl.lvalue<!hl.elaborated<!hl.typedef<@e>, const, volatile >>
const volatile e cvv;
6 changes: 3 additions & 3 deletions test/vast/Dialect/HighLevel/qualifiers-j.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o - | %file-check %s
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o %t && %vast-opt %t | diff -B %t -

// CHECK: hl.var @fp, <common> : !hl.lvalue<!hl.ptr<!hl.paren<!core.fn<(!hl.lvalue<!hl.int>) -> (!hl.int)>>>>
// CHECK: hl.var @fp, <external> : !hl.lvalue<!hl.ptr<!hl.paren<!core.fn<(!hl.lvalue<!hl.int>) -> (!hl.int)>>>>
int (*fp) (int);

// CHECK: hl.var @cfp, <common> : !hl.lvalue<!hl.ptr<!hl.paren<!core.fn<(!hl.lvalue<!hl.int>) -> (!hl.int< const >)>>>>
// CHECK: hl.var @cfp, <external> : !hl.lvalue<!hl.ptr<!hl.paren<!core.fn<(!hl.lvalue<!hl.int>) -> (!hl.int< const >)>>>>
const int (*cfp)(int);

// CHECK: hl.var @fpc, <common> : !hl.lvalue<!hl.ptr<!hl.paren<!core.fn<(!hl.lvalue<!hl.int< const >>) -> (!hl.int)>>>>
// CHECK: hl.var @fpc, <external> : !hl.lvalue<!hl.ptr<!hl.paren<!core.fn<(!hl.lvalue<!hl.int< const >>) -> (!hl.int)>>>>
int (*fpc)(const int);
6 changes: 3 additions & 3 deletions test/vast/Dialect/HighLevel/quirks-n.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ unsigned int typedef u32;
// CHECK: hl.typedef @baz : !hl.elaborated<!hl.record<@foo>, const >
struct foo { int bar; } const typedef baz;

// CHECK: hl.var @a, <common> : !hl.lvalue<!hl.elaborated<!hl.typedef<@s16>>>
// CHECK: hl.var @a, <external> : !hl.lvalue<!hl.elaborated<!hl.typedef<@s16>>>
s16 a;
// CHECK: hl.var @b, <common> : !hl.lvalue<!hl.elaborated<!hl.typedef<@u32>>>
// CHECK: hl.var @b, <external> : !hl.lvalue<!hl.elaborated<!hl.typedef<@u32>>>
u32 b;
// CHECK: hl.var @c, <common> : !hl.lvalue<!hl.elaborated<!hl.typedef<@baz>>>
// CHECK: hl.var @c, <external> : !hl.lvalue<!hl.elaborated<!hl.typedef<@baz>>>
baz c;
2 changes: 1 addition & 1 deletion test/vast/Dialect/HighLevel/storage-a.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o - | %file-check %s
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o %t && %vast-opt %t | diff -B %t -

// CHECK: hl.var @i, <common> : !hl.lvalue<!hl.int>
// CHECK: hl.var @i, <external> : !hl.lvalue<!hl.int>
int i;

// CHECKL: hl.var @ei, <external> sc_extern : !hl.lvalue<!hl.int>
Expand Down
4 changes: 2 additions & 2 deletions test/vast/Dialect/HighLevel/struct-a.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct pair {
int a, b;
};

// CHECK: hl.var @p, <common> : !hl.lvalue<!hl.elaborated<!hl.record<@pair>>>
// CHECK: hl.var @p, <external> : !hl.lvalue<!hl.elaborated<!hl.record<@pair>>>
struct pair p;

struct forward;
Expand All @@ -33,7 +33,7 @@ typedef struct wrap {
int v;
} wrap_t;

// CHECK: hl.var @w, <common> : !hl.lvalue<!hl.elaborated<!hl.typedef<@wrap_t>>>
// CHECK: hl.var @w, <external> : !hl.lvalue<!hl.elaborated<!hl.typedef<@wrap_t>>>
wrap_t w;

// CHECK: hl.struct @compound : {
Expand Down
2 changes: 1 addition & 1 deletion test/vast/Dialect/HighLevel/struct-c.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// CHECK: hl.struct @"[[N:anonymous\[[0-9]+\]]]" : {
// CHECK: hl.field @data : !hl.int
// CHECK: }
// CHECK: hl.var @named, <common> : !hl.lvalue<!hl.elaborated<!hl.record<@"[[N]]">>>
// CHECK: hl.var @named, <external> : !hl.lvalue<!hl.elaborated<!hl.record<@"[[N]]">>>
struct {
int data;
} named;
2 changes: 1 addition & 1 deletion test/vast/Dialect/HighLevel/struct-f.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ struct X {};
// CHECK: hl.typedef @X : !hl.elaborated<!hl.record<@Y>>
typedef struct Y {} X;

// CHECK: hl.var @x, <common> : !hl.lvalue<!hl.elaborated<!hl.record<@X>>>
// CHECK: hl.var @x, <external> : !hl.lvalue<!hl.elaborated<!hl.record<@X>>>
// TODO: this is elaborated "X"
struct X x;

Expand Down
2 changes: 1 addition & 1 deletion test/vast/Dialect/HighLevel/union-a.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// CHECK: hl.field @u16 : !hl.array<2, !hl.short< unsigned >>
// CHECK: hl.field @u8 : !hl.char< unsigned >
// CHECK: }
// CHECK: hl.var @u, <common> : !hl.lvalue<!hl.elaborated<!hl.record<@u>>
// CHECK: hl.var @u, <external> : !hl.lvalue<!hl.elaborated<!hl.record<@u>>
union u {
unsigned int u32;
unsigned short u16[2];
Expand Down
2 changes: 1 addition & 1 deletion test/vast/Dialect/HighLevel/union-b.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct v {
// CHECK: hl.field @"[[N5:anonymous\[[0-9]+\]]]" : !hl.record<@"[[N1]]">
// CHECK: hl.field @m : !hl.int
int m;
// CHECK: hl.var @v1, <common> : !hl.lvalue<!hl.elaborated<!hl.record<@v>>>
// CHECK: hl.var @v1, <external> : !hl.lvalue<!hl.elaborated<!hl.record<@v>>>
} v1;

int main() {
Expand Down
14 changes: 7 additions & 7 deletions test/vast/Transform/HL/LowerTypes/array-a.c
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o - | %vast-opt --vast-hl-lower-types | %file-check %s

// CHECK: hl.var @ai, <common> : !hl.lvalue<!hl.array<10, si32>>
// CHECK: hl.var @ai, <external> : !hl.lvalue<!hl.array<10, si32>>
int ai[10];

// CHECK: hl.var @aci, <common> : !hl.lvalue<!hl.array<5, si32>>
// CHECK: hl.var @aci, <external> : !hl.lvalue<!hl.array<5, si32>>
const int aci[5];

// CHECK: hl.var @avi, <common> : !hl.lvalue<!hl.array<5, si32>>
// CHECK: hl.var @avi, <external> : !hl.lvalue<!hl.array<5, si32>>
volatile int avi[5];

// CHECK: hl.var @acvi, <common> : !hl.lvalue<!hl.array<5, si32>>
// CHECK: hl.var @acvi, <external> : !hl.lvalue<!hl.array<5, si32>>
const volatile int acvi[5];

// CHECK: hl.var @acvui, <common> : !hl.lvalue<!hl.array<5, ui32>>
// CHECK: hl.var @acvui, <external> : !hl.lvalue<!hl.array<5, ui32>>
const volatile unsigned int acvui[5];

// CHECK: hl.var @af, <common> : !hl.lvalue<!hl.array<10, f32>>
// CHECK: hl.var @af, <external> : !hl.lvalue<!hl.array<10, f32>>
float af[10];

// CHECK: hl.var @a3d, <common> : !hl.lvalue<!hl.array<2, !hl.array<4, !hl.array<3, f32>>>>
// CHECK: hl.var @a3d, <external> : !hl.lvalue<!hl.array<2, !hl.array<4, !hl.array<3, f32>>>>
float a3d[2][4][3];