[PATCH] D142347: [NFC][Clang] Move DebugOptions to llvm/Frontend for reuse in Flang
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGab49747f9d67: [NFC][Clang] Move DebugOptions to llvm/Frontend for reuse in Flang (authored by kiranchandramohan, committed by SBallantyne). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D142347/new/ https://reviews.llvm.org/D142347 Files: clang/include/clang/Basic/CodeGenOptions.def clang/include/clang/Basic/CodeGenOptions.h clang/include/clang/Basic/DebugInfoOptions.h clang/include/clang/Driver/ToolChain.h clang/lib/CodeGen/CGDebugInfo.cpp clang/lib/CodeGen/CGDebugInfo.h clang/lib/CodeGen/CGOpenMPRuntime.cpp clang/lib/CodeGen/CGVTables.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Driver/ToolChains/Clang.h clang/lib/Driver/ToolChains/Cuda.cpp clang/lib/Driver/ToolChains/Cuda.h clang/lib/Driver/ToolChains/HIPSPV.cpp clang/lib/Driver/ToolChains/HIPSPV.h clang/lib/Driver/ToolChains/MSVC.h clang/lib/Frontend/CompilerInvocation.cpp clang/lib/Frontend/Rewrite/FrontendActions.cpp clang/tools/clang-import-test/clang-import-test.cpp llvm/include/llvm/Frontend/Debug/Options.h Index: llvm/include/llvm/Frontend/Debug/Options.h === --- llvm/include/llvm/Frontend/Debug/Options.h +++ llvm/include/llvm/Frontend/Debug/Options.h @@ -6,10 +6,10 @@ // //===--===// -#ifndef LLVM_CLANG_BASIC_DEBUGINFOOPTIONS_H -#define LLVM_CLANG_BASIC_DEBUGINFOOPTIONS_H +#ifndef LLVM_FRONTEND_DEBUG_OPTIONS_H +#define LLVM_FRONTEND_DEBUG_OPTIONS_H -namespace clang { +namespace llvm { namespace codegenoptions { enum DebugInfoFormat { @@ -54,13 +54,9 @@ UnusedTypeInfo, }; -enum class DebugTemplateNamesKind { - Full, - Simple, - Mangled -}; +enum class DebugTemplateNamesKind { Full, Simple, Mangled }; } // end namespace codegenoptions -} // end namespace clang +} // end namespace llvm #endif Index: clang/tools/clang-import-test/clang-import-test.cpp === --- clang/tools/clang-import-test/clang-import-test.cpp +++ clang/tools/clang-import-test/clang-import-test.cpp @@ -200,7 +200,7 @@ Inv->getLangOpts()->CXXExceptions = true; // Needed for testing dynamic_cast. Inv->getLangOpts()->RTTI = true; - Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo); + Inv->getCodeGenOpts().setDebugInfo(llvm::codegenoptions::FullDebugInfo); Inv->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple(); Ins->setInvocation(std::move(Inv)); Index: clang/lib/Frontend/Rewrite/FrontendActions.cpp === --- clang/lib/Frontend/Rewrite/FrontendActions.cpp +++ clang/lib/Frontend/Rewrite/FrontendActions.cpp @@ -165,10 +165,11 @@ if (std::unique_ptr OS = CI.createDefaultOutputFile(false, InFile, "cpp")) { if (CI.getLangOpts().ObjCRuntime.isNonFragile()) - return CreateModernObjCRewriter( - std::string(InFile), std::move(OS), CI.getDiagnostics(), - CI.getLangOpts(), CI.getDiagnosticOpts().NoRewriteMacros, - (CI.getCodeGenOpts().getDebugInfo() != codegenoptions::NoDebugInfo)); + return CreateModernObjCRewriter(std::string(InFile), std::move(OS), + CI.getDiagnostics(), CI.getLangOpts(), + CI.getDiagnosticOpts().NoRewriteMacros, + (CI.getCodeGenOpts().getDebugInfo() != + llvm::codegenoptions::NoDebugInfo)); return CreateObjCRewriter(std::string(InFile), std::move(OS), CI.getDiagnostics(), CI.getLangOpts(), CI.getDiagnosticOpts().NoRewriteMacros); Index: clang/lib/Frontend/CompilerInvocation.cpp === --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -12,7 +12,6 @@ #include "clang/Basic/CharInfo.h" #include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/CommentOptions.h" -#include "clang/Basic/DebugInfoOptions.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/DiagnosticDriver.h" #include "clang/Basic/DiagnosticOptions.h" @@ -59,6 +58,7 @@ #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Twine.h" #include "llvm/Config/llvm-config.h" +#include "llvm/Frontend/Debug/Options.h" #include "llvm/IR/DebugInfoMetadata.h" #include "llvm/Linker/Linker.h" #include "llvm/MC/MCTargetOptions.h" @@ -1397,28 +1397,28 @@ std::optional DebugInfoVal; switch (Opts.DebugInfo) { - case codegenoptions::DebugLineTablesOnly: + case
[PATCH] D142347: [NFC][Clang] Move DebugOptions to llvm/Frontend for reuse in Flang
awarzynski accepted this revision. awarzynski added a comment. LGTM, thanks! As @kiranchandramohan points out, this is in line with the overall direction that we agreed on a while back. This change will very likely affect various downstream consumers - it would be helpful to advertise this with a PSA on Discourse. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D142347/new/ https://reviews.llvm.org/D142347 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D142347: [NFC][Clang] Move DebugOptions to llvm/Frontend for reuse in Flang
SBallantyne updated this revision to Diff 508617. SBallantyne added a comment. Remove references to non existing import Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D142347/new/ https://reviews.llvm.org/D142347 Files: clang/include/clang/Basic/CodeGenOptions.def clang/include/clang/Basic/CodeGenOptions.h clang/include/clang/Basic/DebugInfoOptions.h clang/include/clang/Driver/ToolChain.h clang/lib/CodeGen/CGDebugInfo.cpp clang/lib/CodeGen/CGDebugInfo.h clang/lib/CodeGen/CGOpenMPRuntime.cpp clang/lib/CodeGen/CGVTables.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Driver/ToolChains/Clang.h clang/lib/Driver/ToolChains/Cuda.cpp clang/lib/Driver/ToolChains/Cuda.h clang/lib/Driver/ToolChains/HIPSPV.cpp clang/lib/Driver/ToolChains/HIPSPV.h clang/lib/Driver/ToolChains/MSVC.h clang/lib/Frontend/CompilerInvocation.cpp clang/lib/Frontend/Rewrite/FrontendActions.cpp clang/tools/clang-import-test/clang-import-test.cpp llvm/include/llvm/Frontend/Debug/Options.h Index: llvm/include/llvm/Frontend/Debug/Options.h === --- llvm/include/llvm/Frontend/Debug/Options.h +++ llvm/include/llvm/Frontend/Debug/Options.h @@ -6,10 +6,10 @@ // //===--===// -#ifndef LLVM_CLANG_BASIC_DEBUGINFOOPTIONS_H -#define LLVM_CLANG_BASIC_DEBUGINFOOPTIONS_H +#ifndef LLVM_FRONTEND_DEBUG_OPTIONS_H +#define LLVM_FRONTEND_DEBUG_OPTIONS_H -namespace clang { +namespace llvm { namespace codegenoptions { enum DebugInfoFormat { @@ -54,13 +54,9 @@ UnusedTypeInfo, }; -enum class DebugTemplateNamesKind { - Full, - Simple, - Mangled -}; +enum class DebugTemplateNamesKind { Full, Simple, Mangled }; } // end namespace codegenoptions -} // end namespace clang +} // end namespace llvm #endif Index: clang/tools/clang-import-test/clang-import-test.cpp === --- clang/tools/clang-import-test/clang-import-test.cpp +++ clang/tools/clang-import-test/clang-import-test.cpp @@ -200,7 +200,7 @@ Inv->getLangOpts()->CXXExceptions = true; // Needed for testing dynamic_cast. Inv->getLangOpts()->RTTI = true; - Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo); + Inv->getCodeGenOpts().setDebugInfo(llvm::codegenoptions::FullDebugInfo); Inv->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple(); Ins->setInvocation(std::move(Inv)); Index: clang/lib/Frontend/Rewrite/FrontendActions.cpp === --- clang/lib/Frontend/Rewrite/FrontendActions.cpp +++ clang/lib/Frontend/Rewrite/FrontendActions.cpp @@ -165,10 +165,11 @@ if (std::unique_ptr OS = CI.createDefaultOutputFile(false, InFile, "cpp")) { if (CI.getLangOpts().ObjCRuntime.isNonFragile()) - return CreateModernObjCRewriter( - std::string(InFile), std::move(OS), CI.getDiagnostics(), - CI.getLangOpts(), CI.getDiagnosticOpts().NoRewriteMacros, - (CI.getCodeGenOpts().getDebugInfo() != codegenoptions::NoDebugInfo)); + return CreateModernObjCRewriter(std::string(InFile), std::move(OS), + CI.getDiagnostics(), CI.getLangOpts(), + CI.getDiagnosticOpts().NoRewriteMacros, + (CI.getCodeGenOpts().getDebugInfo() != + llvm::codegenoptions::NoDebugInfo)); return CreateObjCRewriter(std::string(InFile), std::move(OS), CI.getDiagnostics(), CI.getLangOpts(), CI.getDiagnosticOpts().NoRewriteMacros); Index: clang/lib/Frontend/CompilerInvocation.cpp === --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -12,7 +12,6 @@ #include "clang/Basic/CharInfo.h" #include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/CommentOptions.h" -#include "clang/Basic/DebugInfoOptions.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/DiagnosticDriver.h" #include "clang/Basic/DiagnosticOptions.h" @@ -59,6 +58,7 @@ #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Twine.h" #include "llvm/Config/llvm-config.h" +#include "llvm/Frontend/Debug/Options.h" #include "llvm/IR/DebugInfoMetadata.h" #include "llvm/Linker/Linker.h" #include "llvm/MC/MCTargetOptions.h" @@ -1397,28 +1397,28 @@ std::optional DebugInfoVal; switch (Opts.DebugInfo) { - case codegenoptions::DebugLineTablesOnly: + case llvm::codegenoptions::DebugLineTablesOnly: DebugInfoVal = "line-tables-only"; break; - case codegenoptions::DebugDirectivesOnly: + case
[PATCH] D142347: [NFC][Clang] Move DebugOptions to llvm/Frontend for reuse in Flang
kiranchandramohan accepted this revision. kiranchandramohan added a comment. This revision is now accepted and ready to land. LGTM. This refactoring helps share code between Clang and Flang. Please wait a couple of days before submitting. Additional notes in support of approval: -> The llvm community approved @jdoerfert 's proposal for llvm/lib/Frontend as a common directory for sharing code between multiple frontends. https://discourse.llvm.org/t/rfc-create-llvm-lib-frontend/53681 -> In general the flang community would like to have the Flang driver independent of Clang. I believe the Clang project is fine with this as OKed in a reply to a previous RFC (https://lists.llvm.org/pipermail/cfe-dev/2020-August/066488.html) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D142347/new/ https://reviews.llvm.org/D142347 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D142347: [NFC][Clang] Move DebugOptions to llvm/Frontend for reuse in Flang
SBallantyne updated this revision to Diff 508532. SBallantyne added a comment. Clang format Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D142347/new/ https://reviews.llvm.org/D142347 Files: clang/include/clang/Basic/CodeGenOptions.def clang/include/clang/Basic/CodeGenOptions.h clang/include/clang/Basic/DebugInfoOptions.h clang/include/clang/Driver/ToolChain.h clang/lib/CodeGen/CGDebugInfo.cpp clang/lib/CodeGen/CGDebugInfo.h clang/lib/CodeGen/CGOpenMPRuntime.cpp clang/lib/CodeGen/CGVTables.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Driver/ToolChains/Clang.h clang/lib/Driver/ToolChains/Cuda.cpp clang/lib/Driver/ToolChains/Cuda.h clang/lib/Driver/ToolChains/HIPSPV.cpp clang/lib/Driver/ToolChains/HIPSPV.h clang/lib/Driver/ToolChains/MSVC.h clang/lib/Frontend/CompilerInvocation.cpp clang/lib/Frontend/Rewrite/FrontendActions.cpp clang/tools/clang-import-test/clang-import-test.cpp llvm/include/llvm/Frontend/Debug/Options.h Index: llvm/include/llvm/Frontend/Debug/Options.h === --- llvm/include/llvm/Frontend/Debug/Options.h +++ llvm/include/llvm/Frontend/Debug/Options.h @@ -6,10 +6,10 @@ // //===--===// -#ifndef LLVM_CLANG_BASIC_DEBUGINFOOPTIONS_H -#define LLVM_CLANG_BASIC_DEBUGINFOOPTIONS_H +#ifndef LLVM_FRONTEND_DEBUG_OPTIONS_H +#define LLVM_FRONTEND_DEBUG_OPTIONS_H -namespace clang { +namespace llvm { namespace codegenoptions { enum DebugInfoFormat { @@ -54,13 +54,9 @@ UnusedTypeInfo, }; -enum class DebugTemplateNamesKind { - Full, - Simple, - Mangled -}; +enum class DebugTemplateNamesKind { Full, Simple, Mangled }; } // end namespace codegenoptions -} // end namespace clang +} // end namespace llvm #endif Index: clang/tools/clang-import-test/clang-import-test.cpp === --- clang/tools/clang-import-test/clang-import-test.cpp +++ clang/tools/clang-import-test/clang-import-test.cpp @@ -200,7 +200,7 @@ Inv->getLangOpts()->CXXExceptions = true; // Needed for testing dynamic_cast. Inv->getLangOpts()->RTTI = true; - Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo); + Inv->getCodeGenOpts().setDebugInfo(llvm::codegenoptions::FullDebugInfo); Inv->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple(); Ins->setInvocation(std::move(Inv)); Index: clang/lib/Frontend/Rewrite/FrontendActions.cpp === --- clang/lib/Frontend/Rewrite/FrontendActions.cpp +++ clang/lib/Frontend/Rewrite/FrontendActions.cpp @@ -165,10 +165,11 @@ if (std::unique_ptr OS = CI.createDefaultOutputFile(false, InFile, "cpp")) { if (CI.getLangOpts().ObjCRuntime.isNonFragile()) - return CreateModernObjCRewriter( - std::string(InFile), std::move(OS), CI.getDiagnostics(), - CI.getLangOpts(), CI.getDiagnosticOpts().NoRewriteMacros, - (CI.getCodeGenOpts().getDebugInfo() != codegenoptions::NoDebugInfo)); + return CreateModernObjCRewriter(std::string(InFile), std::move(OS), + CI.getDiagnostics(), CI.getLangOpts(), + CI.getDiagnosticOpts().NoRewriteMacros, + (CI.getCodeGenOpts().getDebugInfo() != + llvm::codegenoptions::NoDebugInfo)); return CreateObjCRewriter(std::string(InFile), std::move(OS), CI.getDiagnostics(), CI.getLangOpts(), CI.getDiagnosticOpts().NoRewriteMacros); Index: clang/lib/Frontend/CompilerInvocation.cpp === --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -12,7 +12,6 @@ #include "clang/Basic/CharInfo.h" #include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/CommentOptions.h" -#include "clang/Basic/DebugInfoOptions.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/DiagnosticDriver.h" #include "clang/Basic/DiagnosticOptions.h" @@ -59,6 +58,7 @@ #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Twine.h" #include "llvm/Config/llvm-config.h" +#include "llvm/Frontend/Debug/Options.h" #include "llvm/IR/DebugInfoMetadata.h" #include "llvm/Linker/Linker.h" #include "llvm/MC/MCTargetOptions.h" @@ -1397,28 +1397,28 @@ std::optional DebugInfoVal; switch (Opts.DebugInfo) { - case codegenoptions::DebugLineTablesOnly: + case llvm::codegenoptions::DebugLineTablesOnly: DebugInfoVal = "line-tables-only"; break; - case codegenoptions::DebugDirectivesOnly: + case llvm::codegenoptions::DebugDirectivesOnly: DebugInfoVal =
[PATCH] D142347: [NFC][Clang] Move DebugOptions to llvm/Frontend for reuse in Flang
SBallantyne updated this revision to Diff 508150. SBallantyne added a comment. Rebase Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D142347/new/ https://reviews.llvm.org/D142347 Files: clang/include/clang/Basic/CodeGenOptions.def clang/include/clang/Basic/CodeGenOptions.h clang/include/clang/Basic/DebugInfoOptions.h clang/include/clang/Driver/ToolChain.h clang/lib/CodeGen/CGDebugInfo.cpp clang/lib/CodeGen/CGDebugInfo.h clang/lib/CodeGen/CGOpenMPRuntime.cpp clang/lib/CodeGen/CGVTables.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Driver/ToolChains/Clang.h clang/lib/Driver/ToolChains/Cuda.cpp clang/lib/Driver/ToolChains/Cuda.h clang/lib/Driver/ToolChains/HIPSPV.cpp clang/lib/Driver/ToolChains/HIPSPV.h clang/lib/Driver/ToolChains/MSVC.h clang/lib/Frontend/CompilerInvocation.cpp clang/lib/Frontend/Rewrite/FrontendActions.cpp clang/tools/clang-import-test/clang-import-test.cpp llvm/include/llvm/Frontend/Debug/Options.h Index: llvm/include/llvm/Frontend/Debug/Options.h === --- llvm/include/llvm/Frontend/Debug/Options.h +++ llvm/include/llvm/Frontend/Debug/Options.h @@ -6,10 +6,10 @@ // //===--===// -#ifndef LLVM_CLANG_BASIC_DEBUGINFOOPTIONS_H -#define LLVM_CLANG_BASIC_DEBUGINFOOPTIONS_H +#ifndef LLVM_FRONTEND_DEBUG_OPTIONS_H +#define LLVM_FRONTEND_DEBUG_OPTIONS_H -namespace clang { +namespace llvm { namespace codegenoptions { enum DebugInfoFormat { @@ -54,13 +54,9 @@ UnusedTypeInfo, }; -enum class DebugTemplateNamesKind { - Full, - Simple, - Mangled -}; +enum class DebugTemplateNamesKind { Full, Simple, Mangled }; } // end namespace codegenoptions -} // end namespace clang +} // end namespace llvm #endif Index: clang/tools/clang-import-test/clang-import-test.cpp === --- clang/tools/clang-import-test/clang-import-test.cpp +++ clang/tools/clang-import-test/clang-import-test.cpp @@ -200,7 +200,7 @@ Inv->getLangOpts()->CXXExceptions = true; // Needed for testing dynamic_cast. Inv->getLangOpts()->RTTI = true; - Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo); + Inv->getCodeGenOpts().setDebugInfo(llvm::codegenoptions::FullDebugInfo); Inv->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple(); Ins->setInvocation(std::move(Inv)); Index: clang/lib/Frontend/Rewrite/FrontendActions.cpp === --- clang/lib/Frontend/Rewrite/FrontendActions.cpp +++ clang/lib/Frontend/Rewrite/FrontendActions.cpp @@ -165,10 +165,11 @@ if (std::unique_ptr OS = CI.createDefaultOutputFile(false, InFile, "cpp")) { if (CI.getLangOpts().ObjCRuntime.isNonFragile()) - return CreateModernObjCRewriter( - std::string(InFile), std::move(OS), CI.getDiagnostics(), - CI.getLangOpts(), CI.getDiagnosticOpts().NoRewriteMacros, - (CI.getCodeGenOpts().getDebugInfo() != codegenoptions::NoDebugInfo)); + return CreateModernObjCRewriter(std::string(InFile), std::move(OS), + CI.getDiagnostics(), CI.getLangOpts(), + CI.getDiagnosticOpts().NoRewriteMacros, + (CI.getCodeGenOpts().getDebugInfo() != + llvm::codegenoptions::NoDebugInfo)); return CreateObjCRewriter(std::string(InFile), std::move(OS), CI.getDiagnostics(), CI.getLangOpts(), CI.getDiagnosticOpts().NoRewriteMacros); Index: clang/lib/Frontend/CompilerInvocation.cpp === --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -12,7 +12,6 @@ #include "clang/Basic/CharInfo.h" #include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/CommentOptions.h" -#include "clang/Basic/DebugInfoOptions.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/DiagnosticDriver.h" #include "clang/Basic/DiagnosticOptions.h" @@ -59,6 +58,7 @@ #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Twine.h" #include "llvm/Config/llvm-config.h" +#include "llvm/Frontend/Debug/Options.h" #include "llvm/IR/DebugInfoMetadata.h" #include "llvm/Linker/Linker.h" #include "llvm/MC/MCTargetOptions.h" @@ -1397,28 +1397,28 @@ std::optional DebugInfoVal; switch (Opts.DebugInfo) { - case codegenoptions::DebugLineTablesOnly: + case llvm::codegenoptions::DebugLineTablesOnly: DebugInfoVal = "line-tables-only"; break; - case codegenoptions::DebugDirectivesOnly: + case llvm::codegenoptions::DebugDirectivesOnly: DebugInfoVal =
[PATCH] D142347: [NFC][Clang] Move DebugOptions to llvm/Frontend for reuse in Flang
SBallantyne commandeered this revision. SBallantyne added a reviewer: kiranchandramohan. SBallantyne added a comment. Setting this revision as base for adding debug flag to avoid adding additional dependencies on clang. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D142347/new/ https://reviews.llvm.org/D142347 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D142347: [NFC][Clang] Move DebugOptions to llvm/Frontend for reuse in Flang
kiranchandramohan created this revision. Herald added a subscriber: sunshaoce. Herald added a project: All. kiranchandramohan requested review of this revision. Herald added subscribers: llvm-commits, cfe-commits, MaskRay. Herald added projects: clang, LLVM. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D142347 Files: clang/include/clang/Basic/CodeGenOptions.def clang/include/clang/Basic/CodeGenOptions.h clang/include/clang/Basic/DebugInfoOptions.h clang/include/clang/Driver/ToolChain.h clang/lib/CodeGen/CGDebugInfo.cpp clang/lib/CodeGen/CGDebugInfo.h clang/lib/CodeGen/CGOpenMPRuntime.cpp clang/lib/CodeGen/CGVTables.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Driver/ToolChains/Clang.h clang/lib/Driver/ToolChains/Cuda.cpp clang/lib/Driver/ToolChains/Cuda.h clang/lib/Driver/ToolChains/HIPSPV.cpp clang/lib/Driver/ToolChains/HIPSPV.h clang/lib/Driver/ToolChains/MSVC.h clang/lib/Frontend/CompilerInvocation.cpp clang/lib/Frontend/Rewrite/FrontendActions.cpp clang/tools/clang-import-test/clang-import-test.cpp llvm/include/llvm/Frontend/Debug/Options.h Index: llvm/include/llvm/Frontend/Debug/Options.h === --- llvm/include/llvm/Frontend/Debug/Options.h +++ llvm/include/llvm/Frontend/Debug/Options.h @@ -6,10 +6,10 @@ // //===--===// -#ifndef LLVM_CLANG_BASIC_DEBUGINFOOPTIONS_H -#define LLVM_CLANG_BASIC_DEBUGINFOOPTIONS_H +#ifndef LLVM_FRONTEND_DEBUG_OPTIONS_H +#define LLVM_FRONTEND_DEBUG_OPTIONS_H -namespace clang { +namespace llvm { namespace codegenoptions { enum DebugInfoFormat { @@ -54,13 +54,9 @@ UnusedTypeInfo, }; -enum class DebugTemplateNamesKind { - Full, - Simple, - Mangled -}; +enum class DebugTemplateNamesKind { Full, Simple, Mangled }; } // end namespace codegenoptions -} // end namespace clang +} // end namespace llvm #endif Index: clang/tools/clang-import-test/clang-import-test.cpp === --- clang/tools/clang-import-test/clang-import-test.cpp +++ clang/tools/clang-import-test/clang-import-test.cpp @@ -200,7 +200,7 @@ Inv->getLangOpts()->CXXExceptions = true; // Needed for testing dynamic_cast. Inv->getLangOpts()->RTTI = true; - Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo); + Inv->getCodeGenOpts().setDebugInfo(llvm::codegenoptions::FullDebugInfo); Inv->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple(); Ins->setInvocation(std::move(Inv)); Index: clang/lib/Frontend/Rewrite/FrontendActions.cpp === --- clang/lib/Frontend/Rewrite/FrontendActions.cpp +++ clang/lib/Frontend/Rewrite/FrontendActions.cpp @@ -165,10 +165,11 @@ if (std::unique_ptr OS = CI.createDefaultOutputFile(false, InFile, "cpp")) { if (CI.getLangOpts().ObjCRuntime.isNonFragile()) - return CreateModernObjCRewriter( - std::string(InFile), std::move(OS), CI.getDiagnostics(), - CI.getLangOpts(), CI.getDiagnosticOpts().NoRewriteMacros, - (CI.getCodeGenOpts().getDebugInfo() != codegenoptions::NoDebugInfo)); + return CreateModernObjCRewriter(std::string(InFile), std::move(OS), + CI.getDiagnostics(), CI.getLangOpts(), + CI.getDiagnosticOpts().NoRewriteMacros, + (CI.getCodeGenOpts().getDebugInfo() != + llvm::codegenoptions::NoDebugInfo)); return CreateObjCRewriter(std::string(InFile), std::move(OS), CI.getDiagnostics(), CI.getLangOpts(), CI.getDiagnosticOpts().NoRewriteMacros); Index: clang/lib/Frontend/CompilerInvocation.cpp === --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -12,7 +12,6 @@ #include "clang/Basic/CharInfo.h" #include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/CommentOptions.h" -#include "clang/Basic/DebugInfoOptions.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/DiagnosticDriver.h" #include "clang/Basic/DiagnosticOptions.h" @@ -60,6 +59,7 @@ #include "llvm/ADT/Triple.h" #include "llvm/ADT/Twine.h" #include "llvm/Config/llvm-config.h" +#include "llvm/Frontend/Debug/Options.h" #include "llvm/IR/DebugInfoMetadata.h" #include "llvm/Linker/Linker.h" #include "llvm/MC/MCTargetOptions.h" @@ -1366,28 +1366,28 @@ std::optional DebugInfoVal; switch (Opts.DebugInfo) { - case codegenoptions::DebugLineTablesOnly: + case llvm::codegenoptions::DebugLineTablesOnly: DebugInfoVal = "line-tables-only"; break; - case