[linters] Fix perf problem in the linters, added tests

Reviewed By: akotulski

Differential Revision: D4204552

fbshipit-source-id: a484464
master
Dulma Churchill 8 years ago committed by Facebook Github Bot
parent 338a8563a1
commit e8085d5996

@ -13,7 +13,7 @@ ifeq ($(IS_FACEBOOK_TREE),yes)
include $(ROOT_DIR)/facebook/Makefile.env
endif
BUILD_SYSTEMS_TESTS = assembly clang_translation project_root_rel
BUILD_SYSTEMS_TESTS = assembly clang_translation linters project_root_rel
ifneq ($(ANT),no)
BUILD_SYSTEMS_TESTS += ant
endif

@ -25,7 +25,7 @@ let is_in_main_file translation_unit_context an =
| None ->
false
| Some file ->
DB.inode_equal
DB.source_file_equal
(CLocation.source_file_from_path file)
translation_unit_context.CFrontend_config.source_file

@ -45,7 +45,7 @@ let should_do_frontend_check trans_unit_ctx (loc_start, _) =
match loc_start.Clang_ast_t.sl_file with
| Some file ->
let equal_current_source file =
DB.inode_equal (source_file_from_path file)
DB.source_file_equal (source_file_from_path file)
trans_unit_ctx.CFrontend_config.source_file in
equal_current_source file ||
(file_in_project file && not Config.testing_mode)

@ -0,0 +1,10 @@
#include "../../../../codetoanalyze/objcpp/linters/componentkit/FakeComponentKitHeader.h"
@interface SomeClass : CKCompositeComponent
@end
@implementation SomeClass
+ (instancetype) new {
int i; // error
return nil;
}
@end

@ -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.
SYM_ROOT = ../codetoanalyze/linters/tsrc_symlink
TESTS_DIR = ../..
ANALYZER = linters
CLANG_OPTIONS = -x objective-c++ -std=c++11 -fblocks -c
INFER_OPTIONS = --no-filtering --debug-exceptions --project_root $(SYM_ROOT)
INFERPRINT_OPTIONS = --issues-tests
SOURCES = $(SYM_ROOT)/main.mm
include $(TESTS_DIR)/clang.make

@ -0,0 +1 @@
main.mm, SomeClass_new, 7, MUTABLE_LOCAL_VARIABLE_IN_COMPONENT_FILE, []
Loading…
Cancel
Save