[cfe-commits] r171260 - in /cfe/trunk: lib/AST/Decl.cpp test/SemaCXX/warn-bad-memaccess.cpp
Rafael Espindola
rafael.espindola at gmail.com
Sun Dec 30 09:23:09 PST 2012
Author: rafael
Date: Sun Dec 30 11:23:09 2012
New Revision: 171260
URL: http://llvm.org/viewvc/llvm-project?rev=171260&view=rev
Log:
Don't get confused if a extern "C" builtin function is redeclared without
the extern "C".
Modified:
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/test/SemaCXX/warn-bad-memaccess.cpp
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=171260&r1=171259&r2=171260&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Sun Dec 30 11:23:09 2012
@@ -2440,7 +2440,7 @@
return Builtin::BIstrlen;
default:
- if (isExternC()) {
+ if (hasCLanguageLinkage()) {
if (FnInfo->isStr("memset"))
return Builtin::BImemset;
else if (FnInfo->isStr("memcpy"))
Modified: cfe/trunk/test/SemaCXX/warn-bad-memaccess.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-bad-memaccess.cpp?rev=171260&r1=171259&r2=171260&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-bad-memaccess.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-bad-memaccess.cpp Sun Dec 30 11:23:09 2012
@@ -5,6 +5,11 @@
extern "C" void *memcpy(void *s1, const void *s2, unsigned n);
extern "C" void *memcmp(void *s1, const void *s2, unsigned n);
+
+// Redeclare without the extern "C" to test that we still figure out that this
+// is the "real" memset.
+void *memset(void *, int, unsigned);
+
// Several types that should not warn.
struct S1 {} s1;
struct S2 { int x; } s2;
More information about the cfe-commits
mailing list