Reviewed By: martintrojer Differential Revision: D14880808 fbshipit-source-id: 1192dc4c2master
parent
86d4c5a55f
commit
183e9ed9fa
@ -0,0 +1,15 @@
|
||||
// Copyright (c) 2019-present, Facebook, Inc.
|
||||
//
|
||||
// This source code is licensed under the MIT license found in the
|
||||
// LICENSE file in the root directory of this source tree.
|
||||
DEFINE-CHECKER CALL_CXX_METHOD = {
|
||||
SET report_when =
|
||||
WHEN call_cxx_method("fooBar") OR call_cxx_method("bar")
|
||||
HOLDS-IN-NODE CXXMemberCallExpr;
|
||||
|
||||
SET message = "Do not call fooBar or bar.";
|
||||
SET suggestion = "Call something else.";
|
||||
SET severity = "WARNING";
|
||||
SET mode = "OFF";
|
||||
|
||||
};
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2019-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
namespace {
|
||||
struct Foo {
|
||||
void bar(){};
|
||||
void toUnsafeFuture(){};
|
||||
};
|
||||
struct Bar {
|
||||
virtual void fooBar() { f.bar(); };
|
||||
Foo f;
|
||||
};
|
||||
} // anonymous namespace
|
||||
|
||||
int main() {
|
||||
Foo{}.bar();
|
||||
Foo f;
|
||||
f.bar();
|
||||
Bar{}.fooBar();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in new issue