Skip to content

Instantly share code, notes, and snippets.

@d
Last active June 28, 2018 06:58
Show Gist options
  • Save d/852837fbfec24eb7bfe2db116aa693cc to your computer and use it in GitHub Desktop.
Save d/852837fbfec24eb7bfe2db116aa693cc to your computer and use it in GitHub Desktop.
When did we fuck up bool?
xargs --verbose --no-run-if-empty -n1 --arg-file ~/src/d/naughty-booleans-sources.txt clang-query-6.0 -f (egrep -v '^//' ~/src/d/naughty-booleans-clang-query.txt | psub)
parallel --no-run-if-empty --keep-order -n1 --arg-file ~/src/d/naughty-booleans-sources.txt clang-query-6.0 --extra-arg="-fcolor-diagnostics" -f (egrep -v '^//' ~/src/d/naughty-booleans-clang-query.txt | psub)
// set output dump
set bind-root false
let notBool unless(hasType(asString('bool')))
let notPointer unless(hasType(anyOf(pointerType(), hasCanonicalType(pointerType()))))
let isBang hasOperatorName("!")
let isAssign anyOf(hasOperatorName('='), hasOperatorName('|='))
let implicitAssignmentToBool binaryOperator(expr().bind("assigning non-bool to bool"), isAssign, hasLHS(hasType(asString('bool'))), hasRHS(unless(hasType(asString('bool')))))
let callBoolFunc callExpr(callee(functionDecl(returns(hasDeclaration(namedDecl(hasName('bool')))))))
let callTzparse callExpr(callee(functionDecl(hasName('tzparse'))))
let logicalAndOr binaryOperator(anyOf(hasOperatorName('&&'), hasOperatorName('||')))
let logical anyOf(unaryOperator(isBang), logicalAndOr)
let comparison binaryOperator(anyOf(hasOperatorName('=='), hasOperatorName('!=')))
let whitelist memberExpr(expr().bind("member"), member(hasName('es_instrument')))
let nonBoolExpr allOf(implicitCastExpr(hasSourceExpression(expr(expr().bind("neither bool nor pointer"), notBool, notPointer, unless(whitelist)))), unless(logical), unless(comparison))
let underImplicitCastToBool hasParent(implicitCastExpr(hasImplicitDestinationType(asString('bool'))))
let castBackToBool conditionalOperator(anyOf(underImplicitCastToBool, expr(hasParent(parenExpr(underImplicitCastToBool)))))
let isConditionOfConditionalOperator conditionalOperator(hasCondition(equalsBoundNode("implicit cast bool return value of function")))
match implicitAssignmentToBool
match ifStmt(hasCondition(expr(expr().bind("using non-bool expression as condition"), anyOf(unaryOperator(isBang, hasUnaryOperand(nonBoolExpr)), nonBoolExpr, binaryOperator(logicalAndOr, hasEitherOperand(nonBoolExpr))))))
match implicitCastExpr(expr().bind("implicit cast bool return value of function"), hasSourceExpression(expr(callBoolFunc)), hasParent(expr(expr().bind("parent"), unless(logicalAndOr), unless(castBackToBool), unless(isConditionOfConditionalOperator), unless(implicitAssignmentToBool))))
src/backend/utils/adt/like.c
src/backend/utils/adt/cash.c
src/backend/executor/nodeMergeAppend.c
src/backend/catalog/pg_enum.c
src/backend/catalog/aoblkdir.c
src/backend/optimizer/util/plancat.c
src/backend/utils/adt/geo_ops.c
src/backend/regex/regexec.c
src/bin/initdb/pqsignal.c
src/backend/utils/mb/conv.c
src/backend/utils/cache/sharedcache.c
src/backend/utils/adt/selfuncs.c
src/backend/optimizer/path/equivclass.c
src/backend/commands/operatorcmds.c
src/backend/executor/execAOCSScan.c
src/backend/utils/hash/hashfn.c
src/backend/optimizer/plan/planmain.c
src/backend/executor/execQual.c
src/backend/optimizer/path/costsize.c
src/backend/nodes/read.c
src/backend/regex/regfree.c
src/backend/catalog/pg_appendonly.c
src/backend/access/external/url_file.c
src/backend/catalog/pg_constraint.c
src/backend/parser/parser.c
src/backend/access/common/tupconvert.c
src/backend/cdb/cdbbufferedappend.c
src/backend/access/gin/ginbulk.c
src/backend/postmaster/pgarch.c
src/backend/utils/adt/varlena.c
src/backend/utils/cache/ts_cache.c
src/backend/utils/fmgr/dfmgr.c
src/backend/access/hash/hashinsert.c
src/backend/access/common/indextuple.c
src/backend/catalog/gp_fastsequence.c
src/backend/catalog/pg_shdepend.c
src/backend/foreign/foreign.c
src/backend/access/appendonly/appendonly_visimap.c
src/backend/postmaster/postmaster.c
src/backend/replication/repl_gram.c
src/backend/snowball/libstemmer/stem_ISO_8859_1_english.c
src/bin/initdb/initdb.c
src/backend/utils/adt/geo_selfuncs.c
src/backend/utils/mmgr/memprot.c
src/backend/storage/freespace/fsmpage.c
src/backend/access/appendonly/appendonlywriter.c
src/backend/snowball/libstemmer/stem_ISO_8859_1_danish.c
src/backend/utils/time/visibility_summary.c
src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
src/backend/libpq/fe-connect.c
src/backend/access/nbtree/nbtxlog.c
src/backend/access/hash/hashovfl.c
src/backend/utils/adt/interpolate.c
src/backend/access/gist/gist.c
src/backend/libpq/getpeereid.c
src/backend/tcop/postgres.c
src/backend/utils/adt/inet_net_pton.c
src/timezone/zic.c
src/backend/access/appendonly/appendonlytid.c
src/backend/storage/smgr/md.c
src/backend/snowball/libstemmer/stem_ISO_8859_1_french.c
src/backend/utils/misc/testutils.c
src/backend/utils/mb/mbutils.c
src/backend/commands/alter.c
src/backend/utils/mb/wstrcmp.c
src/backend/utils/sort/tuplesort_mk.c
src/backend/tcop/pquery.c
src/backend/postmaster/backoff.c
src/backend/utils/adt/pseudotypes.c
src/backend/commands/tablespace.c
src/backend/utils/adt/bool.c
src/backend/snowball/libstemmer/stem_UTF_8_french.c
src/backend/executor/nodeWorktablescan.c
src/backend/port/pg_latch.c
src/backend/snowball/libstemmer/stem_UTF_8_hungarian.c
src/backend/utils/misc/backend_cancel.c
src/backend/utils/mmgr/event_version.c
src/backend/commands/resgroupcmds.c
src/backend/utils/adt/domains.c
src/backend/snowball/libstemmer/stem_UTF_8_danish.c
src/backend/cdb/cdbpartindex.c
src/backend/tsearch/dict_simple.c
src/backend/executor/nodeIndexscan.c
src/backend/cdb/dispatcher/cdbconn.c
src/backend/access/hash/hashscan.c
src/backend/access/transam/subtrans.c
src/backend/cdb/cdbappendonlystorage.c
src/backend/cdb/cdbcopy.c
src/backend/access/gist/gistutil.c
src/backend/utils/misc/uriparser.c
src/backend/regex/regprefix.c
src/backend/utils/misc/faultinjector.c
src/backend/optimizer/plan/transform.c
src/backend/cdb/motion/tupser.c
src/backend/commands/view.c
src/backend/storage/buffer/localbuf.c
src/backend/utils/gdd/gddfuncs.c
src/backend/commands/portalcmds.c
src/backend/utils/sort/tuplestore.c
src/backend/catalog/namespace.c
src/backend/access/nbtree/nbtsearch.c
src/backend/postmaster/pgstat.c
src/backend/utils/adt/tsvector.c
src/backend/executor/nodeMaterial.c
src/backend/snowball/dict_snowball.c
src/backend/utils/adt/oracle_compat.c
src/backend/cdb/cdbbufferedread.c
src/backend/executor/spi.c
src/backend/executor/nodeDynamicBitmapIndexscan.c
src/backend/optimizer/path/orindxpath.c
src/backend/executor/nodeModifyTable.c
src/backend/utils/hash/pg_crc.c
src/backend/libpq/pg_sha2.c
src/backend/utils/cache/typcache.c
src/backend/commands/schemacmds.c
src/backend/access/external/url.c
src/backend/executor/nodeDML.c
src/backend/nodes/equalfuncs.c
src/backend/executor/nodeUnique.c
src/backend/executor/nodeLockRows.c
src/backend/access/appendonly/appendonlyam.c
src/backend/cdb/cdbtargeteddispatch.c
src/backend/parser/analyze.c
src/backend/executor/nodeSplitUpdate.c
src/backend/nodes/outfuncs.c
src/backend/commands/define.c
src/backend/optimizer/prep/prepqual.c
src/backend/utils/adt/xml.c
src/backend/storage/file/gp_compress.c
src/backend/nodes/print.c
src/backend/nodes/bitmapset.c
src/backend/cdb/dispatcher/cdbpq.c
src/backend/utils/mmgr/mpool.c
src/backend/parser/parse_collate.c
src/backend/catalog/catalog.c
src/bin/initdb/findtimezone.c
src/backend/utils/misc/bitmap_compression.c
src/backend/executor/nodeBitmapHeapscan.c
src/backend/commands/conversioncmds.c
src/backend/executor/nodeHashjoin.c
src/backend/access/hash/hashsearch.c
src/backend/access/transam/xlogloc.c
src/backend/commands/tablecmds.c
src/backend/optimizer/plan/planagg.c
src/backend/optimizer/plan/planner.c
src/backend/commands/prepare.c
src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c
src/backend/commands/indexcmds.c
src/backend/utils/workfile_manager/workfile_segmentspace.c
src/backend/tsearch/dict_synonym.c
src/backend/utils/fmgrtab.c
src/backend/executor/nodeAssertOp.c
src/backend/utils/misc/pg_rusage.c
src/backend/utils/error/debugutils.c
src/backend/utils/adt/varchar.c
src/backend/utils/workfile_manager/workfile_diskspace.c
src/backend/access/heap/tuptoaster.c
src/backend/commands/discard.c
src/backend/cdb/motion/htupfifo.c
src/backend/utils/adt/version.c
src/backend/utils/mb/encnames.c
src/backend/cdb/cdbappendonlyxlog.c
src/backend/cdb/motion/tupchunklist.c
src/backend/access/heap/rewriteheap.c
src/backend/cdb/partitionselection.c
src/backend/access/transam/varsup.c
src/backend/nodes/value.c
src/backend/storage/ipc/standby.c
src/backend/utils/adt/numutils.c
src/backend/commands/copy.c
src/backend/utils/adt/tsvector_op.c
src/backend/storage/page/itemptr.c
src/backend/access/gin/ginget.c
src/backend/optimizer/util/restrictinfo.c
src/backend/utils/adt/tsquery_gist.c
src/backend/cdb/cdbpgdatabase.c
src/backend/executor/nodeSubplan.c
src/backend/executor/instrument.c
src/backend/cdb/cdbsubplan.c
src/backend/catalog/gp_segment_config.c
src/backend/executor/nodeHash.c
src/backend/utils/cache/spccache.c
src/backend/utils/hash/dynahash.c
src/backend/storage/lmgr/predicate.c
src/backend/cdb/cdbutil.c
src/backend/executor/execDynamicScan.c
src/backend/executor/execUtils.c
src/backend/utils/mmgr/runaway_cleaner.c
src/backend/storage/lmgr/lwlock.c
src/backend/optimizer/util/clauses.c
src/backend/nodes/nodeFuncs.c
src/backend/utils/session_state.c
src/backend/access/nbtree/nbtcompare.c
src/backend/snowball/libstemmer/stem_ISO_8859_1_spanish.c
src/backend/postmaster/perfmon_segmentinfo.c
src/backend/parser/parse_param.c
src/backend/cdb/cdbtmutils.c
src/backend/cdb/cdbdistributedsnapshot.c
src/backend/libpq/be-secure.c
src/backend/access/hash/hash.c
src/backend/commands/comment.c
src/backend/utils/time/snapmgr.c
src/backend/cdb/cdboidsync.c
src/backend/cdb/motion/ic_udpifc.c
src/backend/access/transam/xact.c
src/backend/access/common/heaptuple.c
src/backend/utils/error/elog.c
src/backend/access/external/url_execute.c
src/backend/replication/gp_libpqwalreceiver.c
src/backend/access/gin/gininsert.c
src/backend/utils/adt/genfile.c
src/backend/access/heap/visibilitymap.c
src/backend/optimizer/plan/planpartition.c
src/backend/utils/resgroup/resgroup_helper.c
src/backend/executor/nodePartitionSelector.c
src/backend/executor/nodeDynamicTableScan.c
src/backend/storage/ipc/procsignal.c
src/backend/executor/nodeDynamicIndexscan.c
src/backend/libpq/pqcomm.c
src/backend/commands/async.c
src/timezone/localtime.c
src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c
src/backend/executor/nodeLimit.c
src/backend/commands/extprotocolcmds.c
src/backend/utils/adt/windowfuncs.c
src/backend/snowball/libstemmer/stem_ISO_8859_1_hungarian.c
src/backend/main/main.c
src/backend/cdb/dispatcher/cdbdisp_async.c
src/backend/snowball/libstemmer/stem_UTF_8_swedish.c
src/backend/commands/lockcmds.c
src/backend/cdb/cdbrelsize.c
src/backend/optimizer/path/joinrels.c
src/backend/access/bitmap/bitmaputil.c
src/backend/catalog/pg_largeobject.c
src/backend/utils/adt/arrayutils.c
src/backend/optimizer/path/tidpath.c
src/backend/access/transam/slru.c
src/backend/snowball/libstemmer/stem_UTF_8_porter.c
src/backend/utils/adt/gp_optimizer_functions.c
src/backend/catalog/pg_inherits.c
src/backend/executor/nodeShareInputScan.c
src/backend/utils/adt/float.c
src/backend/cdb/dispatcher/cdbdisp_dtx.c
src/backend/optimizer/util/walkers.c
src/backend/utils/adt/varbit.c
src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c
src/backend/utils/resgroup/resgroup.c
src/backend/access/common/tupdesc.c
src/backend/access/gin/ginscan.c
src/backend/cdb/dispatcher/cdbdispatchresult.c
src/backend/access/appendonly/aosegfiles.c
src/backend/cdb/cdbtm.c
src/backend/access/gin/ginfast.c
src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c
src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c
src/backend/tcop/fastpath.c
src/backend/utils/adt/oid.c
src/backend/utils/init/miscinit.c
src/backend/storage/file/reinit.c
src/backend/parser/parse_agg.c
src/backend/utils/adt/misc.c
src/backend/storage/ipc/shmem.c
src/backend/executor/nodeSubqueryscan.c
src/backend/access/transam/multixact.c
src/backend/optimizer/prep/prepjointree.c
src/backend/utils/adt/date.c
src/backend/utils/adt/numeric.c
src/backend/catalog/pg_type.c
src/backend/access/aocs/aocs_compaction.c
src/backend/executor/nodeTableScan.c
src/backend/storage/freespace/indexfsm.c
src/backend/storage/page/checksum.c
src/backend/parser/parse_utilcmd.c
src/backend/replication/walreceiverfuncs.c
src/backend/executor/execHHashagg.c
src/backend/utils/adt/regproc.c
src/backend/access/gin/ginvacuum.c
src/backend/access/gist/gistget.c
src/backend/commands/extension.c
src/backend/access/hash/hashutil.c
src/backend/storage/lmgr/lmgr.c
src/backend/nodes/params.c
src/backend/access/gist/gistvacuum.c
src/backend/executor/execBitmapAOScan.c
src/backend/commands/collationcmds.c
src/backend/utils/mmgr/mcxt.c
src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c
src/backend/utils/adt/nabstime.c
src/backend/optimizer/plan/createplan.c
src/backend/cdb/cdbvarblock.c
src/backend/snowball/libstemmer/utilities.c
src/backend/replication/walreceiver.c
src/backend/cdb/motion/tupleremap.c
src/backend/executor/nodeValuesscan.c
src/backend/cdb/cdbpath.c
src/backend/executor/nodeBitmapAppendOnlyscan.c
src/backend/access/transam/distributedlog.c
src/backend/utils/adt/orderedsetaggs.c
src/backend/libpq/be-fsstubs.c
src/backend/cdb/dispatcher/cdbgang_async.c
src/backend/utils/fmgr/deprecated.c
src/backend/cdb/cdbplan.c
src/backend/utils/mmgr/memaccounting.c
src/backend/storage/buffer/freelist.c
src/backend/tcop/dest.c
src/backend/cdb/cdbappendonlystorageformat.c
src/backend/tsearch/ts_locale.c
src/backend/access/nbtree/nbtsort.c
src/backend/utils/adt/txid.c
src/backend/postmaster/alertseverity.c
src/backend/catalog/quicklz_compression.c
src/backend/access/nbtree/nbtutils.c
src/backend/tsearch/to_tsany.c
src/backend/executor/nodeFunctionscan.c
src/backend/utils/mmgr/portalmem.c
src/backend/access/appendonly/appendonly_visimap_store.c
src/backend/utils/adt/acl.c
src/backend/utils/mmgr/idle_tracker.c
src/backend/utils/adt/tsvector_parser.c
src/backend/snowball/libstemmer/stem_ISO_8859_1_swedish.c
src/backend/nodes/outfast.c
src/backend/access/heap/syncscan.c
src/backend/utils/sort/tuplesort.c
src/backend/storage/ipc/ipc.c
src/backend/optimizer/plan/subselect.c
src/backend/utils/init/globals.c
src/backend/storage/lmgr/spin.c
src/backend/utils/cache/relcache.c
src/backend/snowball/libstemmer/stem_ISO_8859_1_german.c
src/backend/utils/misc/help_config.c
src/bin/initdb/encnames.c
src/backend/executor/execAOScan.c
src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c
src/backend/executor/nodeRowTrigger.c
src/backend/commands/user.c
src/backend/utils/mb/wstrncmp.c
src/backend/utils/adt/network.c
src/backend/tsearch/ts_utils.c
src/backend/commands/analyzefuncs.c
src/backend/cdb/motion/ic_common.c
src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c
src/backend/catalog/pg_compression.c
src/backend/cdb/cdbappendonlystoragewrite.c
src/backend/cdb/cdbheap.c
src/backend/utils/resource_manager/resource_manager.c
src/backend/bootstrap/bootparse.c
src/backend/commands/typecmds.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/cache/plancache.c
src/backend/utils/adt/rowtypes.c
src/backend/access/bitmap/bitmapxlog.c
src/backend/utils/error/assert.c
src/backend/libpq/fe-exec.c
src/backend/snowball/libstemmer/stem_UTF_8_russian.c
src/backend/cdb/cdbmutate.c
src/backend/snowball/libstemmer/stem_ISO_8859_2_romanian.c
src/backend/access/appendonly/appendonly_compaction.c
src/backend/fts/ftsprobe.c
src/backend/access/heap/pruneheap.c
src/backend/access/heap/hio.c
src/backend/executor/functions.c
src/backend/cdb/dispatcher/cdbdisp_query.c
src/backend/utils/adt/format_type.c
src/backend/tsearch/wparser_def.c
src/backend/lib/dllist.c
src/backend/commands/vacuumlazy.c
src/backend/access/gist/gistproc.c
src/backend/utils/adt/char.c
src/backend/nodes/readfuncs.c
src/backend/storage/file/buffile.c
src/backend/executor/nodeResult.c
src/backend/storage/ipc/procarray.c
src/backend/parser/parse_coerce.c
src/backend/access/external/url_curl.c
src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c
src/backend/catalog/pg_conversion.c
src/backend/utils/mb/conversion_procs/euc2004_sjis2004/euc2004_sjis2004.c
src/backend/postmaster/sendalert.c
src/backend/utils/adt/pg_lzcompress.c
src/backend/postmaster/autovacuum.c
src/backend/executor/execDML.c
src/backend/utils/resgroup/resgroup-ops-linux.c
src/backend/libpq/md5.c
src/backend/executor/nodeTidscan.c
src/backend/storage/page/bufpage.c
src/backend/utils/adt/tsginidx.c
src/backend/parser/parse_node.c
src/backend/postmaster/postmaster.c
src/backend/tsearch/dict.c
src/backend/utils/misc/guc.c
src/backend/cdb/cdbsetop.c
src/backend/storage/freespace/freespace.c
src/backend/snowball/libstemmer/stem_UTF_8_italian.c
src/backend/utils/adt/pgstatfuncs.c
src/backend/executor/nodeRecursiveunion.c
src/backend/tsearch/ts_selfuncs.c
src/backend/commands/trigger.c
src/backend/utils/misc/rbtree.c
src/backend/utils/adt/tsrank.c
src/backend/utils/adt/quote.c
src/backend/bootstrap/bootstrap.c
src/backend/catalog/pg_extprotocol.c
src/backend/access/bitmap/bitmapattutil.c
src/backend/executor/execProcnode.c
src/backend/snowball/libstemmer/stem_UTF_8_german.c
src/backend/access/transam/twophase.c
src/backend/utils/cache/lsyscache.c
src/backend/executor/execScan.c
src/backend/storage/buffer/bufmgr.c
src/backend/access/appendonly/appendonly_visimap_udf.c
src/backend/storage/ipc/sinvaladt.c
src/backend/libpq/ip.c
src/backend/storage/lmgr/proc.c
src/backend/catalog/pg_proc.c
src/backend/postmaster/seqserver.c
src/backend/executor/nodeBitmapTableScan.c
src/timezone/strftime.c
src/backend/executor/execGrouping.c
src/backend/catalog/storage.c
src/backend/utils/adt/jsonfuncs.c
src/backend/commands/cluster.c
src/backend/catalog/dependency.c
src/backend/utils/adt/lockfuncs.c
src/backend/access/gin/ginbtree.c
src/timezone/pgtz.c
src/backend/cdb/cdbvars.c
src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c
src/backend/access/bitmap/bitmap.c
src/backend/port/dynloader.c
src/backend/snowball/libstemmer/stem_ISO_8859_1_finnish.c
src/backend/executor/tstoreReceiver.c
src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c
src/backend/utils/fmgr/funcapi.c
src/backend/utils/resscheduler/resscheduler.c
src/backend/commands/foreigncmds.c
src/backend/optimizer/util/predtest.c
src/backend/access/index/indexam.c
src/backend/parser/parse_oper.c
src/backend/catalog/index.c
src/backend/utils/adt/xid.c
src/backend/tsearch/ts_parse.c
src/backend/catalog/aoseg.c
src/backend/utils/cache/syscache.c
src/backend/executor/nodeTableFunction.c
src/backend/access/gin/gindatapage.c
src/backend/executor/execBitmapHeapScan.c
src/backend/utils/adt/tsquery_rewrite.c
src/backend/access/appendonly/appendonly_visimap_entry.c
src/backend/storage/ipc/ipci.c
src/backend/executor/nodeSetOp.c
src/backend/libpq/pqexpbuffer.c
src/backend/utils/time/combocid.c
src/backend/utils/adt/tsgistidx.c
src/backend/utils/misc/fstream/fstream.c
src/backend/access/gin/ginarrayproc.c
src/backend/parser/parse_target.c
src/backend/storage/large_object/inv_api.c
src/backend/utils/adt/timestamp.c
src/backend/utils/adt/array_userfuncs.c
src/backend/storage/ipc/sinval.c
src/backend/libpq/hba.c
src/backend/access/appendonly/aomd.c
src/backend/utils/adt/tsquery.c
src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
src/backend/utils/cache/catcache.c
src/backend/optimizer/plan/planshare.c
src/backend/snowball/libstemmer/stem_UTF_8_romanian.c
src/backend/optimizer/path/clausesel.c
src/backend/libpq/fe-protocol3.c
src/backend/utils/mb/conversion_procs/utf8_and_euc2004/utf8_and_euc2004.c
src/backend/nodes/nodes.c
src/backend/utils/datumstream/datumstream.c
src/backend/utils/adt/tid.c
src/backend/catalog/heap.c
src/backend/utils/fmgr/fmgr.c
src/backend/utils/adt/arrayfuncs.c
src/backend/utils/workfile_manager/workfile_queryspace.c
src/backend/utils/adt/ri_triggers.c
src/backend/storage/lmgr/deadlock.c
src/backend/utils/workfile_manager/workfile_mgr.c
src/backend/utils/adt/uuid.c
src/backend/utils/gp/segadmin.c
src/backend/storage/file/compress_nothing.c
src/backend/utils/resource_manager/memquota.c
src/backend/parser/parse_func.c
src/backend/executor/execBitmapTableScan.c
src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c
src/backend/utils/adt/enum.c
src/backend/cdb/cdbappendonlystorageread.c
src/backend/utils/adt/gp_dump_oids.c
src/backend/utils/sort/tuplestorenew.c
src/backend/utils/adt/regexp.c
src/backend/parser/kwlookup.c
src/backend/snowball/libstemmer/stem_UTF_8_spanish.c
src/backend/fts/fts.c
src/backend/access/common/bufmask.c
src/backend/utils/sort/tuplesort_mkqsort.c
src/backend/executor/nodeSeqscan.c
src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c
src/backend/cdb/cdbsreh.c
src/backend/snowball/libstemmer/stem_ISO_8859_1_dutch.c
src/backend/catalog/pg_namespace.c
src/backend/utils/cache/inval.c
src/backend/postmaster/perfmon.c
src/backend/snowball/libstemmer/stem_ISO_8859_1_portuguese.c
src/backend/tcop/idle_resource_cleaner.c
src/backend/utils/resowner/resowner.c
src/backend/utils/gpmon/gpmon.c
src/backend/snowball/libstemmer/stem_ISO_8859_1_porter.c
src/backend/catalog/pg_depend.c
src/backend/access/transam/gp_transaction_log.c
src/backend/executor/nodeMotion.c
src/backend/storage/file/fd.c
src/backend/tsearch/ts_typanalyze.c
src/backend/port/pg_shmem.c
src/backend/optimizer/plan/initsplan.c
src/backend/tsearch/spell.c
src/backend/utils/adt/pg_locale.c
src/backend/executor/execAmi.c
src/backend/executor/execTuples.c
src/backend/access/common/reloptions.c
src/backend/cdb/cdbsubselect.c
src/backend/access/aocs/aocsam.c
src/backend/parser/keywords.c
src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c
src/backend/tsearch/dict_thesaurus.c
src/backend/cdb/motion/cdbmotion.c
src/backend/executor/nodeAppend.c
src/backend/parser/parse_cte.c
src/backend/storage/file/copydir.c
src/backend/utils/adt/tsquery_op.c
src/backend/access/appendonly/appendonlyblockdirectory.c
src/backend/utils/adt/dbsize.c
src/backend/cdb/cdbpathtoplan.c
src/backend/executor/nodeExternalscan.c
src/backend/optimizer/prep/prepunion.c
src/backend/executor/nodeForeignscan.c
src/backend/parser/scan.c
src/backend/utils/cache/attoptcache.c
src/backend/replication/basebackup.c
src/backend/access/external/url_custom.c
src/backend/access/hash/hashsort.c
src/backend/catalog/aclchk.c
src/backend/rewrite/rewriteSupport.c
src/backend/access/bitmap/bitmapsearch.c
src/backend/optimizer/path/allpaths.c
src/backend/lib/stringinfo.c
src/backend/postmaster/checkpointer.c
src/backend/rewrite/rewriteManip.c
src/backend/cdb/cdbtimer.c
src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c
src/backend/commands/tsearchcmds.c
src/backend/optimizer/path/joinpath.c
src/backend/utils/misc/fstream/gfile.c
src/backend/catalog/indexing.c
src/backend/tsearch/dict_ispell.c
src/backend/executor/execHeapScan.c
src/backend/utils/adt/complex_type.c
src/backend/utils/adt/matrix.c
src/backend/snowball/libstemmer/stem_ISO_8859_1_norwegian.c
src/backend/access/transam/clog.c
src/backend/rewrite/rewriteRemove.c
src/backend/utils/adt/tsquery_cleanup.c
src/backend/access/bitmap/bitmapinsert.c
src/backend/port/pg_sema.c
src/backend/utils/adt/int.c
src/backend/executor/execGpmon.c
src/backend/tsearch/regis.c
src/backend/utils/adt/formatting.c
src/backend/cdb/dispatcher/cdbgang.c
src/backend/cdb/cdbpathlocus.c
src/backend/catalog/zstd_compression.c
src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c
src/backend/parser/parse_relation.c
src/backend/access/gin/ginxlog.c
src/backend/nodes/readfast.c
src/backend/commands/dbcommands.c
src/backend/access/aocs/aocssegfiles.c
src/backend/utils/mmgr/vmem_tracker.c
src/backend/snowball/libstemmer/stem_UTF_8_norwegian.c
src/backend/parser/parse_expr.c
src/backend/executor/nodeBitmapAnd.c
src/backend/commands/vacuum.c
src/backend/utils/mb/wchar.c
src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
src/backend/access/hash/hashfunc.c
src/backend/utils/mmgr/redzone_handler.c
src/backend/executor/nodeMergejoin.c
src/backend/utils/adt/inet_cidr_ntop.c
src/backend/cdb/cdbfts.c
src/backend/storage/ipc/pmsignal.c
src/backend/utils/init/postinit.c
src/backend/commands/proclang.c
src/backend/access/gin/ginutil.c
src/backend/access/gist/gistxlog.c
src/backend/commands/analyze.c
src/backend/storage/smgr/smgr.c
src/backend/catalog/pg_db_role_setting.c
src/backend/access/transam/transam.c
src/backend/access/transam/xlog.c
src/backend/access/index/genam.c
src/backend/utils/adt/datum.c
src/backend/regex/regcomp.c
src/backend/commands/variable.c
src/backend/catalog/pg_exttable.c
src/backend/cdb/cdbllize.c
src/backend/utils/misc/bitstream.c
src/backend/utils/sort/logtape.c
src/backend/postmaster/walwriter.c
src/backend/rewrite/rewriteDefine.c
src/backend/utils/adt/name.c
src/backend/access/transam/rmgr.c
src/backend/cdb/cdbpartition.c
src/backend/executor/nodeSequence.c
src/backend/access/transam/xlogutils.c
src/backend/executor/nodeBitmapOr.c
src/backend/utils/mmgr/aset.c
src/bin/initdb/localtime.c
src/backend/utils/adt/gp_partition_functions.c
src/backend/utils/workfile_manager/workfile_file.c
src/backend/optimizer/util/var.c
src/backend/utils/mmgr/psprintf.c
src/backend/fts/ftsmessagehandler.c
src/backend/parser/gram.c
src/backend/storage/file/bfz.c
src/backend/executor/nodeWindowAgg.c
src/backend/commands/sequence.c
src/backend/libpq/fe-misc.c
src/backend/libpq/fe-protocol2.c
src/backend/access/common/memtuple.c
src/backend/storage/ipc/shmqueue.c
src/backend/access/common/reloptions_gp.c
src/backend/access/nbtree/nbtree.c
src/backend/access/hash/hashpage.c
src/backend/commands/seclabel.c
src/backend/access/transam/twophase_rmgr.c
src/backend/catalog/pg_operator.c
src/backend/cdb/cdblocaldistribxact.c
src/backend/regex/regerror.c
src/backend/optimizer/plan/plangroupext.c
src/backend/libpq/fe-auth.c
src/backend/utils/misc/guc_gp.c
src/backend/cdb/dispatcher/cdbgang_thread.c
src/backend/postmaster/syslogger.c
src/backend/snowball/libstemmer/api.c
src/backend/snowball/libstemmer/stem_KOI8_R_russian.c
src/backend/postmaster/autostats.c
src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/utf8_and_sjis2004.c
src/backend/libpq/sha2.c
src/backend/cdb/cdbdistributedxacts.c
src/backend/executor/nodeAgg.c
src/backend/cdb/cdbdistributedxid.c
src/backend/utils/error/faultinject.c
src/backend/utils/mmgr/ext_alloc.c
src/backend/utils/misc/netcheck.c
src/backend/nodes/tidbitmap.c
src/backend/utils/cache/relmapper.c
src/backend/utils/adt/version.c
src/backend/cdb/dispatcher/cdbdisp_thread.c
src/backend/utils/adt/ascii.c
src/backend/access/gist/gistscan.c
src/backend/access/gist/gistsplit.c
src/backend/cdb/cdbsrlz.c
src/backend/commands/exttablecmds.c
src/backend/cdb/cdbthreadlog.c
src/backend/tcop/utility.c
src/backend/access/transam/xlog.c
src/backend/storage/file/compress_zlib.c
src/backend/nodes/list.c
src/backend/utils/adt/trigfuncs.c
src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c
src/backend/catalog/oid_dispatch.c
src/backend/optimizer/prep/preptlist.c
src/backend/utils/datumstream/datumstreamblock.c
src/backend/cdb/cdbpullup.c
src/backend/storage/lmgr/lock.c
src/backend/cdb/cdbhash.c
src/backend/utils/sort/tuplesort_mkheap.c
src/backend/utils/adt/mac.c
src/backend/utils/resscheduler/resqueue.c
src/backend/executor/nodeCtescan.c
src/backend/access/bitmap/bitmappages.c
src/backend/optimizer/path/indxpath.c
src/timezone/gptime.c
src/backend/nodes/copyfuncs.c
src/backend/cdb/cdbcat.c
src/backend/commands/constraint.c
src/backend/access/nbtree/nbtpage.c
src/backend/cdb/cdbdtxcontextinfo.c
src/backend/snowball/libstemmer/stem_UTF_8_dutch.c
src/backend/utils/adt/encode.c
src/backend/utils/adt/int8.c
src/backend/snowball/libstemmer/stem_UTF_8_turkish.c
src/backend/utils/gdd/gdddetector.c
src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c
src/backend/executor/execMain.c
src/backend/utils/time/sharedsnapshot.c
src/backend/access/transam/xlogfuncs.c
src/backend/utils/misc/tzparser.c
src/backend/executor/nodeSort.c
src/backend/commands/aggregatecmds.c
src/backend/commands/explain.c
src/backend/storage/smgr/smgrtype.c
src/backend/access/external/fileam.c
src/backend/catalog/aovisimap.c
src/backend/executor/execCurrent.c
src/backend/postmaster/fork_process.c
src/backend/parser/scansup.c
src/backend/utils/adt/pivot.c
src/backend/utils/cache/syncrefhashtable.c
src/backend/storage/lmgr/s_lock.c
src/backend/rewrite/rewriteHandler.c
src/backend/catalog/objectaddress.c
src/backend/utils/misc/superuser.c
src/backend/port/atomics.c
src/backend/utils/misc/ps_status.c
src/backend/catalog/pg_collation.c
src/backend/cdb/motion/ic_tcp.c
src/backend/tsearch/wparser.c
src/backend/libpq/crypt.c
src/backend/catalog/toasting.c
src/backend/access/heap/heapam.c
src/backend/cdb/dispatcher/cdbdisp.c
src/backend/optimizer/plan/analyzejoins.c
src/backend/access/gin/ginentrypage.c
src/backend/executor/execJunk.c
src/backend/storage/buffer/buf_init.c
src/backend/snowball/libstemmer/stem_UTF_8_english.c
src/backend/catalog/pg_proc_callback.c
src/backend/access/common/printtup.c
src/backend/snowball/libstemmer/stem_UTF_8_portuguese.c
src/backend/replication/walsender.c
src/backend/optimizer/path/pathkeys.c
src/backend/replication/syncrep.c
src/backend/optimizer/util/pathnode.c
src/backend/nodes/makefuncs.c
src/backend/libpq/pqsignal.c
src/backend/utils/time/tqual.c
src/backend/utils/gdd/gddbackend.c
src/backend/optimizer/util/joininfo.c
src/backend/commands/functioncmds.c
src/backend/libpq/auth.c
src/backend/optimizer/util/tlist.c
src/backend/executor/nodeRepeat.c
src/backend/catalog/pg_aggregate.c
src/backend/replication/gp_replication.c
src/backend/access/common/scankey.c
src/backend/optimizer/plan/setrefs.c
src/backend/optimizer/util/placeholder.c
src/backend/commands/queue.c
src/backend/utils/adt/tsquery_util.c
src/backend/parser/parse_clause.c
src/backend/snowball/libstemmer/stem_ISO_8859_1_italian.c
src/backend/postmaster/bgwriter.c
src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c
src/backend/executor/nodeBitmapIndexscan.c
src/backend/cdb/cdbdoublylinked.c
src/backend/utils/misc/zlib_wrapper.c
src/backend/cdb/cdbgroup.c
src/backend/access/transam/gp_distributed_log.c
src/backend/executor/execWorkfile.c
src/backend/utils/adt/datetime.c
src/backend/catalog/aocatalog.c
src/backend/executor/nodeNestloop.c
src/backend/access/nbtree/nbtinsert.c
src/backend/storage/buffer/buf_table.c
src/backend/commands/opclasscmds.c
src/backend/catalog/pg_attribute_encoding.c
src/backend/libpq/fe-secure.c
src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c
src/backend/utils/adt/json.c
src/backend/libpq/pqformat.c
src/backend/optimizer/util/relnode.c
src/backend/parser/parse_type.c
src/backend/parser/parse_partition.c
src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
src/backend/snowball/libstemmer/stem_UTF_8_finnish.c
require 'pathname'
require 'json'
commands = JSON.load(File.read('compile_commands.json'))
gpdb_path = Pathname.new('~/workspace/gpdb').expand_path
initdb = gpdb_path + 'src/bin/initdb'
backend = gpdb_path + 'src/backend'
timezone = gpdb_path + 'src/timezone'
puts commands.select {|c|
[initdb, backend, timezone].map(&:to_s).any? {|dir|
(gpdb_path + c['directory']).to_s.start_with?(dir)
}
}.map { |c|
(Pathname.new(c['directory']).relative_path_from(gpdb_path) + c['file']).to_s
}.join("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment