[PATCH] D77037: [AST] Fix crashes on decltype(recovery-expr).

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 30 03:13:01 PDT 2020


hokein added inline comments.


================
Comment at: clang/lib/Parse/ParseExprCXX.cpp:3109
+        QualType PreferredType;
+        if (TypeRep)
+          PreferredType = Actions.ProduceConstructorSignatureHelp(
----------------
sammccall wrote:
> Add a comment for what the null case means? (When do we actually hit this?)
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
In `ActOnTypeName`,  `DeclaratorInfo` could be modified (by `GetTypeForDeclarator`) before calling `isInvalidType`.


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.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77037/new/

https://reviews.llvm.org/D77037





More information about the cfe-commits mailing list