From: Aaron Ballman Date: Thu, 1 May 2014 15:21:03 +0000 (+0000) Subject: Fixing a FIXME -- no longer using std::memcpy, since that would fail for non-trivial... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f3fa16f5bfb9439249f87b27d80b6d2fb4aa3692;p=clang Fixing a FIXME -- no longer using std::memcpy, since that would fail for non-trivial types. Replaced with std::copy. No functional changes intended since all uses of this functionality either use pointers or integers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207766 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/Attr.h b/include/clang/AST/Attr.h index 655bcabcf3..fc4881619b 100644 --- a/include/clang/AST/Attr.h +++ b/include/clang/AST/Attr.h @@ -26,8 +26,8 @@ #include "llvm/ADT/StringSwitch.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" +#include #include -#include namespace clang { class ASTContext; diff --git a/utils/TableGen/ClangAttrEmitter.cpp b/utils/TableGen/ClangAttrEmitter.cpp index e03afe4ecc..8e06b51326 100644 --- a/utils/TableGen/ClangAttrEmitter.cpp +++ b/utils/TableGen/ClangAttrEmitter.cpp @@ -537,9 +537,8 @@ namespace { << "A->" << getLowerName() << "_size()"; } void writeCtorBody(raw_ostream &OS) const override { - // FIXME: memcpy is not safe on non-trivial types. - OS << " std::memcpy(" << getLowerName() << ", " << getUpperName() - << ", " << getLowerName() << "Size * sizeof(" << getType() << "));\n"; + OS << " std::copy(" << getUpperName() << ", " << getUpperName() + << " + " << getLowerName() << "Size, " << getLowerName() << ");"; } void writeCtorInitializers(raw_ostream &OS) const override { OS << getLowerName() << "Size(" << getUpperName() << "Size), "