Skip to content

Commit

Permalink
Pred rename and remove non used code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillem Marpons committed May 16, 2012
1 parent 6db5357 commit 07ebb10
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
4 changes: 1 addition & 3 deletions lib/CrispClangPlugin/ClangPrologPredicates.cpp
Expand Up @@ -95,7 +95,7 @@ namespace crisp {
if ( !PL_get_atom_chars(MsgT, (char **) &Msg)) return FALSE;
// atom_t StmtA = PL_new_atom("stmt");
// functor_t StmtF = PL_new_functor(StmtA, 1);
atom_t NamedDeclA = PL_new_atom("namedDecl");
atom_t NamedDeclA = PL_new_atom("NamedDecl");
functor_t NamedDeclF = PL_new_functor(NamedDeclA, 2);

// functor_t SortF;
Expand All @@ -120,8 +120,6 @@ namespace crisp {
term_t HeadT = PL_new_term_ref();
term_t ListT = PL_copy_term_ref(CulpritsT); // copy as we need to write
while(PL_get_list(ListT, HeadT, ListT)) {
functor_t SortF;
if ( !PL_get_functor(HeadT, &SortF)) return FALSE;
term_t ElemT = PL_new_term_ref();
if ( !PL_get_arg(1, HeadT, ElemT)) return FALSE;
if ( PL_unify_functor(HeadT, NamedDeclF)) {
Expand Down
17 changes: 8 additions & 9 deletions prolog/Rules/SomeHICPPrules.pl
Expand Up @@ -12,6 +12,12 @@
),
'CallExpr::directCallee'(CallExpr, Callee).

'calls+'(Caller, Callee) :-
calls(Caller, Callee).
'calls+'(Caller, IndirectCallee) :-
calls(Caller, DirectCallee),
'calls+'(DirectCallee, IndirectCallee).

calls_to_this(Caller, Callee) :-
'Decl::body'(Caller, Body),
'child+'(Body, CallExpr),
Expand All @@ -20,12 +26,6 @@
'Stmt::stmtClassName'(MemberExpr, 'CXXThisExpr'),
'CallExpr::directCallee'(CallExpr, Callee).

'calls+'(Caller, Callee) :-
calls(Caller, Callee).
'calls+'(Caller, IndirectCallee) :-
calls(Caller, DirectCallee),
'calls+'(DirectCallee, IndirectCallee).

'calls_to_this+'(Caller, Callee) :-
calls_to_this(Caller, Callee).
'calls_to_this+'(Caller, IndirectCallee) :-
Expand All @@ -34,16 +34,15 @@

violation('HICPP 3.3.13',
'ctor/dtor %0 calls (maybe indirectly) virtual method %1',
[ namedDecl(Caller, 'caller %0 declared here')
, namedDecl(Callee, 'callee %0 declared here')]) :-
[ 'NamedDecl'(Caller, 'caller %0 declared here')
, 'NamedDecl'(Callee, 'callee %0 declared here')]) :-
isA(Record, 'CXXRecordDecl'),
( 'CXXRecordDecl::ctor'(Record, Caller)
; 'CXXRecordDecl::destructor'(Record, Caller)
),
'CXXRecordDecl::method'(Record, Callee),
'CXXMethodDecl::is_virtual'(Callee), % implies Caller \= Callee
'calls_to_this+'(Caller, Callee).
% 'calls+'(Caller, Callee).

violation_candidate('HICPP 3.4.2', [MethodRepr]) :-
isA(Method, 'CXXMethodDecl'),
Expand Down

0 comments on commit 07ebb10

Please sign in to comment.