-
Notifications
You must be signed in to change notification settings - Fork 43
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
Use Base.CoreLogging #78
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,10 @@ os: | |
- linux | ||
- osx | ||
|
||
env: | ||
- DEBUG=true | ||
- DEBUG=false | ||
|
||
julia: | ||
- nightly | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,11 +9,9 @@ identify(::Type{LLVMType}, ::Val{K}) where {K} = bug("Unknown type kind $K") | |
|
||
@inline function check(::Type{T}, ref::API.LLVMTypeRef) where T<:LLVMType | ||
ref==C_NULL && throw(NullException()) | ||
@static if DEBUG | ||
@debug begin | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like an odd use of Really There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I wanted to avoid (DRY) another global |
||
T′ = identify(LLVMType, ref) | ||
if T != T′ | ||
error("invalid conversion of $T′ type reference to $T") | ||
end | ||
@assert T==T′ "invalid conversion of $T′ type reference to $T" | ||
end | ||
end | ||
|
||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ Context() do ctx | |
@test typeof(LLVM.ref(typ)) == LLVM.API.LLVMTypeRef # untyped | ||
|
||
@test typeof(LLVM.IntegerType(LLVM.ref(typ))) == LLVM.IntegerType # type reconstructed | ||
if LLVM.DEBUG | ||
@debug begin # TODO: does this correspond with the loglevel of the LLVM module? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like the wrong use of |
||
@test_throws ErrorException LLVM.FunctionType(LLVM.ref(typ)) # wrong type | ||
end | ||
@test_throws NullException LLVM.FunctionType(LLVM.API.LLVMTypeRef(C_NULL)) | ||
|
@@ -182,7 +182,7 @@ LLVM.Module("SomeModule", ctx) do mod | |
@test typeof(LLVM.ref(val)) == LLVM.API.LLVMValueRef # untyped | ||
|
||
@test typeof(LLVM.Instruction(LLVM.ref(val))) == LLVM.AllocaInst # type reconstructed | ||
if LLVM.DEBUG | ||
@debug begin # TODO: does this correspond with the loglevel of the LLVM module? | ||
@test_throws ErrorException LLVM.Function(LLVM.ref(val)) # wrong | ||
end | ||
@test_throws NullException LLVM.Function(LLVM.API.LLVMValueRef(C_NULL)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, there's not a system for configuration yet, but what you're doing here is a very common pattern for this kind of thing which needs some kind of support. Actually I'm not sure I'll even have time for doing something nice for configuration in 1.0 - there's still a lot of other arguably-breaking-but-probably-not-feature-frozen things which need straightening out in Base, while configuration can be done in a package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can work with an env flag and global logger for now.