Convert a regular declaration into an omap of identifiers to parameter declarations.
(decl-to-ident-paramdecl-map decl) → map
The resulting parameter declarations represent the same variables, with the same types and qualifiers. The keys to the omap are the identifiers bound by each parameter declaration.
A declaration which introduces multiple variables is converted to an omap
of equal length to the number of identifiers. For instance, the
declaration
Only variable declarations are converted. Static assertions result in
This is used by split-fn to track declared variables and to create parameters for the newly generated function (with the subset of declared variables which are used).
Function:
(defun decl-to-ident-paramdecl-map0 (declspecs initdeclors) (declare (xargs :guard (and (decl-spec-listp declspecs) (initdeclor-listp initdeclors)))) (let ((__function__ 'decl-to-ident-paramdecl-map0)) (declare (ignorable __function__)) (b* (((when (endp initdeclors)) nil) ((initdeclor initdeclor) (first initdeclors)) (ident (declor->ident initdeclor.declor))) (omap::update ident (make-paramdecl :spec declspecs :decl (paramdeclor-declor initdeclor.declor)) (decl-to-ident-paramdecl-map0 declspecs (rest initdeclors))))))
Theorem:
(defthm ident-paramdecl-mapp-of-decl-to-ident-paramdecl-map0 (b* ((map (decl-to-ident-paramdecl-map0 declspecs initdeclors))) (ident-paramdecl-mapp map)) :rule-classes :rewrite)
Function:
(defun decl-to-ident-paramdecl-map (decl) (declare (xargs :guard (declp decl))) (let ((__function__ 'decl-to-ident-paramdecl-map)) (declare (ignorable __function__)) (decl-case decl :decl (decl-to-ident-paramdecl-map0 decl.specs decl.init) :statassert nil)))
Theorem:
(defthm ident-paramdecl-mapp-of-decl-to-ident-paramdecl-map (b* ((map (decl-to-ident-paramdecl-map decl))) (ident-paramdecl-mapp map)) :rule-classes :rewrite)