Reviewed By: ddino Differential Revision: D14401963 fbshipit-source-id: 8d080324amaster
parent
5aedc7e71c
commit
5c2ef731ff
@ -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_FUNCTION = {
|
||||||
|
SET report_when =
|
||||||
|
WHEN call_qualified_function("anamespace::the_function") OR call_function("the_other_function")
|
||||||
|
HOLDS-IN-NODE CallExpr;
|
||||||
|
|
||||||
|
SET message = "the_function and the_other_function are not to be called";
|
||||||
|
SET suggestion = "Call something else.";
|
||||||
|
SET severity = "WARNING";
|
||||||
|
SET mode = "ON";
|
||||||
|
|
||||||
|
};
|
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* 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 anamespace {
|
||||||
|
void the_function() {}
|
||||||
|
|
||||||
|
void the_other_function() {}
|
||||||
|
} // namespace anamespace
|
||||||
|
|
||||||
|
namespace anothernamespace {
|
||||||
|
void the_function() {}
|
||||||
|
|
||||||
|
void the_other_function() {}
|
||||||
|
} // namespace anothernamespace
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
anamespace::the_function();
|
||||||
|
anothernamespace::the_function();
|
||||||
|
anamespace::the_other_function();
|
||||||
|
anothernamespace::the_other_function();
|
||||||
|
{
|
||||||
|
using namespace anamespace;
|
||||||
|
the_function();
|
||||||
|
the_other_function();
|
||||||
|
}
|
||||||
|
{
|
||||||
|
using namespace anothernamespace;
|
||||||
|
the_function();
|
||||||
|
the_other_function();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in new issue