Skip to content
Snippets Groups Projects
Commit 08af7e8d authored by David Bühler's avatar David Bühler
Browse files

[server] Adds a boolean isFunctionPointer to marker attributes.

parent c611520d
No related branches found
No related tags found
No related merge requests found
...@@ -147,6 +147,8 @@ export interface markerAttributesData { ...@@ -147,6 +147,8 @@ export interface markerAttributesData {
isLval: boolean; isLval: boolean;
/** Whether it is a function symbol */ /** Whether it is a function symbol */
isFunction: boolean; isFunction: boolean;
/** Whether it is a function pointer */
isFunctionPointer: boolean;
/** Whether it is a function declaration */ /** Whether it is a function declaration */
isFunDecl: boolean; isFunDecl: boolean;
/** Function scope of the marker, if applicable */ /** Function scope of the marker, if applicable */
...@@ -165,6 +167,7 @@ export const jMarkerAttributesData: Json.Decoder<markerAttributesData> = ...@@ -165,6 +167,7 @@ export const jMarkerAttributesData: Json.Decoder<markerAttributesData> =
descr: Json.jString, descr: Json.jString,
isLval: Json.jBoolean, isLval: Json.jBoolean,
isFunction: Json.jBoolean, isFunction: Json.jBoolean,
isFunctionPointer: Json.jBoolean,
isFunDecl: Json.jBoolean, isFunDecl: Json.jBoolean,
scope: Json.jOption(Json.jString), scope: Json.jOption(Json.jString),
sloc: Json.jOption(jSource), sloc: Json.jOption(jSource),
...@@ -175,7 +178,8 @@ export const byMarkerAttributesData: Compare.Order<markerAttributesData> = ...@@ -175,7 +178,8 @@ export const byMarkerAttributesData: Compare.Order<markerAttributesData> =
Compare.byFields Compare.byFields
<{ marker: marker, labelKind: string, titleKind: string, name: string, <{ marker: marker, labelKind: string, titleKind: string, name: string,
descr: string, isLval: boolean, isFunction: boolean, descr: string, isLval: boolean, isFunction: boolean,
isFunDecl: boolean, scope?: string, sloc?: source }>({ isFunctionPointer: boolean, isFunDecl: boolean, scope?: string,
sloc?: source }>({
marker: byMarker, marker: byMarker,
labelKind: Compare.alpha, labelKind: Compare.alpha,
titleKind: Compare.alpha, titleKind: Compare.alpha,
...@@ -183,6 +187,7 @@ export const byMarkerAttributesData: Compare.Order<markerAttributesData> = ...@@ -183,6 +187,7 @@ export const byMarkerAttributesData: Compare.Order<markerAttributesData> =
descr: Compare.string, descr: Compare.string,
isLval: Compare.boolean, isLval: Compare.boolean,
isFunction: Compare.boolean, isFunction: Compare.boolean,
isFunctionPointer: Compare.boolean,
isFunDecl: Compare.boolean, isFunDecl: Compare.boolean,
scope: Compare.defined(Compare.string), scope: Compare.defined(Compare.string),
sloc: Compare.defined(bySource), sloc: Compare.defined(bySource),
...@@ -240,8 +245,8 @@ export const markerAttributes: State.Array<marker,markerAttributesData> = marker ...@@ -240,8 +245,8 @@ export const markerAttributes: State.Array<marker,markerAttributesData> = marker
/** Default value for `markerAttributesData` */ /** Default value for `markerAttributesData` */
export const markerAttributesDataDefault: markerAttributesData = export const markerAttributesDataDefault: markerAttributesData =
{ marker: markerDefault, labelKind: '', titleKind: '', name: '', descr: '', { marker: markerDefault, labelKind: '', titleKind: '', name: '', descr: '',
isLval: false, isFunction: false, isFunDecl: false, scope: undefined, isLval: false, isFunction: false, isFunctionPointer: false,
sloc: undefined }; isFunDecl: false, scope: undefined, sloc: undefined };
const getMainFunction_internal: Server.GetRequest<null,fct | undefined> = { const getMainFunction_internal: Server.GetRequest<null,fct | undefined> = {
kind: Server.RqKind.GET, kind: Server.RqKind.GET,
......
...@@ -320,6 +320,13 @@ struct ...@@ -320,6 +320,13 @@ struct
| Some vi -> Globals.Functions.mem vi | Some vi -> Globals.Functions.mem vi
| None -> false | None -> false
let is_function_pointer = function
| PLval (_, _, (Mem _, NoOffset as lval))
when Cil.(isFunctionType (typeOfLval lval)) -> true
| PLval (_, _, lval)
when Cil.(isFunPtrType (Cil.typeOfLval lval)) -> true
| _ -> false
let is_fundecl = function let is_fundecl = function
| PVDecl(Some _,Kglobal,vi) -> vi.vglob && Globals.Functions.mem vi | PVDecl(Some _,Kglobal,vi) -> vi.vglob && Globals.Functions.mem vi
| _ -> false | _ -> false
...@@ -377,6 +384,14 @@ struct ...@@ -377,6 +384,14 @@ struct
~get:(fun (tag, _) -> is_function tag) ~get:(fun (tag, _) -> is_function tag)
model model
let () =
States.column
~name:"isFunctionPointer"
~descr:(Md.plain "Whether it is a function pointer")
~data:(module Jbool)
~get:(fun (tag, _) -> is_function_pointer tag)
model
let () = let () =
States.column States.column
~name:"isFunDecl" ~name:"isFunDecl"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment