diff options
-rw-r--r-- | include/clang/AST/FullExpr.h | 88 | ||||
-rw-r--r-- | include/clang/AST/Stmt.h | 1 | ||||
-rw-r--r-- | include/clang/Sema/Sema.h | 14 | ||||
-rw-r--r-- | lib/AST/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lib/AST/FullExpr.cpp | 45 | ||||
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 16 |
6 files changed, 6 insertions, 159 deletions
diff --git a/include/clang/AST/FullExpr.h b/include/clang/AST/FullExpr.h deleted file mode 100644 index 6ceefed8a6..0000000000 --- a/include/clang/AST/FullExpr.h +++ /dev/null @@ -1,88 +0,0 @@ -//===--- FullExpr.h - 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. -// -//===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_AST_FULLEXPR_H -#define LLVM_CLANG_AST_FULLEXPR_H - -#include "llvm/ADT/PointerUnion.h" - -namespace clang { - class ASTContext; - class CXXTemporary; - class Expr; - -class FullExpr { - struct ExprAndTemporaries { - Expr *SubExpr; - - unsigned NumTemps; - - typedef CXXTemporary** temps_iterator; - - temps_iterator temps_begin() { - return reinterpret_cast<CXXTemporary **>(this + 1); - } - temps_iterator temps_end() { - return temps_begin() + NumTemps; - } - }; - - typedef llvm::PointerUnion<Expr *, ExprAndTemporaries *> SubExprTy; - SubExprTy SubExpr; - - FullExpr() { } - -public: - static FullExpr Create(ASTContext &Context, Expr *SubExpr, - CXXTemporary **Temps, unsigned NumTemps); - - Expr *getExpr() { - if (Expr *E = SubExpr.dyn_cast<Expr *>()) - return E; - - return SubExpr.get<ExprAndTemporaries *>()->SubExpr; - } - - const Expr *getExpr() const { - return const_cast<FullExpr*>(this)->getExpr(); - } - - typedef CXXTemporary** temps_iterator; - - temps_iterator temps_begin() { - if (ExprAndTemporaries *ET = SubExpr.dyn_cast<ExprAndTemporaries *>()) - return ET->temps_begin(); - - return 0; - } - temps_iterator temps_end() { - if (ExprAndTemporaries *ET = SubExpr.dyn_cast<ExprAndTemporaries *>()) - return ET->temps_end(); - - return 0; - } - - void *getAsOpaquePtr() const { return SubExpr.getOpaqueValue(); } - - static FullExpr getFromOpaquePtr(void *Ptr) { - FullExpr E; - E.SubExpr = SubExprTy::getFromOpaqueValue(Ptr); - return E; - } -}; - -} // end namespace clang - -#endif diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h index 1318532653..421c59661b 100644 --- a/include/clang/AST/Stmt.h +++ b/include/clang/AST/Stmt.h @@ -20,7 +20,6 @@ #include "clang/AST/PrettyPrinter.h" #include "clang/AST/StmtIterator.h" #include "clang/AST/DeclGroup.h" -#include "clang/AST/FullExpr.h" #include "llvm/ADT/SmallVector.h" #include "clang/AST/ASTContext.h" #include <string> diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index 8b157bdeb8..56cf99ec79 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -78,7 +78,6 @@ namespace clang { class ExternalSemaSource; class FormatAttr; class FriendDecl; - class FullExpr; class FunctionDecl; class FunctionProtoType; class FunctionTemplateDecl; @@ -1556,7 +1555,7 @@ public: private: // FIXME: No need to make the entire Sema class a friend when it's just - // Sema::FullExpr that needs access to the constructor below. + // Sema::MakeFullExpr that needs access to the constructor below. friend class Sema; explicit FullExprArg(Expr *expr) : E(expr) {} @@ -1595,17 +1594,17 @@ public: SourceLocation ColonLoc, Stmt *SubStmt, bool HasUnusedAttr); StmtResult ActOnIfStmt(SourceLocation IfLoc, - FullExprArg CondVal, Decl *CondVar, - Stmt *ThenVal, - SourceLocation ElseLoc, Stmt *ElseVal); + FullExprArg CondVal, Decl *CondVar, + Stmt *ThenVal, + SourceLocation ElseLoc, Stmt *ElseVal); StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, Expr *Cond, Decl *CondVar); StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body); StmtResult ActOnWhileStmt(SourceLocation WhileLoc, - FullExprArg Cond, - Decl *CondVar, Stmt *Body); + FullExprArg Cond, + Decl *CondVar, Stmt *Body); StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, @@ -2379,7 +2378,6 @@ public: Expr *MaybeCreateExprWithCleanups(Expr *SubExpr); Stmt *MaybeCreateStmtWithCleanups(Stmt *SubStmt); ExprResult MaybeCreateExprWithCleanups(ExprResult SubExpr); - FullExpr CreateFullExpr(Expr *SubExpr); ExprResult ActOnFinishFullExpr(Expr *Expr); StmtResult ActOnFinishFullStmt(Stmt *Stmt); diff --git a/lib/AST/CMakeLists.txt b/lib/AST/CMakeLists.txt index 6fca4d7e73..e98a89646c 100644 --- a/lib/AST/CMakeLists.txt +++ b/lib/AST/CMakeLists.txt @@ -24,7 +24,6 @@ add_clang_library(clangAST ExprClassification.cpp ExprConstant.cpp ExprCXX.cpp - FullExpr.cpp InheritViz.cpp ItaniumCXXABI.cpp MicrosoftCXXABI.cpp diff --git a/lib/AST/FullExpr.cpp b/lib/AST/FullExpr.cpp deleted file mode 100644 index 93ee8d1360..0000000000 --- a/lib/AST/FullExpr.cpp +++ /dev/null @@ -1,45 +0,0 @@ -//===--- 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 "clang/AST/Expr.h" -#include "clang/AST/ExprCXX.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->temps_begin()); - - return E; -} - diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 7be1c3307a..fb5428a6b4 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -3176,22 +3176,6 @@ Sema::MaybeCreateExprWithCleanups(ExprResult SubExpr) { return Owned(MaybeCreateExprWithCleanups(SubExpr.take())); } -FullExpr Sema::CreateFullExpr(Expr *SubExpr) { - unsigned FirstTemporary = ExprEvalContexts.back().NumTemporaries; - assert(ExprTemporaries.size() >= FirstTemporary); - - unsigned NumTemporaries = ExprTemporaries.size() - FirstTemporary; - CXXTemporary **Temporaries = - NumTemporaries == 0 ? 0 : &ExprTemporaries[FirstTemporary]; - - FullExpr E = FullExpr::Create(Context, SubExpr, Temporaries, NumTemporaries); - - ExprTemporaries.erase(ExprTemporaries.begin() + FirstTemporary, - ExprTemporaries.end()); - - return E; -} - Stmt *Sema::MaybeCreateStmtWithCleanups(Stmt *SubStmt) { assert(SubStmt && "sub statement can't be null!"); |