diff --git a/clang/include/clang/CIR/CIRGenerator.h b/clang/include/clang/CIR/CIRGenerator.h index c8ca7e4bfa728..414eba80b88b8 100644 --- a/clang/include/clang/CIR/CIRGenerator.h +++ b/clang/include/clang/CIR/CIRGenerator.h @@ -37,14 +37,14 @@ namespace cir { class CIRGenerator : public clang::ASTConsumer { virtual void anchor(); clang::DiagnosticsEngine &diags; - clang::ASTContext *astCtx; + clang::ASTContext *astContext; // Only used for debug info. llvm::IntrusiveRefCntPtr fs; const clang::CodeGenOptions &codeGenOpts; protected: - std::unique_ptr mlirCtx; + std::unique_ptr mlirContext; std::unique_ptr cgm; public: @@ -52,7 +52,7 @@ class CIRGenerator : public clang::ASTConsumer { llvm::IntrusiveRefCntPtr fs, const clang::CodeGenOptions &cgo); ~CIRGenerator() override; - void Initialize(clang::ASTContext &astCtx) override; + void Initialize(clang::ASTContext &astContext) override; bool HandleTopLevelDecl(clang::DeclGroupRef group) override; mlir::ModuleOp getModule() const; }; diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp index e7c9512dcd3de..0db24c3b41d18 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp @@ -25,13 +25,14 @@ using namespace clang; using namespace clang::CIRGen; -CIRGenModule::CIRGenModule(mlir::MLIRContext &context, - clang::ASTContext &astctx, +CIRGenModule::CIRGenModule(mlir::MLIRContext &mlirContext, + clang::ASTContext &astContext, const clang::CodeGenOptions &cgo, DiagnosticsEngine &diags) - : builder(context, *this), astCtx(astctx), langOpts(astctx.getLangOpts()), - theModule{mlir::ModuleOp::create(mlir::UnknownLoc::get(&context))}, - diags(diags), target(astctx.getTargetInfo()), genTypes(*this) { + : builder(mlirContext, *this), astContext(astContext), + langOpts(astContext.getLangOpts()), + theModule{mlir::ModuleOp::create(mlir::UnknownLoc::get(&mlirContext))}, + diags(diags), target(astContext.getTargetInfo()), genTypes(*this) { // Initialize cached types SInt8Ty = cir::IntType::get(&getMLIRContext(), 8, /*isSigned=*/true); @@ -48,7 +49,7 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &context, mlir::Location CIRGenModule::getLoc(SourceLocation cLoc) { assert(cLoc.isValid() && "expected valid source location"); - const SourceManager &sm = astCtx.getSourceManager(); + const SourceManager &sm = astContext.getSourceManager(); PresumedLoc pLoc = sm.getPresumedLoc(cLoc); StringRef filename = pLoc.getFilename(); return mlir::FileLineColLoc::get(builder.getStringAttr(filename), diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.h b/clang/lib/CIR/CodeGen/CIRGenModule.h index 397e501fd4e87..1c7ed63773900 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.h +++ b/clang/lib/CIR/CodeGen/CIRGenModule.h @@ -41,7 +41,7 @@ class CIRGenModule : public CIRGenTypeCache { CIRGenModule &operator=(CIRGenModule &) = delete; public: - CIRGenModule(mlir::MLIRContext &context, clang::ASTContext &astctx, + CIRGenModule(mlir::MLIRContext &mlirContext, clang::ASTContext &astContext, const clang::CodeGenOptions &cgo, clang::DiagnosticsEngine &diags); @@ -51,7 +51,7 @@ class CIRGenModule : public CIRGenTypeCache { CIRGenBuilderTy builder; /// Hold Clang AST information. - clang::ASTContext &astCtx; + clang::ASTContext &astContext; const clang::LangOptions &langOpts; @@ -67,7 +67,7 @@ class CIRGenModule : public CIRGenTypeCache { public: mlir::ModuleOp getModule() const { return theModule; } CIRGenBuilderTy &getBuilder() { return builder; } - clang::ASTContext &getASTContext() const { return astCtx; } + clang::ASTContext &getASTContext() const { return astContext; } CIRGenTypes &getTypes() { return genTypes; } mlir::MLIRContext &getMLIRContext() { return *builder.getContext(); } diff --git a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp index e93bf93b1cb7d..181af1898baff 100644 --- a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp @@ -9,7 +9,7 @@ using namespace clang; using namespace clang::CIRGen; CIRGenTypes::CIRGenTypes(CIRGenModule &genModule) - : cgm(genModule), context(genModule.getASTContext()), + : cgm(genModule), astContext(genModule.getASTContext()), builder(cgm.getBuilder()) {} CIRGenTypes::~CIRGenTypes() {} @@ -19,7 +19,7 @@ mlir::MLIRContext &CIRGenTypes::getMLIRContext() const { } mlir::Type CIRGenTypes::convertType(QualType type) { - type = context.getCanonicalType(type); + type = astContext.getCanonicalType(type); const Type *ty = type.getTypePtr(); // Has the type already been processed? @@ -43,8 +43,9 @@ mlir::Type CIRGenTypes::convertType(QualType type) { case BuiltinType::SChar: case BuiltinType::Short: case BuiltinType::WChar_S: - resultType = cir::IntType::get(&getMLIRContext(), context.getTypeSize(ty), - /*isSigned=*/true); + resultType = + cir::IntType::get(&getMLIRContext(), astContext.getTypeSize(ty), + /*isSigned=*/true); break; // Unsigned integral types. case BuiltinType::Char8: @@ -58,8 +59,9 @@ mlir::Type CIRGenTypes::convertType(QualType type) { case BuiltinType::ULongLong: case BuiltinType::UShort: case BuiltinType::WChar_U: - resultType = cir::IntType::get(&getMLIRContext(), context.getTypeSize(ty), - /*isSigned=*/false); + resultType = + cir::IntType::get(&getMLIRContext(), astContext.getTypeSize(ty), + /*isSigned=*/false); break; default: cgm.errorNYI(SourceLocation(), "processing of built-in type", type); diff --git a/clang/lib/CIR/CodeGen/CIRGenTypes.h b/clang/lib/CIR/CodeGen/CIRGenTypes.h index b5039b6d4a81d..563d7759831fa 100644 --- a/clang/lib/CIR/CodeGen/CIRGenTypes.h +++ b/clang/lib/CIR/CodeGen/CIRGenTypes.h @@ -36,7 +36,7 @@ class CIRGenModule; /// AST types to CIR types. class CIRGenTypes { CIRGenModule &cgm; - clang::ASTContext &context; + clang::ASTContext &astContext; CIRGenBuilderTy &builder; public: diff --git a/clang/lib/CIR/CodeGen/CIRGenerator.cpp b/clang/lib/CIR/CodeGen/CIRGenerator.cpp index 8f3370c0041af..91070eda7d45a 100644 --- a/clang/lib/CIR/CodeGen/CIRGenerator.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenerator.cpp @@ -29,15 +29,15 @@ CIRGenerator::CIRGenerator(clang::DiagnosticsEngine &diags, : diags(diags), fs(std::move(vfs)), codeGenOpts{cgo} {} CIRGenerator::~CIRGenerator() = default; -void CIRGenerator::Initialize(ASTContext &astCtx) { +void CIRGenerator::Initialize(ASTContext &astContext) { using namespace llvm; - this->astCtx = &astCtx; + this->astContext = &astContext; - mlirCtx = std::make_unique(); - mlirCtx->loadDialect(); - cgm = std::make_unique(*mlirCtx.get(), astCtx, - codeGenOpts, diags); + mlirContext = std::make_unique(); + mlirContext->loadDialect(); + cgm = std::make_unique( + *mlirContext.get(), astContext, codeGenOpts, diags); } mlir::ModuleOp CIRGenerator::getModule() const { return cgm->getModule(); }