| Index: allocated-type.patch
|
| ===================================================================
|
| --- allocated-type.patch (revision 175317)
|
| +++ allocated-type.patch (working copy)
|
| @@ -1,8 +1,8 @@
|
| diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h
|
| -index 96603eb..7586cbb 100644
|
| +index c737d5f..352c96c 100644
|
| --- a/include/clang/AST/ExprCXX.h
|
| +++ b/include/clang/AST/ExprCXX.h
|
| -@@ -1456,6 +1456,9 @@ class CXXNewExpr : public Expr {
|
| +@@ -1459,6 +1459,9 @@ class CXXNewExpr : public Expr {
|
| /// null.
|
| FunctionDecl *OperatorDelete;
|
|
|
| @@ -12,7 +12,7 @@
|
| /// \brief The allocated type-source information, as written in the source.
|
| TypeSourceInfo *AllocatedTypeInfo;
|
|
|
| -@@ -1530,6 +1533,9 @@ public:
|
| +@@ -1533,6 +1536,9 @@ public:
|
| FunctionDecl *getOperatorDelete() const { return OperatorDelete; }
|
| void setOperatorDelete(FunctionDecl *D) { OperatorDelete = D; }
|
|
|
| @@ -22,7 +22,7 @@
|
| bool isArray() const { return Array; }
|
| Expr *getArraySize() {
|
| return Array ? cast<Expr>(SubExprs[0]) : 0;
|
| -@@ -1637,6 +1643,8 @@ public:
|
| +@@ -1640,6 +1646,8 @@ public:
|
| class CXXDeleteExpr : public Expr {
|
| // Points to the operator delete overload that is used. Could be a member.
|
| FunctionDecl *OperatorDelete;
|
| @@ -31,7 +31,7 @@
|
| // The pointer expression to be deleted.
|
| Stmt *Argument;
|
| // Location of the expression.
|
| -@@ -1659,7 +1667,9 @@ public:
|
| +@@ -1662,7 +1670,9 @@ public:
|
| : Expr(CXXDeleteExprClass, ty, VK_RValue, OK_Ordinary, false, false,
|
| arg->isInstantiationDependent(),
|
| arg->containsUnexpandedParameterPack()),
|
| @@ -42,7 +42,7 @@
|
| GlobalDelete(globalDelete),
|
| ArrayForm(arrayForm), ArrayFormAsWritten(arrayFormAsWritten),
|
| UsualArrayDeleteWantsSize(usualArrayDeleteWantsSize) { }
|
| -@@ -1679,6 +1689,12 @@ public:
|
| +@@ -1682,6 +1692,12 @@ public:
|
| }
|
|
|
| FunctionDecl *getOperatorDelete() const { return OperatorDelete; }
|
| @@ -56,10 +56,10 @@
|
| Expr *getArgument() { return cast<Expr>(Argument); }
|
| const Expr *getArgument() const { return cast<Expr>(Argument); }
|
| diff --git a/include/clang/Basic/LangOptions.def b/include/clang/Basic/LangOptions.def
|
| -index f4cba24..5e2ea5a 100644
|
| +index f180e31..0b457e8 100644
|
| --- a/include/clang/Basic/LangOptions.def
|
| +++ b/include/clang/Basic/LangOptions.def
|
| -@@ -127,6 +127,8 @@ BENIGN_LANGOPT(DebuggerSupport , 1, 0, "debugger support")
|
| +@@ -130,6 +130,8 @@ BENIGN_LANGOPT(DebuggerSupport , 1, 0, "debugger support")
|
| BENIGN_LANGOPT(DebuggerCastResultToId, 1, 0, "for 'po' in the debugger, cast the result to id if it is of unknown type")
|
| BENIGN_LANGOPT(DebuggerObjCLiteral , 1, 0, "debugger Objective-C literals and subscripting support")
|
|
|
| @@ -69,24 +69,24 @@
|
| LANGOPT(SinglePrecisionConstants , 1, 0, "treating double-precision floating point constants as single precision constants")
|
| LANGOPT(FastRelaxedMath , 1, 0, "OpenCL fast relaxed math")
|
| diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td
|
| -index 2ace8f3..a625fdd 100644
|
| +index 7598643..17e8b70 100644
|
| --- a/include/clang/Driver/Options.td
|
| +++ b/include/clang/Driver/Options.td
|
| -@@ -299,6 +299,9 @@ def fno_address_sanitizer : Flag<["-"], "fno-address-sanitizer">, Group<f_Group>
|
| - def fthread_sanitizer : Flag<["-"], "fthread-sanitizer">, Group<f_Group>,
|
| - HelpText<"Enable ThreadSanitizer instrumentation (race detection)">;
|
| +@@ -299,6 +299,9 @@ def faddress_sanitizer : Flag<["-"], "faddress-sanitizer">, Group<f_Group>;
|
| + def fno_address_sanitizer : Flag<["-"], "fno-address-sanitizer">, Group<f_Group>;
|
| + def fthread_sanitizer : Flag<["-"], "fthread-sanitizer">, Group<f_Group>;
|
| def fno_thread_sanitizer : Flag<["-"], "fno-thread-sanitizer">, Group<f_Group>;
|
| +def fintercept_allocation_functions : Flag<["-"], "fintercept-allocation-functions">, Group<f_Group>, Flags<[CC1Option]>,
|
| + HelpText<"Intercept allocation functions and allocated types">;
|
| +def fno_intercept_allocation_functions : Flag<["-"], "fno-intercept-allocation-functions">, Group<f_Group>, Flags<[CC1Option]>;
|
| def fasm : Flag<["-"], "fasm">, Group<f_Group>;
|
|
|
| - def fasm_blocks : Flag<["-"], "fasm-blocks">, Group<f_Group>;
|
| + def fasm_blocks : Flag<["-"], "fasm-blocks">, Group<f_Group>, Flags<[CC1Option]>;
|
| diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
|
| -index 4183dcf..8483209 100644
|
| +index 047804a..1d60251 100644
|
| --- a/include/clang/Sema/Sema.h
|
| +++ b/include/clang/Sema/Sema.h
|
| -@@ -3260,6 +3260,9 @@ public:
|
| +@@ -3291,6 +3291,9 @@ public:
|
| NamespaceDecl *getStdNamespace() const;
|
| NamespaceDecl *getOrCreateStdNamespace();
|
|
|
| @@ -96,7 +96,7 @@
|
| CXXRecordDecl *getStdBadAlloc() const;
|
|
|
| /// \brief Tests whether Ty is an instance of std::initializer_list and, if
|
| -@@ -3790,6 +3793,7 @@ public:
|
| +@@ -3821,6 +3824,7 @@ public:
|
| void DeclareGlobalAllocationFunction(DeclarationName Name, QualType Return,
|
| QualType Argument,
|
| bool addMallocAttr = false);
|
| @@ -105,22 +105,22 @@
|
| bool FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD,
|
| DeclarationName Name, FunctionDecl* &Operator,
|
| diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp
|
| -index 9758b60..ec8dc42 100644
|
| +index 1dc7de1..87dc918 100644
|
| --- a/lib/AST/ExprCXX.cpp
|
| +++ b/lib/AST/ExprCXX.cpp
|
| -@@ -94,6 +94,7 @@ CXXNewExpr::CXXNewExpr(ASTContext &C, bool globalNew, FunctionDecl *operatorNew,
|
| +@@ -95,6 +95,7 @@ CXXNewExpr::CXXNewExpr(ASTContext &C, bool globalNew, FunctionDecl *operatorNew,
|
| ty->isInstantiationDependentType(),
|
| ty->containsUnexpandedParameterPack()),
|
| SubExprs(0), OperatorNew(operatorNew), OperatorDelete(operatorDelete),
|
| + OperatorNewIntercept(0),
|
| AllocatedTypeInfo(allocatedTypeInfo), TypeIdParens(typeIdParens),
|
| - StartLoc(startLoc), DirectInitRange(directInitRange),
|
| + Range(Range), DirectInitRange(directInitRange),
|
| GlobalNew(globalNew), UsualArrayDeleteWantsSize(usualArrayDeleteWantsSize) {
|
| diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp
|
| -index b583c62..757949d 100644
|
| +index 9df8905..1df8c29 100644
|
| --- a/lib/CodeGen/CGClass.cpp
|
| +++ b/lib/CodeGen/CGClass.cpp
|
| -@@ -973,7 +973,9 @@ namespace {
|
| +@@ -966,7 +966,9 @@ namespace {
|
| void Emit(CodeGenFunction &CGF, Flags flags) {
|
| const CXXDestructorDecl *Dtor = cast<CXXDestructorDecl>(CGF.CurCodeDecl);
|
| const CXXRecordDecl *ClassDecl = Dtor->getParent();
|
| @@ -132,7 +132,7 @@
|
| }
|
| };
|
| diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp
|
| -index 7f640f6..926c325 100644
|
| +index f7d8202..74387b4 100644
|
| --- a/lib/CodeGen/CGExprCXX.cpp
|
| +++ b/lib/CodeGen/CGExprCXX.cpp
|
| @@ -1227,6 +1227,31 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) {
|
| @@ -354,7 +354,7 @@
|
| }
|
|
|
| diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h
|
| -index fadc391..f13eb8e 100644
|
| +index e8f7055..90d1990 100644
|
| --- a/lib/CodeGen/CodeGenFunction.h
|
| +++ b/lib/CodeGen/CodeGenFunction.h
|
| @@ -407,6 +407,14 @@ public:
|
| @@ -385,10 +385,10 @@
|
| llvm::Value* EmitCXXTypeidExpr(const CXXTypeidExpr *E);
|
| llvm::Value *EmitDynamicCast(llvm::Value *V, const CXXDynamicCastExpr *DCE);
|
| diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
|
| -index 2eca3fe..48869ea 100644
|
| +index eec3974..58f259c 100644
|
| --- a/lib/Driver/Tools.cpp
|
| +++ b/lib/Driver/Tools.cpp
|
| -@@ -2444,6 +2444,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
| +@@ -2482,6 +2482,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
| if (getToolChain().SupportsProfiling())
|
| Args.AddLastArg(CmdArgs, options::OPT_pg);
|
|
|
| @@ -403,10 +403,10 @@
|
| if (!Args.hasFlag(options::OPT_flax_vector_conversions,
|
| options::OPT_fno_lax_vector_conversions))
|
| diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
|
| -index d0ff7d2..b2825fd 100644
|
| +index 711e0e3..9a9703d 100644
|
| --- a/lib/Frontend/CompilerInvocation.cpp
|
| +++ b/lib/Frontend/CompilerInvocation.cpp
|
| -@@ -1233,6 +1233,8 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
|
| +@@ -1237,6 +1237,8 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
|
| Opts.DebuggerSupport = Args.hasArg(OPT_fdebugger_support);
|
| Opts.DebuggerCastResultToId = Args.hasArg(OPT_fdebugger_cast_result_to_id);
|
| Opts.DebuggerObjCLiteral = Args.hasArg(OPT_fdebugger_objc_literal);
|
| @@ -416,10 +416,10 @@
|
| Opts.CurrentModule = Args.getLastArgValue(OPT_fmodule_name);
|
|
|
| diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
|
| -index f9eb9eb..078cdb3 100644
|
| +index 027491c..3a2bdd0 100644
|
| --- a/lib/Sema/SemaDeclCXX.cpp
|
| +++ b/lib/Sema/SemaDeclCXX.cpp
|
| -@@ -5160,6 +5160,7 @@ bool Sema::CheckDestructor(CXXDestructorDecl *Destructor) {
|
| +@@ -5688,6 +5688,7 @@ bool Sema::CheckDestructor(CXXDestructorDecl *Destructor) {
|
|
|
| MarkFunctionReferenced(Loc, OperatorDelete);
|
|
|
| @@ -427,7 +427,7 @@
|
| Destructor->setOperatorDelete(OperatorDelete);
|
| }
|
|
|
| -@@ -5664,6 +5665,32 @@ NamespaceDecl *Sema::getOrCreateStdNamespace() {
|
| +@@ -6192,6 +6193,32 @@ NamespaceDecl *Sema::getOrCreateStdNamespace() {
|
| return getStdNamespace();
|
| }
|
|
|
| @@ -461,7 +461,7 @@
|
| assert(getLangOpts().CPlusPlus &&
|
| "Looking for std::initializer_list outside of C++.");
|
| diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
|
| -index bed6cb0..609833a 100644
|
| +index e3df0a3..d718c39 100644
|
| --- a/lib/Sema/SemaExprCXX.cpp
|
| +++ b/lib/Sema/SemaExprCXX.cpp
|
| @@ -371,26 +371,15 @@ Sema::ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc,
|
| @@ -495,27 +495,21 @@
|
|
|
| if (isType) {
|
| // The operand is a type; handle it as such.
|
| -@@ -1400,14 +1389,75 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal,
|
| +@@ -1397,14 +1386,75 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
|
| }
|
| }
|
|
|
| - return Owned(new (Context) CXXNewExpr(Context, UseGlobal, OperatorNew,
|
| -- OperatorDelete,
|
| -- UsualArrayDeleteWantsSize,
|
| -- llvm::makeArrayRef(PlaceArgs, NumPlaceArgs),
|
| -- TypeIdParens,
|
| -- ArraySize, initStyle, Initializer,
|
| -- ResultType, AllocTypeInfo,
|
| -- StartLoc, DirectInitRange));
|
| + CXXNewExpr* Result =
|
| + new (Context) CXXNewExpr(Context, UseGlobal, OperatorNew,
|
| -+ OperatorDelete,
|
| -+ UsualArrayDeleteWantsSize,
|
| -+ llvm::makeArrayRef(PlaceArgs, NumPlaceArgs),
|
| -+ TypeIdParens,
|
| -+ ArraySize, initStyle, Initializer,
|
| -+ ResultType, AllocTypeInfo,
|
| -+ StartLoc, DirectInitRange);
|
| + OperatorDelete,
|
| + UsualArrayDeleteWantsSize,
|
| + llvm::makeArrayRef(PlaceArgs, NumPlaceArgs),
|
| + TypeIdParens,
|
| + ArraySize, initStyle, Initializer,
|
| + ResultType, AllocTypeInfo,
|
| +- Range, DirectInitRange));
|
| ++ Range, DirectInitRange);
|
| +
|
| + if (getLangOpts().InterceptAllocationFunctions &&
|
| + getLangOpts().RTTI) {
|
| @@ -579,7 +573,7 @@
|
| }
|
|
|
| /// \brief Checks that a type is suitable as the allocated type
|
| -@@ -1847,6 +1897,80 @@ void Sema::DeclareGlobalNewDelete() {
|
| +@@ -1844,6 +1894,80 @@ void Sema::DeclareGlobalNewDelete() {
|
| Context.VoidTy, VoidPtr);
|
| }
|
|
|
| @@ -660,7 +654,7 @@
|
| /// DeclareGlobalAllocationFunction - Declares a single implicit global
|
| /// allocation function if it doesn't already exist.
|
| void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
|
| -@@ -2206,10 +2330,70 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
|
| +@@ -2207,10 +2331,70 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
|
|
|
| }
|
|
|
|
|