Skip to content

Commit

Permalink
Edge Cases For VTable
Browse files Browse the repository at this point in the history
  • Loading branch information
fundamental committed Aug 9, 2014
1 parent 36c8236 commit 5c6ce2f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
22 changes: 14 additions & 8 deletions src/pass1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,20 @@ struct DummyPass4 : public ModulePass {
for(unsigned i=2; i<ops; ++i)
{
auto op = v->getOperand(i);
auto alias = dyn_cast<GlobalAlias>(op->getOperand(0));//dyn_cast<BitCastInst>(op);
auto someth = op->getOperand(0);
Function *function = NULL;
if(alias)
function = dyn_cast<Function>(alias->getOperand(0));
else
function = dyn_cast<Function>(someth);
fprintf(stderr, " %d: %s\n", i-2, function->getName().str().c_str());
const char *fname = NULL;
if(!dyn_cast<ConstantPointerNull>(op)) {
Function *function = NULL;
auto alias = dyn_cast<GlobalAlias>(op->getOperand(0));//dyn_cast<BitCastInst>(op);
auto someth = op->getOperand(0);
auto etc = dyn_cast<GlobalVariable>(someth);
if(alias)
function = dyn_cast<Function>(alias->getOperand(0));
else
function = dyn_cast<Function>(someth);
if(function)
fname = function->getName().str().c_str();
}
fprintf(stderr, " %d: %s\n", i-2, fname);
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/virtual-methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class C : public B
void other(void);
};

class D : public virtual C
class D : public C
{
public:
virtual void RT method(void) {};
Expand Down

0 comments on commit 5c6ce2f

Please sign in to comment.