Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Documentation Typo in header of ParseExpr.cpp: Reference to ParseBinaryExpression instead of ParseRHSOfBinaryExpression since 2006 #195747

@vrpT14s

Description

@vrpT14s

At the top of clang/Parse/ParseExpr.cpp, there's a comment describing the file:

//===----------------------------------------------------------------------===//
///
/// \file
/// Provides the Expression parsing implementation.
///
/// Expressions in C99 basically consist of a bunch of binary operators with
/// unary operators and other random stuff at the leaves.
///
/// In the C99 grammar, these unary operators bind tightest and are represented
/// as the 'cast-expression' production.  Everything else is either a binary
/// operator (e.g. '/') or a ternary operator ("?:").  The unary leaves are
/// handled by ParseCastExpression, the higher level pieces are handled by
/// ParseBinaryExpression.
///
//===----------------------------------------------------------------------===//

But the function ParseBinaryExpression doesn't exist anywhere in the LLVM codebase except in this comment:

$ cd /vol/lec/cc/llvm-project/
$ grep -rIi "ParseBinaryExpression"
clang/lib/Parse/ParseExpr.cpp:/// ParseBinaryExpression.
$

(Searching in github directly also only showed this comment).

This comment was added by Lattner in 2006 in commit cde626a where he introduced both of those functions, but a few commits later (d35c34f) he renames ParseBinaryExpression to ParseExpression (since you can't tell if it's a binary or just a unary until after you parse the first unary expression) but forgets to update the header comment and it remains to this day.

This is a bit of a nothingburger but since it's a header comment it shows up at the top of the doxygen documentation too. Newbies like me who are checking the parser for the first time will see this comment first and get a bit confused for about 5 minutes searching for a non-existent function.

I'll add a pull request that changes that one word in the comment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"documentation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions