Skip to content

Commit 0c4d02e

Browse files
committed
Change terminology "obtaining address of" -> "taking address of"
The wording "take address of" or "taking address of" is more common across the codebase: % git grep 'tak\(e\|ing\) address of' | wc 107 1513 16080 Whereas the wording "obtaining address of" has no occurrence. Use the more common wording.
1 parent 9afacb1 commit 0c4d02e

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ Improvements to Clang's diagnostics
789789
}
790790

791791
- The :doc:`ThreadSafetyAnalysis` now supports ``-Wthread-safety-addressof``,
792-
which enables warning if the address of guarded variables is obtained.
792+
which enables warning on taking the address of guarded variables.
793793

794794
Improvements to Clang's time-trace
795795
----------------------------------

clang/include/clang/Analysis/Analyses/ThreadSafety.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ enum ProtectedOperationKind {
5555
/// Returning a pt-guarded variable by reference.
5656
POK_PtReturnByRef,
5757

58-
/// Obtaining address of a variable (e.g. &x).
58+
/// Taking address of a variable (e.g. &x).
5959
POK_AddressOf,
6060
};
6161

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4142,10 +4142,10 @@ def note_guarded_by_declared_here : Note<"guarded_by declared here">;
41424142

41434143
// Thread safety warnings on addressof
41444144
def warn_addressof_requires_any_lock : Warning<
4145-
"obtaining address of variable %0 requires holding any mutex">,
4145+
"taking address of variable %0 requires holding any mutex">,
41464146
InGroup<ThreadSafetyAddressof>, DefaultIgnore;
41474147
def warn_addressof_requires_lock : Warning<
4148-
"obtaining address of variable %1 requires holding %0 '%2'">,
4148+
"taking address of variable %1 requires holding %0 '%2'">,
41494149
InGroup<ThreadSafetyAddressof>, DefaultIgnore;
41504150

41514151
// Dummy warning that will trigger "beta" warnings from the analysis if enabled.

clang/test/Sema/warn-thread-safety-analysis.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ int main(void) {
136136

137137
#ifdef CHECK_ADDRESSOF
138138
set_value(&a_, 0); // expected-warning{{calling function 'set_value' requires holding mutex 'foo_.mu_' exclusively}} \
139-
expected-warning{{obtaining address of variable 'a_' requires holding mutex 'foo_.mu_'}}
139+
expected-warning{{taking address of variable 'a_' requires holding mutex 'foo_.mu_'}}
140140
#else
141141
set_value(&a_, 0); // expected-warning{{calling function 'set_value' requires holding mutex 'foo_.mu_' exclusively}}
142142
#endif
@@ -187,7 +187,7 @@ int main(void) {
187187
late_parsing.a_value_defined_before = 1; // expected-warning{{writing variable 'a_value_defined_before' requires holding mutex 'a_mutex_defined_late' exclusively}}
188188
late_parsing.a_ptr_defined_before = 0;
189189
# ifdef CHECK_ADDRESSOF
190-
(void)&late_parsing.a_value_defined_before; // expected-warning{{obtaining address of variable 'a_value_defined_before' requires holding mutex 'a_mutex_defined_late'}}
190+
(void)&late_parsing.a_value_defined_before; // expected-warning{{taking address of variable 'a_value_defined_before' requires holding mutex 'a_mutex_defined_late'}}
191191
# else
192192
(void)&late_parsing.a_value_defined_before; // no warning
193193
# endif

clang/test/SemaCXX/warn-thread-safety-analysis.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4953,8 +4953,8 @@ class Foo {
49534953
--data_; // expected-warning {{writing variable 'data_' requires holding mutex 'mu_' exclusively}}
49544954
data_--; // expected-warning {{writing variable 'data_' requires holding mutex 'mu_' exclusively}}
49554955
#ifdef CHECK_ADDRESSOF
4956-
(void)&data_; // expected-warning {{obtaining address of variable 'data_' requires holding mutex 'mu_'}}
4957-
(void)&datap1_; // expected-warning {{obtaining address of variable 'datap1_' requires holding mutex 'mu_'}}
4956+
(void)&data_; // expected-warning {{taking address of variable 'data_' requires holding mutex 'mu_'}}
4957+
(void)&datap1_; // expected-warning {{taking address of variable 'datap1_' requires holding mutex 'mu_'}}
49584958
#else
49594959
(void)&data_; // no warning
49604960
(void)&datap1_; // no warning
@@ -5903,7 +5903,7 @@ class Foo {
59035903

59045904
void ptr_test() {
59055905
#ifdef CHECK_ADDRESSOF
5906-
int *b = &a; // expected-warning {{obtaining address of variable 'a' requires holding mutex 'mu'}}
5906+
int *b = &a; // expected-warning {{taking address of variable 'a' requires holding mutex 'mu'}}
59075907
#else
59085908
int *b = &a; // no warning
59095909
#endif
@@ -6126,7 +6126,7 @@ class Return {
61266126

61276127
Foo *returns_ptr() {
61286128
#ifdef CHECK_ADDRESSOF
6129-
return &foo; // expected-warning {{obtaining address of variable 'foo' requires holding mutex 'mu'}}
6129+
return &foo; // expected-warning {{taking address of variable 'foo' requires holding mutex 'mu'}}
61306130
#else
61316131
return &foo; // no warning
61326132
#endif

0 commit comments

Comments
 (0)