Skip to content

Instantly share code, notes, and snippets.

@crabtw
crabtw / anonymous.td
Created November 20, 2019 14:48
llvm tablegen bugs
class AAA {
AAA a = !cast<AAA>(NAME);
}
foreach _ = [1, 2] in
def : AAA;
multiclass BBB {
def : AAA;
}
diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp
index e5afa1264a..a5691e7c91 100644
--- a/lib/Format/UnwrappedLineParser.cpp
+++ b/lib/Format/UnwrappedLineParser.cpp
@@ -1883,6 +1883,7 @@ void UnwrappedLineParser::parseLabel() {
--Line->Level;
if (CommentsBeforeNextToken.empty() && FormatTok->Tok.is(tok::l_brace)) {
CompoundStatementIndenter Indenter(this, Style, Line->Level);
+ ++Line->Level;
parseBlock(/*MustBeDeclaration=*/false);
@crabtw
crabtw / err.cpp
Last active April 28, 2017 03:09
#include <cstdlib>
#include <iostream>
static void err() {
std::cerr << std::endl;
exit(1);
}
template <typename First, typename... Rest>
static void err(First&& first, Rest&&... rest) {
@crabtw
crabtw / fmt.cpp
Created February 17, 2017 23:48
format
#include <cstdio>
#include <string>
struct Fmt {
operator const char *() {
return fmt.c_str();
}
std::string fmt;
};
@crabtw
crabtw / fix-select-coin.patch
Created January 1, 2016 08:07
Fix COIN key of gngeo 0.8
--- src/event.c.orig 2016-01-01 15:55:03.995071650 +0800
+++ src/event.c 2016-01-01 15:56:36.584921148 +0800
@@ -385,6 +385,11 @@
if (joy_state[1][GN_START])
memory.intern_start &= 0xFB;
+ if (joy_state[0][GN_SELECT_COIN])
+ memory.intern_start &= 0xFD;
+ if (joy_state[1][GN_SELECT_COIN])
+ memory.intern_start &= 0xF7;
LD_PRELOAD=/usr/lib/libclang.so ./bindgen -I/usr/lib/clang/3.5.0/include -Icef3 cef3/include/capi/cef_base_capi.h -match cef_base_capi -lcef3
@crabtw
crabtw / glib2.supp
Last active January 8, 2018 15:59
valgrind suppression file for glib2
# gobject
{
constructor
Memcheck:Leak
...
fun:gobject_init_ctor
}
# glib
RUSTC = rustc
CC = gcc
AR = ar
test: test.rs ffi.o
$(RUSTC) $< -L . -o $@
ffi.o: ffi.c
$(CC) -fPIC -c $< -o $@
CC = gcc
RUSTC = rustc
BINDGEN = bindgen
test: test.rs hello.rs libhello.so
$(RUSTC) $< -L . -o $@
hello.rs: hello.h
$(BINDGEN) -l hello $< -o $@
@crabtw
crabtw / Makefile
Last active December 17, 2015 16:19
clang arm cross compiler
BIN = arm-linux-gnueabihf-clang
SRC = arm_linux_gnueabihf.ml
LIB = unix.cmxa
all: $(BIN)
$(BIN): $(SRC)
ocamlopt -o $@ $(LIB) $<