Skip to content
Commit 464c7132 authored by Oliver Kellogg's avatar Oliver Kellogg
Browse files

Support C++11 "enum class" in C++ Import:

lib/cppparser/ast.{h,cpp} class EnumSpecifierAST
- Add functions setClass, isClass accessing new member m_isClass of type
  bool.
- Add functions setEnumBase, enumBase accessing new member m_enumBase
  of type TypeSpecifierAST::Node.

lib/cppparser/parser.cpp function parseEnumSpecifier
- Add bool isClass initialized to false.
- After consuming Token_enum add int tk initialized to
  m_lexer->lookAhead(0).
- If tk is Token_class or Token_struct then set isClass true and call
  nextToken().
- After call to parseName(name) add variable enumBase of type
  TypeSpecifierAST::Node.
- If m_lexer->lookAhead(0) is ':' then call nextToken() followed by
  parseSimpleTypeSpecifier(enumBase).
- Reassign tk from m_lexer->lookAhead(0) and permit only ';' or '{' as
  its value.
- Remove call to nextToken(), it is postponed to after the assignments
  to `ast'.
- At assignments to `ast' call ast->setClass(isClass) and
  ast->setEnumBase(enumBase).

test/import/cxx/cxx11-strongly-typed-enumerations.h
- Rename second definition of Enum2,Enum3 to Enum4,Enum5 to avoid
  overlap.

CCBUG: 338649
parent dd912a2d
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment