38 lines · cpp
1//====- CIROpInterfaces.cpp - Interface to AST Attributes ---------------===//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-exception6//7//===----------------------------------------------------------------------===//8//9// Defines the interface to CIR operations.10//11//===----------------------------------------------------------------------===//12#include "clang/CIR/Interfaces/CIROpInterfaces.h"13 14using namespace cir;15 16/// Include the generated type qualifiers interfaces.17#include "clang/CIR/Interfaces/CIROpInterfaces.cpp.inc"18 19#include "clang/CIR/MissingFeatures.h"20 21bool CIRGlobalValueInterface::hasDefaultVisibility() {22 assert(!cir::MissingFeatures::hiddenVisibility());23 assert(!cir::MissingFeatures::protectedVisibility());24 return isPublic() || isPrivate();25}26 27bool CIRGlobalValueInterface::canBenefitFromLocalAlias() {28 assert(!cir::MissingFeatures::supportIFuncAttr());29 // hasComdat here should be isDeduplicateComdat, but as far as clang codegen30 // is concerned, there is no case for Comdat::NoDeduplicate as all comdat31 // would be Comdat::Any or Comdat::Largest (in the case of MS ABI). And CIRGen32 // wouldn't even generate Comdat::Largest comdat as it tries to leave ABI33 // specifics to LLVM lowering stage, thus here we don't need test Comdat34 // selectionKind.35 return hasDefaultVisibility() && hasExternalLinkage() && !isDeclaration() &&36 !hasComdat();37}38