[PATCH] D100955: [-Wcalled-once] Do not run analysis on Obj-C++

Valeriy Savchenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 22 05:21:25 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG5780dbeee648: [-Wcalled-once] Do not run analysis on Obj-C++ (authored by vsavchenko).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100955/new/

https://reviews.llvm.org/D100955

Files:
  clang/lib/Sema/AnalysisBasedWarnings.cpp
  clang/test/SemaObjCXX/warn-called-once.mm


Index: clang/test/SemaObjCXX/warn-called-once.mm
===================================================================
--- clang/test/SemaObjCXX/warn-called-once.mm
+++ clang/test/SemaObjCXX/warn-called-once.mm
@@ -1,7 +1,13 @@
-// RUN: %clang_cc1 -verify -fsyntax-only -Wcompletion-handler %s
+// RUN: %clang_cc1 -verify -fsyntax-only -fblocks -Wcompletion-handler %s
 
 // expected-no-diagnostics
 
 class HasCtor {
   HasCtor(void *) {}
 };
+
+void double_call_one_block(void (^completionHandler)(void)) {
+  completionHandler();
+  completionHandler();
+  // no-warning - we don't support C++/Obj-C++ yet
+}
Index: clang/lib/Sema/AnalysisBasedWarnings.cpp
===================================================================
--- clang/lib/Sema/AnalysisBasedWarnings.cpp
+++ clang/lib/Sema/AnalysisBasedWarnings.cpp
@@ -2403,7 +2403,7 @@
   }
 
   // Check for violations of "called once" parameter properties.
-  if (S.getLangOpts().ObjC &&
+  if (S.getLangOpts().ObjC && !S.getLangOpts().CPlusPlus &&
       shouldAnalyzeCalledOnceParameters(Diags, D->getBeginLoc())) {
     if (AC.getCFG()) {
       CalledOnceCheckReporter Reporter(S, IPData->CalledOnceData);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100955.339580.patch
Type: text/x-patch
Size: 1164 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210422/9b22de22/attachment.bin>


More information about the cfe-commits mailing list