diff options
| -rw-r--r-- | clang/include/clang/AST/Expr.h | 2 | ||||
| -rw-r--r-- | clang/lib/AST/Expr.cpp | 5 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CodeGenTypes.cpp | 4 | ||||
| -rw-r--r-- | clang/test/Sema/PR2727.c | 5 |
4 files changed, 16 insertions, 0 deletions
diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h index 00de0233b45..b84ca020a1a 100644 --- a/clang/include/clang/AST/Expr.h +++ b/clang/include/clang/AST/Expr.h @@ -540,6 +540,8 @@ public: Expr(SizeOfAlignOfTypeExprClass, resultType), isSizeof(issizeof), Ty(argType), OpLoc(op), RParenLoc(rp) {} + virtual void Destroy(ASTContext& C); + bool isSizeOf() const { return isSizeof; } QualType getArgumentType() const { return Ty; } diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index a7e49d0efcd..49c76a89d86 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -1236,6 +1236,11 @@ int64_t UnaryOperator::evaluateOffsetOf(ASTContext& C) const return ::evaluateOffsetOf(C, cast<Expr>(Val)) / CharSize; } +void SizeOfAlignOfTypeExpr::Destroy(ASTContext& C) { + // Override default behavior of traversing children. We do not want + // to delete the type. +} + //===----------------------------------------------------------------------===// // Child Iterators for iterating over subexpressions/substatements //===----------------------------------------------------------------------===// diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp index 1cdd798a397..e302f2b9ec9 100644 --- a/clang/lib/CodeGen/CodeGenTypes.cpp +++ b/clang/lib/CodeGen/CodeGenTypes.cpp @@ -352,6 +352,10 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) { TheModule.addTypeName(TypeName, Res); return Res; } + + case Type::BlockPointer: { + assert(0 && "FIXME: Cannot get type of block pointer."); + } } // FIXME: implement. diff --git a/clang/test/Sema/PR2727.c b/clang/test/Sema/PR2727.c new file mode 100644 index 00000000000..faf934d947a --- /dev/null +++ b/clang/test/Sema/PR2727.c @@ -0,0 +1,5 @@ +int f (int x) +{ + // sizeof applied to a type should not delete the type. + return sizeof (int[x]); +} |

