diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2015-03-06 14:15:57 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2015-03-06 14:15:57 +0000 |
commit | f04f98d543e267bb0999557e28e5c665036a05fd (patch) | |
tree | a9ec0f3ccdbde501c81ca63eb1762a57294199c5 /clang | |
parent | 618c67a018ec523a2a3116421bd2a690cf696564 (diff) | |
download | bcm5719-llvm-f04f98d543e267bb0999557e28e5c665036a05fd.tar.gz bcm5719-llvm-f04f98d543e267bb0999557e28e5c665036a05fd.zip |
Use delegating ctors to reduce code duplication. NFC.
llvm-svn: 231476
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/AST/Expr.cpp | 33 | ||||
-rw-r--r-- | clang/lib/AST/Type.cpp | 10 | ||||
-rw-r--r-- | clang/lib/Lex/Lexer.cpp | 10 |
3 files changed, 6 insertions, 47 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index ae807903127..8006d2be3c1 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -1141,40 +1141,13 @@ CallExpr::CallExpr(const ASTContext& C, StmtClass SC, Expr *fn, RParenLoc = rparenloc; } -CallExpr::CallExpr(const ASTContext& C, Expr *fn, ArrayRef<Expr*> args, +CallExpr::CallExpr(const ASTContext &C, Expr *fn, ArrayRef<Expr *> args, QualType t, ExprValueKind VK, SourceLocation rparenloc) - : Expr(CallExprClass, t, VK, OK_Ordinary, - fn->isTypeDependent(), - fn->isValueDependent(), - fn->isInstantiationDependent(), - fn->containsUnexpandedParameterPack()), - NumArgs(args.size()) { - - SubExprs = new (C) Stmt*[args.size()+PREARGS_START]; - SubExprs[FN] = fn; - for (unsigned i = 0; i != args.size(); ++i) { - if (args[i]->isTypeDependent()) - ExprBits.TypeDependent = true; - if (args[i]->isValueDependent()) - ExprBits.ValueDependent = true; - if (args[i]->isInstantiationDependent()) - ExprBits.InstantiationDependent = true; - if (args[i]->containsUnexpandedParameterPack()) - ExprBits.ContainsUnexpandedParameterPack = true; - - SubExprs[i+PREARGS_START] = args[i]; - } - - CallExprBits.NumPreArgs = 0; - RParenLoc = rparenloc; + : CallExpr(C, CallExprClass, fn, /*NumPreArgs=*/0, args, t, VK, rparenloc) { } CallExpr::CallExpr(const ASTContext &C, StmtClass SC, EmptyShell Empty) - : Expr(SC, Empty), SubExprs(nullptr), NumArgs(0) { - // FIXME: Why do we allocate this? - SubExprs = new (C) Stmt*[PREARGS_START]; - CallExprBits.NumPreArgs = 0; -} + : CallExpr(C, SC, /*NumPreArgs=*/0, Empty) {} CallExpr::CallExpr(const ASTContext &C, StmtClass SC, unsigned NumPreArgs, EmptyShell Empty) diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index ace5fc373a5..67c09cb5a7e 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -170,15 +170,7 @@ DependentSizedExtVectorType::Profile(llvm::FoldingSetNodeID &ID, VectorType::VectorType(QualType vecType, unsigned nElements, QualType canonType, VectorKind vecKind) - : Type(Vector, canonType, vecType->isDependentType(), - vecType->isInstantiationDependentType(), - vecType->isVariablyModifiedType(), - vecType->containsUnexpandedParameterPack()), - ElementType(vecType) -{ - VectorTypeBits.VecKind = vecKind; - VectorTypeBits.NumElements = nElements; -} + : VectorType(Vector, vecType, nElements, canonType, vecKind) {} VectorType::VectorType(TypeClass tc, QualType vecType, unsigned nElements, QualType canonType, VectorKind vecKind) diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index ca5252e1c9c..a3b520b2632 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -143,14 +143,8 @@ Lexer::Lexer(SourceLocation fileloc, const LangOptions &langOpts, /// range will outlive it, so it doesn't take ownership of it. Lexer::Lexer(FileID FID, const llvm::MemoryBuffer *FromFile, const SourceManager &SM, const LangOptions &langOpts) - : FileLoc(SM.getLocForStartOfFile(FID)), LangOpts(langOpts) { - - InitLexer(FromFile->getBufferStart(), FromFile->getBufferStart(), - FromFile->getBufferEnd()); - - // We *are* in raw mode. - LexingRawMode = true; -} + : Lexer(SM.getLocForStartOfFile(FID), langOpts, FromFile->getBufferStart(), + FromFile->getBufferStart(), FromFile->getBufferEnd()) {} /// Create_PragmaLexer: Lexer constructor - Create a new lexer object for /// _Pragma expansion. This has a variety of magic semantics that this method |