[cfe-commits] r68914 - in /cfe/trunk: include/clang/Basic/DiagnosticParseKinds.td include/clang/Parse/Action.h include/clang/Parse/Parser.h lib/Parse/ParseDecl.cpp lib/Parse/ParseDeclCXX.cpp lib/Sema/Sema.h lib/Sema/SemaDecl.cpp test/Parser/declarators.c
Sebastian Redl
sebastian.redl at getdesigned.at
Sun Apr 12 14:57:04 PDT 2009
Chris Lattner wrote:
> Author: lattner
> Date: Sun Apr 12 16:49:30 2009
> New Revision: 68914
>
> ==============================================================================
> --- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
> +++ cfe/trunk/lib/Parse/ParseDecl.cpp Sun Apr 12 16:49:30 2009
> @@ -654,19 +654,39 @@
> }
>
> // Otherwise, if we don't consume this token, we are going to emit an
> - // error anyway. Since this is almost certainly an invalid type name,
> - // emit a diagnostic that says it, eat the token, and pretend we saw an
> - // 'int'.
> + // error anyway. Try to recover from various common problems. Check
> + // to see if this was a reference to a tag name without a tag specified.
> + // This is a common problem in C (saying 'foo' insteat of 'struct foo').
>
Typo "insteat".
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Sun Apr 12 16:49:30 2009
> @@ -139,6 +139,29 @@
> return 0;
> }
>
> +/// isTagName() - This method is called *for error recovery purposes only*
> +/// to determine if the specified name is a valid tag name ("struct foo"). If
> +/// so, this returns the TST for the tag corresponding to it (TST_enum,
> +/// TST_union, TST_struct, TST_class). This is used to diagnose cases in C
> +/// where the user forgot to specify the tag.
> +DeclSpec::TST Sema::isTagName(IdentifierInfo &II, Scope *S) {
>
Should MinimalAction have this function too? Or is error recovery not
interesting for MA?
Sebastian
More information about the cfe-commits
mailing list