blob: 0eaf7a5610f60a15fe67f7df90c2c56d2318245d [file] [log] [blame]
Argyrios Kyrtzidis0eca89e2010-08-20 16:03:52 +00001//===--- ASTCommon.cpp - 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#include "ASTCommon.h"
15#include "clang/Basic/IdentifierTable.h"
16#include "llvm/ADT/StringExtras.h"
17
18using namespace clang;
19
20unsigned serialization::ComputeHash(Selector Sel) {
21 unsigned N = Sel.getNumArgs();
22 if (N == 0)
23 ++N;
24 unsigned R = 5381;
25 for (unsigned I = 0; I != N; ++I)
26 if (IdentifierInfo *II = Sel.getIdentifierInfoForSlot(I))
27 R = llvm::HashString(II->getName(), R);
28 return R;
29}