This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main() { | |
Class* x = ::new Class(); | |
::delete x; | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (getLangOpts().InterceptAllocationFunctions && | |
getLangOpts().RTTI) { | |
bool UseSize = false; | |
IdentifierInfo *DeleteInterceptInfo = | |
&PP.getIdentifierTable().get("__op_delete_intercept__"); | |
DeclareGlobalAllocatorInterceptFunctions( | |
DeclarationName(DeleteInterceptInfo), UseSize); | |
LookupResult R(*this, DeleteInterceptInfo, SourceLocation(), | |
LookupOrdinaryName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RUN: clang++ -fintercept-allocation typeaware.cpp | |
#include <stdio.h> | |
#include <typeinfo> | |
#include <iostream> | |
struct Klass { | |
int x, y, z; | |
Klass() { x = 1; y = 2; z = 3; } | |
~Klass() { x = 0; } | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Base(object): | |
def public(self): | |
print "base:public" | |
def call_private(self): | |
self._private() | |
def call_hidden(self): | |
self.__hidden() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PredictableIterator(object): | |
def __init__(self, iterator): | |
self.iterator = iter(iterator) | |
self._next = None | |
def __iter__(self): return self | |
def next(self): | |
if self._next: | |
result = self._next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Base(object): | |
def __init__(self, x): | |
self._hoge = x | |
@staticmethod | |
def generate(n, x): | |
if n == 0: | |
return Sub0(x) | |
return Sub1(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test(x, y=[], z=list()): | |
y.append(x) | |
print y | |
z.append(x) | |
print z | |
test('foo') | |
test(42) | |
test(None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
dct = {} | |
dct['foo'] = {} | |
dct['bar'] = {} | |
dct['baz'] = [] | |
foo = dct['foo'] | |
foo['alpha'] = 42 | |
foo['beta'] = 31 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from proxy import target | |
target.Print() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <sys/types.h> | |
#include <sys/wait.h> | |
#include <unistd.h> | |
#define A1 (1024 * 1024 * 200) | |
#define A2_PARENT (1024 * 1024 * 300) | |
#define A2_CHILD (1024 * 1024 * 500) | |
int main() { |