forked from OSchip/llvm-project
Patched our local Clang to fix a crash when parsing
classes/structs that have variable-length arrays at the end. llvm-svn: 156026
This commit is contained in:
parent
c0b976c42a
commit
e38e69f204
|
@ -0,0 +1,26 @@
|
|||
Index: lib/Sema/SemaChecking.cpp
|
||||
===================================================================
|
||||
--- lib/Sema/SemaChecking.cpp (revision 152265)
|
||||
+++ lib/Sema/SemaChecking.cpp (working copy)
|
||||
@@ -4416,12 +4416,16 @@
|
||||
|
||||
// Don't consider sizes resulting from macro expansions or template argument
|
||||
// substitution to form C89 tail-padded arrays.
|
||||
- ConstantArrayTypeLoc TL =
|
||||
- cast<ConstantArrayTypeLoc>(FD->getTypeSourceInfo()->getTypeLoc());
|
||||
- const Expr *SizeExpr = dyn_cast<IntegerLiteral>(TL.getSizeExpr());
|
||||
- if (!SizeExpr || SizeExpr->getExprLoc().isMacroID())
|
||||
- return false;
|
||||
|
||||
+ TypeSourceInfo *TInfo = FD->getTypeSourceInfo();
|
||||
+ if (TInfo) {
|
||||
+ ConstantArrayTypeLoc TL =
|
||||
+ cast<ConstantArrayTypeLoc>(TInfo->getTypeLoc());
|
||||
+ const Expr *SizeExpr = dyn_cast<IntegerLiteral>(TL.getSizeExpr());
|
||||
+ if (!SizeExpr || SizeExpr->getExprLoc().isMacroID())
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
const RecordDecl *RD = dyn_cast<RecordDecl>(FD->getDeclContext());
|
||||
if (!RD) return false;
|
||||
if (RD->isUnion()) return false;
|
Loading…
Reference in New Issue