@@ -26,8 +26,8 @@ import (
26
26
27
27
// CompilationDatabase keeps track of all the compile commands run by the builder
28
28
type CompilationDatabase struct {
29
- contents []CompilationCommand
30
- filename * paths.Path
29
+ Contents []CompilationCommand
30
+ File * paths.Path
31
31
}
32
32
33
33
// CompilationCommand keeps track of a single run of a compile command
@@ -40,17 +40,17 @@ type CompilationCommand struct {
40
40
// NewCompilationDatabase creates an empty CompilationDatabase
41
41
func NewCompilationDatabase (filename * paths.Path ) * CompilationDatabase {
42
42
return & CompilationDatabase {
43
- filename : filename ,
43
+ File : filename ,
44
44
}
45
45
}
46
46
47
47
// SaveToFile save the CompilationDatabase to file as a clangd-compatible compile_commands.json,
48
48
// see https://clang.llvm.org/docs/JSONCompilationDatabase.html
49
49
func (db * CompilationDatabase ) SaveToFile () {
50
- if jsonContents , err := json .MarshalIndent (db .contents , "" , " " ); err != nil {
50
+ if jsonContents , err := json .MarshalIndent (db .Contents , "" , " " ); err != nil {
51
51
fmt .Printf ("Error serializing compilation database: %s" , err )
52
52
return
53
- } else if err := db .filename .WriteFile (jsonContents ); err != nil {
53
+ } else if err := db .File .WriteFile (jsonContents ); err != nil {
54
54
fmt .Printf ("Error writing compilation database: %s" , err )
55
55
}
56
56
}
@@ -77,5 +77,5 @@ func (db *CompilationDatabase) Add(target *paths.Path, command *exec.Cmd) {
77
77
File : target .String (),
78
78
}
79
79
80
- db .contents = append (db .contents , entry )
80
+ db .Contents = append (db .Contents , entry )
81
81
}
0 commit comments