Skip to content

Commit 063fac5

Browse files
committed
Remove ShowFullyQualifiedNames to be added separately
1 parent ade740c commit 063fac5

File tree

4 files changed

+18
-46
lines changed

4 files changed

+18
-46
lines changed

clang-tools-extra/clang-tidy/bugprone/UnsafeFunctionsCheck.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ namespace clang::tidy::bugprone {
2121

2222
static constexpr llvm::StringLiteral OptionNameCustomFunctions =
2323
"CustomFunctions";
24-
static constexpr llvm::StringLiteral OptionNameShowFullyQualifiedNames =
25-
"ShowFullyQualifiedNames";
2624
static constexpr llvm::StringLiteral OptionNameReportDefaultFunctions =
2725
"ReportDefaultFunctions";
2826
static constexpr llvm::StringLiteral OptionNameReportMoreUnsafeFunctions =
@@ -187,8 +185,6 @@ UnsafeFunctionsCheck::UnsafeFunctionsCheck(StringRef Name,
187185
: ClangTidyCheck(Name, Context),
188186
CustomFunctions(parseCheckedFunctions(
189187
Options.get(OptionNameCustomFunctions, ""), Context)),
190-
ShowFullyQualifiedNames(
191-
Options.get(OptionNameShowFullyQualifiedNames, false)),
192188
ReportDefaultFunctions(
193189
Options.get(OptionNameReportDefaultFunctions, true)),
194190
ReportMoreUnsafeFunctions(
@@ -197,8 +193,6 @@ UnsafeFunctionsCheck::UnsafeFunctionsCheck(StringRef Name,
197193
void UnsafeFunctionsCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
198194
Options.store(Opts, OptionNameCustomFunctions,
199195
serializeCheckedFunctions(CustomFunctions));
200-
Options.store(Opts, OptionNameShowFullyQualifiedNames,
201-
ShowFullyQualifiedNames);
202196
Options.store(Opts, OptionNameReportDefaultFunctions, ReportDefaultFunctions);
203197
Options.store(Opts, OptionNameReportMoreUnsafeFunctions,
204198
ReportMoreUnsafeFunctions);
@@ -322,12 +316,6 @@ void UnsafeFunctionsCheck::check(const MatchFinder::MatchResult &Result) {
322316
<< SourceExpr->getSourceRange();
323317
}
324318

325-
if (ShowFullyQualifiedNames) {
326-
diag(SourceExpr->getExprLoc(),
327-
"fully qualified name of function is: '%0'", DiagnosticIDs::Note)
328-
<< FuncDecl->getQualifiedNameAsString();
329-
}
330-
331319
return;
332320
}
333321
}

clang-tools-extra/clang-tidy/bugprone/UnsafeFunctionsCheck.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ class UnsafeFunctionsCheck : public ClangTidyCheck {
4343
private:
4444
const std::vector<CheckedFunction> CustomFunctions;
4545

46-
/// If true, the fully qualified name of custom functions will be shown in a
47-
/// note tag.
48-
const bool ShowFullyQualifiedNames;
4946
/// If true, the default set of functions are reported.
5047
const bool ReportDefaultFunctions;
5148
/// If true, additional functions from widely used API-s (such as POSIX) are

clang-tools-extra/docs/clang-tidy/checks/bugprone/unsafe-functions.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,6 @@ fully qualified name (``::std::original``).
121121
As an example, the member function ``open`` in the class ``std::ifstream``
122122
has a fully qualified name of ``::std::basic_ifstream<char>::open``.
123123

124-
To aid with finding the fully qualified names of expressions, the option ``ShowFullyQualifiedNames`` can be used.
125-
This option will show the fully qualified name of all functions matched by the custom function matchers.
126-
127124
Options
128125
-------
129126

clang-tools-extra/test/clang-tidy/checkers/bugprone/unsafe-functions-custom-regex.cpp

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %check_clang_tidy -check-suffix=NON-STRICT-REGEX %s bugprone-unsafe-functions %t --\
2-
// RUN: -config="{CheckOptions: {bugprone-unsafe-functions.CustomFunctions: '::name_match,replacement,is a qualname match;^::prefix_match,,is matched on qualname prefix;^::S::member_match_,,is matched on a C++ class member', bugprone-unsafe-functions.ShowFullyQualifiedNames: true}}"
2+
// RUN: -config="{CheckOptions: {bugprone-unsafe-functions.CustomFunctions: '::name_match,replacement,is a qualname match;^::prefix_match,,is matched on qualname prefix;^::S::member_match_,,is matched on a C++ class member'}}"
33
// RUN: %check_clang_tidy -check-suffix=STRICT-REGEX %s bugprone-unsafe-functions %t --\
44
// RUN: -config="{CheckOptions: {bugprone-unsafe-functions.CustomFunctions: '^name_match$,replacement,is matched on function name only;^::prefix_match$,,is a full qualname match;^::S::member_match_1$,,is matched on a C++ class member'}}"
55

@@ -24,56 +24,46 @@ void prefix_match_regex();
2424

2525
void f1() {
2626
name_match();
27-
// CHECK-NOTES-NON-STRICT-REGEX: :[[@LINE-1]]:3: warning: function 'name_match' is a qualname match; 'replacement' should be used instead
28-
// CHECK-NOTES-NON-STRICT-REGEX: :[[@LINE-2]]:3: note: fully qualified name of function is: 'name_match'
29-
// CHECK-NOTES-STRICT-REGEX: :[[@LINE-3]]:3: warning: function 'name_match' is matched on function name only; 'replacement' should be used instead
27+
// CHECK-MESSAGES-NON-STRICT-REGEX: :[[@LINE-1]]:3: warning: function 'name_match' is a qualname match; 'replacement' should be used instead
28+
// CHECK-MESSAGES-STRICT-REGEX: :[[@LINE-2]]:3: warning: function 'name_match' is matched on function name only; 'replacement' should be used instead
3029
prefix_match();
31-
// CHECK-NOTES-NON-STRICT-REGEX: :[[@LINE-1]]:3: warning: function 'prefix_match' is matched on qualname prefix; it should not be used
32-
// CHECK-NOTES-NON-STRICT-REGEX: :[[@LINE-2]]:3: note: fully qualified name of function is: 'prefix_match'
33-
// CHECK-NOTES-STRICT-REGEX: :[[@LINE-3]]:3: warning: function 'prefix_match' is a full qualname match; it should not be used
30+
// CHECK-MESSAGES-NON-STRICT-REGEX: :[[@LINE-1]]:3: warning: function 'prefix_match' is matched on qualname prefix; it should not be used
31+
// CHECK-MESSAGES-STRICT-REGEX: :[[@LINE-2]]:3: warning: function 'prefix_match' is a full qualname match; it should not be used
3432

3533
::name_match();
36-
// CHECK-NOTES-NON-STRICT-REGEX: :[[@LINE-1]]:3: warning: function 'name_match' is a qualname match; 'replacement' should be used instead
37-
// CHECK-NOTES-NON-STRICT-REGEX: :[[@LINE-2]]:3: note: fully qualified name of function is: 'name_match'
38-
// CHECK-NOTES-STRICT-REGEX: :[[@LINE-3]]:3: warning: function 'name_match' is matched on function name only; 'replacement' should be used instead
34+
// CHECK-MESSAGES-NON-STRICT-REGEX: :[[@LINE-1]]:3: warning: function 'name_match' is a qualname match; 'replacement' should be used instead
35+
// CHECK-MESSAGES-STRICT-REGEX: :[[@LINE-2]]:3: warning: function 'name_match' is matched on function name only; 'replacement' should be used instead
3936
regex_test::name_match();
40-
// CHECK-NOTES-NON-STRICT-REGEX: :[[@LINE-1]]:3: warning: function 'name_match' is a qualname match; 'replacement' should be used instead
41-
// CHECK-NOTES-NON-STRICT-REGEX: :[[@LINE-2]]:3: note: fully qualified name of function is: 'regex_test::name_match'
42-
// CHECK-NOTES-STRICT-REGEX: :[[@LINE-3]]:3: warning: function 'name_match' is matched on function name only; 'replacement' should be used instead
37+
// CHECK-MESSAGES-NON-STRICT-REGEX: :[[@LINE-1]]:3: warning: function 'name_match' is a qualname match; 'replacement' should be used instead
38+
// CHECK-MESSAGES-STRICT-REGEX: :[[@LINE-2]]:3: warning: function 'name_match' is matched on function name only; 'replacement' should be used instead
4339
name_match_regex();
44-
// CHECK-NOTES-NON-STRICT-REGEX: :[[@LINE-1]]:3: warning: function 'name_match_regex' is a qualname match; 'replacement' should be used instead
45-
// CHECK-NOTES-NON-STRICT-REGEX: :[[@LINE-2]]:3: note: fully qualified name of function is: 'name_match_regex'
40+
// CHECK-MESSAGES-NON-STRICT-REGEX: :[[@LINE-1]]:3: warning: function 'name_match_regex' is a qualname match; 'replacement' should be used instead
4641
// no-warning STRICT-REGEX
4742

4843
::prefix_match();
49-
// CHECK-NOTES-NON-STRICT-REGEX: :[[@LINE-1]]:3: warning: function 'prefix_match' is matched on qualname prefix; it should not be used
50-
// CHECK-NOTES-NON-STRICT-REGEX: :[[@LINE-2]]:3: note: fully qualified name of function is: 'prefix_match'
51-
// CHECK-NOTES-STRICT-REGEX: :[[@LINE-3]]:3: warning: function 'prefix_match' is a full qualname match; it should not be used
44+
// CHECK-MESSAGES-NON-STRICT-REGEX: :[[@LINE-1]]:3: warning: function 'prefix_match' is matched on qualname prefix; it should not be used
45+
// CHECK-MESSAGES-STRICT-REGEX: :[[@LINE-2]]:3: warning: function 'prefix_match' is a full qualname match; it should not be used
5246
regex_test::prefix_match();
5347
// no-warning NON-STRICT-REGEX
5448
// no-warning STRICT-REGEX
5549
prefix_match_regex();
56-
// CHECK-NOTES-NON-STRICT-REGEX: :[[@LINE-1]]:3: warning: function 'prefix_match_regex' is matched on qualname prefix; it should not be used
57-
// CHECK-NOTES-NON-STRICT-REGEX: :[[@LINE-2]]:3: note: fully qualified name of function is: 'prefix_match_regex'
50+
// CHECK-MESSAGES-NON-STRICT-REGEX: :[[@LINE-1]]:3: warning: function 'prefix_match_regex' is matched on qualname prefix; it should not be used
5851
// no-warning STRICT-REGEX
5952
}
6053

6154
void f2() {
6255
S s;
6356

6457
S::member_match_1();
65-
// CHECK-NOTES-NON-STRICT-REGEX: :[[@LINE-1]]:3: warning: function 'member_match_1' is matched on a C++ class member; it should not be used
66-
// CHECK-NOTES-NON-STRICT-REGEX: :[[@LINE-2]]:3: note: fully qualified name of function is: 'S::member_match_1'
67-
// CHECK-NOTES-STRICT-REGEX: :[[@LINE-3]]:3: warning: function 'member_match_1' is matched on a C++ class member; it should not be used
58+
// CHECK-MESSAGES-NON-STRICT-REGEX: :[[@LINE-1]]:3: warning: function 'member_match_1' is matched on a C++ class member; it should not be used
59+
// CHECK-MESSAGES-STRICT-REGEX: :[[@LINE-2]]:3: warning: function 'member_match_1' is matched on a C++ class member; it should not be used
6860

6961
s.member_match_1();
70-
// CHECK-NOTES-NON-STRICT-REGEX: :[[@LINE-1]]:5: warning: function 'member_match_1' is matched on a C++ class member; it should not be used
71-
// CHECK-NOTES-NON-STRICT-REGEX: :[[@LINE-2]]:5: note: fully qualified name of function is: 'S::member_match_1'
72-
// CHECK-NOTES-STRICT-REGEX: :[[@LINE-3]]:5: warning: function 'member_match_1' is matched on a C++ class member; it should not be used
62+
// CHECK-MESSAGES-NON-STRICT-REGEX: :[[@LINE-1]]:5: warning: function 'member_match_1' is matched on a C++ class member; it should not be used
63+
// CHECK-MESSAGES-STRICT-REGEX: :[[@LINE-2]]:5: warning: function 'member_match_1' is matched on a C++ class member; it should not be used
7364

7465
s.member_match_2();
75-
// CHECK-NOTES-NON-STRICT-REGEX: :[[@LINE-1]]:5: warning: function 'member_match_2' is matched on a C++ class member; it should not be used
76-
// CHECK-NOTES-NON-STRICT-REGEX: :[[@LINE-2]]:5: note: fully qualified name of function is: 'S::member_match_2'
66+
// CHECK-MESSAGES-NON-STRICT-REGEX: :[[@LINE-1]]:5: warning: function 'member_match_2' is matched on a C++ class member; it should not be used
7767
// no-warning STRICT-REGEX
7868

7969
member_match_1();

0 commit comments

Comments
 (0)