diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Serialization/ASTCommon.h')
| -rw-r--r-- | contrib/llvm/tools/clang/lib/Serialization/ASTCommon.h | 23 | 
1 files changed, 19 insertions, 4 deletions
diff --git a/contrib/llvm/tools/clang/lib/Serialization/ASTCommon.h b/contrib/llvm/tools/clang/lib/Serialization/ASTCommon.h index 12e26c1fc2b9..296642e3674a 100644 --- a/contrib/llvm/tools/clang/lib/Serialization/ASTCommon.h +++ b/contrib/llvm/tools/clang/lib/Serialization/ASTCommon.h @@ -1,9 +1,8 @@  //===- ASTCommon.h - 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. +// 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  //  //===----------------------------------------------------------------------===//  // @@ -39,6 +38,7 @@ enum DeclUpdateKind {    UPD_MANGLING_NUMBER,    UPD_STATIC_LOCAL_NUMBER,    UPD_DECL_MARKED_OPENMP_THREADPRIVATE, +  UPD_DECL_MARKED_OPENMP_ALLOCATE,    UPD_DECL_MARKED_OPENMP_DECLARETARGET,    UPD_DECL_EXPORTED,    UPD_ADDED_ATTR_TO_RECORD @@ -109,6 +109,21 @@ template<typename Fn> void numberAnonymousDeclsWithin(const DeclContext *DC,    }  } +/// Determine whether the given declaration will be included in the per-module +/// initializer if it needs to be eagerly handed to the AST consumer. If so, we +/// should not hand it to the consumer when deserializing it, nor include it in +/// the list of eagerly deserialized declarations. +inline bool isPartOfPerModuleInitializer(const Decl *D) { +  if (isa<ImportDecl>(D)) +    return true; +  // Template instantiations are notionally in an "instantiation unit" rather +  // than in any particular translation unit, so they need not be part of any +  // particular (sub)module's per-module initializer. +  if (auto *VD = dyn_cast<VarDecl>(D)) +    return !isTemplateInstantiation(VD->getTemplateSpecializationKind()); +  return false; +} +  } // namespace serialization  } // namespace clang  | 
