From aaeba6fb6597a495f788ab67cb3904e333b9cb6d Mon Sep 17 00:00:00 2001 From: Richard Trieu Date: Thu, 6 Mar 2014 02:25:04 +0000 Subject: [PATCH] Suppress diagnostics during name lookup for absolute value type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203061 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaChecking.cpp | 1 + test/SemaCXX/warn-absolute-value2.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 test/SemaCXX/warn-absolute-value2.cpp diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 7bf1071d67..dd7cb5855f 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -3817,6 +3817,7 @@ static void emitReplacement(Sema &S, SourceLocation Loc, SourceRange Range, // 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. diff --git a/test/SemaCXX/warn-absolute-value2.cpp b/test/SemaCXX/warn-absolute-value2.cpp new file mode 100644 index 0000000000..2affcb18f0 --- /dev/null +++ b/test/SemaCXX/warn-absolute-value2.cpp @@ -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@-1{{using integer absolute value function 'abs' when argument is of floating point type}} +} -- 2.50.1