Skip to content

Conversation

@koparasy
Copy link
Contributor

The repo no longer builds with gcc:

/usr/WS2/koparasy/LLVM/clangir/clang/lib/CIR/FrontendAction/CIRGenAction.cpp:113:21: error: declaration of ‘clang::CompilerInstance& cir::CIRGenConsumer::CompilerInstance’ changes meaning of ‘CompilerInstance’ [-fpermissive]
  113 |   CompilerInstance &CompilerInstance;
      |                     ^~~~~~~~~~~~~~~~
In file included from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/Frontend/FrontendAction.h:24,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/CIR/FrontendAction/CIRGenAction.h:12,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/lib/CIR/FrontendAction/CIRGenAction.cpp:9:
/usr/WS2/koparasy/LLVM/clangir/clang/include/clang/Frontend/CompilerInstance.h:81:7: note: ‘CompilerInstance’ declared here as ‘class clang::CompilerInstance’
   81 | class CompilerInstance : public ModuleLoader {
      |       ^~~~~~~~~~~~~~~~
/usr/WS2/koparasy/LLVM/clangir/clang/lib/CIR/FrontendAction/CIRGenAction.cpp:114:22: error: declaration of ‘clang::DiagnosticsEngine& cir::CIRGenConsumer::DiagnosticsEngine’ changes meaning of ‘DiagnosticsEngine’ [-fpermissive]
  114 |   DiagnosticsEngine &DiagnosticsEngine;
      |                      ^~~~~~~~~~~~~~~~~
In file included from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/AST/Type.h:21,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/AST/CanonicalType.h:17,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/AST/ASTContext.h:18,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/CIR/FrontendAction/CIRGenAction.h:12,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/lib/CIR/FrontendAction/CIRGenAction.cpp:9:
/usr/WS2/koparasy/LLVM/clangir/clang/include/clang/Basic/Diagnostic.h:230:7: note: ‘DiagnosticsEngine’ declared here as ‘class clang::DiagnosticsEngine’
  230 | class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
      |       ^~~~~~~~~~~~~~~~~
/usr/WS2/koparasy/LLVM/clangir/clang/lib/CIR/FrontendAction/CIRGenAction.cpp:115:47: warning: ‘maybe_unused’ attribute ignored [-Wattributes]
  115 |   [[maybe_unused]] const HeaderSearchOptions &HeaderSearchOptions;
      |                                               ^~~~~~~~~~~~~~~~~~~
/usr/WS2/koparasy/LLVM/clangir/clang/lib/CIR/FrontendAction/CIRGenAction.cpp:115:47: error: declaration of ‘const clang::HeaderSearchOptions& cir::CIRGenConsumer::HeaderSearchOptions’ changes meaning of ‘HeaderSearchOptions’ [-fpermissive]
In file included from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/Frontend/ASTUnit.h:25,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/CIR/FrontendAction/CIRGenAction.h:12,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/lib/CIR/FrontendAction/CIRGenAction.cpp:9:
/usr/WS2/koparasy/LLVM/clangir/clang/include/clang/Lex/HeaderSearchOptions.h:64:7: note: ‘HeaderSearchOptions’ declared here as ‘class clang::HeaderSearchOptions’
   64 | class HeaderSearchOptions {
      |       ^~~~~~~~~~~~~~~~~~~
/usr/WS2/koparasy/LLVM/clangir/clang/lib/CIR/FrontendAction/CIRGenAction.cpp:116:19: error: declaration of ‘clang::CodeGenOptions& cir::CIRGenConsumer::CodeGenOptions’ changes meaning of ‘CodeGenOptions’ [-fpermissive]
  116 |   CodeGenOptions &CodeGenOptions;
      |                   ^~~~~~~~~~~~~~
In file included from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/Basic/TargetInfo.h:21,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/Frontend/CompilerInstance.h:15,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/Frontend/FrontendAction.h:24,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/CIR/FrontendAction/CIRGenAction.h:12,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/lib/CIR/FrontendAction/CIRGenAction.cpp:9:
/usr/WS2/koparasy/LLVM/clangir/clang/include/clang/Basic/CodeGenOptions.h:88:7: note: ‘CodeGenOptions’ declared here as ‘class clang::CodeGenOptions’
   88 | class CodeGenOptions : public CodeGenOptionsBase {
      |       ^~~~~~~~~~~~~~
/usr/WS2/koparasy/LLVM/clangir/clang/lib/CIR/FrontendAction/CIRGenAction.cpp:117:41: warning: ‘maybe_unused’ attribute ignored [-Wattributes]
  117 |   [[maybe_unused]] const TargetOptions &TargetOptions;
      |                                         ^~~~~~~~~~~~~
/usr/WS2/koparasy/LLVM/clangir/clang/lib/CIR/FrontendAction/CIRGenAction.cpp:117:41: error: declaration of ‘const clang::TargetOptions& cir::CIRGenConsumer::TargetOptions’ changes meaning of ‘TargetOptions’ [-fpermissive]
In file included from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/Frontend/ASTUnit.h:24,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/include/clang/CIR/FrontendAction/CIRGenAction.h:12,
                 from /usr/WS2/koparasy/LLVM/clangir/clang/lib/CIR/FrontendAction/CIRGenAction.cpp:9:
/usr/WS2/koparasy/LLVM/clangir/clang/include/clang/Basic/TargetOptions.h:26:7: note: ‘TargetOptions’ declared here as ‘class clang::TargetOptions’
   26 | class TargetOptions {
      |       ^~~~~~~~~~~~~
/usr/WS2/koparasy/LLVM/clangir/clang/lib/CIR/FrontendAction/CIRGenAction.cpp:118:39: warning: ‘maybe_unused’ attribute ignored [-Wattributes]
  118 |   [[maybe_unused]] const LangOptions &LangOptions;
      |                                       ^~~~~~~~~~~
/usr/WS2/koparasy/LLVM/clangir/clang/lib/CIR/FrontendAction/CIRGenAction.cpp:118:39: error: declaration of ‘const clang::LangOptions& cir::CIRGenConsumer::LangOptions’ changes meaning of ‘LangOptions’ [-fpermissive]

This fixes these variable naming issues.

Copy link
Collaborator

@andykaylor andykaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing this! I'm making some suggestions on naming to try to align with classic codegen, but I don't have strong feelings about that.

Comment on lines 113 to 118
CompilerInstance &CompInstance;
DiagnosticsEngine &DiagEngine;
[[maybe_unused]] const HeaderSearchOptions &HdrSearchOptions;
CodeGenOptions &CGenOptions;
[[maybe_unused]] const TargetOptions &TgtOptions;
[[maybe_unused]] const LangOptions &LOptions;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CompilerInstance &CompInstance;
DiagnosticsEngine &DiagEngine;
[[maybe_unused]] const HeaderSearchOptions &HdrSearchOptions;
CodeGenOptions &CGenOptions;
[[maybe_unused]] const TargetOptions &TgtOptions;
[[maybe_unused]] const LangOptions &LOptions;
CompilerInstance &CI;
DiagnosticsEngine &Diags;
[[maybe_unused]] const HeaderSearchOptions &HeaderSearchOpts;
CodeGenOptions &CodeGenOpts;
[[maybe_unused]] const TargetOptions &TargetOpts;
[[maybe_unused]] const LangOptions &LangOpts;

These changes are suggested to align with the equivalent names in clang/lib/CodeGen/BackendConsumer.h

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to follow OG, thank you!

CIRGenConsumer(CIRGenAction::OutputType Action,
class CompilerInstance &CompilerInstance,
class DiagnosticsEngine &DiagnosticsEngine,
class CompilerInstance &CompInstance,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class CompilerInstance &CompInstance,
class CompilerInstance &CI,

And likewise, as above.

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, pending we solve the CI issue to merge this safely

@bcardosolopes
Copy link
Member

Errors are unrelated, merging anyways

@bcardosolopes bcardosolopes merged commit cb1db52 into llvm:main Nov 18, 2025
6 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants