diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2016-12-20 16:51:02 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2016-12-20 16:51:02 +0000 |
commit | a7206b9e097cd403c3e53ada214b8bbfaca9449b (patch) | |
tree | aa714806a4de1eacfc58f02954ea79711109829e /clang/lib/AST/DeclOpenMP.cpp | |
parent | 11da40b775805a2192edc9df8e427b6427a99a10 (diff) | |
download | bcm5719-llvm-a7206b9e097cd403c3e53ada214b8bbfaca9449b.tar.gz bcm5719-llvm-a7206b9e097cd403c3e53ada214b8bbfaca9449b.zip |
[OPENMP] Fix for PR31416: Clang crashes on OMPCapturedExpr during source
based coverage compilation
Added source location info to captured expression declaration + fixed
source location info for loop based directives.
llvm-svn: 290181
Diffstat (limited to 'clang/lib/AST/DeclOpenMP.cpp')
-rw-r--r-- | clang/lib/AST/DeclOpenMP.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/clang/lib/AST/DeclOpenMP.cpp b/clang/lib/AST/DeclOpenMP.cpp index 5b06ce0778a..95e44acca03 100644 --- a/clang/lib/AST/DeclOpenMP.cpp +++ b/clang/lib/AST/DeclOpenMP.cpp @@ -90,13 +90,18 @@ OMPDeclareReductionDecl::getPrevDeclInScope() const { void OMPCapturedExprDecl::anchor() {} OMPCapturedExprDecl *OMPCapturedExprDecl::Create(ASTContext &C, DeclContext *DC, - IdentifierInfo *Id, - QualType T) { - return new (C, DC) OMPCapturedExprDecl(C, DC, Id, T); + IdentifierInfo *Id, QualType T, + SourceLocation StartLoc) { + return new (C, DC) OMPCapturedExprDecl(C, DC, Id, T, StartLoc); } OMPCapturedExprDecl *OMPCapturedExprDecl::CreateDeserialized(ASTContext &C, unsigned ID) { - return new (C, ID) OMPCapturedExprDecl(C, nullptr, nullptr, QualType()); + return new (C, ID) + OMPCapturedExprDecl(C, nullptr, nullptr, QualType(), SourceLocation()); } +SourceRange OMPCapturedExprDecl::getSourceRange() const { + assert(hasInit()); + return SourceRange(getInit()->getLocStart(), getInit()->getLocEnd()); +} |