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

(#147) DIModule #157

Merged
merged 5 commits into from
Nov 11, 2020
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
12 changes: 10 additions & 2 deletions asm/specialized_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -1110,8 +1110,16 @@ func (gen *generator) irDIModule(new metadata.SpecializedNode, old *ast.DIModule
md.ConfigMacros = stringLit(oldField.ConfigMacros())
case *ast.IncludePathField:
md.IncludePath = stringLit(oldField.IncludePath())
case *ast.SysrootField:
md.Sysroot = stringLit(oldField.Sysroot())
case *ast.APINotesField:
md.APINotes = stringLit(oldField.APINotes())
case *ast.FileField:
file, err := gen.irMDField(oldField.File())
if err != nil {
return nil, errors.WithStack(err)
}
md.File = file
case *ast.LineField:
md.Line = intLit(oldField.Line())
default:
panic(fmt.Errorf("support for DIModule field %T not yet implemented", old))
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/google/go-cmp v0.3.1
github.com/kr/pretty v0.2.0
github.com/kr/text v0.2.0 // indirect
github.com/llir/ll v0.0.0-20200425014433-60cd8feecf92
github.com/llir/ll v0.0.0-20201108035927-e6454a4aa8b6
github.com/mewmew/float v0.0.0-20191226120903-16bbe2fdd85e
github.com/pkg/errors v0.9.1
golang.org/x/mod v0.3.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/llir/ll v0.0.0-20200425014433-60cd8feecf92 h1:46SWNHwNB1dvOK+9gO3TENanWN9ICNCXvt4uYAQh8aw=
github.com/llir/ll v0.0.0-20200425014433-60cd8feecf92/go.mod h1:8W5HJz80PitAyPZUpOcljQxTu6LD5YKW1URTo+OjVoc=
github.com/llir/ll v0.0.0-20201108035927-e6454a4aa8b6 h1:QDN0XtGiUcDkBWt7Ud+8bEEyYDZY4Y8G0ooi5dITAdE=
github.com/llir/ll v0.0.0-20201108035927-e6454a4aa8b6/go.mod h1:8W5HJz80PitAyPZUpOcljQxTu6LD5YKW1URTo+OjVoc=
github.com/mewmew/float v0.0.0-20191226120903-16bbe2fdd85e h1:KCD7E/8LKwDsC5ymlEWJ3xCiSPaCywrS/psToBMOBH4=
github.com/mewmew/float v0.0.0-20191226120903-16bbe2fdd85e/go.mod h1:O+xb+8ycBNHzJicFVs7GRWtruD4tVZI0huVnw5TM01E=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand Down
16 changes: 13 additions & 3 deletions ir/metadata/specialized_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,9 @@ type DIModule struct {
Name string // required.
ConfigMacros string // optional; empty if not present.
IncludePath string // optional; empty if not present.
Sysroot string // optional; empty if not present.
APINotes string // optional; empty if not present.
File Field // optional; empty if not present.
Line int64 // optional; zero value if not present.
}

// String returns the LLVM syntax representation of the specialized metadata
Expand Down Expand Up @@ -1471,8 +1473,16 @@ func (md *DIModule) LLString() string {
field := fmt.Sprintf("includePath: %s", quote(md.IncludePath))
fields = append(fields, field)
}
if len(md.Sysroot) > 0 {
field := fmt.Sprintf("sysroot: %s", quote(md.Sysroot))
if len(md.APINotes) > 0 {
field := fmt.Sprintf("apinotes: %s", quote(md.APINotes))
fields = append(fields, field)
}
if md.File != nil {
field := fmt.Sprintf("file: %s", md.File)
fields = append(fields, field)
}
if md.Line != 0 {
field := fmt.Sprintf("line: %d", md.Line)
fields = append(fields, field)
}
fmt.Fprintf(buf, "!DIModule(%s)", strings.Join(fields, ", "))
Expand Down
2 changes: 1 addition & 1 deletion testdata
Submodule testdata updated 6360 files