]> granicus.if.org Git - clang/commit
AST: defer to TypeLoc::copy in TypeLoc::initializeFullCopy
authorJustin Bogner <mail@justinbogner.com>
Mon, 7 Dec 2015 20:04:57 +0000 (20:04 +0000)
committerJustin Bogner <mail@justinbogner.com>
Mon, 7 Dec 2015 20:04:57 +0000 (20:04 +0000)
commit4b4726ef9aa0f64789856b07b04eb55a14401cd9
treeca3eb84e34e01db785e07daf7e55a68aec54b38d
parent1e4fb607e70c0e4966f314460d022452adabbc34
AST: defer to TypeLoc::copy in TypeLoc::initializeFullCopy

If we're initializing a TypeLoc from one that's been allocated with
different alignment, memcpy will get the padding wrong. The `copy`
method already checks and handles this case, so we should just defer
to it.

This also drops the `const` off of the `initializeFullCopy`
declarations, since it isn't even remotely true (and the compiler
notices when we try to call copy() instead of tricking it with
memcpy).

Fixes llvm.org/pr23516.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254935 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/AST/TypeLoc.h