clang
20.0.0git
Toggle main menu visibility
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Related Functions
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
x
y
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
o
p
q
r
s
t
u
v
w
Enumerations
_
a
b
c
f
g
i
l
m
n
o
p
r
s
t
v
Enumerator
_
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Examples
lib
CIR
CodeGen
CIRGenerator.cpp
Go to the documentation of this file.
1
//===--- CIRGenerator.cpp - Emit CIR from ASTs ----------------------------===//
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 builds an AST and converts it to CIR.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#include "
CIRGenModule.h
"
14
15
#include "mlir/IR/MLIRContext.h"
16
17
#include "
clang/AST/DeclGroup.h
"
18
#include "
clang/CIR/CIRGenerator.h
"
19
#include "
clang/CIR/Dialect/IR/CIRDialect.h
"
20
21
using namespace
cir
;
22
using namespace
clang
;
23
24
void
CIRGenerator::anchor() {}
25
26
CIRGenerator::CIRGenerator
(
clang::DiagnosticsEngine
&diags,
27
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>
vfs,
28
const
CodeGenOptions
&cgo)
29
: diags(diags), fs(
std
::move(vfs)), codeGenOpts{cgo} {}
30
CIRGenerator::~CIRGenerator
() =
default
;
31
32
void
CIRGenerator::Initialize
(
ASTContext
&astContext) {
33
using namespace
llvm
;
34
35
this->astContext = &astContext;
36
37
mlirContext
= std::make_unique<mlir::MLIRContext>();
38
mlirContext
->loadDialect<cir::CIRDialect>();
39
cgm
= std::make_unique<clang::CIRGen::CIRGenModule>(
40
*
mlirContext
.get(), astContext, codeGenOpts, diags);
41
}
42
43
mlir::ModuleOp
CIRGenerator::getModule
()
const
{
return
cgm
->getModule(); }
44
45
bool
CIRGenerator::HandleTopLevelDecl
(
DeclGroupRef
group) {
46
47
for
(
Decl
*
decl
: group)
48
cgm
->emitTopLevelDecl(
decl
);
49
50
return
true
;
51
}
CIRDialect.h
CIRGenModule.h
CIRGenerator.h
DeclGroup.h
cir::CIRGenerator::CIRGenerator
CIRGenerator(clang::DiagnosticsEngine &diags, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > fs, const clang::CodeGenOptions &cgo)
Definition:
CIRGenerator.cpp:26
cir::CIRGenerator::getModule
mlir::ModuleOp getModule() const
Definition:
CIRGenerator.cpp:43
cir::CIRGenerator::cgm
std::unique_ptr< clang::CIRGen::CIRGenModule > cgm
Definition:
CIRGenerator.h:48
cir::CIRGenerator::~CIRGenerator
~CIRGenerator() override
cir::CIRGenerator::HandleTopLevelDecl
bool HandleTopLevelDecl(clang::DeclGroupRef group) override
HandleTopLevelDecl - Handle the specified top-level declaration.
Definition:
CIRGenerator.cpp:45
cir::CIRGenerator::mlirContext
std::unique_ptr< mlir::MLIRContext > mlirContext
Definition:
CIRGenerator.h:47
cir::CIRGenerator::Initialize
void Initialize(clang::ASTContext &astContext) override
Initialize - This is called to initialize the consumer, providing the ASTContext.
Definition:
CIRGenerator.cpp:32
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition:
ASTContext.h:188
clang::CodeGenOptions
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
Definition:
CodeGenOptions.h:56
clang::DeclGroupRef
Definition:
DeclGroup.h:51
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition:
DeclBase.h:86
clang::DiagnosticsEngine
Concrete class used by the front-end to report problems and issues.
Definition:
Diagnostic.h:231
llvm::IntrusiveRefCntPtr
Definition:
LLVM.h:43
cir
Definition:
CIRGenerator.h:36
clang::ast_matchers::decl
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
Definition:
ASTMatchersInternal.cpp:762
clang
The JSON file list parser is used to communicate input to InstallAPI.
Definition:
CalledOnceCheck.h:17
llvm
Diagnostic wrappers for TextAPI types for error reporting.
Definition:
Dominators.h:30
std
Definition:
__clang_cuda_cmath.h:361
Generated on Fri Mar 21 2025 20:59:08 for clang by
1.9.6