[Lldb-commits] [lldb] [LLDB] Add type casting to DIL, part 1 of 3. (PR #165199)
Ilia Kuklin via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 29 11:58:20 PDT 2025
================
@@ -339,6 +463,40 @@ std::string DILParser::ParseUnqualifiedId() {
return identifier;
}
+CompilerType
+DILParser::ResolveTypeDeclarators(CompilerType type,
+ const std::vector<Token> &ptr_operators) {
+ CompilerType bad_type;
+ // Resolve pointers/references.
+ for (Token tk : ptr_operators) {
+ uint32_t loc = tk.GetLocation();
+ if (tk.GetKind() == Token::star) {
+ // Pointers to reference types are forbidden.
+ if (type.IsReferenceType()) {
+ BailOut(llvm::formatv("'type name' declared as a pointer to a "
+ "reference of type {0}",
+ type.TypeDescription()),
+ loc, CurToken().GetSpelling().length());
+ return bad_type;
+ }
----------------
kuilpd wrote:
I guess we could drop cast to &, we don't have an assignment operator yet anyway. The check should stay regardless though, because if DIL cannot handle something, it must return an error rather then an incorrect value.
But in general, this is a C-style cast with C-style syntax, I think it should be expected to be used only with C/C++ code, since DIL will be mostly used automatically without the programmer knowing that DIL will try to evaluate the expression before the compiler.
https://github.com/llvm/llvm-project/pull/165199
More information about the lldb-commits
mailing list