Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(16)

Issue 6203078: Enable intercepting (de-)allocated types in operator new and delete.

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 1 month ago by Dai Mikurube (Chromium)
Modified:
13 years, 10 months ago
Reviewers:
Base URL:
http://llvm.org/git/clang.git@master
Visibility:
Public.

Description

We changed our approach into http://codereview.chromium.org/10821125/. Enable intercepting (de-)allocated types in operator new and delete. This feature is provided mainly for memory (heap) profiling. When -fallocated-type-in-operator-new is not specified, it changes nothing. If 1) -fallocated-type-in-operator-new is specified to Clang, and 2) 'void* operator new(size_t, const type_info&)' is declared in the C++ code, new expressions are switched to call the declared 'operator new' with an allocated type given in the second argument. Similar switching for 'operator delete' and placement 'new's. Please see - an example 'AllocatedTypeExample1.cpp', and - a brief document 'AllocatedType-README.txt' in this patchset. TODO: Temporary objects may be leaking?

Patch Set 1 #

Patch Set 2 : refined. (not working yet) #

Patch Set 3 : Working. (maybe including memory leak) #

Patch Set 4 : Add an example #

Patch Set 5 : Removed unnecessary change in CGExprCXX.cpp. #

Patch Set 6 : Changed comments in the example. #

Patch Set 7 : Supported multiple source files. #

Patch Set 8 : Refactor CXXTypeInfoDecl. #

Patch Set 9 : Refactor in BuildCXXNew.] #

Patch Set 10 : added TODOs about leak. #

Patch Set 11 : Add <typeinfo> only if C++. #

Patch Set 12 : Find type_info-new only from the global scope. #

Patch Set 13 : Add examples. #

Patch Set 14 : Fixed TypeLoc-less TypeSourceInfo. It was breaking AllocatedTypeExample4.cpp. #

Patch Set 15 : Avoid 'type_info' addition within template declarations. #

Patch Set 16 : Rebased. #

Patch Set 17 : Remove auto-include <typeinfo> and auto-declare 'operator new'. #

Patch Set 18 : Fix a case if -fallocated-type-in-operator-new is given, but no viable declaration is found for 'op… #

Patch Set 19 : Supports handling operator delete. (for trial... may contain bugs.) #

Patch Set 20 : Updated examples. #

Patch Set 21 : Refined examples. #

Patch Set 22 : #

Patch Set 23 : Fixed some bugs for operator delete. #

Patch Set 24 : Add a brief document. #

Patch Set 25 : rebased. #

Patch Set 26 : Support operator delete[]. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+791 lines, -39 lines) Patch
A AllocatedType-README.txt View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +84 lines, -0 lines 0 comments Download
A AllocatedTypeExample.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +5 lines, -0 lines 0 comments Download
A AllocatedTypeExample-common.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +25 lines, -0 lines 0 comments Download
A AllocatedTypeExample1.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +93 lines, -0 lines 0 comments Download
A AllocatedTypeExample2.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +47 lines, -0 lines 0 comments Download
A AllocatedTypeExample3.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +57 lines, -0 lines 0 comments Download
A AllocatedTypeExample4.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +69 lines, -0 lines 0 comments Download
A AllocatedTypeExample5.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +70 lines, -0 lines 0 comments Download
A AllocatedTypeExample6.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +68 lines, -0 lines 0 comments Download
M include/clang/Basic/LangOptions.def View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +1 line, -0 lines 0 comments Download
M include/clang/Driver/Options.td View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 1 chunk +3 lines, -0 lines 0 comments Download
M include/clang/Sema/Sema.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 4 chunks +8 lines, -2 lines 0 comments Download
M lib/CodeGen/CGExprCXX.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 3 chunks +60 lines, -22 lines 0 comments Download
M lib/Driver/Tools.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 1 chunk +4 lines, -0 lines 0 comments Download
M lib/Frontend/CompilerInvocation.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 2 chunks +4 lines, -0 lines 0 comments Download
M lib/Parse/ParseCXXInlineMethods.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 2 chunks +27 lines, -1 line 0 comments Download
M lib/Parse/ParseExprCXX.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 1 chunk +2 lines, -1 line 0 comments Download
M lib/Sema/SemaDeclCXX.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 1 chunk +20 lines, -0 lines 0 comments Download
M lib/Sema/SemaExprCXX.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 10 chunks +139 lines, -12 lines 0 comments Download
M lib/Sema/TreeTransform.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 4 chunks +5 lines, -1 line 0 comments Download

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b