Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote-tracking branch 'predator/master'

  • Loading branch information...
commit 15f99cb6f05973da2e5bea80451add7dde98edd2 2 parents 110e9eb + 0a18a97
@ondrik authored
Showing with 1,363 additions and 680 deletions.
  1. +4 −2 cl/builtins.cc
  2. +10 −5 cl/callgraph.cc
  3. +4 −2 cl/cl_chain.cc
  4. +40 −20 cl/cl_dotgen.cc
  5. +2 −1  cl/cl_easy.cc
  6. +6 −3 cl/cl_factory.cc
  7. +4 −2 cl/cl_locator.cc
  8. +43 −20 cl/cl_pp.cc
  9. +36 −18 cl/cl_storage.cc
  10. +14 −7 cl/cl_typedot.cc
  11. +47 −22 cl/cldebug.cc
  12. +44 −22 cl/clf_intchk.cc
  13. +6 −3 cl/clf_opchk.cc
  14. +8 −4 cl/clf_unilabel.cc
  15. +14 −7 cl/clf_unswitch.cc
  16. +18 −9 cl/clutil.cc
  17. +2 −1  cl/code_listener.cc
  18. +1 −0  cl/gcc/clplug.c
  19. +14 −7 cl/killer.cc
  20. +4 −2 cl/loopscan.cc
  21. +18 −9 cl/ssd.cc
  22. +8 −4 cl/stopwatch.cc
  23. +68 −34 cl/storage.cc
  24. +10 −5 cl/util.hh
  25. +20 −10 fwnull/cl_fwnull.cc
  26. +2 −1  include/cl/cl_msg.hh
  27. +10 −5 include/cl/clutil.hh
  28. +8 −3 include/cl/code_listener.h
  29. +8 −4 sl/cl_symexec.cc
  30. +52 −29 sl/intrange.cc
  31. +22 −11 sl/intrange.hh
  32. +22 −11 sl/memdebug.cc
  33. +2 −1  sl/plotenum.cc
  34. +12 −6 sl/prototype.cc
  35. +10 −5 sl/sigcatch.cc
  36. +22 −11 sl/symabstract.cc
  37. +8 −4 sl/symbin.cc
  38. +28 −14 sl/symbt.cc
  39. +34 −17 sl/symcall.cc
  40. +2 −1  sl/symcmp.hh
  41. +12 −6 sl/symcut.cc
  42. +4 −2 sl/symdiscover.cc
  43. +2 −1  sl/symdiscover.hh
  44. +10 −5 sl/symdump.cc
  45. +14 −7 sl/syments.hh
  46. +50 −25 sl/symexec.cc
  47. +18 −9 sl/symgc.cc
  48. +200 −100 sl/symheap.cc
  49. +16 −8 sl/symheap.hh
  50. +34 −17 sl/symjoin.cc
  51. +2 −1  sl/symjoin.hh
  52. +6 −3 sl/sympath.cc
  53. +54 −27 sl/symplot.cc
  54. +73 −36 sl/symproc.cc
  55. +2 −1  sl/symproc.hh
  56. +12 −6 sl/symseg.cc
  57. +22 −11 sl/symseg.hh
  58. +46 −23 sl/symstate.cc
  59. +70 −35 sl/symtrace.cc
  60. +16 −8 sl/symutil.cc
  61. +12 −6 sl/symutil.hh
  62. +1 −1  tests/forester-regre/test-p0028.err
