@@ -25,6 +25,7 @@ module fpm_compile_commands
25
25
26
26
type, extends(serializable_t) :: compile_command_table_t
27
27
28
+
28
29
type (compile_command_t), allocatable :: command(:)
29
30
30
31
contains
@@ -116,13 +117,32 @@ subroutine cct_dump_toml(self, table, error)
116
117
117
118
! > Error handling
118
119
type (error_t), allocatable , intent (out ) :: error
119
-
120
- ! call set_string(table, "directory", self%directory, error, 'compile_command_table_t')
121
- ! if (allocated(error)) return
122
- ! call set_list(table, "arguments", self%arguments, error)
123
- ! if (allocated(error)) return
124
- ! call set_string(table, "file", self%file, error, 'compile_command_table_t')
125
- ! if (allocated(error)) return
120
+
121
+ integer :: ii
122
+ type (toml_table), pointer :: ptr
123
+ character (64 ) :: name
124
+
125
+ if (.not. allocated (self% command)) return
126
+
127
+ do ii = 1 , size (self% command)
128
+ associate (cmd = > self% command(ii))
129
+
130
+ ! Set node for this command
131
+ write (name,1 ) ii
132
+ call add_table(table, trim (name), ptr)
133
+ if (.not. associated (ptr)) then
134
+ call fatal_error(error, " compile_command_table_t cannot create entry for " // trim (name))
135
+ return
136
+ end if
137
+
138
+ ! Dump node
139
+ call cmd% dump_to_toml(ptr, error)
140
+ if (allocated (error)) return
141
+
142
+ endassociate
143
+ end do
144
+
145
+ 1 format (' compile_command_' ,i0)
126
146
127
147
end subroutine cct_dump_toml
128
148
0 commit comments