diff options
author | Zhanyong Wan <wan@google.com> | 2010-09-03 23:50:56 +0000 |
---|---|---|
committer | Zhanyong Wan <wan@google.com> | 2010-09-03 23:50:56 +0000 |
commit | 18ca8bf8505433104a86545fedbf37e603998188 (patch) | |
tree | 60a5f1a4a7c314f99fb9b282b68e6fe386395054 | |
parent | 1b1b9accd10a0a72768075cb09b3b50875c32b7f (diff) | |
download | llvm-18ca8bf8505433104a86545fedbf37e603998188.zip llvm-18ca8bf8505433104a86545fedbf37e603998188.tar.gz llvm-18ca8bf8505433104a86545fedbf37e603998188.tar.bz2 |
fix a crash in RecursiveASTVisitor's child classes (PR8403); reviewed by chandlerc.
llvm-svn: 113038
-rw-r--r-- | clang/lib/AST/TemplateBase.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/AST/TemplateBase.cpp b/clang/lib/AST/TemplateBase.cpp index 351aebe..a3bf145 100644 --- a/clang/lib/AST/TemplateBase.cpp +++ b/clang/lib/AST/TemplateBase.cpp @@ -125,19 +125,22 @@ SourceRange TemplateArgumentLoc::getSourceRange() const { switch (Argument.getKind()) { case TemplateArgument::Expression: return getSourceExpression()->getSourceRange(); - + case TemplateArgument::Declaration: return getSourceDeclExpression()->getSourceRange(); - + case TemplateArgument::Type: - return getTypeSourceInfo()->getTypeLoc().getSourceRange(); - + if (TypeSourceInfo *TSI = getTypeSourceInfo()) + return TSI->getTypeLoc().getSourceRange(); + else + return SourceRange(); + case TemplateArgument::Template: if (getTemplateQualifierRange().isValid()) return SourceRange(getTemplateQualifierRange().getBegin(), getTemplateNameLoc()); return SourceRange(getTemplateNameLoc()); - + case TemplateArgument::Integral: case TemplateArgument::Pack: case TemplateArgument::Null: |