Reviewed By: jvillard Differential Revision: D25371929 fbshipit-source-id: 966f333e3master
parent
f5936689a4
commit
27ab8bd253
@ -0,0 +1,21 @@
|
||||
(*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*)
|
||||
|
||||
open! IStd
|
||||
|
||||
let dispatch : (unit, unit, unit) ProcnameDispatcher.TypName.dispatcher =
|
||||
let open ProcnameDispatcher.TypName in
|
||||
make_dispatcher
|
||||
[ -"folly" &:: "Optional" &::.*--> ()
|
||||
; -"std" &:: "__wrap_iter" &::.*--> ()
|
||||
; -"std" &:: "atomic" &::.*--> ()
|
||||
; -"std" &:: "function" &::.*--> ()
|
||||
; -"std" &:: "optional" &::.*--> ()
|
||||
; -"std" &:: "vector" &::.*--> () ]
|
||||
|
||||
|
||||
let is_blocklisted_struct typ_name = dispatch () typ_name |> Option.is_some
|
@ -0,0 +1,11 @@
|
||||
(*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*)
|
||||
|
||||
open! IStd
|
||||
|
||||
val is_blocklisted_struct : Typ.name -> bool
|
||||
(** Check if a struct name is in the blocklist for uninit checker. *)
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
|
||||
void get_closure(std::function<int()> closure);
|
||||
|
||||
class Uninit {
|
||||
void closure_call_ok() {
|
||||
auto closure = [this]() { return 5; };
|
||||
get_closure(closure);
|
||||
}
|
||||
|
||||
class MyClass {
|
||||
public:
|
||||
int i;
|
||||
int j;
|
||||
};
|
||||
|
||||
void init_by_store(MyClass* x) {
|
||||
MyClass y{3, 5};
|
||||
reinterpret_cast<std::atomic<MyClass>*>(x)->store(
|
||||
y, std::memory_order_release);
|
||||
}
|
||||
|
||||
void call_init_by_store_ok() {
|
||||
MyClass x;
|
||||
init_by_store(&x);
|
||||
int y = x.i;
|
||||
}
|
||||
};
|
Loading…
Reference in new issue