From dbbd7515a3bb88c1963c74c618a47f214611be39 Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Sun, 19 Apr 2015 21:23:43 +0300 Subject: [PATCH] Add source locations for alien-types. --- NEWS | 2 ++ contrib/sb-introspect/introspect.lisp | 5 +++-- src/code/host-alieneval.lisp | 4 +++- src/compiler/globaldb.lisp | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 81a9d07e5..a03eb813b 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,8 @@ changes relative to sbcl-1.2.10: to a constant (VALUES integer integer) indicating the source line/column from which it was read, intended for logging Lisp runtime errors in a style similar to that afforded by the C preprocessor __LINE__ macro. + * enhancement: improved source locations for VOPs, alien types and + declarations. * bug fix: functions in :FINAL deprecation have the correct docstring. No visible change, as no such functions presently exist. (lp#1439151) * bug fix: (SETF (FDEFINITION this) (FDEFINITION OTHER)) signals an error diff --git a/contrib/sb-introspect/introspect.lisp b/contrib/sb-introspect/introspect.lisp index f0823a795..27cc94140 100644 --- a/contrib/sb-introspect/introspect.lisp +++ b/contrib/sb-introspect/introspect.lisp @@ -182,6 +182,7 @@ name. Type can currently be one of the following: :STRUCTURE :SYMBOL-MACRO :TYPE + :ALIEN-TYPE :VARIABLE :DECLARATION @@ -334,8 +335,8 @@ If an unsupported TYPE is requested, the function will return NIL. (setf (definition-source-description source) (list name)) source)))))) - ((:vop) - (let ((loc (sb-int:info :source-location :vop name))) + ((:vop :alien-type) + (let ((loc (sb-int:info :source-location type name))) (and loc (translate-source-location loc)))) ((:source-transform) diff --git a/src/code/host-alieneval.lisp b/src/code/host-alieneval.lisp index 6ffa108a4..c722eaca9 100644 --- a/src/code/host-alieneval.lisp +++ b/src/code/host-alieneval.lisp @@ -290,7 +290,9 @@ ,@(when *new-auxiliary-types* `((%def-auxiliary-alien-types ',*new-auxiliary-types*))) ,@(when name - `((%define-alien-type ',name ',alien-type))))))) + `((%define-alien-type ',name ',alien-type) + (setf (info :source-location :alien-type ',name) + (sb!c:source-location)))))))) (eval-when (#-sb-xc :compile-toplevel :load-toplevel :execute) (defun %def-auxiliary-alien-types (types) diff --git a/src/compiler/globaldb.lisp b/src/compiler/globaldb.lisp index 978fb58cf..ae51892b0 100644 --- a/src/compiler/globaldb.lisp +++ b/src/compiler/globaldb.lisp @@ -718,6 +718,7 @@ (define-info-type (:source-location :symbol-macro) :type-spec t) (define-info-type (:source-location :vop) :type-spec t) (define-info-type (:source-location :declaration) :type-spec t) +(define-info-type (:source-location :alien-type) :type-spec t) ;; This is for the SB-INTROSPECT contrib module, and debugging. (defun call-with-each-info (function symbol) -- 2.11.4.GIT