[clang] [clang] Warn on mismatched RequiresCapability attributes (PR #67520)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 20 03:59:25 PST 2024


================
@@ -2073,6 +2073,18 @@ class ThreadSafetyReporter : public clang::threadSafety::ThreadSafetyHandler {
     Warnings.emplace_back(std::move(Warning), getNotes());
   }
 
+  void handleAttributeMismatch(const NamedDecl *ThisDecl,
+                               const NamedDecl *PrevDecl) override {
+    PartialDiagnosticAt Warning(ThisDecl->getLocation(),
+                                S.PDiag(diag::warn_attribute_mismatch)
+                                    << ThisDecl);
+    Warnings.emplace_back(std::move(Warning), getNotes());
+
+    PartialDiagnosticAt Note(PrevDecl->getLocation(),
+                             S.PDiag(diag::note_previous_decl) << PrevDecl);
+    Warnings.emplace_back(std::move(Note), getNotes());
----------------
tbaederr wrote:

Ah yes, that makes sense. Thanks!

https://github.com/llvm/llvm-project/pull/67520


More information about the cfe-commits mailing list