[clang] 5780dbe - [-Wcalled-once] Do not run analysis on Obj-C++
Valeriy Savchenko via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 22 05:21:24 PDT 2021
Author: Valeriy Savchenko
Date: 2021-04-22T15:20:52+03:00
New Revision: 5780dbeee6480fdceae66fb57dcc7bd1cfcda5c9
URL: https://github.com/llvm/llvm-project/commit/5780dbeee6480fdceae66fb57dcc7bd1cfcda5c9
DIFF: https://github.com/llvm/llvm-project/commit/5780dbeee6480fdceae66fb57dcc7bd1cfcda5c9.diff
LOG: [-Wcalled-once] Do not run analysis on Obj-C++
Objective-C++ is not yet suppoerted.
rdar://76729552
Differential Revision: https://reviews.llvm.org/D100955
Added:
Modified:
clang/lib/Sema/AnalysisBasedWarnings.cpp
clang/test/SemaObjCXX/warn-called-once.mm
Removed:
################################################################################
diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp
index bcd6a00d7ba5a..aa2602c8d9256 100644
--- a/clang/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp
@@ -2403,7 +2403,7 @@ void clang::sema::AnalysisBasedWarnings::IssueWarnings(
}
// 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);
diff --git a/clang/test/SemaObjCXX/warn-called-once.mm b/clang/test/SemaObjCXX/warn-called-once.mm
index 312da27d9ae32..3763a9b219f24 100644
--- a/clang/test/SemaObjCXX/warn-called-once.mm
+++ b/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
+}
More information about the cfe-commits
mailing list