[PATCH] D105759: Implement P2361 Unevaluated string literals
Aaron Ballman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 27 12:21:35 PDT 2023
aaron.ballman added a comment.
In D105759#4453440 <https://reviews.llvm.org/D105759#4453440>, @cor3ntin wrote:
> Parse attribute as unevaluated string if they
> are declare StringLiteralArgument in the Attr.td file.
>
> WIP
>
> @aaron.ballman Do we agree on direction before I
> fix the remaining broken tests?
Mostly agreed, though I left a comment where I think the direction should change slightly.
> There are a few limitations, which I'm hoping not to fix there
>
> - It doesn't support variadic string arguments
That's reasonable; let's leave them as evaluated strings for now so there's no behavioral change.
> - checking the type of argument ahead of time seems like a good idea overall, maybe we want to expand that system?
I agree; we currently have the common handler checking argument counts (https://github.com/llvm/llvm-project/blob/1e010c5c4fae43c52d6f5f1c8e8920c26bcc6cc7/clang/lib/Sema/SemaAttr.cpp#L1419), but we don't generate any code for checking argument types. But certainly doesn't need to be done as part of your work.
================
Comment at: clang/include/clang/Basic/Attr.td:3048
}];
+ let ParseArgumentsAsUnevaluated = 1;
}
----------------
I don't think we should reuse this flag this way. This flag is for the traditional sense of "unevaluated", but unevaluated string literals are a different kind of beast. I think that should be tracked on the argument level. We can either adjust:
```
class StringArgument<string name, bit opt = 0> : Argument<name, opt>;
```
so that it takes another bit for whether the string is unevaluated or not, or we could add a new subclass for `UnevaluatedStringArgument`. Then ClangAttrEmitter.cpp would look at this information when emitting the switch cases.
================
Comment at: llvm/cmake/modules/HandleLLVMOptions.cmake:608
# based on object lifetime.
- add_flag_if_supported("-fno-lifetime-dse" CMAKE_CXX_FLAGS)
+ # add_flag_if_supported("-fno-lifetime-dse" CMAKE_CXX_FLAGS)
endif ( LLVM_COMPILER_IS_GCC_COMPATIBLE )
----------------
Spurious change. ;-)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105759/new/
https://reviews.llvm.org/D105759
More information about the llvm-commits
mailing list