struct Parser::AngleBracketTracker

Declaration

struct Parser::AngleBracketTracker { /* full declaration omitted */ };

Description

Tracker for ' < ' tokens that might have been intended to be treated as an angle bracket instead of a less-than comparison. This happens when the user intends to form a template-id, but typoes the template-name or forgets a 'template' keyword for a dependent template name. We track these locations from the point where we see a ' < ' with a name-like expression on its left until we see a '>' or '>>' that might match it.

Declared at: clang/include/clang/Parse/Parser.h:320

Member Variables

public SmallVector< clang::Parser::AngleBracketTracker::Loc, 8> Locs

Method Overview

  • public void add(clang::Parser & P, clang::Expr * TemplateName, clang::SourceLocation LessLoc, clang::Parser::AngleBracketTracker::Priority Prio)
  • public void clear(clang::Parser & P)
  • public clang::Parser::AngleBracketTracker::Loc * getCurrent(clang::Parser & P)

Methods

void add(
    clang::Parser& P,
    clang::Expr* TemplateName,
    clang::SourceLocation LessLoc,
    clang::Parser::AngleBracketTracker::Priority
        Prio)

Description

Add an expression that might have been intended to be a template name. In the case of ambiguity, we arbitrarily select the innermost such expression, for example in 'foo < bar < baz', 'bar' is the current candidate. No attempt is made to track that 'foo' is also a candidate for the case where we see a second suspicious '>' token.

Declared at: clang/include/clang/Parse/Parser.h:361

Parameters

clang::Parser& P
clang::Expr* TemplateName
clang::SourceLocation LessLoc
clang::Parser::AngleBracketTracker::Priority Prio

void clear(clang::Parser& P)

Description

Mark the current potential missing template location as having been handled (this happens if we pass a "corresponding" '>' or '>>' token or leave a bracket scope).

Declared at: clang/include/clang/Parse/Parser.h:378

Parameters

clang::Parser& P

clang::Parser::AngleBracketTracker::Loc*
getCurrent(clang::Parser& P)

Description

Get the current enclosing expression that might hve been intended to be a template name.

Declared at: clang/include/clang/Parse/Parser.h:385

Parameters

clang::Parser& P