File tree 3 files changed +28
-0
lines changed 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -424,6 +424,8 @@ Improvements to Clang's diagnostics
424
424
name was a reserved name, which we improperly allowed to suppress the
425
425
diagnostic.
426
426
427
+ - Clang now diagnoses ``[[deprecated]] `` attribute usage on local variables (#GH90073).
428
+
427
429
Improvements to Clang's time-trace
428
430
----------------------------------
429
431
Original file line number Diff line number Diff line change @@ -182,6 +182,12 @@ static bool ShouldDiagnoseAvailabilityInContext(
182
182
return false ;
183
183
}
184
184
185
+ if (K == AR_Deprecated) {
186
+ if (const auto *VD = dyn_cast<VarDecl>(OffendingDecl))
187
+ if (VD->isLocalVarDeclOrParm () && VD->isDeprecated ())
188
+ return true ;
189
+ }
190
+
185
191
// Checks if we should emit the availability diagnostic in the context of C.
186
192
auto CheckContext = [&](const Decl *C) {
187
193
if (K == AR_NotYetIntroduced) {
Original file line number Diff line number Diff line change @@ -260,5 +260,25 @@ namespace ArrayComp {
260
260
bool b7 = arr1 == +f();
261
261
}
262
262
263
+ namespace GH90073 {
264
+ [[deprecated]] int f1 () { // expected-note {{'f1' has been explicitly marked deprecated here}}
265
+ [[deprecated]] int a; // expected-note {{'a' has been explicitly marked deprecated here}} \
266
+ // expected-note {{'a' has been explicitly marked deprecated here}}
267
+ a = 0 ; // expected-warning {{'a' is deprecated}}
268
+ return a; // expected-warning {{'a' is deprecated}}
269
+ }
270
+
271
+ [[deprecated]] void f2 ([[deprecated]] int x) { // expected-note {{'f2' has been explicitly marked deprecated here}} \
272
+ // expected-note {{'x' has been explicitly marked deprecated here}}
273
+ x = 4 ; // expected-warning {{'x' is deprecated}}
274
+ }
275
+
276
+ int main () {
277
+ f1 (); // expected-warning {{'f1' is deprecated}}
278
+ f2 (1 ); // expected-warning {{'f2' is deprecated}}
279
+ return 0 ;
280
+ }
281
+ }
282
+
263
283
# 1 " /usr/include/system-header.h" 1 3
264
284
void system_header_function (void ) throw();
You can’t perform that action at this time.
0 commit comments