diff --git a/clang-tools-extra/pseudo/lib/cxx.bnf b/clang-tools-extra/pseudo/lib/cxx.bnf --- a/clang-tools-extra/pseudo/lib/cxx.bnf +++ b/clang-tools-extra/pseudo/lib/cxx.bnf @@ -750,3 +750,8 @@ #! split it into two tokens to make the GLR parser aware of the nested-template #! case. greatergreater := > > + +#! C++ predefined identifier, __func__ [dcl.fct.def.general] p8 +#! FIXME: add other (MSVC, GNU extension) predefined identifiers. +primary-expression := predefined-expression +predefined-expression := __FUNC__ diff --git a/clang-tools-extra/pseudo/test/cxx/predefined-identifier.cpp b/clang-tools-extra/pseudo/test/cxx/predefined-identifier.cpp new file mode 100644 --- /dev/null +++ b/clang-tools-extra/pseudo/test/cxx/predefined-identifier.cpp @@ -0,0 +1,5 @@ +// RUN: clang-pseudo -grammar=%cxx-bnf-file -source=%s --print-forest | FileCheck %s +void s() { + __func__; + // CHECK: expression~__FUNC__ := tok[5] +}