From 926717e50953413e0156e77c483cf748ee8ab814 Mon Sep 17 00:00:00 2001 From: zebullon Date: Sun, 5 Jan 2025 11:09:55 +0900 Subject: [PATCH] Add flag --- clang/include/clang/Basic/DiagnosticFrontendKinds.td | 3 +++ clang/include/clang/Basic/Features.def | 1 + clang/include/clang/Basic/LangOptions.def | 1 + clang/include/clang/Driver/Options.td | 5 +++++ clang/lib/Frontend/CompilerInvocation.cpp | 8 ++++++-- clang/lib/Parse/ParseDeclCXX.cpp | 11 +++++++++-- 6 files changed, 25 insertions(+), 4 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticFrontendKinds.td b/clang/include/clang/Basic/DiagnosticFrontendKinds.td index 68d0e844780b4..9a8faa3e38aa0 100644 --- a/clang/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/clang/include/clang/Basic/DiagnosticFrontendKinds.td @@ -105,6 +105,9 @@ def err_fe_reflection_incompatible_with_blocks : Error< def err_fe_parameter_reflection_without_reflection : Error< "cannot specify '-fparameter-reflection' without '-freflection'">, DefaultFatal; +def err_fe_attribute_reflection_without_reflection : Error< + "cannot specify '-fattribute-reflection' without '-freflection'">, + DefaultFatal; def err_fe_dependency_file_requires_MT : Error< "-dependency-file requires at least one -MT or -MQ option">; def err_fe_invalid_plugin_name : Error< diff --git a/clang/include/clang/Basic/Features.def b/clang/include/clang/Basic/Features.def index 4f826ac0b1cc0..f0941542cbfbe 100644 --- a/clang/include/clang/Basic/Features.def +++ b/clang/include/clang/Basic/Features.def @@ -310,6 +310,7 @@ FEATURE(cxx_abi_relative_vtable, LangOpts.CPlusPlus && LangOpts.RelativeCXXABIVT FEATURE(reflection, LangOpts.Reflection) FEATURE(reflection_new_syntax, LangOpts.ReflectionNewSyntax) FEATURE(parameter_reflection, LangOpts.ParameterReflection) +FEATURE(attribute_reflection, LangOpts.AttributeReflection) FEATURE(expansion_statements, LangOpts.ExpansionStatements) FEATURE(annotation_attributes, LangOpts.AnnotationAttributes) FEATURE(consteval_blocks, LangOpts.ConstevalBlocks) diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def index b30ecdf17175c..e0ed057032c07 100644 --- a/clang/include/clang/Basic/LangOptions.def +++ b/clang/include/clang/Basic/LangOptions.def @@ -314,6 +314,7 @@ LANGOPT(OpenACC , 1, 0, "OpenACC Enabled") LANGOPT(Reflection , 1, 0, "Experimental C++26 Reflection") LANGOPT(ReflectionNewSyntax , 1, 0, "New syntax for C++26 Reflection") LANGOPT(ParameterReflection , 1, 0, "Augments C++26 Reflection with function parameter reflection") +LANGOPT(AttributeReflection , 1, 0, "Augments C++26 Reflection with standard attribute reflection") LANGOPT(ExpansionStatements , 1, 0, "Experimental C++26 Expansion Statements") LANGOPT(AnnotationAttributes, 1, 0, "Experimental C++26 support for annotations") LANGOPT(ConstevalBlocks, 1, 0, "Experimental C++26 support for consteval blocks") diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 255d2ef84a55a..67a6f1056d30b 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -3504,6 +3504,11 @@ defm parameter_reflection : BoolFOption<"parameter-reflection", PosFlag, NegFlag>; +defm attribute_reflection : BoolFOption<"attribute-reflection", + LangOpts<"AttributeReflection">, DefaultFalse, + PosFlag, + NegFlag>; defm expansion_statements : BoolFOption<"expansion-statements", LangOpts<"ExpansionStatements">, DefaultFalse, PosFlag(Result.get()); Expr::EvalResult ER;