llvm-project/clang-tools-extra/pseudo/test/cxx/contextual-keywords.cpp
Haojian Wu 9ab67cc8bf [pseudo] Implement guard extension.
- Extend the GLR parser to allow conditional reduction based on the
  guard functions;
- Implement two simple guards (contextual-override/final) for cxx.bnf;
- layering: clangPseudoCXX depends on clangPseudo (as the guard function need
  to access the TokenStream);

Differential Revision: https://reviews.llvm.org/D127448
2022-07-05 15:55:15 +02:00

10 lines
368 B
C++

// RUN: clang-pseudo -grammar=cxx -source=%s --print-forest | FileCheck %s
// Verify that the contextual-{final,override} rules are guarded conditionally,
// No ambiguous parsing for the virt-specifier.
class Foo {
void foo1() override;
// CHECK: virt-specifier-seq~IDENTIFIER := tok[7]
void foo2() final;
// CHECK: virt-specifier-seq~IDENTIFIER := tok[13]
};