forked from facebook/infer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: This commit is for Inferbo: Infer-based buffer overrun analyzer. Closes facebook#549 Reviewed By: jvillard Differential Revision: D4439297 Pulled By: sblackshear fbshipit-source-id: ddfb5ba
- Loading branch information
1 parent
c5e962e
commit cef2f0e
Showing
37 changed files
with
3,225 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Kihong Heo <khheo@ropas.snu.ac.kr> | ||
Sungkeun Cho <skcho@ropas.snu.ac.kr> | ||
Kwangkeun Yi <kwang@ropas.snu.ac.kr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
(* | ||
* Copyright (c) 2016 - present | ||
* | ||
* Programming Research Laboratory (ROPAS) | ||
* Seoul National University, Korea | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*) | ||
|
||
module F = Format | ||
|
||
module Allocsite = | ||
struct | ||
include String | ||
let pp fmt s = Format.fprintf fmt "%s" s | ||
let make x = x | ||
end | ||
|
||
module Loc = | ||
struct | ||
type t = | ||
| Var of Var.t | ||
| Allocsite of Allocsite.t | ||
| Field of t * Ident.fieldname | ||
[@@deriving compare] | ||
|
||
let rec pp fmt = function | ||
| Var v -> | ||
Var.pp F.str_formatter v; | ||
let s = F.flush_str_formatter () in | ||
if s.[0] = '&' then | ||
F.fprintf fmt "%s" (String.sub s 1 (String.length s - 1)) | ||
else F.fprintf fmt "%s" s | ||
| Allocsite a -> Allocsite.pp fmt a | ||
| Field (l, f) -> F.fprintf fmt "%a.%a" pp l Ident.pp_fieldname f | ||
let is_var = function Var _ -> true | _ -> false | ||
let is_pvar_in_reg v = | ||
Var.pp F.str_formatter v; | ||
let s = F.flush_str_formatter () in | ||
s.[0] = '&' | ||
let is_logical_var = function | ||
| Var (Var.LogicalVar _) -> true | ||
| _ -> false | ||
let of_var v = Var v | ||
let of_allocsite a = Allocsite a | ||
let of_pvar pvar = Var (Var.of_pvar pvar) | ||
let of_id id = Var (Var.of_id id) | ||
let append_field l f = Field (l, f) | ||
|
||
let is_return = function | ||
| Var (Var.ProgramVar x) -> | ||
Mangled.equal (Pvar.get_name x) Ident.name_return | ||
| _ -> false | ||
end | ||
|
||
module PowLoc = | ||
struct | ||
include AbstractDomain.FiniteSet | ||
(struct | ||
include Set.Make (struct type t = Loc.t [@@deriving compare] end) | ||
let pp_element fmt e = Loc.pp fmt e | ||
let pp fmt s = | ||
Format.fprintf fmt "{"; | ||
iter (fun e -> Format.fprintf fmt "%a," pp_element e) s; | ||
Format.fprintf fmt "}" | ||
end) | ||
|
||
let bot = empty | ||
|
||
let of_pvar pvar = singleton (Loc.of_pvar pvar) | ||
let of_id id = singleton (Loc.of_id id) | ||
let append_field ploc fn = fold (fun l -> add (Loc.append_field l fn)) ploc empty | ||
end |
Oops, something went wrong.