Argyrios Kyrtzidis | 0eca89e | 2010-08-20 16:03:52 +0000 | [diff] [blame] | 1 | //===- ASTCommon.h - Common stuff for ASTReader/ASTWriter -*- C++ -*-=========// |
| 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 defines common functions that both ASTReader and ASTWriter use. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef LLVM_CLANG_SERIALIZATION_LIB_AST_COMMON_H |
| 15 | #define LLVM_CLANG_SERIALIZATION_LIB_AST_COMMON_H |
| 16 | |
Argyrios Kyrtzidis | eb3f04e | 2010-08-20 16:04:20 +0000 | [diff] [blame] | 17 | #include "clang/Serialization/ASTBitCodes.h" |
| 18 | |
Argyrios Kyrtzidis | 0eca89e | 2010-08-20 16:03:52 +0000 | [diff] [blame] | 19 | namespace clang { |
Argyrios Kyrtzidis | 0eca89e | 2010-08-20 16:03:52 +0000 | [diff] [blame] | 20 | |
| 21 | namespace serialization { |
| 22 | |
Argyrios Kyrtzidis | 565bf30 | 2010-10-24 17:26:50 +0000 | [diff] [blame] | 23 | enum DeclUpdateKind { |
Argyrios Kyrtzidis | b6cc0e1 | 2010-10-24 17:26:54 +0000 | [diff] [blame] | 24 | UPD_CXX_SET_DEFINITIONDATA, |
Argyrios Kyrtzidis | bef1a7b | 2010-10-28 07:38:42 +0000 | [diff] [blame] | 25 | UPD_CXX_ADDED_IMPLICIT_MEMBER, |
| 26 | UPD_CXX_ADDED_TEMPLATE_SPECIALIZATION |
Argyrios Kyrtzidis | 565bf30 | 2010-10-24 17:26:50 +0000 | [diff] [blame] | 27 | }; |
| 28 | |
Argyrios Kyrtzidis | eb3f04e | 2010-08-20 16:04:20 +0000 | [diff] [blame] | 29 | TypeIdx TypeIdxFromBuiltin(const BuiltinType *BT); |
| 30 | |
| 31 | template <typename IdxForTypeTy> |
| 32 | TypeID MakeTypeID(QualType T, IdxForTypeTy IdxForType) { |
| 33 | if (T.isNull()) |
| 34 | return PREDEF_TYPE_NULL_ID; |
| 35 | |
| 36 | unsigned FastQuals = T.getLocalFastQualifiers(); |
| 37 | T.removeFastQualifiers(); |
| 38 | |
| 39 | if (T.hasLocalNonFastQualifiers()) |
| 40 | return IdxForType(T).asTypeID(FastQuals); |
| 41 | |
| 42 | assert(!T.hasLocalQualifiers()); |
| 43 | |
| 44 | if (const BuiltinType *BT = dyn_cast<BuiltinType>(T.getTypePtr())) |
| 45 | return TypeIdxFromBuiltin(BT).asTypeID(FastQuals); |
| 46 | |
| 47 | return IdxForType(T).asTypeID(FastQuals); |
| 48 | } |
| 49 | |
Argyrios Kyrtzidis | 0eca89e | 2010-08-20 16:03:52 +0000 | [diff] [blame] | 50 | unsigned ComputeHash(Selector Sel); |
| 51 | |
| 52 | } // namespace serialization |
| 53 | |
| 54 | } // namespace clang |
| 55 | |
| 56 | #endif |