Issue 145628
Summary [clang-tidy] [Modules] Avoid duplicated checkings
Labels clang-tidy
Assignees
Reporter ChuanqiXu9
    Reproducer:

```
// RUN: rm -fr %t
// RUN: mkdir %t
// RUN: split-file %s %t
// RUN: mkdir %t/tmp
//
// RUN: %clang -std=c++20 -x c++-module %t/a.cpp --precompile -o %t/a.pcm
//
// RUN: %check_clang_tidy -std=c++20 -check-suffix=DEFAULT %t/a.cpp \
// RUN:   cppcoreguidelines-narrowing-conversions %t/a.cpp -- \
// RUN:   -config='{}'

// RUN: clang-tidy %t/use.cpp -fix --checks=-*,cppcoreguidelines-narrowing-conversions \
// RUN: -config={} -- \
// RUN:     -fmodule-file=a=%t/a.pcm -std=c++20 -nostdinc++

//--- a.cpp
export module a;
export void most_narrowing_is_not_ok() {
  int i;
  long long ui;
  i = ui;
  // CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:7: warning: narrowing conversion from 'long long' to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
}

//--- use.cpp
import a;
void use() {
    most_narrowing_is_not_ok();
    // CHECK-MESSAGES-DEFAULT:
}
```

In this example, we don't hope we see the warning for use.cpp. Concretely, we can save a lot of times avoid duplicated checkings.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to