View
6 cl/builtins.cc
@@ -27,7 +27,8 @@
namespace CodeStorage {
-bool isBuiltInFnc(const struct cl_operand &op) {
+bool isBuiltInFnc(const struct cl_operand &op)
+{
const char *name;
if (!fncNameFromCst(&name, &op))
// likely indirect fuction call
@@ -38,7 +39,8 @@ bool isBuiltInFnc(const struct cl_operand &op) {
|| STREQ("VK_ASSERT", name);
}
-bool isBuiltInCall(const Insn &insn) {
+bool isBuiltInCall(const Insn &insn)
+{
return isBuiltInFnc(insn.operands[/* fnc */ 1]);
}
View
15 cl/callgraph.cc
@@ -35,7 +35,8 @@ namespace CallGraph {
typedef const struct cl_operand &TOp;
typedef const Insn *TInsn;
-Node* allocNodeIfNeeded(Graph &cg, Fnc *const fnc) {
+Node* allocNodeIfNeeded(Graph &cg, Fnc *const fnc)
+{
Node *&node = fnc->cgNode;
if (node)
return node;
@@ -46,7 +47,8 @@ Node* allocNodeIfNeeded(Graph &cg, Fnc *const fnc) {
return node;
}
-void handleCallback(Graph &cg, Node *node, const TInsn insn, TOp op) {
+void handleCallback(Graph &cg, Node *node, const TInsn insn, TOp op)
+{
int uid;
if (!fncUidFromOperand(&uid, &op))
// not a function
@@ -70,7 +72,8 @@ void handleCallback(Graph &cg, Node *node, const TInsn insn, TOp op) {
cg.hasCallback = true;
}
-void handleCall(Graph &cg, Node *node, const TInsn insn) {
+void handleCall(Graph &cg, Node *node, const TInsn insn)
+{
// if there is a call, it is no longer a leaf node
cg.leaves.erase(node);
@@ -92,7 +95,8 @@ void handleCall(Graph &cg, Node *node, const TInsn insn) {
cg.roots.erase(targetNode);
}
-void handleFnc(Fnc *const fnc) {
+void handleFnc(Fnc *const fnc)
+{
Graph &cg = fnc->stor->callGraph;
Node *const node = allocNodeIfNeeded(cg, fnc);
@@ -114,7 +118,8 @@ void handleFnc(Fnc *const fnc) {
}
}
-void buildCallGraph(const Storage &stor) {
+void buildCallGraph(const Storage &stor)
+{
StopWatch watch;
BOOST_FOREACH(Fnc *fnc, stor.fncs)
View
6 cl/cl_chain.cc
@@ -103,11 +103,13 @@ class ClChain: public ICodeListener {
} \
} while (0)
-ClChain::~ClChain() {
+ClChain::~ClChain()
+{
CL_CHAIN_FOREACH(destroy);
}
-void ClChain::append(cl_code_listener *item) {
+void ClChain::append(cl_code_listener *item)
+{
list_.push_back(item);
}
View
60 cl/cl_dotgen.cc
@@ -228,11 +228,13 @@ void ClDotGenerator::createDotFile(std::ofstream &str, std::string fileName,
CL_ERROR("unable to create file '" << fileName << "'");
}
-void ClDotGenerator::closeSub(std::ofstream &str) {
+void ClDotGenerator::closeSub(std::ofstream &str)
+{
str << "}" << std::endl;
}
-void ClDotGenerator::closeDot(std::ofstream &str) {
+void ClDotGenerator::closeDot(std::ofstream &str)
+{
ClDotGenerator::closeSub(str);
if (!str)
@@ -253,21 +255,25 @@ ClDotGenerator::ClDotGenerator(const char *glDotFile):
}
}
-ClDotGenerator::~ClDotGenerator() {
+ClDotGenerator::~ClDotGenerator()
+{
if (hasGlDotFile_)
this->closeDot(glOut_);
}
-void ClDotGenerator::acknowledge() {
+void ClDotGenerator::acknowledge()
+{
// we haven't been waiting for acknowledge anyway, sorry...
}
-void ClDotGenerator::gobbleEdge(std::string dst, EdgeType type) {
+void ClDotGenerator::gobbleEdge(std::string dst, EdgeType type)
+{
perBbEdgeMap_[dst] = type;
perFncEdgeMap_[dst] = type;
}
-void ClDotGenerator::emitEdge(std::string dst, EdgeType type) {
+void ClDotGenerator::emitEdge(std::string dst, EdgeType type)
+{
switch (type) {
case ET_LC_CALL:
case ET_LC_CALL_INDIR:
@@ -291,7 +297,8 @@ void ClDotGenerator::emitEdge(std::string dst, EdgeType type) {
<< " [color=" << EtColors[type] << "];" << std::endl;
}
-void ClDotGenerator::emitBb() {
+void ClDotGenerator::emitBb()
+{
// colorize current BB node
perFileOut_ << "\t" << SL_QUOTE_BB(bb_)
<< " [color=" << NtColors[nodeType_]
@@ -321,7 +328,8 @@ void ClDotGenerator::emitCallSet(std::ofstream &str, TCallSet &cs,
}
}
-void ClDotGenerator::emitPendingCalls() {
+void ClDotGenerator::emitPendingCalls()
+{
TCallMultiMap::iterator i;
for (i = perFncCalls_.begin(); i != perFncCalls_.end(); ++i) {
const string &dst = i->first;
@@ -351,7 +359,8 @@ void ClDotGenerator::emitPendingCalls() {
perFncEdgeMap_.clear();
}
-void ClDotGenerator::emitFncEntry(const char *label) {
+void ClDotGenerator::emitFncEntry(const char *label)
+{
FILE_FNC_STREAM(SL_SUBGRAPH(fnc_ << "." << label, fnc_
<< "() at " << loc_.file << ":" << loc_.line)
<< "\tcolor=blue;" << std::endl
@@ -368,7 +377,8 @@ void ClDotGenerator::emitFncEntry(const char *label) {
perFileOut_ << "\tURL=" << SL_QUOTE_URL(fnc_) << ";" << std::endl;
}
-void ClDotGenerator::emitInsnJmp(const char *label) {
+void ClDotGenerator::emitInsnJmp(const char *label)
+{
perFncOut_ << "\t" << SL_QUOTE_BB(bb_ << SL_BB_POS_SUFFIX)
<< " [shape=box, color=black, fontcolor=black,"
<< " style=bold, label=goto];" << std::endl;
@@ -396,7 +406,8 @@ void ClDotGenerator::emitInsnCond(const char *then_label,
<< " [color=green];" << std::endl;
}
-void ClDotGenerator::emitOpIfNeeded() {
+void ClDotGenerator::emitOpIfNeeded()
+{
switch (lastInsn_) {
case CL_INSN_UNOP:
case CL_INSN_BINOP:
@@ -417,7 +428,8 @@ void ClDotGenerator::emitOpIfNeeded() {
<< std::endl;
}
-void ClDotGenerator::emitInsnCall() {
+void ClDotGenerator::emitInsnCall()
+{
perFncOut_ << "\t" << SL_QUOTE_BB(bb_ << SL_BB_POS_SUFFIX)
<< " [shape=box, color=blue, fontcolor=blue, style=dashed,"
<< " label=call];" << std::endl;
@@ -429,7 +441,8 @@ void ClDotGenerator::emitInsnCall() {
<< std::endl;
}
-void ClDotGenerator::checkForFncRef(const struct cl_operand *op) {
+void ClDotGenerator::checkForFncRef(const struct cl_operand *op)
+{
if (CL_OPERAND_CST != op->code)
return;
@@ -447,7 +460,8 @@ void ClDotGenerator::checkForFncRef(const struct cl_operand *op) {
perBbCalls_[name].insert(str.str());
}
-void ClDotGenerator::file_open(const char *file_name) {
+void ClDotGenerator::file_open(const char *file_name)
+{
CL_LOC_SET_FILE(loc_, file_name);
ClDotGenerator::createDotFile(perFileOut_, file_name, true);
perFileOut_ << SL_GRAPH(file_name);
@@ -483,7 +497,8 @@ void ClDotGenerator::fnc_open(const struct cl_operand *fnc)
<< std::endl;
}
-void ClDotGenerator::fnc_arg_decl(int, const struct cl_operand *) {
+void ClDotGenerator::fnc_arg_decl(int, const struct cl_operand *)
+{
}
void ClDotGenerator::fnc_close()
@@ -500,7 +515,8 @@ void ClDotGenerator::fnc_close()
bb_.clear();
}
-void ClDotGenerator::bb_open(const char *bb_name) {
+void ClDotGenerator::bb_open(const char *bb_name)
+{
if (!bb_.empty())
// emit last BB
this->emitBb();
@@ -516,7 +532,8 @@ void ClDotGenerator::bb_open(const char *bb_name) {
<< "\tURL=\"\";" << std::endl;
}
-void ClDotGenerator::insn(const struct cl_insn *cli) {
+void ClDotGenerator::insn(const struct cl_insn *cli)
+{
switch (cli->code) {
case CL_INSN_NOP:
case CL_INSN_LABEL:
@@ -626,7 +643,8 @@ void ClDotGenerator::insn_call_open(const struct cl_loc *loc,
CL_INSN_JMP;
}
-void ClDotGenerator::insn_call_arg(int, const struct cl_operand *arg_src) {
+void ClDotGenerator::insn_call_arg(int, const struct cl_operand *arg_src)
+{
this->checkForFncRef(arg_src);
}
@@ -655,7 +673,8 @@ void ClDotGenerator::insn_switch_case(const struct cl_loc *,
<< " [color=yellow];" << std::endl;
}
-void ClDotGenerator::insn_switch_close() {
+void ClDotGenerator::insn_switch_close()
+{
lastInsn_ =
/* FIXME: we have no CL_INSN_SWITCH in enum cl_insn_e */
CL_INSN_JMP;
@@ -663,6 +682,7 @@ void ClDotGenerator::insn_switch_close() {
// /////////////////////////////////////////////////////////////////////////////
// public interface, see cl_dotgen.hh for more details
-ICodeListener* createClDotGenerator(const char *args) {
+ICodeListener* createClDotGenerator(const char *args)
+{
return new ClDotGenerator(args);
}
View
3  cl/cl_easy.cc
@@ -80,6 +80,7 @@ class ClEasy: public ClStorageBuilder {
// /////////////////////////////////////////////////////////////////////////////
// interface, see cl_easy.hh for details
-ICodeListener* createClEasy(const char *configString) {
+ICodeListener* createClEasy(const char *configString)
+{
return new ClEasy(configString);
}
View
9 cl/cl_factory.cc
@@ -224,7 +224,8 @@ namespace {
}
}
-ClfChainFactory::ClfChainFactory() {
+ClfChainFactory::ClfChainFactory()
+{
map_["unify_labels_gl"] = createClfUniLabelGl;
map_["unify_labels_static"] = createClfUniLabelStatic;
map_["unify_labels_fnc"] = createClfUniLabelFnc;
@@ -302,11 +303,13 @@ ClFactory::ClFactory():
d->map["typedot"] = &createClTypeDotGenerator;
}
-ClFactory::~ClFactory() {
+ClFactory::~ClFactory()
+{
delete d;
}
-ICodeListener* ClFactory::create(const char *config_string) {
+ICodeListener* ClFactory::create(const char *config_string)
+{
CL_FACTORY_DEBUG("ClFactory: config_string: " << config_string);
TStringMap args;
View
6 cl/cl_locator.cc
@@ -98,13 +98,15 @@ ClLocator::ClLocator():
{
}
-void ClLocator::printLocation(const struct cl_loc *loc) {
+void ClLocator::printLocation(const struct cl_loc *loc)
+{
CL_DEBUG_MSG(cl_loc_fallback(loc, &lastLoc_),
"linearized code follows...");
}
// /////////////////////////////////////////////////////////////////////////////
// public interface, see cl_locator.hh for more details
-ICodeListener* createClLocator(const char *) {
+ICodeListener* createClLocator(const char *)
+{
return new ClLocator;
}
View
63 cl/cl_pp.cc
@@ -138,7 +138,8 @@ ClPrettyPrint::ClPrettyPrint(const char *fileName, bool showTypes):
CL_ERROR("unable to create file '" << fileName << "'");
}
-ClPrettyPrint::~ClPrettyPrint() {
+ClPrettyPrint::~ClPrettyPrint()
+{
if (fname_)
fstr_.close();
}
@@ -243,7 +244,8 @@ namespace {
}
}
-void ClPrettyPrint::printIntegralCst(const struct cl_operand *op) {
+void ClPrettyPrint::printIntegralCst(const struct cl_operand *op)
+{
const struct cl_type *type = op->type;
const int value = op->data.cst.data.cst_int.value;
@@ -280,6 +282,9 @@ void ClPrettyPrint::printIntegralCst(const struct cl_operand *op) {
if (value < 0)
out_ << SSD_INLINE_COLOR(C_LIGHT_RED, "(");
+ if (op->type->is_unsigned)
+ out_ << "U";
+
SSD_COLORIZE(out_, C_WHITE) << value;
if (value < 0)
out_ << SSD_INLINE_COLOR(C_LIGHT_RED, ")");
@@ -303,7 +308,8 @@ void ClPrettyPrint::printIntegralCst(const struct cl_operand *op) {
}
}
-void ClPrettyPrint::printCst(const struct cl_operand *op) {
+void ClPrettyPrint::printCst(const struct cl_operand *op)
+{
enum cl_type_e code = op->data.cst.code;
switch (code) {
case CL_TYPE_INT:
@@ -357,7 +363,8 @@ namespace {
}
}
-void ClPrettyPrint::printBareType(const struct cl_type *clt, bool expandFnc) {
+void ClPrettyPrint::printBareType(const struct cl_type *clt, bool expandFnc)
+{
string str;
for (; clt; clt = clt->items[0].type) {
enum cl_type_e code = clt->code;
@@ -452,7 +459,8 @@ void ClPrettyPrint::printBareType(const struct cl_type *clt, bool expandFnc) {
}
}
-void ClPrettyPrint::printVarType(const struct cl_operand *op) {
+void ClPrettyPrint::printVarType(const struct cl_operand *op)
+{
if (op->code == CL_OPERAND_VOID)
CL_TRAP;
@@ -480,7 +488,8 @@ namespace {
}
}
-void ClPrettyPrint::printNestedVar(const struct cl_operand *op) {
+void ClPrettyPrint::printNestedVar(const struct cl_operand *op)
+{
switch (op->code) {
case CL_OPERAND_VAR:
if (!op->data.var->name) {
@@ -520,7 +529,8 @@ namespace {
}
}
-void ClPrettyPrint::printOffsetAccessor(const int off) {
+void ClPrettyPrint::printOffsetAccessor(const int off)
+{
out_ << ssd::Color(C_LIGHT_RED) << "<";
if (0 <= off)
@@ -529,7 +539,8 @@ void ClPrettyPrint::printOffsetAccessor(const int off) {
out_ << off << ">" << ssd::Color(C_NO_COLOR);
}
-void ClPrettyPrint::printRecordAccessor(const struct cl_accessor **ac) {
+void ClPrettyPrint::printRecordAccessor(const struct cl_accessor **ac)
+{
std::string tag;
int offset = 0;
readItemAccessInfo(*ac, &tag, &offset);
@@ -544,7 +555,8 @@ void ClPrettyPrint::printRecordAccessor(const struct cl_accessor **ac) {
out_ << SSD_INLINE_COLOR(C_CYAN, "[+" << offset << "]") << tag;
}
-void ClPrettyPrint::printOperandVar(const struct cl_operand *op) {
+void ClPrettyPrint::printOperandVar(const struct cl_operand *op)
+{
const struct cl_accessor *ac = op->accessor;
this->printVarType(op);
@@ -606,7 +618,8 @@ void ClPrettyPrint::printOperandVar(const struct cl_operand *op) {
}
}
-void ClPrettyPrint::printOperand(const struct cl_operand *op) {
+void ClPrettyPrint::printOperand(const struct cl_operand *op)
+{
if (!op) {
CL_DEBUG_MSG(&loc_, "no operand given to " << __FUNCTION__);
return;
@@ -629,7 +642,8 @@ void ClPrettyPrint::printOperand(const struct cl_operand *op) {
}
}
-void ClPrettyPrint::printAssignmentLhs(const struct cl_operand *lhs) {
+void ClPrettyPrint::printAssignmentLhs(const struct cl_operand *lhs)
+{
if (!lhs || lhs->code == CL_OPERAND_VOID) {
CL_DEBUG_MSG(&loc_, "no lhs given to " << __FUNCTION__);
return;
@@ -641,13 +655,15 @@ void ClPrettyPrint::printAssignmentLhs(const struct cl_operand *lhs) {
<< " ";
}
-void ClPrettyPrint::printInsnNop(const struct cl_insn *) {
+void ClPrettyPrint::printInsnNop(const struct cl_insn *)
+{
out_ << "\t\t"
<< SSD_INLINE_COLOR(C_LIGHT_RED, "nop")
<< std::endl;
}
-void ClPrettyPrint::printInsnJmp(const struct cl_insn *cli) {
+void ClPrettyPrint::printInsnJmp(const struct cl_insn *cli)
+{
if (printingArgDecls_) {
printingArgDecls_ = false;
out_ << SSD_INLINE_COLOR(C_LIGHT_RED, ")") << ":"
@@ -661,7 +677,8 @@ void ClPrettyPrint::printInsnJmp(const struct cl_insn *cli) {
<< std::endl;
}
-void ClPrettyPrint::printInsnCond(const struct cl_insn *cli) {
+void ClPrettyPrint::printInsnCond(const struct cl_insn *cli)
+{
const struct cl_operand *src = cli->data.insn_cond.src;
const char *label_true = cli->data.insn_cond.then_label;
const char *label_false = cli->data.insn_cond.else_label;
@@ -689,7 +706,8 @@ void ClPrettyPrint::printInsnCond(const struct cl_insn *cli) {
<< std::endl;
}
-void ClPrettyPrint::printInsnRet(const struct cl_insn *cli) {
+void ClPrettyPrint::printInsnRet(const struct cl_insn *cli)
+{
const struct cl_operand *src = cli->data.insn_ret.src;
out_ << "\t\t"
@@ -703,13 +721,15 @@ void ClPrettyPrint::printInsnRet(const struct cl_insn *cli) {
out_ << std::endl;
}
-void ClPrettyPrint::printInsnAbort(const struct cl_insn *) {
+void ClPrettyPrint::printInsnAbort(const struct cl_insn *)
+{
out_ << "\t\t"
<< SSD_INLINE_COLOR(C_LIGHT_RED, "abort")
<< std::endl;
}
-void ClPrettyPrint::printInsnUnop(const struct cl_insn *cli) {
+void ClPrettyPrint::printInsnUnop(const struct cl_insn *cli)
+{
const enum cl_unop_e code = cli->data.insn_unop.code;
const struct cl_operand *dst = cli->data.insn_unop.dst;
const struct cl_operand *src = cli->data.insn_unop.src;
@@ -748,7 +768,8 @@ void ClPrettyPrint::printInsnUnop(const struct cl_insn *cli) {
out_ << std::endl;
}
-void ClPrettyPrint::printInsnBinop(const struct cl_insn *cli) {
+void ClPrettyPrint::printInsnBinop(const struct cl_insn *cli)
+{
const enum cl_binop_e code = cli->data.insn_binop.code;
const struct cl_operand *dst = cli->data.insn_binop.dst;
const struct cl_operand *src1 = cli->data.insn_binop.src1;
@@ -865,7 +886,8 @@ void ClPrettyPrint::printInsnBinop(const struct cl_insn *cli) {
out_ << SSD_INLINE_COLOR(C_LIGHT_RED, ")") << std::endl;
}
-void ClPrettyPrint::printInsnLabel(const struct cl_insn *cli) {
+void ClPrettyPrint::printInsnLabel(const struct cl_insn *cli)
+{
const char *name = cli->data.insn_label.name;
if (!name)
return;
@@ -1009,7 +1031,8 @@ void ClPrettyPrint::insn_switch_close()
// /////////////////////////////////////////////////////////////////////////////
// public interface, see cl_pp.hh for more details
-ICodeListener* createClPrettyPrint(const char *args, bool showTypes) {
+ICodeListener* createClPrettyPrint(const char *args, bool showTypes)
+{
// check whether a file name is given
return (args && *args)
? new ClPrettyPrint(/* file name */ args, showTypes)
View
54 cl/cl_storage.cc
@@ -347,12 +347,14 @@ ClStorageBuilder::ClStorageBuilder():
{
}
-ClStorageBuilder::~ClStorageBuilder() {
+ClStorageBuilder::~ClStorageBuilder()
+{
releaseStorage(d->stor);
delete d;
}
-void ClStorageBuilder::acknowledge() {
+void ClStorageBuilder::acknowledge()
+{
this->run(d->stor);
}
@@ -377,7 +379,8 @@ void ClStorageBuilder::Private::digInitials(const TOp *op)
}
}
-EVar varCodeByScope(const enum cl_scope_e scope, const bool isArgDecl) {
+EVar varCodeByScope(const enum cl_scope_e scope, const bool isArgDecl)
+{
switch (scope) {
case CL_SCOPE_GLOBAL:
case CL_SCOPE_STATIC:
@@ -394,7 +397,8 @@ EVar varCodeByScope(const enum cl_scope_e scope, const bool isArgDecl) {
}
}
-bool ClStorageBuilder::Private::digOperandVar(const TOp *op, bool isArgDecl) {
+bool ClStorageBuilder::Private::digOperandVar(const TOp *op, bool isArgDecl)
+{
const int id = varIdFromOperand(op);
// mark as used in the current function
@@ -431,7 +435,8 @@ bool ClStorageBuilder::Private::digOperandVar(const TOp *op, bool isArgDecl) {
return true;
}
-void ClStorageBuilder::Private::digOperandCst(const struct cl_operand *op) {
+void ClStorageBuilder::Private::digOperandCst(const struct cl_operand *op)
+{
const struct cl_cst &cst = op->data.cst;
if (CL_TYPE_FNC != cst.code)
// we are interested only in fncs for now
@@ -468,7 +473,8 @@ void ClStorageBuilder::Private::digOperandCst(const struct cl_operand *op) {
nameMap[name] = uid;
}
-void ClStorageBuilder::Private::digOperand(const TOp *op) {
+void ClStorageBuilder::Private::digOperand(const TOp *op)
+{
if (!op || CL_OPERAND_VOID == op->code)
return;
@@ -518,7 +524,8 @@ void ClStorageBuilder::Private::digOperand(const TOp *op) {
this->digInitials(op);
}
-void ClStorageBuilder::Private::openInsn(Insn *newInsn) {
+void ClStorageBuilder::Private::openInsn(Insn *newInsn)
+{
// set pointer to the owning instance of Storage
newInsn->stor = &this->stor;
@@ -530,7 +537,8 @@ void ClStorageBuilder::Private::openInsn(Insn *newInsn) {
insn = newInsn;
}
-void ClStorageBuilder::Private::closeInsn() {
+void ClStorageBuilder::Private::closeInsn()
+{
TOperandList &operands = insn->operands;
BOOST_FOREACH(const struct cl_operand &op, operands) {
this->digOperand(&op);
@@ -548,20 +556,23 @@ void ClStorageBuilder::Private::closeInsn() {
insn = 0;
}
-void ClStorageBuilder::file_open(const char *fileName) {
+void ClStorageBuilder::file_open(const char *fileName)
+{
if (!fileName)
CL_TRAP;
d->file = fileName;
}
-void ClStorageBuilder::file_close() {
+void ClStorageBuilder::file_close()
+{
// let it honestly crash if callback sequence is incorrect since this should
// have already been caught by ClfCbSeqChk cl filter
d->file = 0;
}
-void ClStorageBuilder::fnc_open(const struct cl_operand *op) {
+void ClStorageBuilder::fnc_open(const struct cl_operand *op)
+{
if (CL_OPERAND_CST != op->code)
CL_TRAP;
@@ -590,7 +601,8 @@ void ClStorageBuilder::fnc_open(const struct cl_operand *op) {
d->bb = 0;
}
-void ClStorageBuilder::fnc_arg_decl(int pos, const struct cl_operand *op) {
+void ClStorageBuilder::fnc_arg_decl(int pos, const struct cl_operand *op)
+{
if (CL_OPERAND_VAR != op->code)
CL_TRAP;
@@ -603,18 +615,21 @@ void ClStorageBuilder::fnc_arg_decl(int pos, const struct cl_operand *op) {
(void) pos;
}
-void ClStorageBuilder::fnc_close() {
+void ClStorageBuilder::fnc_close()
+{
// let it honestly crash if callback sequence is incorrect since this should
// have already been caught by ClfCbSeqChk cl filter
d->fnc = 0;
}
-void ClStorageBuilder::bb_open(const char *bb_name) {
+void ClStorageBuilder::bb_open(const char *bb_name)
+{
ControlFlow &cfg = d->fnc->cfg;
d->bb = cfg[bb_name];
}
-void ClStorageBuilder::insn(const struct cl_insn *cli) {
+void ClStorageBuilder::insn(const struct cl_insn *cli)
+{
if (!d->bb)
// FIXME: this simply ignores 'jump to entry' insn
return;
@@ -649,14 +664,16 @@ void ClStorageBuilder::insn_call_open(
d->openInsn(insn);
}
-void ClStorageBuilder::insn_call_arg(int, const struct cl_operand *arg_src) {
+void ClStorageBuilder::insn_call_arg(int, const struct cl_operand *arg_src)
+{
TOperandList &operands = d->insn->operands;
unsigned idx = operands.size();
operands.resize(idx + 1);
storeOperand(operands[idx], arg_src);
}
-void ClStorageBuilder::insn_call_close() {
+void ClStorageBuilder::insn_call_close()
+{
d->closeInsn();
// switch back preventing for next instructions
@@ -737,6 +754,7 @@ void ClStorageBuilder::insn_switch_case(
}
}
-void ClStorageBuilder::insn_switch_close() {
+void ClStorageBuilder::insn_switch_close()
+{
d->closeInsn();
}
View
21 cl/cl_typedot.cc
@@ -203,7 +203,8 @@ ClTypeDotGenerator::ClTypeDotGenerator(const char *glDotFile)
<< "\tlabelloc=t;" << std::endl;
}
-ClTypeDotGenerator::~ClTypeDotGenerator() {
+ClTypeDotGenerator::~ClTypeDotGenerator()
+{
glOut_ << "}" << std::endl;
if (!glOut_) {
CL_WARN("error detected while closing a file");
@@ -211,7 +212,8 @@ ClTypeDotGenerator::~ClTypeDotGenerator() {
glOut_.close();
}
-void ClTypeDotGenerator::acknowledge() {
+void ClTypeDotGenerator::acknowledge()
+{
// we haven't been waiting for acknowledge anyway, sorry...
}
@@ -228,7 +230,8 @@ namespace {
}
// FIXME: copy pasted from ClPrettyPrint::printVarType
-void ClTypeDotGenerator::printType(const struct cl_type *clt) {
+void ClTypeDotGenerator::printType(const struct cl_type *clt)
+{
string str;
for (; clt; clt = clt->items[0].type) {
enum cl_type_e code = clt->code;
@@ -312,7 +315,8 @@ void ClTypeDotGenerator::gobbleEdge(cl_type_uid_t src, cl_type_uid_t dst,
pendingEdges_.push_back(Edge(src, dst, code, strLabel));
}
-void ClTypeDotGenerator::emitPendingEdges() {
+void ClTypeDotGenerator::emitPendingEdges()
+{
TEdgeList::iterator i;
for (i = pendingEdges_.begin(); i != pendingEdges_.end(); ++i) {
const Edge &e = *i;
@@ -372,7 +376,8 @@ void ClTypeDotGenerator::digOneType(const struct cl_type *type, TStack &st)
}
}
-void ClTypeDotGenerator::handleType(const struct cl_type *clt) {
+void ClTypeDotGenerator::handleType(const struct cl_type *clt)
+{
TStack st;
st.push(clt);
@@ -391,7 +396,8 @@ void ClTypeDotGenerator::handleType(const struct cl_type *clt) {
this->emitPendingEdges();
}
-void ClTypeDotGenerator::handleOperand(const struct cl_operand *op) {
+void ClTypeDotGenerator::handleOperand(const struct cl_operand *op)
+{
if (!op || op->code == CL_OPERAND_VOID)
return;
@@ -404,6 +410,7 @@ void ClTypeDotGenerator::handleOperand(const struct cl_operand *op) {
// /////////////////////////////////////////////////////////////////////////////
// public interface, see cl_typedot.hh for more details
-ICodeListener* createClTypeDotGenerator(const char *args) {
+ICodeListener* createClTypeDotGenerator(const char *args)
+{
return new ClTypeDotGenerator(args);
}
View
69 cl/cldebug.cc
@@ -26,7 +26,8 @@
#include <boost/algorithm/string/replace.hpp>
-void cltToStreamCore(std::ostream &out, const struct cl_type *clt) {
+void cltToStreamCore(std::ostream &out, const struct cl_type *clt)
+{
out << "*((const struct cl_type *)"
<< static_cast<const void *>(clt)
<< ")";
@@ -99,7 +100,8 @@ class DumpCltVisitor {
}
};
-void cltToStream(std::ostream &out, const struct cl_type *clt, unsigned depth) {
+void cltToStream(std::ostream &out, const struct cl_type *clt, unsigned depth)
+{
if (!depth) {
cltToStreamCore(out, clt);
return;
@@ -119,7 +121,8 @@ void cltToStream(std::ostream &out, const struct cl_type *clt, unsigned depth) {
traverseTypeIc(clt, visitor);
}
-void acToStream(std::ostream &out, const struct cl_accessor *ac, bool oneline) {
+void acToStream(std::ostream &out, const struct cl_accessor *ac, bool oneline)
+{
if (!ac) {
out << "(empty)";
if (!oneline)
@@ -172,7 +175,8 @@ void acToStream(std::ostream &out, const struct cl_accessor *ac, bool oneline) {
namespace {
-void operandToStreamCstInt(std::ostream &str, const struct cl_operand &op) {
+void operandToStreamCstInt(std::ostream &str, const struct cl_operand &op)
+{
const struct cl_cst &cst = op.data.cst;
const int val = cst.data.cst_int.value;
@@ -183,7 +187,11 @@ void operandToStreamCstInt(std::ostream &str, const struct cl_operand &op) {
break;
case CL_TYPE_INT:
- str << "(int)" << val;
+ str << "(int)";
+ if (op.type->is_unsigned)
+ str << "U";
+
+ str << val;
break;
case CL_TYPE_BOOL:
@@ -206,7 +214,8 @@ void operandToStreamCstInt(std::ostream &str, const struct cl_operand &op) {
}
}
-void operandToStreamCst(std::ostream &str, const struct cl_operand &op) {
+void operandToStreamCst(std::ostream &str, const struct cl_operand &op)
+{
const struct cl_cst &cst = op.data.cst;
const enum cl_type_e code = cst.code;
switch (code) {
@@ -246,7 +255,8 @@ void operandToStreamCst(std::ostream &str, const struct cl_operand &op) {
}
}
-const char* fieldName(const struct cl_accessor *ac) {
+const char* fieldName(const struct cl_accessor *ac)
+{
CL_BREAK_IF(!ac || ac->code != CL_ACCESSOR_ITEM);
const struct cl_type *clt = ac->type;
@@ -261,7 +271,8 @@ const char* fieldName(const struct cl_accessor *ac) {
: "<anon_item>";
}
-void arrayIdxToStream(std::ostream &str, const struct cl_operand *idx) {
+void arrayIdxToStream(std::ostream &str, const struct cl_operand *idx)
+{
if (CL_OPERAND_CST != idx->code) {
str << "[...]";
return;
@@ -277,7 +288,8 @@ void arrayIdxToStream(std::ostream &str, const struct cl_operand *idx) {
str << "[" << cst.data.cst_int.value << "]";
}
-void operandToStreamAcs(std::ostream &str, const struct cl_accessor *ac) {
+void operandToStreamAcs(std::ostream &str, const struct cl_accessor *ac)
+{
if (!ac)
return;
@@ -320,7 +332,8 @@ void operandToStreamAcs(std::ostream &str, const struct cl_accessor *ac) {
}
}
-void operandToStreamVar(std::ostream &str, const struct cl_operand &op) {
+void operandToStreamVar(std::ostream &str, const struct cl_operand &op)
+{
const struct cl_accessor *ac = op.accessor;
// FIXME: copy/pasted from cl_pp.cc
@@ -353,7 +366,8 @@ void operandToStreamVar(std::ostream &str, const struct cl_operand &op) {
} // namespace
-void operandToStream(std::ostream &str, const struct cl_operand &op) {
+void operandToStream(std::ostream &str, const struct cl_operand &op)
+{
const enum cl_operand_e code = op.code;
switch (code) {
case CL_OPERAND_VOID:
@@ -442,7 +456,8 @@ void binOpToStream(std::ostream &str, int subCode,
str << ")";
}
-void callToStream(std::ostream &str, const CodeStorage::TOperandList &opList) {
+void callToStream(std::ostream &str, const CodeStorage::TOperandList &opList)
+{
const struct cl_operand &dst = opList[/* dst */ 0];
if (CL_OPERAND_VOID != dst.code) {
operandToStream(str, dst);
@@ -460,7 +475,8 @@ void callToStream(std::ostream &str, const CodeStorage::TOperandList &opList) {
str << ")";
}
-void retToStream(std::ostream &str, const struct cl_operand &src) {
+void retToStream(std::ostream &str, const struct cl_operand &src)
+{
str << "return";
if (CL_OPERAND_VOID == src.code)
@@ -472,7 +488,8 @@ void retToStream(std::ostream &str, const struct cl_operand &src) {
} // namespace
-void insnToStream(std::ostream &str, const CodeStorage::Insn &insn) {
+void insnToStream(std::ostream &str, const CodeStorage::Insn &insn)
+{
const CodeStorage::TOperandList &opList = insn.operands;
const CodeStorage::TTargetList &tList = insn.targets;
@@ -533,34 +550,42 @@ void insnToStream(std::ostream &str, const CodeStorage::Insn &insn) {
using std::cout;
-void cl_dump(const struct cl_type *clt) {
+void cl_dump(const struct cl_type *clt)
+{
cltToStream(cout, clt, /* depth */ 3U);
}
-void cl_dump(const struct cl_type *clt, unsigned depth) {
+void cl_dump(const struct cl_type *clt, unsigned depth)
+{
cltToStream(cout, clt, depth);
}
-void cl_dump(const struct cl_accessor *ac) {
+void cl_dump(const struct cl_accessor *ac)
+{
acToStream(cout, ac, /* oneline */ false);
}
-void cl_dump(const struct cl_accessor &ac) {
+void cl_dump(const struct cl_accessor &ac)
+{
cl_dump(&ac);
}
-void cl_dump(const struct cl_operand &op) {
+void cl_dump(const struct cl_operand &op)
+{
cout << op << "\n";
}
-void cl_dump(const struct cl_operand *op) {
+void cl_dump(const struct cl_operand *op)
+{
cl_dump(*op);
}
-void cl_dump(const struct CodeStorage::Insn &insn) {
+void cl_dump(const struct CodeStorage::Insn &insn)
+{
cout << insn << "\n";
}
-void cl_dump(const struct CodeStorage::Insn *insn) {
+void cl_dump(const struct CodeStorage::Insn *insn)
+{
cl_dump(*insn);
}
View
66 cl/clf_intchk.cc
@@ -394,7 +394,8 @@ ClfCbSeqChk::ClfCbSeqChk(ICodeListener *slave):
{
}
-const char* ClfCbSeqChk::toString(EState state) {
+const char* ClfCbSeqChk::toString(EState state)
+{
#define CASE_TO_STRING(state) case state: return #state;
switch (state) {
CASE_TO_STRING(S_INIT)
@@ -412,16 +413,19 @@ const char* ClfCbSeqChk::toString(EState state) {
}
}
-void ClfCbSeqChk::emitUnexpected(const char *what) {
+void ClfCbSeqChk::emitUnexpected(const char *what)
+{
CL_ERROR_MSG(&loc_, "unexpected callback in state "
<< toString(state_) << " (" << what << ")");
}
-void ClfCbSeqChk::emitUnexpected(EState state) {
+void ClfCbSeqChk::emitUnexpected(EState state)
+{
this->emitUnexpected(toString(state));
}
-void ClfCbSeqChk::setState(EState newState) {
+void ClfCbSeqChk::setState(EState newState)
+{
switch (state_) {
case S_INIT:
switch (newState) {
@@ -488,17 +492,20 @@ void ClfCbSeqChk::setState(EState newState) {
state_ = newState;
}
-void ClfCbSeqChk::chkArgDecl() {
+void ClfCbSeqChk::chkArgDecl()
+{
if (S_FNC_DECL != state_)
this->emitUnexpected("fnc_arg_decl");
}
-void ClfCbSeqChk::chkInsnNop() {
+void ClfCbSeqChk::chkInsnNop()
+{
if (S_BLOCK_LEVEL != state_)
this->emitUnexpected("CL_INSN_NOP");
}
-void ClfCbSeqChk::chkInsnJmp() {
+void ClfCbSeqChk::chkInsnJmp()
+{
switch (state_) {
case S_FNC_DECL:
case S_BLOCK_LEVEL:
@@ -511,60 +518,70 @@ void ClfCbSeqChk::chkInsnJmp() {
state_ = S_FNC_BODY;
}
-void ClfCbSeqChk::chkInsnCond() {
+void ClfCbSeqChk::chkInsnCond()
+{
if (S_BLOCK_LEVEL != state_)
this->emitUnexpected("CL_INSN_COND");
state_ = S_FNC_BODY;
}
-void ClfCbSeqChk::chkInsnRet() {
+void ClfCbSeqChk::chkInsnRet()
+{
if (S_BLOCK_LEVEL != state_)
this->emitUnexpected("CL_INSN_RET");
state_ = S_FNC_BODY;
}
-void ClfCbSeqChk::chkInsnAbort() {
+void ClfCbSeqChk::chkInsnAbort()
+{
if (S_BLOCK_LEVEL != state_)
this->emitUnexpected("CL_INSN_ABORT");
state_ = S_FNC_BODY;
}
-void ClfCbSeqChk::chkInsnUnop() {
+void ClfCbSeqChk::chkInsnUnop()
+{
if (S_BLOCK_LEVEL != state_)
this->emitUnexpected("CL_INSN_UNOP");
}
-void ClfCbSeqChk::chkInsnBinop() {
+void ClfCbSeqChk::chkInsnBinop()
+{
if (S_BLOCK_LEVEL != state_)
this->emitUnexpected("CL_INSN_BINOP");
}
-void ClfCbSeqChk::chkInsnLabel() {
+void ClfCbSeqChk::chkInsnLabel()
+{
if (S_BLOCK_LEVEL != state_)
this->emitUnexpected("CL_INSN_LABEL");
}
-void ClfCbSeqChk::chkInsnCallArg() {
+void ClfCbSeqChk::chkInsnCallArg()
+{
if (S_INSN_CALL != state_)
this->emitUnexpected("insn_call_arg");
}
-void ClfCbSeqChk::setCallClose() {
+void ClfCbSeqChk::setCallClose()
+{
if (S_INSN_CALL != state_)
this->emitUnexpected("insn_call_close");
state_ = S_BLOCK_LEVEL;
}
-void ClfCbSeqChk::chkInsnSwitchCase() {
+void ClfCbSeqChk::chkInsnSwitchCase()
+{
if (S_INSN_SWITCH != state_)
this->emitUnexpected("insn_switch_case");
}
-void ClfCbSeqChk::setSwitchClose() {
+void ClfCbSeqChk::setSwitchClose()
+{
if (S_INSN_SWITCH != state_)
this->emitUnexpected("insn_switch_close");
@@ -580,11 +597,13 @@ ClfLabelChk::ClfLabelChk(ICodeListener *slave):
{
}
-void ClfLabelChk::reset() {
+void ClfLabelChk::reset()
+{
map_.clear();
}
-void ClfLabelChk::defineLabel(const char *label) {
+void ClfLabelChk::defineLabel(const char *label)
+{
LabelState &ls = map_[label];
if (ls.defined) {
CL_ERROR_MSG(&loc_, "redefinition of label '" << label << "'");
@@ -595,14 +614,16 @@ void ClfLabelChk::defineLabel(const char *label) {
ls.loc = loc_;
}
-void ClfLabelChk::reqLabel(const char *label) {
+void ClfLabelChk::reqLabel(const char *label)
+{
LabelState &ls = map_[label];
ls.reachable = true;
if (!ls.loc.file)
ls.loc = loc_;
}
-void ClfLabelChk::emitWarnings() {
+void ClfLabelChk::emitWarnings()
+{
TMap::iterator i;
for (i = map_.begin(); i != map_.end(); ++i) {
const std::string label = i->first;
@@ -632,7 +653,8 @@ namespace {
// /////////////////////////////////////////////////////////////////////////////
// public interface, see clf_intchk.hh for more details
-ICodeListener* createClfIntegrityChk(ICodeListener *slave) {
+ICodeListener* createClfIntegrityChk(ICodeListener *slave)
+{
return usageChk(
new ClfLabelChk(
new ClfCbSeqChk(slave)));
View
9 cl/clf_opchk.cc
@@ -26,7 +26,8 @@ ClfOpCheckerBase::ClfOpCheckerBase(ICodeListener *slave):
{
}
-void ClfOpCheckerBase::handleArrayIdx(const struct cl_operand *op) {
+void ClfOpCheckerBase::handleArrayIdx(const struct cl_operand *op)
+{
if (CL_OPERAND_VOID == op->code)
return;
@@ -41,7 +42,8 @@ void ClfOpCheckerBase::handleArrayIdx(const struct cl_operand *op) {
}
}
-void ClfOpCheckerBase::handleSrc(const struct cl_operand *op) {
+void ClfOpCheckerBase::handleSrc(const struct cl_operand *op)
+{
if (CL_OPERAND_VOID == op->code)
return;
@@ -60,7 +62,8 @@ void ClfOpCheckerBase::handleSrc(const struct cl_operand *op) {
this->handleArrayIdx(op);
}
-void ClfOpCheckerBase::handleDstSrc(const struct cl_operand *op) {
+void ClfOpCheckerBase::handleDstSrc(const struct cl_operand *op)
+{
if (CL_OPERAND_VOID == op->code)
return;
View
12 cl/clf_unilabel.cc
@@ -126,13 +126,15 @@ ClfUniLabel::ClfUniLabel(ICodeListener *slave, cl_scope_e scope):
}
}
-std::string ClfUniLabel::resolveLabel(const char *label) {
+std::string ClfUniLabel::resolveLabel(const char *label)
+{
std::ostringstream str;
str << "L" << this->labelLookup(label);
return str.str();
}
-int ClfUniLabel::labelLookup(const char *label) {
+int ClfUniLabel::labelLookup(const char *label)
+{
std::string str(label);
TMap::iterator i = map_.find(str);
@@ -143,13 +145,15 @@ int ClfUniLabel::labelLookup(const char *label) {
return last_;
}
-void ClfUniLabel::reset() {
+void ClfUniLabel::reset()
+{
map_.clear();
last_ = 0;
}
// /////////////////////////////////////////////////////////////////////////////
// public interface, see clf_unilabel.hh for more details
-ICodeListener* createClfUniLabel(ICodeListener *slave, cl_scope_e scope) {
+ICodeListener* createClfUniLabel(ICodeListener *slave, cl_scope_e scope)
+{
return new ClfUniLabel(slave, scope);
}
View
21 cl/clf_unswitch.cc
@@ -33,7 +33,8 @@
#define NULLIFY(what) \
memset(&(what), 0, sizeof (what))
-int getCaseVal(const struct cl_operand *op) {
+int getCaseVal(const struct cl_operand *op)
+{
CL_BREAK_IF(!op || !op->type);
enum cl_type_e code = op->type->code;
@@ -116,7 +117,8 @@ class ClfUnfoldSwitch: public ClFilterBase {
using std::string;
-ClfUnfoldSwitch::~ClfUnfoldSwitch() {
+ClfUnfoldSwitch::~ClfUnfoldSwitch()
+{
BOOST_FOREACH(struct cl_var *clv, ptrs_) {
delete clv;
}
@@ -124,7 +126,8 @@ ClfUnfoldSwitch::~ClfUnfoldSwitch() {
// FIXME: duplicated code from clf_uniregs.cc
// TODO: implement shared module providing this
-void ClfUnfoldSwitch::cloneSwitchSrc(const struct cl_operand *op) {
+void ClfUnfoldSwitch::cloneSwitchSrc(const struct cl_operand *op)
+{
CL_BREAK_IF(!op);
src_ = *op;
@@ -142,7 +145,8 @@ void ClfUnfoldSwitch::cloneSwitchSrc(const struct cl_operand *op) {
// FIXME: duplicated code from clf_uniregs.cc
// TODO: implement shared module providing this
-void ClfUnfoldSwitch::freeClonedSwitchSrc() {
+void ClfUnfoldSwitch::freeClonedSwitchSrc()
+{
struct cl_accessor *ac = src_.accessor;
while (ac) {
struct cl_accessor *next = ac->next;
@@ -154,7 +158,8 @@ void ClfUnfoldSwitch::freeClonedSwitchSrc() {
}
}
-struct cl_var* ClfUnfoldSwitch::acquireClVar() {
+struct cl_var* ClfUnfoldSwitch::acquireClVar()
+{
struct cl_var *clv = new struct cl_var;
memset(clv, 0, sizeof *clv);
clv->uid = /* XXX */ 0x400000 + switchCnt_;
@@ -217,7 +222,8 @@ void ClfUnfoldSwitch::emitCase(int cst, struct cl_type *type, const char *label)
ClFilterBase::bb_open(aux_label);
}
-void ClfUnfoldSwitch::emitDefault() {
+void ClfUnfoldSwitch::emitDefault()
+{
if (defLabel_.empty())
CL_TRAP;
@@ -232,7 +238,8 @@ void ClfUnfoldSwitch::emitDefault() {
// /////////////////////////////////////////////////////////////////////////////
// public interface, see clf_unswitch.hh for more details
-ICodeListener* createClfUnfoldSwitch(ICodeListener *slave) {
+ICodeListener* createClfUnfoldSwitch(ICodeListener *slave)
+{
return createClfUniLabel(new ClfUnfoldSwitch(
createClfUniLabel(slave, CL_SCOPE_GLOBAL)),
CL_SCOPE_GLOBAL);
View
27 cl/clutil.cc
@@ -29,7 +29,8 @@
#include <boost/foreach.hpp>
#include <boost/tuple/tuple.hpp>
-bool operator==(const struct cl_type &a, const struct cl_type &b) {
+bool operator==(const struct cl_type &a, const struct cl_type &b)
+{
// go through the given types recursively and match UIDs etc.
typedef std::pair<const struct cl_type *, const struct cl_type *> TItem;
std::stack<TItem> todo;
@@ -100,7 +101,8 @@ bool operator==(const struct cl_type &a, const struct cl_type &b) {
return true;
}
-const struct cl_type* targetTypeOfPtr(const struct cl_type *clt) {
+const struct cl_type* targetTypeOfPtr(const struct cl_type *clt)
+{
if (!clt || clt->code != CL_TYPE_PTR)
return /* not a pointer */ 0;
@@ -111,7 +113,8 @@ const struct cl_type* targetTypeOfPtr(const struct cl_type *clt) {
return clt;
}
-const struct cl_type* targetTypeOfArray(const struct cl_type *clt) {
+const struct cl_type* targetTypeOfArray(const struct cl_type *clt)
+{
CL_BREAK_IF(!clt || clt->code != CL_TYPE_ARRAY || clt->item_cnt != 1);
clt = clt->items[/* target */ 0].type;
@@ -119,7 +122,8 @@ const struct cl_type* targetTypeOfArray(const struct cl_type *clt) {
return clt;
}
-bool seekRefAccessor(const struct cl_accessor *ac) {
+bool seekRefAccessor(const struct cl_accessor *ac)
+{
for(; ac; ac = ac->next) {
if (CL_ACCESSOR_REF != ac->code)
continue;
@@ -133,7 +137,8 @@ bool seekRefAccessor(const struct cl_accessor *ac) {
return false;
}
-int intCstFromOperand(const struct cl_operand *op) {
+int intCstFromOperand(const struct cl_operand *op)
+{
CL_BREAK_IF(CL_OPERAND_CST != op->code);
const struct cl_cst &cst = op->data.cst;
@@ -142,7 +147,8 @@ int intCstFromOperand(const struct cl_operand *op) {
return cst.data.cst_int.value;
}
-int varIdFromOperand(const struct cl_operand *op, const char **pName) {
+int varIdFromOperand(const struct cl_operand *op, const char **pName)
+{
CL_BREAK_IF(CL_OPERAND_VAR != op->code);
if (pName)
*pName = op->data.var->name;
@@ -150,7 +156,8 @@ int varIdFromOperand(const struct cl_operand *op, const char **pName) {
return op->data.var->uid;
}
-bool fncNameFromCst(const char **pName, const struct cl_operand *op) {
+bool fncNameFromCst(const char **pName, const struct cl_operand *op)
+{
if (CL_OPERAND_CST != op->code)
return false;
@@ -167,7 +174,8 @@ bool fncNameFromCst(const char **pName, const struct cl_operand *op) {
return !!fncName;
}
-bool fncUidFromOperand(int *pUid, const struct cl_operand *op) {
+bool fncUidFromOperand(int *pUid, const struct cl_operand *op)
+{
if (CL_OPERAND_CST != op->code)
return false;
@@ -198,7 +206,8 @@ std::string varToString(
return str.str();
}
-int offsetByIdxChain(const struct cl_type *clt, const TFieldIdxChain &ic) {
+int offsetByIdxChain(const struct cl_type *clt, const TFieldIdxChain &ic)
+{
int off = 0;
BOOST_FOREACH(const int idx, ic) {
View
3  cl/code_listener.cc
@@ -165,7 +165,8 @@ void cl_global_cleanup(void)
free((char *)app_name);
}
-bool cl_is_term_insn(enum cl_insn_e code) {
+bool cl_is_term_insn(enum cl_insn_e code)
+{
switch (code) {
case CL_INSN_JMP:
case CL_INSN_COND:
View
1  cl/gcc/clplug.c
@@ -986,6 +986,7 @@ static void read_cst_int(struct cl_operand *op, tree t)
CL_BREAK_IF(TREE_INT_CST_HIGH(t) != 0 && (TREE_INT_CST_LOW(t) == 0
|| TREE_INT_CST_HIGH(t) != -1));
+ // FIXME: should we read unsigned types separately?
op->code = CL_OPERAND_CST;
op->data.cst.code = CL_TYPE_INT;
op->data.cst.data.cst_int.value = TREE_INT_CST_LOW(t);
View
21 cl/killer.cc
@@ -78,7 +78,8 @@ struct Data {
}
};
-void scanOperand(BlockData &bData, const cl_operand &op, bool dst) {
+void scanOperand(BlockData &bData, const cl_operand &op, bool dst)
+{
VK_DEBUG(4, "scanOperand: " << op << ((dst) ? " [dst]" : " [src]"));
bool fieldOfComp = false;
@@ -134,7 +135,8 @@ void scanOperand(BlockData &bData, const cl_operand &op, bool dst) {
VK_DEBUG(3, "gen(" << name << ")");
}
-void scanInsn(BlockData &bData, const Insn &insn) {
+void scanInsn(BlockData &bData, const Insn &insn)
+{
VK_DEBUG_MSG(3, &insn.loc, "scanInsn: " << insn);
const TOperandList opList = insn.operands;
@@ -170,7 +172,8 @@ void scanInsn(BlockData &bData, const Insn &insn) {
}
}
-void updateBlock(Data &data, TBlock bb) {
+void updateBlock(Data &data, TBlock bb)
+{
VK_DEBUG_MSG(2, &bb->front()->loc, "updateBlock: " << bb->name());
BlockData &bData = data.blocks[bb];
bool anyChange = false;
@@ -199,7 +202,8 @@ void updateBlock(Data &data, TBlock bb) {
data.todo.insert(bbDst);
}
-void computeFixPoint(Data &data) {
+void computeFixPoint(Data &data)
+{
// fixed-point computation
unsigned cntSteps = 1;
TBlockSet &todo = data.todo;
@@ -312,7 +316,8 @@ void commitInsn(
}
}
-void commitBlock(Data &data, TBlock bb) {
+void commitBlock(Data &data, TBlock bb)
+{
const TTargetList &targets = bb->targets();
const unsigned cntTargets = targets.size();
const bool multipleTargets = (1 < cntTargets);
@@ -381,7 +386,8 @@ void commitBlock(Data &data, TBlock bb) {
}
}
-void analyzeFnc(Fnc &fnc) {
+void analyzeFnc(Fnc &fnc)
+{
// shared state info
Data data(*fnc.stor);
@@ -415,7 +421,8 @@ void analyzeFnc(Fnc &fnc) {
} // namespace VarKiller
-void killLocalVariables(Storage &stor) {
+void killLocalVariables(Storage &stor)
+{
StopWatch watch;
// analyze all _defined_ functions
View
6 cl/loopscan.cc
@@ -67,7 +67,8 @@ typedef std::stack<DfsItem> TDfsStack;
typedef std::pair<TBlock, TBlock> TCfgEdge;
typedef std::set<TCfgEdge> TEdgeSet;
-void analyzeFnc(Fnc &fnc) {
+void analyzeFnc(Fnc &fnc)
+{
const TLoc loc = &fnc.def.data.cst.data.cst_fnc.loc;
LS_DEBUG_MSG(2, loc, ">>> entering " << nameOf(fnc) << "()");
@@ -142,7 +143,8 @@ void analyzeFnc(Fnc &fnc) {
} // namespace LoopScan
-void findLoopClosingEdges(Storage &stor) {
+void findLoopClosingEdges(Storage &stor)
+{
StopWatch watch;
// go through all _defined_ functions
View
27 cl/ssd.cc
@@ -31,33 +31,39 @@ namespace ssd {
// ColorConsole implementation
bool ColorConsole::enabled_ = false;
-void ColorConsole::enable(bool value) {
+void ColorConsole::enable(bool value)
+{
enabled_ = value;
}
-bool ColorConsole::isEnabled() {
+bool ColorConsole::isEnabled()
+{
return enabled_;
}
-void ColorConsole::enableForTerm() {
+void ColorConsole::enableForTerm()
+{
#if HAVE_ISATTY
enabled_ = isatty(STDOUT_FILENO) && isatty(STDERR_FILENO);
#endif
}
-void ColorConsole::enableForTerm(int fd) {
+void ColorConsole::enableForTerm(int fd)
+{
#if HAVE_ISATTY
enabled_ = isatty(fd);
#endif
}
-void ColorConsole::enableIfCoutIsTerm() {
+void ColorConsole::enableIfCoutIsTerm()
+{
#if HAVE_ISATTY
enabled_ = isatty(STDOUT_FILENO);
#endif
}
-void ColorConsole::enableIfCerrIsTerm() {
+void ColorConsole::enableIfCerrIsTerm()
+{
#if HAVE_ISATTY
enabled_ = isatty(STDERR_FILENO);
#endif
@@ -65,7 +71,8 @@ void ColorConsole::enableIfCerrIsTerm() {
// /////////////////////////////////////////////////////////////////////////////
// Color implementation
-std::ostream& operator<< (std::ostream &stream, const Color &color) {
+std::ostream& operator<< (std::ostream &stream, const Color &color)
+{
static const char ESC = '\033';
if (!ColorConsole::isEnabled())
return stream;
@@ -101,11 +108,13 @@ Colorize::Colorize(std::ostream &stream, EColor color):
stream_ << Color(color);
}
-Colorize::~Colorize() {
+Colorize::~Colorize()
+{
stream_ << Color(C_NO_COLOR);
}
-std::ostream& Colorize::stream() {
+std::ostream& Colorize::stream()
+{
return stream_;
}
View
12 cl/stopwatch.cc
@@ -31,21 +31,25 @@ StopWatch::StopWatch():
this->reset();
}
-StopWatch::~StopWatch() {
+StopWatch::~StopWatch()
+{
delete d;
}
-void StopWatch::reset() {
+void StopWatch::reset()
+{
d->start = clock();
}
-float /* sec */ StopWatch::elapsed() const {
+float /* sec */ StopWatch::elapsed() const
+{
static const float RATIO = CLOCKS_PER_SEC;
const float diff = clock() - d->start;
return diff/RATIO;
}
-std::ostream& operator<<(std::ostream &str, const StopWatch &watch) {
+std::ostream& operator<<(std::ostream &str, const StopWatch &watch)
+{
using namespace std;
const std::ios_base::fmtflags oldFlags = str.flags();
View
102 cl/storage.cc
@@ -95,7 +95,8 @@ Var::Var():
{
}
-Var::~Var() {
+Var::~Var()
+{
}
Var::Var(EVar code_, const struct cl_operand *op):
@@ -137,7 +138,8 @@ Var::Var(EVar code_, const struct cl_operand *op):
CL_BREAK_IF("attempt to create invalid CodeStorage::Var object");
}
-bool isOnStack(const Var &var) {
+bool isOnStack(const Var &var)
+{
const EVar code = var.code;
switch (code) {
case VAR_FNC_ARG:
@@ -166,7 +168,8 @@ VarDb::VarDb():
{
}
-VarDb::~VarDb() {
+VarDb::~VarDb()
+{
BOOST_FOREACH(const Var &var, vars_)
BOOST_FOREACH(const Insn *insn, var.initials)
destroyInsn(const_cast<Insn *>(insn));
@@ -174,11 +177,13 @@ VarDb::~VarDb() {
delete d;
}
-Var& VarDb::operator[](int uid) {
+Var& VarDb::operator[](int uid)
+{
return dbLookup(d->db, vars_, uid);
}
-const Var& VarDb::operator[](int uid) const {
+const Var& VarDb::operator[](int uid) const
+{
return dbConstLookup(d->db, vars_, uid);
}
@@ -209,17 +214,20 @@ TypeDb::TypeDb():
{
}
-TypeDb::~TypeDb() {
+TypeDb::~TypeDb()
+{
delete d;
}
-void TypeDb::Private::updatePtrSizeof(int size, int *pField) {
+void TypeDb::Private::updatePtrSizeof(int size, int *pField)
+{
CL_BREAK_IF(size <= 0);
CL_BREAK_IF(-1 != *pField && *pField != size);
*pField = size;
}
-void TypeDb::Private::digPtrSizeof(const struct cl_type *clt) {
+void TypeDb::Private::digPtrSizeof(const struct cl_type *clt)
+{
if (CL_TYPE_PTR != clt->code)
return;
@@ -237,7 +245,8 @@ void TypeDb::Private::digPtrSizeof(const struct cl_type *clt) {
this->genericDataPtr = clt;
}
-bool TypeDb::insert(const struct cl_type *clt) {
+bool TypeDb::insert(const struct cl_type *clt)
+{
if (!clt) {
CL_DEBUG("TypeDb::insert() got a NULL pointer");
return false;
@@ -258,19 +267,23 @@ bool TypeDb::insert(const struct cl_type *clt) {
return true;
}
-int TypeDb::codePtrSizeof() const {
+int TypeDb::codePtrSizeof() const
+{
return d->codePtrSizeof;
}
-int TypeDb::dataPtrSizeof() const {
+int TypeDb::dataPtrSizeof() const
+{
return d->dataPtrSizeof;
}
-const struct cl_type* TypeDb::genericDataPtr() const {
+const struct cl_type* TypeDb::genericDataPtr() const
+{
return d->genericDataPtr;
}
-void readTypeTree(TypeDb &db, const struct cl_type *clt) {
+void readTypeTree(TypeDb &db, const struct cl_type *clt)
+{
if (!clt) {
#if 0
CL_DEBUG("readTypeTree() got a NULL pointer");
@@ -293,7 +306,8 @@ void readTypeTree(TypeDb &db, const struct cl_type *clt) {
}
}
-const struct cl_type* TypeDb::operator[](int uid) const {
+const struct cl_type* TypeDb::operator[](int uid) const
+{
typedef Private::TMap TDb;
TDb &db = d->db;
TDb::iterator iter = db.find(uid);
@@ -312,7 +326,8 @@ const struct cl_type* TypeDb::operator[](int uid) const {
// /////////////////////////////////////////////////////////////////////////////
// Block implementation
-void Block::append(Insn *insn) {
+void Block::append(Insn *insn)
+{
#ifndef NDEBUG
if (!insns_.empty()) {
// check insn sequence
@@ -324,28 +339,33 @@ void Block::append(Insn *insn) {
insns_.push_back(insn);
}
-void Block::appendPredecessor(Block *pred) {
+void Block::appendPredecessor(Block *pred)
+{
inbound_.push_back(pred);
}
-const Insn* Block::front() const {
+const Insn* Block::front() const
+{
CL_BREAK_IF(insns_.empty());
return insns_.front();
}
-const Insn* Block::back() const {
+const Insn* Block::back() const
+{
CL_BREAK_IF(insns_.empty());
return insns_.back();
}
-const TTargetList& Block::targets() const {
+const TTargetList& Block::targets() const
+{
const Insn *last = this->back();
CL_BREAK_IF(!cl_is_term_insn(last->code));
return last->targets;
}
-bool Block::isLoopEntry() const {
+bool Block::isLoopEntry() const
+{
BOOST_FOREACH(const Block *ref, inbound_) {
const Insn *term = ref->back();
const TTargetList &tList = ref->targets();
@@ -378,23 +398,27 @@ ControlFlow::ControlFlow(const ControlFlow &ref):
{
}
-ControlFlow::~ControlFlow() {
+ControlFlow::~ControlFlow()
+{
delete d;
}
-ControlFlow& ControlFlow::operator=(const ControlFlow &ref) {
+ControlFlow& ControlFlow::operator=(const ControlFlow &ref)
+{
bbs_ = ref.bbs_;
delete d;
d = new Private(*ref.d);
return *this;
}
-const Block* ControlFlow::entry() const {
+const Block* ControlFlow::entry() const
+{
CL_BREAK_IF(bbs_.empty());
return bbs_[0];
}
-Block*& ControlFlow::operator[](const char *name) {
+Block*& ControlFlow::operator[](const char *name)
+{
Block* &ref = dbLookup(d->db, bbs_, name, 0);
if (!ref)
// the object will be NOT destroyed by ControlFlow
@@ -403,14 +427,16 @@ Block*& ControlFlow::operator[](const char *name) {
return ref;
}
-const Block* ControlFlow::operator[](const char *name) const {
+const Block* ControlFlow::operator[](const char *name) const
+{
return dbConstLookup(d->db, bbs_, name);
}
// /////////////////////////////////////////////////////////////////////////////
// Fnc implementation
-inline const struct cl_cst& cstFromFnc(const Fnc &fnc) {
+inline const struct cl_cst& cstFromFnc(const Fnc &fnc)
+{
const struct cl_operand &op = fnc.def;
CL_BREAK_IF(CL_OPERAND_CST != op.code);
@@ -421,22 +447,26 @@ inline const struct cl_cst& cstFromFnc(const Fnc &fnc) {
return cst;
}
-const char* nameOf(const Fnc &fnc) {
+const char* nameOf(const Fnc &fnc)
+{
const struct cl_cst &cst = cstFromFnc(fnc);
return cst.data.cst_fnc.name;
}
-const struct cl_loc* locationOf(const Fnc &fnc) {
+const struct cl_loc* locationOf(const Fnc &fnc)
+{
const struct cl_cst &cst = cstFromFnc(fnc);
return &cst.data.cst_fnc.loc;
}
-int uidOf(const Fnc &fnc) {
+int uidOf(const Fnc &fnc)
+{
const struct cl_cst &cst = cstFromFnc(fnc);
return cst.data.cst_fnc.uid;
}
-bool isDefined(const Fnc &fnc) {
+bool isDefined(const Fnc &fnc)
+{
return CL_OPERAND_CST == fnc.def.code
&& !cstFromFnc(fnc).data.cst_fnc.is_extern;
}
@@ -459,18 +489,21 @@ FncDb::FncDb(const FncDb &ref):
{
}
-FncDb::~FncDb() {
+FncDb::~FncDb()
+{
delete d;
}
-FncDb& FncDb::operator=(const FncDb &ref) {
+FncDb& FncDb::operator=(const FncDb &ref)
+{
fncs_ = ref.fncs_;
delete d;
d = new Private(*ref.d);
return *this;
}
-Fnc*& FncDb::operator[](int uid) {
+Fnc*& FncDb::operator[](int uid)
+{
Fnc* &ref = dbLookup(d->db, fncs_, uid, 0);
if (!ref)
// the object will be NOT destroyed by FncDb
@@ -479,7 +512,8 @@ Fnc*& FncDb::operator[](int uid) {
return ref;
}
-const Fnc* FncDb::operator[](int uid) const {
+const Fnc* FncDb::operator[](int uid) const
+{
return dbConstLookup(d->db, fncs_, uid);
}
View
15 cl/util.hh
@@ -30,7 +30,8 @@
#define FIXW(w) std::fixed << std::setfill('0') << std::setw(w)
template <typename T>
-void swapValues(T &a, T &b) {
+void swapValues(T &a, T &b)
+{
const T tmp = a;
a = b;
b = tmp;
@@ -38,23 +39,27 @@ void swapValues(T &a, T &b) {
// ensure (a <= b)
template <typename T>
-void sortValues(T &a, T &b) {
+void sortValues(T &a, T &b)
+{
if (b < a)
swapValues(a, b);
}
template <typename TCont>
-bool hasKey(const TCont &cont, const typename TCont::key_type &key) {
+bool hasKey(const TCont &cont, const typename TCont::key_type &key)
+{
return cont.end() != cont.find(key);
}
template <typename TCont>
-bool hasKey(const TCont *cont, const typename TCont::key_type &key) {
+bool hasKey(const TCont *cont, const typename TCont::key_type &key)
+{
return hasKey(*cont, key);
}
template <typename TCont>
-bool insertOnce(TCont &cont, const typename TCont::key_type &key) {
+bool insertOnce(TCont &cont, const typename TCont::key_type &key)
+{
return cont.insert(key)./* inserted */second;
}
View
30 fwnull/cl_fwnull.cc
@@ -141,7 +141,8 @@ void handleDerefs(Data::TState &state, const CodeStorage::Insn *insn)
}
/// returns true for VS_NOT_NULL and VS_NOT_NULL_DEDUCED
-inline bool anyNotNull(const EVarState code) {
+inline bool anyNotNull(const EVarState code)
+{
switch (code) {
case VS_NOT_NULL:
case VS_NOT_NULL_DEDUCED:
@@ -157,7 +158,8 @@ inline bool anyNotNull(const EVarState code) {
* @param dst destination state (used in read-write mode)
* @param src source state (used in read-only mode)
*/
-bool mergeValues(VarState &dst, const VarState &src) {
+bool mergeValues(VarState &dst, const VarState &src)
+{
if (VS_UNDEF == src.code || VS_MIGHT_BE_NULL == dst.code)
// nothing to propagate actually
return false;
@@ -199,7 +201,8 @@ bool mergeValues(VarState &dst, const VarState &src) {
* @param state state valid per current instruction
* @param insn instruction you want to process
*/
-void handleInsnUnop(Data::TState &state, const CodeStorage::Insn *insn) {
+void handleInsnUnop(Data::TState &state, const CodeStorage::Insn *insn)
+{
handleDerefs(state, insn);
const struct cl_operand &dst = insn->operands[0];
@@ -325,7 +328,8 @@ bool handleInsnCmpNull(Data::TState &state,
* @param state state valid per current instruction
* @param insn instruction you want to process
*/
-void handleInsnBinop(Data::TState &state, const CodeStorage::Insn *insn) {
+void handleInsnBinop(Data::TState &state, const CodeStorage::Insn *insn)
+{
const CodeStorage::TOperandList &opList = insn->operands;
#ifndef NDEBUG
@@ -392,7 +396,8 @@ void handleInsnBinop(Data::TState &state, const CodeStorage::Insn *insn) {
* @param state state valid per current instruction
* @param insn instruction you want to process
*/
-void handleInsnCall(Data::TState &state, const CodeStorage::Insn *insn) {
+void handleInsnCall(Data::TState &state, const CodeStorage::Insn *insn)
+{
const struct cl_operand &dst = insn->operands[0];
if (dst.accessor)
// we're interested only in direct manipulation of variables here
@@ -437,7 +442,8 @@ void treatRefAsSideEffect(Data::TState &state,
* @param state state valid per current instruction
* @param insn instruction you want to process
*/
-void handleInsnNonterm(Data::TState &state, const CodeStorage::Insn *insn) {
+void handleInsnNonterm(Data::TState &state, const CodeStorage::Insn *insn)
+{
treatRefAsSideEffect(state, insn->operands);
const enum cl_insn_e code = insn->code;
@@ -496,7 +502,8 @@ void updateState(Data &data,
* @param uid CodeStorage uid of the branch-by variable
* @param val true in 'then' branch, false in 'else' branch
*/
-void replaceInBranch(Data::TState &state, int uid, bool val) {
+void replaceInBranch(Data::TState &state, int uid, bool val)
+{
VarState &vs = state[uid];
bool isNull;
@@ -620,7 +627,8 @@ void handleInsnTerm(Data &data,
}
}
-void handleBlock(Data &data, Data::TBlock bb) {
+void handleBlock(Data &data, Data::TBlock bb)
+{
// go through the sequence of instructions of the current basic block
Data::TState next = data.stateMap[bb];
BOOST_FOREACH(const CodeStorage::Insn *insn, *bb) {
@@ -634,7 +642,8 @@ void handleBlock(Data &data, Data::TBlock bb) {
}
}
-void handleFnc(const CodeStorage::Fnc &fnc) {
+void handleFnc(const CodeStorage::Fnc &fnc)
+{
using namespace CodeStorage;
Data data;
@@ -661,7 +670,8 @@ void handleFnc(const CodeStorage::Fnc &fnc) {
// /////////////////////////////////////////////////////////////////////////////
// see easy.hh for details
-void clEasyRun(const CodeStorage::Storage &stor, const char *) {
+void clEasyRun(const CodeStorage::Storage &stor, const char *)
+{
using namespace CodeStorage;
BOOST_FOREACH(const Fnc *pFnc, stor.fncs) {
View
3  include/cl/cl_msg.hh
@@ -141,7 +141,8 @@
CL_DEBUG_MSG(loc, what); \
} while (0)
-inline std::ostream& operator<<(std::ostream &str, const struct cl_loc &loc) {
+inline std::ostream& operator<<(std::ostream &str, const struct cl_loc &loc)
+{
if (!&loc || !loc.file) {
str << "<unknown location>: ";
return str;
View
15 include/cl/clutil.hh
@@ -41,7 +41,8 @@ namespace CodeStorage {
bool operator==(const struct cl_type &cltA, const struct cl_type &cltB);
/// compare given two pieces of static type-info semantically
-inline bool operator!=(const struct cl_type &cltA, const struct cl_type &cltB) {
+inline bool operator!=(const struct cl_type &cltA, const struct cl_type &cltB)
+{
return !(cltA == cltB);
}
@@ -51,7 +52,8 @@ const struct cl_type* targetTypeOfPtr(const struct cl_type *clt);
/// return type of the @b target object that the array type can point to
const struct cl_type* targetTypeOfArray(const struct cl_type *clt);
-inline bool isComposite(const struct cl_type *clt, bool includingArray = true) {
+inline bool isComposite(const struct cl_type *clt, bool includingArray = true)
+{
if (!clt)
return false;
@@ -68,7 +70,8 @@ inline bool isComposite(const struct cl_type *clt, bool includingArray = true) {
}
}
-inline bool isDataPtr(const struct cl_type *clt) {
+inline bool isDataPtr(const struct cl_type *clt)
+{
if (!clt || clt->code != CL_TYPE_PTR)
return false;
@@ -76,7 +79,8 @@ inline bool isDataPtr(const struct cl_type *clt) {
return (CL_TYPE_FNC != clt->code);
}
-inline bool isCodePtr(const