Skip to content

Commit

Permalink
update @[attr] + clang-17 to path find (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
xn0px90 authored Jan 12, 2024
1 parent ff9c8f8 commit 3134e91
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions src/c2v.v
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ mut:
}

fn find_clang_in_path() string {
clangs := ['clang-14', 'clang-13', 'clang-12', 'clang-11', 'clang-10', 'clang']
clangs := ['clang-17', 'clang-14', 'clang-13', 'clang-12', 'clang-11', 'clang-10', 'clang']
for clang in clangs {
os.find_abs_path_of_executable(clang) or { continue }
return clang
Expand Down Expand Up @@ -2250,12 +2250,12 @@ fn (mut c2v C2V) save_globals() {
}
}

[if trace_verbose ?]
@[if trace_verbose ?]
fn vprintln(s string) {
println(s)
}

[if trace_verbose ?]
@[if trace_verbose ?]
fn vprint(s string) {
print(s)
}
Expand Down
50 changes: 25 additions & 25 deletions src/node.v
Original file line number Diff line number Diff line change
Expand Up @@ -6,64 +6,64 @@ module main
// vfmt off
struct Node {
id string
kind_str string [json: 'kind'] // e.g. "IntegerLiteral"
location NodeLocation [json: 'loc']
kind_str string @[json: 'kind'] // e.g. "IntegerLiteral"
location NodeLocation @[json: 'loc']
range Range
previous_declaration string [json: 'previousDecl']
previous_declaration string @[json: 'previousDecl']
name string // e.g. "my_var_name"
ast_type AstJsonType [json: 'type']
class_modifier string [json: 'storageClass']
tags string [json: 'tagUsed']
initialization_type string [json: 'init'] // "c" => "cinit"
ast_type AstJsonType @[json: 'type']
class_modifier string @[json: 'storageClass']
tags string @[json: 'tagUsed']
initialization_type string @[json: 'init'] // "c" => "cinit"
value string // e.g. "777" for IntegerLiteral
value_number int [json: 'value'] // For CharacterLiterals, since `value` is a number there, not at string
value_number int @[json: 'value'] // For CharacterLiterals, since `value` is a number there, not at string
opcode string // e.g. "+" in BinaryOperator
ast_argument_type AstJsonType [json: 'argType']
ast_argument_type AstJsonType @[json: 'argType']
array_filler []Node // for InitListExpr
declaration_id string [json: 'declId'] // for goto labels
label_id string [json: 'targetLabelDeclId'] // for goto statements
is_postfix bool [json: 'isPostfix']
declaration_id string @[json: 'declId'] // for goto labels
label_id string @[json: 'targetLabelDeclId'] // for goto statements
is_postfix bool @[json: 'isPostfix']
mut:
//parent_node &Node [skip] = unsafe {nil }
inner []Node
ref_declaration RefDeclarationNode [json: 'referencedDecl'] //&Node
kind NodeKind [skip]
current_child_id int [skip]
is_builtin_type bool [skip]
redeclarations_count int [skip] // increased when some *other* Node had previous_decl == this Node.id
ref_declaration RefDeclarationNode @[json: 'referencedDecl'] //&Node
kind NodeKind @[skip]
current_child_id int @[skip]
is_builtin_type bool @[skip]
redeclarations_count int @[skip] // increased when some *other* Node had previous_decl == this Node.id
}
// vfmt on

struct NodeLocation {
offset int
file string
line int
source_file SourceFile [json: 'includedFrom']
spelling_file SourceFile [json: 'spellingLoc']
source_file SourceFile @[json: 'includedFrom']
spelling_file SourceFile @[json: 'spellingLoc']
}

struct Range {
begin Begin
}

struct Begin {
spelling_file SourceFile [json: 'spellingLoc']
spelling_file SourceFile @[json: 'spellingLoc']
}

struct SourceFile {
path string [json: 'file']
path string @[json: 'file']
}

struct AstJsonType {
desugared_qualified string [json: 'desugaredQualType']
qualified string [json: 'qualType']
desugared_qualified string @[json: 'desugaredQualType']
qualified string @[json: 'qualType']
}

struct RefDeclarationNode {
kind_str string [json: 'kind'] // e.g. "IntegerLiteral"
kind_str string @[json: 'kind'] // e.g. "IntegerLiteral"
name string
mut:
kind NodeKind [skip]
kind NodeKind @[skip]
}

const bad_node = Node{
Expand Down

0 comments on commit 3134e91

Please sign in to comment.