Class: Benchcc::Compiler
- Inherits:
-
Object
- Object
- Benchcc::Compiler
- Defined in:
- lib/benchcc/compiler.rb
Overview
Basic interface to compiler frontends.
Class Method Summary collapse
Instance Method Summary collapse
-
#compile(file, *args) ⇒ Object
compile: Path -> Hash.
-
#to_s ⇒ Object
Show the name and the version of the compiler.
Class Method Details
.guess_from_binary(binary) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/benchcc/compiler.rb', line 28 def self.guess_from_binary(binary) stdout, stderr, status = Open3.capture3("#{binary} --version") case stdout when /\(GCC\)/ return GCC.new(binary) when /clang/ return Clang.new(binary) else raise ArgumentError("unknown compiler #{binary}") end end |
Instance Method Details
#compile(file, *args) ⇒ Object
compile: Path -> Hash
Compile the given file and return compilation statistics.
Additional compiler-specific arguments may be specified. A CompilationError is raised if the compilation fails for whatever reason.
24 25 26 |
# File 'lib/benchcc/compiler.rb', line 24 def compile(file, *args) raise NotImplementedError end |
#to_s ⇒ Object
Show the name and the version of the compiler.
13 14 15 |
# File 'lib/benchcc/compiler.rb', line 13 def to_s raise NotImplementedError end |