[PATCH] D100955: [-Wcalled-once] Do not run analysis on Obj-C++
Valeriy Savchenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 21 06:51:12 PDT 2021
vsavchenko created this revision.
vsavchenko added a reviewer: NoQ.
Herald added a subscriber: Charusso.
vsavchenko requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Objective-C++ is not yet suppoerted.
rdar://76729552
Repository:
rG LLVM Github Monorepo
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.339220.patch
Type: text/x-patch
Size: 1164 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210421/09aef76b/attachment-0001.bin>
More information about the cfe-commits
mailing list