diff options
Diffstat (limited to 'lib/Serialization/ASTCommon.h')
-rw-r--r-- | lib/Serialization/ASTCommon.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/Serialization/ASTCommon.h b/lib/Serialization/ASTCommon.h index 12e26c1fc2..296642e367 100644 --- a/lib/Serialization/ASTCommon.h +++ b/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 |