Skip to content

Commit 355dd3e

Browse files
committed
compilation database: made some fields public
1 parent c50fa1c commit 355dd3e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: arduino/builder/compilation_database.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import (
2626

2727
// CompilationDatabase keeps track of all the compile commands run by the builder
2828
type CompilationDatabase struct {
29-
contents []CompilationCommand
30-
filename *paths.Path
29+
Contents []CompilationCommand
30+
File *paths.Path
3131
}
3232

3333
// CompilationCommand keeps track of a single run of a compile command
@@ -40,17 +40,17 @@ type CompilationCommand struct {
4040
// NewCompilationDatabase creates an empty CompilationDatabase
4141
func NewCompilationDatabase(filename *paths.Path) *CompilationDatabase {
4242
return &CompilationDatabase{
43-
filename: filename,
43+
File: filename,
4444
}
4545
}
4646

4747
// SaveToFile save the CompilationDatabase to file as a clangd-compatible compile_commands.json,
4848
// see https://clang.llvm.org/docs/JSONCompilationDatabase.html
4949
func (db *CompilationDatabase) SaveToFile() {
50-
if jsonContents, err := json.MarshalIndent(db.contents, "", " "); err != nil {
50+
if jsonContents, err := json.MarshalIndent(db.Contents, "", " "); err != nil {
5151
fmt.Printf("Error serializing compilation database: %s", err)
5252
return
53-
} else if err := db.filename.WriteFile(jsonContents); err != nil {
53+
} else if err := db.File.WriteFile(jsonContents); err != nil {
5454
fmt.Printf("Error writing compilation database: %s", err)
5555
}
5656
}
@@ -77,5 +77,5 @@ func (db *CompilationDatabase) Add(target *paths.Path, command *exec.Cmd) {
7777
File: target.String(),
7878
}
7979

80-
db.contents = append(db.contents, entry)
80+
db.Contents = append(db.Contents, entry)
8181
}

0 commit comments

Comments
 (0)