Skip to content

Commit

Permalink
Fix deprecated type declaration syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Feb 13, 2017
1 parent 7feddb6 commit 3c8a525
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
julia 0.5
Compat 0.9.5
Compat 0.17.0
8 changes: 4 additions & 4 deletions src/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# other related types and utilities.

# forward-declarations
@reftypedef abstract User <: Value
@reftypedef abstract Constant <: User
@reftypedef abstract GlobalValue <: Constant
@reftypedef abstract GlobalObject <: GlobalValue
@reftypedef @compat abstract type User <: Value end
@reftypedef @compat abstract type Constant <: User end
@reftypedef @compat abstract type GlobalValue <: Constant end
@reftypedef @compat abstract type GlobalObject <: GlobalValue end
@reftypedef proxy=Value kind=LLVMFunctionValueKind immutable Function <: GlobalObject end
@reftypedef proxy=Value kind=LLVMBasicBlockValueKind immutable BasicBlock <: Value end

Expand Down
2 changes: 1 addition & 1 deletion src/core/attributes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export Attribute,
EnumAttribute, StringAttribute,
kind, value

@reftypedef ref=LLVMAttributeRef abstract Attribute
@reftypedef ref=LLVMAttributeRef @compat abstract type Attribute end

@reftypedef proxy=Attribute immutable EnumAttribute <: Attribute end

Expand Down
6 changes: 3 additions & 3 deletions src/core/type.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ width(inttyp::IntegerType) = API.LLVMGetIntTypeWidth(ref(inttyp))

# NOTE: this type doesn't exist in the LLVM API,
# we add it for convenience of typechecking generic values (see execution.jl)
@reftypedef abstract FloatingPointType <: LLVMType
@reftypedef @compat abstract type FloatingPointType <: LLVMType end

# NOTE: we don't handle the obscure types here (:X86FP80, :FP128, :PPCFP128),
# they would also need special casing as LLVMPPCFP128Type != LLVMPPC_FP128TypeKind
Expand Down Expand Up @@ -96,14 +96,14 @@ end

## composite types

@reftypedef abstract CompositeType <: LLVMType
@reftypedef @compat abstract type CompositeType <: LLVMType end


## sequential types

export addrspace

@reftypedef abstract SequentialType <: CompositeType
@reftypedef @compat abstract type SequentialType <: CompositeType end

import Base: length, size, eltype

Expand Down
2 changes: 1 addition & 1 deletion src/pass.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export Pass

abstract Pass
@compat abstract type Pass end


#
Expand Down
2 changes: 1 addition & 1 deletion src/passmanager.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export PassManager,
add!, dispose

abstract PassManager
@compat abstract type PassManager end

add!(pm::PassManager, pass::Pass) =
API.LLVMAddPass(ref(pm), ref(pass))
Expand Down
4 changes: 2 additions & 2 deletions src/types.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## forward declarations
# TODO: LLVM.Type once JuliaLang/Julia#18756 is backported
@reftypedef ref=LLVMTypeRef enum=LLVMTypeKind abstract LLVMType
@reftypedef ref=LLVMValueRef enum=LLVMValueKind abstract Value
@reftypedef ref=LLVMTypeRef enum=LLVMTypeKind @compat abstract type LLVMType end
@reftypedef ref=LLVMValueRef enum=LLVMValueKind @compat abstract type Value end
@reftypedef ref=LLVMModuleRef immutable Module end
@reftypedef ref=LLVMTargetDataRef immutable DataLayout end

Expand Down
4 changes: 4 additions & 0 deletions src/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ macro reftypedef(args...)
typedef = args[end]

# decode type definition
if typedef.head == :macrocall
# handle `@compat` prefixing 0.6-style type declarations
typedef = macroexpand(typedef)
end
if typedef.head == :abstract
structure = typedef.args[1]
elseif typedef.head == :type
Expand Down

0 comments on commit 3c8a525

Please sign in to comment.