We mark these decls as invalid.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/include/clang/AST/Type.h | ||
---|---|---|
2144 | Why is this called isErrorType when the expr version is containsErrors? | |
clang/lib/Parse/ParseExprCXX.cpp | ||
3109 | Add a comment for what the null case means? (When do we actually hit this?) | |
clang/lib/Sema/SemaType.cpp | ||
1591 | we've added the ability to represent types containing errors, but now we're dropping the type. |
address review comments.
clang/lib/Parse/ParseExprCXX.cpp | ||
---|---|---|
3109 | yeah, the [CompleteTest](https://github.com/llvm/llvm-project/blob/master/clang/unittests/Sema/CodeCompleteTest.cpp#L490) hits the assertion after this patch. the assertion seems incorrect -- IIUC, the assertion is for the isInvalidType() sanity check on Line 3090, however btw, I think for the CodeCompleteTest, would be nicer to make ActOnTypeName return decltype(<recovery-expr>(bar)), rather than the null type, but I'm not sure changing the ActOnTypeName behavior has any side effect. |
clang/lib/Parse/ParseExprCXX.cpp | ||
---|---|---|
3109 |
What you say makes sense, but I think it's worth probing why it's not currently hit (e.g. by int x(auto);, where GetDeclSpecTypeForDeclarator marks the decl as invalid because auto isn't allowed in a prototype).
Definitely. I think "invalid" on a type-concept is stronger than what we're looking for - since we're not tracking errors in decls, we'd want to use "haserrors" on type-concepts and then promote to "invalid" on decl-concepts. Ugh, the design of "Declarator" makes this difficult, because there's no distinction between "type of this declarator is invalid" and "type of this declarator makes the declarator invalid". I'd suggest leaving a FIXME on the changes in SemaType, saying something like "we want resulting declarations to be marked invalid, but claiming the type is invalid is too strong - e.g. it causes ActOnTypeName to return a null type." | |
clang/lib/Sema/SemaType.cpp | ||
1594 | are you sure you want this in the individual cases, rather than once at the end of this function? |
address comments.
clang/lib/Parse/ParseExprCXX.cpp | ||
---|---|---|
3109 |
I believe the issue exists even before this patch, it was just not caught by tests. Added one. | |
clang/lib/Sema/SemaType.cpp | ||
1594 | ah, good point, moved the end of the switch statement. |
Why is this called isErrorType when the expr version is containsErrors?