r203061 - Suppress diagnostics during name lookup for absolute value type.
Richard Trieu
rtrieu at google.com
Wed Mar 5 18:25:04 PST 2014
Author: rtrieu
Date: Wed Mar 5 20:25:04 2014
New Revision: 203061
URL: http://llvm.org/viewvc/llvm-project?rev=203061&view=rev
Log:
Suppress diagnostics during name lookup for absolute value type.
Added:
cfe/trunk/test/SemaCXX/warn-absolute-value2.cpp
Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=203061&r1=203060&r2=203061&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Mar 5 20:25:04 2014
@@ -3817,6 +3817,7 @@ static void emitReplacement(Sema &S, Sou
// Look up absolute value function in TU scope.
DeclarationName DN(&S.Context.Idents.get(AbsName));
LookupResult R(S, DN, Loc, Sema::LookupAnyName);
+ R.suppressDiagnostics();
S.LookupName(R, S.TUScope);
// Skip notes if multiple results found in lookup.
Added: cfe/trunk/test/SemaCXX/warn-absolute-value2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-absolute-value2.cpp?rev=203061&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-absolute-value2.cpp (added)
+++ cfe/trunk/test/SemaCXX/warn-absolute-value2.cpp Wed Mar 5 20:25:04 2014
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -verify %s -Wabsolute-value
+
+extern "C" {
+int abs(int);
+long labs(long);
+}
+
+using ::labs;
+
+long test(long x) {
+ return ::abs(x);
+ // expected-warning at -1{{using integer absolute value function 'abs' when argument is of floating point type}}
+}
More information about the cfe-commits
mailing list