summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/FullExpr.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-12-16 02:09:40 +0000
committerAnders Carlsson <andersca@mac.com>2009-12-16 02:09:40 +0000
commitafb2dade0c7fd42434ccd7e66008ac455baeabba (patch)
tree3b7eb25d16baac0945811e5a9082f3393c78de16 /clang/lib/AST/FullExpr.cpp
parent0db42252f75f3baa72fe73ab0dfb7ba6e1bd2e29 (diff)
downloadbcm5719-llvm-afb2dade0c7fd42434ccd7e66008ac455baeabba.tar.gz
bcm5719-llvm-afb2dade0c7fd42434ccd7e66008ac455baeabba.zip
Check in a rudimentary FullExpr class that isn't used anywhere yet. Rename Action::FullExpr to Action::MakeFullExpr to avoid name clashes.
llvm-svn: 91494
Diffstat (limited to 'clang/lib/AST/FullExpr.cpp')
-rw-r--r--clang/lib/AST/FullExpr.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/clang/lib/AST/FullExpr.cpp b/clang/lib/AST/FullExpr.cpp
new file mode 100644
index 00000000000..39c3bad0a77
--- /dev/null
+++ b/clang/lib/AST/FullExpr.cpp
@@ -0,0 +1,42 @@
+//===--- FullExpr.cpp - C++ full expression class ---------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the FullExpr interface, to be used for type safe handling
+// of full expressions.
+//
+// Full expressions are described in C++ [intro.execution]p12.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/FullExpr.h"
+#include "llvm/Support/AlignOf.h"
+using namespace clang;
+
+FullExpr FullExpr::Create(ASTContext &Context, Expr *SubExpr,
+ CXXTemporary **Temporaries, unsigned NumTemporaries) {
+ FullExpr E;
+
+ if (!NumTemporaries) {
+ E.SubExpr = SubExpr;
+ return E;
+ }
+
+ unsigned Size = sizeof(FullExpr)
+ + sizeof(CXXTemporary *) * NumTemporaries;
+
+ unsigned Align = llvm::AlignOf<ExprAndTemporaries>::Alignment;
+ ExprAndTemporaries *ET =
+ static_cast<ExprAndTemporaries *>(Context.Allocate(Size, Align));
+
+ ET->SubExpr = SubExpr;
+ std::copy(Temporaries, Temporaries + NumTemporaries, ET->begin());
+
+ return E;
+}
OpenPOWER on IntegriCloud