[all-commits] [llvm/llvm-project] b3f6e3: Improve recovery from invalid template-ids.

Richard Smith via All-commits all-commits at lists.llvm.org
Fri Mar 27 17:25:03 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b3f6e3d6d64d77a9c840b8407b7e3c49b62b46dd
      https://github.com/llvm/llvm-project/commit/b3f6e3d6d64d77a9c840b8407b7e3c49b62b46dd
  Author: Richard Smith <richard at metafoo.co.uk>
  Date:   2020-03-27 (Fri, 27 Mar 2020)

  Changed paths:
    M clang/include/clang/Sema/Ownership.h
    M clang/include/clang/Sema/ParsedTemplate.h
    M clang/lib/Parse/ParseCXXInlineMethods.cpp
    M clang/lib/Parse/ParseDecl.cpp
    M clang/lib/Parse/ParseDeclCXX.cpp
    M clang/lib/Parse/ParseExprCXX.cpp
    M clang/lib/Parse/ParseTemplate.cpp
    M clang/lib/Parse/ParseTentative.cpp
    M clang/lib/Parse/Parser.cpp
    M clang/lib/Sema/DeclSpec.cpp
    M clang/test/CXX/drs/dr3xx.cpp
    M clang/test/CXX/temp/p3.cpp
    M clang/test/Parser/cxx-ambig-init-templ.cpp
    M clang/test/Parser/cxx-class.cpp
    M clang/test/Parser/cxx-member-initializers.cpp
    M clang/test/Parser/cxx-template-decl.cpp
    M clang/test/Parser/eof2.cpp
    M clang/test/Parser/recovery.cpp
    M clang/test/SemaCXX/PR20705.cpp
    M clang/test/SemaCXX/PR9459.cpp
    M clang/test/SemaCXX/builtins.cpp
    M clang/test/SemaCXX/implicit-exception-spec.cpp
    M clang/test/SemaCXX/injected-class-name-crash.cpp
    M clang/test/SemaCXX/invalid-member-expr.cpp
    M clang/test/SemaTemplate/ms-delayed-default-template-args.cpp
    M clang/test/SemaTemplate/temp_arg.cpp
    M clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp

  Log Message:
  -----------
  Improve recovery from invalid template-ids.

Instead of bailing out of parsing when we encounter an invalid
template-name or template arguments in a template-id, produce an
annotation token describing the invalid construct.

This avoids duplicate errors and generally allows us to recover better.
In principle we should be able to extend this to store some kinds of
invalid template-id in the AST for tooling use, but that isn't handled
as part of this change.




More information about the All-commits mailing list