Replace TypeLoc llvm::cast support to be well-defined.
authorDavid Blaikie <dblaikie@gmail.com>
Mon, 18 Feb 2013 22:06:02 +0000 (22:06 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Mon, 18 Feb 2013 22:06:02 +0000 (22:06 +0000)
commit6adc78e0df73d1f7dca4f0a39fe1473b4c2bd346
tree4e0f7c0b001d67a581b235b4f19314a314de48e4
parentf666b761bd0737c7e9dd39531f4145fc2a334066
Replace TypeLoc llvm::cast support to be well-defined.

The TypeLoc hierarchy used the llvm::cast machinery to perform undefined
behavior by casting pointers/references to TypeLoc objects to derived types
and then using the derived copy constructors (or even returning pointers to
derived types that actually point to the original TypeLoc object).

Some context is in this thread:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056804.html
Though it's spread over a few months which can be hard to read in the mail
archive.

llvm-svn: 175462
29 files changed:
clang/include/clang/AST/RecursiveASTVisitor.h
clang/include/clang/AST/TypeLoc.h
clang/include/clang/AST/TypeLocVisitor.h
clang/lib/ARCMigrate/TransGCAttrs.cpp
clang/lib/AST/ASTContext.cpp
clang/lib/AST/Comment.cpp
clang/lib/AST/MicrosoftMangle.cpp
clang/lib/AST/TemplateBase.cpp
clang/lib/AST/TypeLoc.cpp
clang/lib/Sema/SemaChecking.cpp
clang/lib/Sema/SemaCodeComplete.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaExceptionSpec.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaInit.cpp
clang/lib/Sema/SemaStmt.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/lib/Sema/SemaTemplateInstantiate.cpp
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/lib/Sema/SemaTemplateVariadic.cpp
clang/lib/Sema/SemaType.cpp
clang/lib/Sema/TreeTransform.h
clang/lib/Sema/TypeLocBuilder.h
clang/tools/libclang/CIndex.cpp
clang/tools/libclang/CXCursor.cpp
clang/tools/libclang/IndexingContext.cpp
clang/tools/libclang/RecursiveASTVisitor.h