summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2014-03-06 02:25:04 +0000
committerRichard Trieu <rtrieu@google.com>2014-03-06 02:25:04 +0000
commitfe771c071aaa378b5813ae827f462e105c0b637c (patch)
treea5dd9c27776472c914e17ef1f92c3aa8622c312c /clang
parentbc46f3c15dfa37f0c336d1ad3f01180d4c33ac99 (diff)
downloadbcm5719-llvm-fe771c071aaa378b5813ae827f462e105c0b637c.tar.gz
bcm5719-llvm-fe771c071aaa378b5813ae827f462e105c0b637c.zip
Suppress diagnostics during name lookup for absolute value type.
llvm-svn: 203061
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp1
-rw-r--r--clang/test/SemaCXX/warn-absolute-value2.cpp13
2 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 7bf1071d671..dd7cb5855f2 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/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/clang/test/SemaCXX/warn-absolute-value2.cpp b/clang/test/SemaCXX/warn-absolute-value2.cpp
new file mode 100644
index 00000000000..2affcb18f0b
--- /dev/null
+++ b/clang/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}}
+}
OpenPOWER on IntegriCloud