diff options
| author | Eli Friedman <efriedma@codeaurora.org> | 2016-10-19 22:16:32 +0000 | 
|---|---|---|
| committer | Eli Friedman <efriedma@codeaurora.org> | 2016-10-19 22:16:32 +0000 | 
| commit | 01d6b963d2903977fea1950cf6b083d44be0745a (patch) | |
| tree | 0bfe66badda61e4345901725d6979775f5aa5761 /clang/lib/CodeGen | |
| parent | 802e4a58a619c2777722cedf07fa2962cc90a67b (diff) | |
| download | bcm5719-llvm-01d6b963d2903977fea1950cf6b083d44be0745a.tar.gz bcm5719-llvm-01d6b963d2903977fea1950cf6b083d44be0745a.zip | |
Don't crash generating debug info for VLA in function prototype.
Fixes regression from r279445.
Differential Revision: https://reviews.llvm.org/D25793
llvm-svn: 284652
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 8 | 
1 files changed, 5 insertions, 3 deletions
| diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index ef8f31e574d..1d80a1bf9da 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -2180,9 +2180,11 @@ llvm::DIType *CGDebugInfo::CreateType(const ArrayType *Ty, llvm::DIFile *Unit) {      if (const auto *CAT = dyn_cast<ConstantArrayType>(Ty))        Count = CAT->getSize().getZExtValue();      else if (const auto *VAT = dyn_cast<VariableArrayType>(Ty)) { -      llvm::APSInt V; -      if (VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext())) -        Count = V.getExtValue(); +      if (Expr *Size = VAT->getSizeExpr()) { +        llvm::APSInt V; +        if (Size->EvaluateAsInt(V, CGM.getContext())) +          Count = V.getExtValue(); +      }      }      // FIXME: Verify this is right for VLAs. | 

