forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix daedalean-friend-declarations check
Use the right argument to check if the friend is an overloaded operator. Remove `#if 0` that prevented the test from passing. Tested with: ./build/bin/llvm-lit -v clang-tools-extra/test/clang-tidy/checkers/daedalean-friend-declarations.cpp
- Loading branch information
1 parent
8050e3c
commit 03bc5bb
Showing
2 changed files
with
15 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 7 additions & 6 deletions
13
clang-tools-extra/test/clang-tidy/checkers/daedalean-friend-declarations.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
// RUN: %check_clang_tidy %s daedalean-friend-declarations %t | ||
#if 0 | ||
|
||
class S {}; | ||
|
||
class B {}; | ||
|
||
class A { | ||
friend class B; | ||
// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: Friend declaration must not be used [daedalean-friend-declarations] | ||
friend void foo(); | ||
// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: Friend declaration must not be used [daedalean-friend-declarations] | ||
friend S& operator << (S&, const A&); | ||
friend S &operator<<(S &, const A &); | ||
}; | ||
|
||
#endif | ||
template<typename T> | ||
template <typename T> | ||
class C { | ||
|
||
template<typename U> | ||
template <typename U> | ||
friend class C; | ||
}; | ||
|
||
C<int> bar() { | ||
return {}; | ||
} | ||
} |