summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Comment.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-02-18 22:06:02 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-02-18 22:06:02 +0000
commit6adc78e0df73d1f7dca4f0a39fe1473b4c2bd346 (patch)
tree4e0f7c0b001d67a581b235b4f19314a314de48e4 /clang/lib/AST/Comment.cpp
parentf666b761bd0737c7e9dd39531f4145fc2a334066 (diff)
downloadbcm5719-llvm-6adc78e0df73d1f7dca4f0a39fe1473b4c2bd346.tar.gz
bcm5719-llvm-6adc78e0df73d1f7dca4f0a39fe1473b4c2bd346.zip
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
Diffstat (limited to 'clang/lib/AST/Comment.cpp')
-rw-r--r--clang/lib/AST/Comment.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/clang/lib/AST/Comment.cpp b/clang/lib/AST/Comment.cpp
index ea1a3f737af..db55c045449 100644
--- a/clang/lib/AST/Comment.cpp
+++ b/clang/lib/AST/Comment.cpp
@@ -241,32 +241,32 @@ void DeclInfo::fill() {
while (true) {
TL = TL.IgnoreParens();
// Look through qualified types.
- if (QualifiedTypeLoc *QualifiedTL = dyn_cast<QualifiedTypeLoc>(&TL)) {
- TL = QualifiedTL->getUnqualifiedLoc();
+ if (QualifiedTypeLoc QualifiedTL = TL.getAs<QualifiedTypeLoc>()) {
+ TL = QualifiedTL.getUnqualifiedLoc();
continue;
}
// Look through pointer types.
- if (PointerTypeLoc *PointerTL = dyn_cast<PointerTypeLoc>(&TL)) {
- TL = PointerTL->getPointeeLoc().getUnqualifiedLoc();
+ if (PointerTypeLoc PointerTL = TL.getAs<PointerTypeLoc>()) {
+ TL = PointerTL.getPointeeLoc().getUnqualifiedLoc();
continue;
}
- if (BlockPointerTypeLoc *BlockPointerTL =
- dyn_cast<BlockPointerTypeLoc>(&TL)) {
- TL = BlockPointerTL->getPointeeLoc().getUnqualifiedLoc();
+ if (BlockPointerTypeLoc BlockPointerTL =
+ TL.getAs<BlockPointerTypeLoc>()) {
+ TL = BlockPointerTL.getPointeeLoc().getUnqualifiedLoc();
continue;
}
- if (MemberPointerTypeLoc *MemberPointerTL =
- dyn_cast<MemberPointerTypeLoc>(&TL)) {
- TL = MemberPointerTL->getPointeeLoc().getUnqualifiedLoc();
+ if (MemberPointerTypeLoc MemberPointerTL =
+ TL.getAs<MemberPointerTypeLoc>()) {
+ TL = MemberPointerTL.getPointeeLoc().getUnqualifiedLoc();
continue;
}
// Is this a typedef for a function type?
- if (FunctionTypeLoc *FTL = dyn_cast<FunctionTypeLoc>(&TL)) {
+ if (FunctionTypeLoc FTL = TL.getAs<FunctionTypeLoc>()) {
Kind = FunctionKind;
- ArrayRef<ParmVarDecl *> Params = FTL->getParams();
+ ArrayRef<ParmVarDecl *> Params = FTL.getParams();
ParamVars = ArrayRef<const ParmVarDecl *>(Params.data(),
Params.size());
- ResultType = FTL->getResultLoc().getType();
+ ResultType = FTL.getResultLoc().getType();
break;
}
break;
OpenPOWER on IntegriCloud