[cfe-commits] r126950 - in /cfe/trunk: lib/Sema/Sema.cpp test/SemaCXX/unused-functions.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Thu Mar 3 09:47:42 PST 2011
Author: akirtzidis
Date: Thu Mar 3 11:47:42 2011
New Revision: 126950
URL: http://llvm.org/viewvc/llvm-project?rev=126950&view=rev
Log:
Don't emit unused warning for deleted functions. Fixes rdar://8365684 & http://llvm.org/PR9391.
Modified:
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/test/SemaCXX/unused-functions.cpp
Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=126950&r1=126949&r2=126950&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Thu Mar 3 11:47:42 2011
@@ -451,6 +451,8 @@
const FunctionDecl *DiagD;
if (!FD->hasBody(DiagD))
DiagD = FD;
+ if (DiagD->isDeleted())
+ continue; // Deleted functions are supposed to be unused.
Diag(DiagD->getLocation(),
isa<CXXMethodDecl>(DiagD) ? diag::warn_unused_member_function
: diag::warn_unused_function)
Modified: cfe/trunk/test/SemaCXX/unused-functions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/unused-functions.cpp?rev=126950&r1=126949&r2=126950&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/unused-functions.cpp (original)
+++ cfe/trunk/test/SemaCXX/unused-functions.cpp Thu Mar 3 11:47:42 2011
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -Wunused -verify %s
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -Wunused -verify %s
static int foo(int x) { return x; }
@@ -6,3 +6,5 @@
T get_from_foo(T y) { return foo(y); }
int g(int z) { return get_from_foo(z); }
+
+namespace { void f() = delete; }
More information about the cfe-commits
mailing list