mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-27 15:28:53 -04:00
30 lines
918 B
C++
30 lines
918 B
C++
//===--- ASTCommon.cpp - Common stuff for ASTReader/ASTWriter----*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file defines common functions that both ASTReader and ASTWriter use.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "ASTCommon.h"
|
|
#include "clang/Basic/IdentifierTable.h"
|
|
#include "llvm/ADT/StringExtras.h"
|
|
|
|
using namespace clang;
|
|
|
|
unsigned serialization::ComputeHash(Selector Sel) {
|
|
unsigned N = Sel.getNumArgs();
|
|
if (N == 0)
|
|
++N;
|
|
unsigned R = 5381;
|
|
for (unsigned I = 0; I != N; ++I)
|
|
if (IdentifierInfo *II = Sel.getIdentifierInfoForSlot(I))
|
|
R = llvm::HashString(II->getName(), R);
|
|
return R;
|
|
}
|