//===-- ODRHash.h - Hashing to diagnose ODR failures ------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// /// /// \file /// This file contains the declaration of the ODRHash class, which calculates /// a hash based on AST nodes, which is stable across different runs. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_AST_ODRHASH_H #define LLVM_CLANG_AST_ODRHASH_H #include "clang/AST/DeclarationName.h" #include "clang/AST/Type.h" #include "clang/AST/TemplateBase.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/PointerUnion.h" #include "llvm/ADT/SmallVector.h" namespace clang { class APValue; class Decl; class IdentifierInfo; class NestedNameSpecifier; class Stmt; class TemplateParameterList; // ODRHash is used to calculate a hash based on AST node contents that // does not rely on pointer addresses. This allows the hash to not vary // between runs and is usable to detect ODR problems in modules. To use, // construct an ODRHash object, then call Add* methods over the nodes that // need to be hashed. Then call CalculateHash to get the hash value. // Typically, only one Add* call is needed. clear can be called to reuse the // object. class ODRHash { … }; } // end namespace clang #endif