 |
|
 |
|
| Files: |
1 |
|
Branches Taken: |
0.0% |
0 / 0 |
| Generated: |
2010-02-10 01:31 |
|
Branches Executed: |
0.0% |
0 / 0 |
| |
|
Line Coverage: |
100.0% |
2 / 2 |
| |
 |
|
 |
1 : //===-------------- TypeOrdering.h - Total ordering for types -------------===//
2 : //
3 : // The LLVM Compiler Infrastructure
4 : //
5 : // This file is distributed under the University of Illinois Open Source
6 : // License. See LICENSE.TXT for details.
7 : //
8 : //===----------------------------------------------------------------------===//
9 : //
10 : // This file provides a function objects and specializations that
11 : // allow QualType values to be sorted, used in std::maps, std::sets,
12 : // llvm::DenseMaps, and llvm::DenseSets.
13 : //
14 : //===----------------------------------------------------------------------===//
15 :
16 : #ifndef LLVM_CLANG_TYPE_ORDERING_H
17 : #define LLVM_CLANG_TYPE_ORDERING_H
18 :
19 : #include "clang/AST/Type.h"
20 : #include <functional>
21 :
22 : namespace clang {
23 :
24 : /// QualTypeOrdering - Function object that provides a total ordering
25 : /// on QualType values.
26 : struct QualTypeOrdering : std::binary_function<QualType, QualType, bool> {
27 24904: bool operator()(QualType T1, QualType T2) const {
28 24904: return std::less<void*>()(T1.getAsOpaquePtr(), T2.getAsOpaquePtr());
29 : }
30 : };
31 :
32 : }
33 :
34 : namespace llvm {
35 : template<class> struct DenseMapInfo;
36 :
37 : template<> struct DenseMapInfo<clang::QualType> {
38 : static inline clang::QualType getEmptyKey() { return clang::QualType(); }
39 :
40 : static inline clang::QualType getTombstoneKey() {
41 : using clang::QualType;
42 : return QualType::getFromOpaquePtr(reinterpret_cast<clang::Type *>(-1));
43 : }
44 :
45 : static unsigned getHashValue(clang::QualType Val) {
46 : return (unsigned)((uintptr_t)Val.getAsOpaquePtr()) ^
47 : ((unsigned)((uintptr_t)Val.getAsOpaquePtr() >> 9));
48 : }
49 :
50 : static bool isEqual(clang::QualType LHS, clang::QualType RHS) {
51 : return LHS == RHS;
52 : }
53 : };
54 : }
55 :
56 : #endif
Generated: 2010-02-10 01:31 by zcov