Reviewed By: dulmarod Differential Revision: D7829738 fbshipit-source-id: 73be42fmaster
parent
038c0b92d4
commit
d4337abcb4
@ -1 +1 @@
|
|||||||
Subproject commit b639c067dbad75be0f0fb92bc8d1bd0732d453de
|
Subproject commit c29650957f6fcb8c82aa5da2c7b9971ede8677ac
|
@ -0,0 +1,18 @@
|
|||||||
|
# Copyright (c) 2016 - present Facebook, Inc.
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
TESTS_DIR = ../../..
|
||||||
|
|
||||||
|
ANALYZER = linters
|
||||||
|
CLANG_OPTIONS = -std=c++11 -c
|
||||||
|
INFER_OPTIONS = --cxx --linters-def-file linters_example.al --project-root $(TESTS_DIR)
|
||||||
|
INFERPRINT_OPTIONS = --issues-tests
|
||||||
|
|
||||||
|
SOURCES = \
|
||||||
|
$(wildcard *.cpp)
|
||||||
|
|
||||||
|
include $(TESTS_DIR)/clang.make
|
@ -0,0 +1 @@
|
|||||||
|
codetoanalyze/cpp/linters-for-test-only/test_constructor.cpp, g, 19, FIND_CXX_COPY_CONSTRUCTOR, WARNING, []
|
@ -0,0 +1,13 @@
|
|||||||
|
DEFINE-CHECKER FIND_CXX_COPY_CONSTRUCTOR = {
|
||||||
|
|
||||||
|
LET is_copy_constructor =
|
||||||
|
is_node("CXXConstructExpr") AND is_cxx_copy_constructor();
|
||||||
|
|
||||||
|
SET report_when =
|
||||||
|
IN-NODE VarDecl WITH-TRANSITION InitExpr
|
||||||
|
(is_copy_constructor HOLDS-EVENTUALLY )
|
||||||
|
HOLDS-EVENTUALLY;
|
||||||
|
|
||||||
|
SET message = "Found Copy Constructor";
|
||||||
|
|
||||||
|
};
|
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 - present Facebook, Inc.
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
struct A {
|
||||||
|
int a, b, c, d;
|
||||||
|
};
|
||||||
|
|
||||||
|
const A& f() {
|
||||||
|
static A a;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
int g() {
|
||||||
|
auto x = f();
|
||||||
|
return x.a + x.b;
|
||||||
|
}
|
Loading…
Reference in new issue