]> granicus.if.org Git - clang/commitdiff
Don't get confused if a extern "C" builtin function is redeclared without
authorRafael Espindola <rafael.espindola@gmail.com>
Sun, 30 Dec 2012 17:23:09 +0000 (17:23 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Sun, 30 Dec 2012 17:23:09 +0000 (17:23 +0000)
the extern "C".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171260 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Decl.cpp
test/SemaCXX/warn-bad-memaccess.cpp

index 92b1e4abf2eca4398a190992dc366f838561d193..2d34e4c335fbf82aca5a8f1fc62ef4fd81b79464 100644 (file)
@@ -2440,7 +2440,7 @@ unsigned FunctionDecl::getMemoryFunctionKind() const {
     return Builtin::BIstrlen;
 
   default:
-    if (isExternC()) {
+    if (hasCLanguageLinkage()) {
       if (FnInfo->isStr("memset"))
         return Builtin::BImemset;
       else if (FnInfo->isStr("memcpy"))
index 3a02c84e9fc4bb743e0f46bb8cffbabeab57153e..7a7459acee1d3ca2317daf8df8610cb11a158e7b 100644 (file)
@@ -5,6 +5,11 @@ extern "C" void *memmove(void *s1, const void *s2, unsigned n);
 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;