clang 22.0.0git
CIRGenException.cpp
Go to the documentation of this file.
1//===--- CIRGenException.cpp - Emit CIR Code for C++ exceptions -*- 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 contains code dealing with C++ exception related code generation.
10//
11//===----------------------------------------------------------------------===//
12
13#include "CIRGenCXXABI.h"
14#include "CIRGenFunction.h"
15
17
18using namespace clang;
19using namespace clang::CIRGen;
20
22 const llvm::Triple &triple = getTarget().getTriple();
23 if (cgm.getLangOpts().OpenMPIsTargetDevice &&
24 (triple.isNVPTX() || triple.isAMDGCN())) {
25 cgm.errorNYI("emitCXXThrowExpr OpenMP with NVPTX or AMDGCN Triples");
26 return;
27 }
28
29 if (const Expr *subExpr = e->getSubExpr()) {
30 QualType throwType = subExpr->getType();
31 if (throwType->isObjCObjectPointerType()) {
32 cgm.errorNYI("emitCXXThrowExpr ObjCObjectPointerType");
33 return;
34 } else {
35 cgm.errorNYI("emitCXXThrowExpr with subExpr");
36 return;
37 }
38 } else {
39 cgm.getCXXABI().emitRethrow(*this, /*isNoReturn=*/true);
40 }
41}
virtual void emitRethrow(CIRGenFunction &cgf, bool isNoReturn)=0
const TargetInfo & getTarget() const
void emitCXXThrowExpr(const CXXThrowExpr *e)
DiagnosticBuilder errorNYI(SourceLocation, llvm::StringRef)
Helpers to emit "not yet implemented" error diagnostics.
const clang::LangOptions & getLangOpts() const
Definition: CIRGenModule.h:107
CIRGenCXXABI & getCXXABI() const
Definition: CIRGenModule.h:109
A C++ throw-expression (C++ [except.throw]).
Definition: ExprCXX.h:1209
const Expr * getSubExpr() const
Definition: ExprCXX.h:1229
This represents one expression.
Definition: Expr.h:112
A (possibly-)qualified type.
Definition: TypeBase.h:937
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
Definition: TargetInfo.h:1288
bool isObjCObjectPointerType() const
Definition: TypeBase.h:8749
The JSON file list parser is used to communicate input to InstallAPI.