[PATCH] Add llvm-go tool.

Rui Ueyama ruiu at google.com
Wed Oct 22 17:27:02 PDT 2014


================
Comment at: bindings/go/build.sh:31
@@ -57,11 +30,2 @@
 llvm_version="$($llvm_config --version)"
-llvm_cflags="$($llvm_config --cppflags)"
-llvm_ldflags="$($llvm_config --ldflags) $($llvm_config --libs $llvm_components) $($llvm_config --system-libs)"
-if [ $(uname) != "Darwin" ]; then
-  # OS X doesn't like -rpath with cgo. See:
-  # https://code.google.com/p/go/issues/detail?id=7293
-  llvm_ldflags="-Wl,-rpath,$($llvm_config --libdir) $llvm_ldflags"
-fi
-sed -e "s#@LLVM_CFLAGS@#$llvm_cflags#g; s#@LLVM_LDFLAGS@#$llvm_ldflags#g" $gollvmdir/llvm_config.go.in > \
-  $gollvmdir/llvm_config.go
 printf "package llvm\n\nconst Version = \"%s\"\n" "$llvm_version" > $gollvmdir/version.go
----------------
I think generated files shouldn't be written to the LLVM source tree. Instead it should be written to the build directory.

================
Comment at: tools/llvm-go/llvm-go.go:35
@@ +34,3 @@
+
+type compilerflags struct {
+	cppflags, cxxflags, ldflags string
----------------
compilerFlags

================
Comment at: tools/llvm-go/llvm-go.go:36
@@ +35,3 @@
+type compilerflags struct {
+	cppflags, cxxflags, ldflags string
+}
----------------
drop "flags" from field name.

================
Comment at: tools/llvm-go/llvm-go.go:103
@@ +102,3 @@
+		} else if a == "-tags" && i+1 < len(args) {
+			args[i+1] = args[i+1] + tag
+			addedTag = true
----------------
This should be

  args[i+1] = args[i+1] + " " + tag

?

================
Comment at: tools/llvm-go/llvm-go.go:120
@@ +119,3 @@
+
+	fmt.Printf(`// +build !byollvm
+
----------------
You may want to a comment that this file is auto-generated by llvm-go.go.

================
Comment at: tools/llvm-go/llvm-go.go:152
@@ +151,3 @@
+
+		os.Symlink(filepath.Join(srcdir, p.llvmpath), path)
+	}
----------------
Need to check the return value. On Windows I think it will return an error.

================
Comment at: tools/llvm-go/llvm-go.go:189
@@ +188,3 @@
+	}
+	proc.Wait()
+
----------------
Check the error.

================
Comment at: tools/llvm-go/llvm-go.go:209
@@ +208,3 @@
+		printConfig()
+	}
+}
----------------
Print the help message if none above.

http://reviews.llvm.org/D5902






More information about the llvm-commits mailing list