[all-commits] [llvm/llvm-project] 0dd0b1: [Parser] Avoid spurious 'missing template' error i...

Haojian Wu via All-commits all-commits at lists.llvm.org
Thu Mar 19 08:15:41 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 0dd0b1017c807e7a803e69be7bdc5c0ac7b469d8
      https://github.com/llvm/llvm-project/commit/0dd0b1017c807e7a803e69be7bdc5c0ac7b469d8
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2020-03-19 (Thu, 19 Mar 2020)

  Changed paths:
    M clang/include/clang/Parse/Parser.h
    M clang/lib/Parse/ParseDecl.cpp
    M clang/lib/Parse/ParseDeclCXX.cpp
    M clang/lib/Parse/ParseExpr.cpp
    M clang/lib/Parse/ParseExprCXX.cpp
    M clang/lib/Parse/ParseOpenMP.cpp
    M clang/lib/Parse/ParseStmtAsm.cpp
    M clang/lib/Parse/ParseTemplate.cpp
    M clang/lib/Parse/Parser.cpp
    A clang/test/SemaTemplate/dependent-typos-recovery.cpp

  Log Message:
  -----------
  [Parser] Avoid spurious 'missing template' error in presence of typos.

Suppress those diagnostics if lhs of a member expression contains
errors. Typo correction produces dependent expressions even in
non-template code, that led to spurious diagnostics before.

previous:
    /tmp/t.cpp:6:17: error: use 'template' keyword to treat 'f' as a dependent template name
    auto a = bilder.f<int>();
                    ^
                    template
    /tmp/t.cpp:6:10: error: use of undeclared identifier 'bilder'; did you mean 'builder'?
    auto a = bilder.f<int>();
             ^~~~~~
             builder

vs now:

    /tmp/t.cpp:6:10: error: use of undeclared identifier 'bilder'; did you mean 'builder'?
    auto a = bilder.f<int>();
             ^~~~~~
             builder

Original patch from Ilya.

Reviewers: sammccall

Reviewed By: sammccall

Tags: #clang

Differential Revision: https://reviews.llvm.org/D65592




More information about the All-commits mailing list