clang 24.0.0git
ModuleUtils.h
Go to the documentation of this file.
1//===--- ModuleUtils.h - Shared module emission queries ---------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file holds the AST queries that both classic CodeGen and CIR CodeGen
10// need while deciding how a declaration is emitted at module scope, such as
11// its linkage and whether it belongs in a COMDAT group.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CLANG_CODEGENUTILS_MODULEUTILS_H
16#define LLVM_CLANG_CODEGENUTILS_MODULEUTILS_H
17
19
20namespace clang::CodeGenUtils {
21
22/// Check whether \p D is a strong definition, and thus must not be given
23/// common linkage. \p NoCommon reflects -fno-common.
24bool isVarDeclStrongDefinition(const ASTContext &Ctx, const VarDecl *D,
25 bool NoCommon);
26
27/// Check whether \p D should be emitted into a COMDAT group.
28bool shouldBeInCOMDAT(const ASTContext &Ctx, const Decl &D);
29
30} // namespace clang::CodeGenUtils
31
32#endif // LLVM_CLANG_CODEGENUTILS_MODULEUTILS_H
Defines the clang::ASTContext interface.
bool isVarDeclStrongDefinition(const ASTContext &Ctx, const VarDecl *D, bool NoCommon)
Check whether D is a strong definition, and thus must not be given common linkage.
bool shouldBeInCOMDAT(const ASTContext &Ctx, const Decl &D)
Check whether D should be emitted into a COMDAT group.