Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Christian Dietrich
clang-hash
Commits
6912b4a5
Commit
6912b4a5
authored
Mar 16, 2016
by
Lukas Lehnert
Browse files
partly broken with assert
parent
7db077cb
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/SHA1.h
View file @
6912b4a5
//#define DEBUG
//
#define DEBUG
/*
*
...
...
src/hash-visitor.cc
View file @
6912b4a5
...
...
@@ -174,6 +174,7 @@ bool HashVisitor::VisitParmVarDecl(const ParmVarDecl *Node){
void
HashVisitor
::
hashType
(
QualType
T
)
{
uint64_t
qualifiers
=
0
;
if
(
T
.
hasQualifiers
()){
errs
()
<<
"has Qualifiers
\n
"
;
//TODO evtl. CVRMASK benutzen
if
(
T
.
isLocalConstQualified
()){
qualifiers
|=
1
;
...
...
@@ -186,24 +187,29 @@ void HashVisitor::hashType(QualType T) {
}
//weitere qualifier?
}
else
errs
()
<<
"no qualifiers
\n
"
;
const
Type
*
type
=
T
.
getUnqualifiedType
().
getTypePtr
();
const
Type
*
type
=
T
.
/*
getUnqualifiedType().
*/
getTypePtr
();
assert
(
type
!=
nullptr
);
if
(
qualifiers
)
{
Hash
()
<<
qualifiers
;
}
T
->
dump
();
errs
()
<<
type
<<
" "
<<
qualifiers
<<
" qualifiers
\n
"
;
const
sha1
::
digest
*
saved_digest
=
GetHash
(
type
);
/*
// Optimierung verdeckt aktuell noch Probleme mit Qualifiern
if(saved_digest){
Hash() << *saved_digest;
return;
}
*/
// Visit in Pre-Order
unsigned
Depth
=
beforeDescent
();
...
...
@@ -228,7 +234,7 @@ void HashVisitor::hashType(QualType T) {
type
->
dump
();
}
assert
(
!
saved_digest
||
digest
==
*
saved_digest
&&
"Hashes do not match"
);
assert
(
(
!
saved_digest
||
digest
==
*
saved_digest
)
&&
"Hashes do not match"
);
// Hash into Parent
Hash
()
<<
digest
;
...
...
@@ -252,8 +258,8 @@ bool HashVisitor::VisitPointerType(const PointerType *T) {
Hash
()
<<
"pointer"
;
const
sha1
::
digest
*
digest
=
GetHash
(
T
->
getPointeeType
().
getTypePtr
());
if
(
digest
){
Hash
()
<<
*
digest
;
return
true
;
//
Hash() << *digest;
//
return true;
}
//FIXME: evtl. FunctionPointerType (erst Testsysteme)
if
((
T
->
getPointeeType
()).
getTypePtr
()
->
isStructureType
()){
...
...
@@ -483,8 +489,8 @@ void HashVisitor::hashName(const NamedDecl *ND) {
//Expressions
bool
HashVisitor
::
VisitCastExpr
(
const
CastExpr
*
Node
){
hashStmt
(
Node
->
getSubExpr
());
Hash
()
<<
"cast"
;
hashStmt
(
Node
->
getSubExpr
());
Hash
()
<<
Node
->
getCastKind
();
hashType
(
Node
->
getType
());
return
true
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment