Commit 39ec3b06 authored by ager@chromium.org's avatar ager@chromium.org

Oilpan: tighten DISALLOW_ALLOCATION so it does not allow inline

allocation by user-defined placement new operators.

Removing the placement new operators will lead to redefinition errors
if a class is marked as DISALLOW_ALLOCATION or STACK_ALLOCATED
and at the same time defines placement new operators.

R=oilpan-reviews@chromium.org, vegorov@chromium.org, zerny@chromium.org
BUG=

Review URL: https://codereview.chromium.org/199733009

git-svn-id: svn://svn.chromium.org/blink/trunk@169642 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 3e3cc15c
......@@ -1025,20 +1025,36 @@ T* adoptRefCountedGarbageCollected(T* ptr)
}
#if COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS)
#define DISALLOW_ALLOCATION() \
private: \
#define DISALLOW_ALLOCATION() \
private: \
void* operator new(size_t) = delete; \
void* operator new(size_t, NotNullTag, void*) = delete; \
void* operator new(size_t, void*) = delete;
#define ALLOW_ONLY_INLINE_ALLOCATION() \
public: \
void* operator new(size_t, NotNullTag, void* location) { return location; } \
void* operator new(size_t, void* location) { return location; } \
private: \
void* operator new(size_t) = delete;
#else
#define DISALLOW_ALLOCATION() \
private: \
void* operator new(size_t);
#endif
#define DISALLOW_ALLOCATION() \
private: \
void* operator new(size_t); \
void* operator new(size_t, NotNullTag, void*); \
void* operator new(size_t, void*)
#define ALLOW_ONLY_INLINE_ALLOCATION() \
public: \
void* operator new(size_t, NotNullTag, void* location) { return location; } \
void* operator new(size_t, void* location) { return location; } \
DISALLOW_ALLOCATION()
private: \
void* operator new(size_t);
#endif
// These macros insert annotations that the Blink GC plugin for clang uses for
// verification. STACK_ALLOCATED is used to declare that objects of this type
......@@ -1047,10 +1063,13 @@ T* adoptRefCountedGarbageCollected(T* ptr)
// GC_PLUGIN_IGNORE a bug-number should be provided as an argument where the
// bug describes what needs to happen to remove the GC_PLUGIN_IGNORE again.
#if COMPILER(CLANG) && !defined(ADDRESS_SANITIZER)
#define STACK_ALLOCATED() \
private: \
__attribute__((annotate("blink_stack_allocated"))) \
void* operator new(size_t) = delete;
#define STACK_ALLOCATED() \
private: \
__attribute__((annotate("blink_stack_allocated"))) \
void* operator new(size_t) = delete; \
void* operator new(size_t, NotNullTag, void*) = delete; \
void* operator new(size_t, void*) = delete;
#define GC_PLUGIN_IGNORE(bug) \
__attribute__((annotate("blink_gc_plugin_ignore")))
#else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment