Skip to content

Commit 3f66d51

Browse files
authoredNov 8, 2024
[CIR][CIRGen] Move CIRGen types into clang::CIRGen (#1082)
#1025 explains why we want to move the CIR dialect from the `mlir::cir` to the `cir` namespace. To avoid overloading the `cir` namespace too much afterwards, move all symbols whose equivalents live inside the `clang::CodeGen` namespace to a new `clang::CIRGen` namespace, so that we match the original CodeGen's structure more closely. There's some symbols that live under `clang/include/clang/CIR` whose equivalents live in `clang/lib/CodeGen` and are in the `clang::CodeGen` namespace. We have these symbols in a common location since they're also used by lowering, so I've also left them in the `cir` namespace. Those symbols are: - AArch64ABIKind - ABIArgInfo - FnInfoOpts - TypeEvaluationKind - X86AVXABILevel This is a pretty large PR out of necessity. To make it slightly more reviewable, I've split it out into three commits (which will be squashed together when the PR lands): - The first commit manually switches places to the `clang::CIRGen` namespace. This has to be manual because we only want to move things selectively. - The second commit adjusts namespace prefixes to make builds work. I ran https://gist.github.com/smeenai/f4dd441fb61c53e835c4e6057f8c322f to make this change. The script is idempotent, and I added substitutions one at a time and reviewed each one afterwards (using `git diff --color-words=.`) to ensure only intended changes were being made. - The third commit runs `git clang-format`. Because I went one-by-one with all my substitutions and checked each one afterwards, I'm pretty confident in the validity of all the changes (despite the size of the PR).

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+671
-666
lines changed
 

‎clang/include/clang/CIR/CIRGenerator.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@ namespace clang {
3434
class ASTContext;
3535
class DeclGroupRef;
3636
class FunctionDecl;
37-
} // namespace clang
3837

39-
namespace cir {
38+
namespace CIRGen {
4039
class CIRGenModule;
4140
class CIRGenTypes;
41+
} // namespace CIRGen
42+
} // namespace clang
4243

44+
namespace cir {
4345
class CIRGenerator : public clang::ASTConsumer {
4446
virtual void anchor();
4547
clang::DiagnosticsEngine &Diags;
@@ -70,7 +72,7 @@ class CIRGenerator : public clang::ASTConsumer {
7072

7173
protected:
7274
std::unique_ptr<mlir::MLIRContext> mlirCtx;
73-
std::unique_ptr<CIRGenModule> CGM;
75+
std::unique_ptr<clang::CIRGen::CIRGenModule> CGM;
7476

7577
private:
7678
llvm::SmallVector<clang::FunctionDecl *, 8> DeferredInlineMemberFuncDefs;

‎clang/lib/CIR/CodeGen/ABIInfo.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111

1212
#include "clang/AST/Type.h"
1313

14-
namespace cir {
14+
namespace clang::CIRGen {
1515

16-
class ABIArgInfo;
1716
class CIRGenCXXABI;
1817
class CIRGenFunctionInfo;
1918
class CIRGenTypes;
@@ -42,6 +41,6 @@ class ABIInfo {
4241
bool isPromotableIntegerTypeForABI(clang::QualType Ty) const;
4342
};
4443

45-
} // namespace cir
44+
} // namespace clang::CIRGen
4645

4746
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.