Skip to content

Commit

Permalink
Cxx: fill scope fields of unknown/ref tags
Browse files Browse the repository at this point in the history
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
  • Loading branch information
masatake committed Dec 1, 2022
1 parent 4110035 commit 78fde67
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 28 deletions.
10 changes: 5 additions & 5 deletions Units/parser-c.r/c-reftags.d/expected.tags
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ B input.c /^ A, B$/;" e enum:X file: roles:def
i input.c /^extern int i;$/;" x typeref:typename:int roles:def
f input.c /^int f(int j)$/;" f typeref:typename:int roles:def
j input.c /^int f(int j)$/;" z function:f typeref:typename:int file: roles:def
j input.c /^ if (j == 0)$/;" Y roles:ref
i input.c /^ return i + B + j + f(0);$/;" Y roles:ref
B input.c /^ return i + B + j + f(0);$/;" Y roles:ref
j input.c /^ return i + B + j + f(0);$/;" Y roles:ref
f input.c /^ return i + B + j + f(0);$/;" Y roles:ref
j input.c /^ if (j == 0)$/;" Y function:f roles:ref
i input.c /^ return i + B + j + f(0);$/;" Y function:f roles:ref
B input.c /^ return i + B + j + f(0);$/;" Y function:f roles:ref
j input.c /^ return i + B + j + f(0);$/;" Y function:f roles:ref
f input.c /^ return i + B + j + f(0);$/;" Y function:f roles:ref
40 changes: 20 additions & 20 deletions Units/parser-qtmoc.r/simple-qt-reftag.d/expected.tags
Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
QFrame input.h /^class ColumnPreferencesFrame : public QFrame$/;" unknown language:C++
ColumnPreferencesFrame input.h /^class ColumnPreferencesFrame : public QFrame$/;" class language:C++
Q_OBJECT input.h /^ Q_OBJECT$/;" unknown language:C++
Q_OBJECT input.h /^ Q_OBJECT$/;" unknown language:C++ class:ColumnPreferencesFrame
method0 input.h /^ void method0(void);$/;" prototype language:C++ class:ColumnPreferencesFrame typeref:typename:void
slots input.h /^private slots:$/;" unknown language:C++
slots input.h /^private slots:$/;" unknown language:C++ class:ColumnPreferencesFrame
slot0 input.h /^ void slot0(void);$/;" prototype language:C++ class:ColumnPreferencesFrame typeref:typename:void
slot0 input.h /^ void slot0(void);$/;" slot language:QtMoc class:ColumnPreferencesFrame typeref:typename:void
slot1 input.h /^ void slot1(void);$/;" prototype language:C++ class:ColumnPreferencesFrame typeref:typename:void
slot1 input.h /^ void slot1(void);$/;" slot language:QtMoc class:ColumnPreferencesFrame typeref:typename:void
slots input.h /^public slots:$/;" unknown language:C++
slots input.h /^public slots:$/;" unknown language:C++ class:ColumnPreferencesFrame
slot2 input.h /^ void slot2(void);$/;" prototype language:C++ class:ColumnPreferencesFrame typeref:typename:void
slot2 input.h /^ void slot2(void);$/;" slot language:QtMoc class:ColumnPreferencesFrame typeref:typename:void
slot3 input.h /^ void slot3(void);$/;" prototype language:C++ class:ColumnPreferencesFrame typeref:typename:void
slot3 input.h /^ void slot3(void);$/;" slot language:QtMoc class:ColumnPreferencesFrame typeref:typename:void
Q_SLOTS input.h /^Q_SLOTS:$/;" unknown language:C++
Q_SLOTS input.h /^Q_SLOTS:$/;" unknown language:C++ class:ColumnPreferencesFrame
slot4 input.h /^ void slot4(void);$/;" prototype language:C++ class:ColumnPreferencesFrame typeref:typename:void
slot4 input.h /^ void slot4(void);$/;" slot language:QtMoc class:ColumnPreferencesFrame typeref:typename:void
slot5 input.h /^ void slot5(void);$/;" prototype language:C++ class:ColumnPreferencesFrame typeref:typename:void
slot5 input.h /^ void slot5(void);$/;" slot language:QtMoc class:ColumnPreferencesFrame typeref:typename:void
field0 input.h /^ int field0;$/;" member language:C++ class:ColumnPreferencesFrame typeref:typename:int
method1 input.h /^ virtual void method1(void);$/;" prototype language:C++ class:ColumnPreferencesFrame typeref:typename:void
Q_SLOTS input.h /^private Q_SLOTS:$/;" unknown language:C++
Q_SLOTS input.h /^private Q_SLOTS:$/;" unknown language:C++ class:ColumnPreferencesFrame
slot6 input.h /^ void slot6(void);$/;" prototype language:C++ class:ColumnPreferencesFrame typeref:typename:void
slot6 input.h /^ void slot6(void);$/;" slot language:QtMoc class:ColumnPreferencesFrame typeref:typename:void
slot7 input.h /^ void slot7(void);$/;" prototype language:C++ class:ColumnPreferencesFrame typeref:typename:void
slot7 input.h /^ void slot7(void);$/;" slot language:QtMoc class:ColumnPreferencesFrame typeref:typename:void
Q_SLOTS input.h /^public Q_SLOTS:$/;" unknown language:C++
Q_SLOTS input.h /^public Q_SLOTS:$/;" unknown language:C++ class:ColumnPreferencesFrame
slot8 input.h /^ void slot8(void);$/;" prototype language:C++ class:ColumnPreferencesFrame typeref:typename:void
slot8 input.h /^ void slot8(void);$/;" slot language:QtMoc class:ColumnPreferencesFrame typeref:typename:void
slot9 input.h /^ void slot9(void);$/;" prototype language:C++ class:ColumnPreferencesFrame typeref:typename:void
slot9 input.h /^ void slot9(void);$/;" slot language:QtMoc class:ColumnPreferencesFrame typeref:typename:void
slots input.h /^slots:$/;" unknown language:C++
slots input.h /^slots:$/;" unknown language:C++ class:ColumnPreferencesFrame
slot10 input.h /^ void slot10(void);$/;" prototype language:C++ class:ColumnPreferencesFrame typeref:typename:void
slot10 input.h /^ void slot10(void);$/;" slot language:QtMoc class:ColumnPreferencesFrame typeref:typename:void
slot11 input.h /^ void slot11(void);$/;" prototype language:C++ class:ColumnPreferencesFrame typeref:typename:void
slot11 input.h /^ void slot11(void);$/;" slot language:QtMoc class:ColumnPreferencesFrame typeref:typename:void
field1 input.h /^ int field1;$/;" member language:C++ class:ColumnPreferencesFrame typeref:typename:int
signals input.h /^signals:$/;" unknown language:C++
signals input.h /^signals:$/;" unknown language:C++ class:ColumnPreferencesFrame
signal0 input.h /^ void signal0(void);$/;" prototype language:C++ class:ColumnPreferencesFrame typeref:typename:void
signal0 input.h /^ void signal0(void);$/;" signal language:QtMoc class:ColumnPreferencesFrame typeref:typename:void
signal1 input.h /^ void signal1(void);$/;" prototype language:C++ class:ColumnPreferencesFrame typeref:typename:void
signal1 input.h /^ void signal1(void);$/;" signal language:QtMoc class:ColumnPreferencesFrame typeref:typename:void
field2 input.h /^ int field2;$/;" member language:C++ class:ColumnPreferencesFrame typeref:typename:int
method2 input.h /^ virtual void method2(void);$/;" prototype language:C++ class:ColumnPreferencesFrame typeref:typename:void
Q_SIGNALS input.h /^Q_SIGNALS:$/;" unknown language:C++
Q_SIGNALS input.h /^Q_SIGNALS:$/;" unknown language:C++ class:ColumnPreferencesFrame
signal2 input.h /^ void signal2(void);$/;" prototype language:C++ class:ColumnPreferencesFrame typeref:typename:void
signal2 input.h /^ void signal2(void);$/;" signal language:QtMoc class:ColumnPreferencesFrame typeref:typename:void
signal3 input.h /^ void signal3(void);$/;" prototype language:C++ class:ColumnPreferencesFrame typeref:typename:void
signal3 input.h /^ void signal3(void);$/;" signal language:QtMoc class:ColumnPreferencesFrame typeref:typename:void
field3 input.h /^ int field3;$/;" member language:C++ class:ColumnPreferencesFrame typeref:typename:int
method3 input.h /^ virtual void method3(void);$/;" prototype language:C++ class:ColumnPreferencesFrame typeref:typename:void
Q_PROPERTY input.h /^ Q_PROPERTY(QString text MEMBER m_text NOTIFY textChanged)$/;" unknown language:C++
QString input.h /^ Q_PROPERTY(QString text MEMBER m_text NOTIFY textChanged)$/;" unknown language:C++
Q_PROPERTY input.h /^ Q_PROPERTY(QString text MEMBER m_text NOTIFY textChanged)$/;" unknown language:C++ class:ColumnPreferencesFrame
QString input.h /^ Q_PROPERTY(QString text MEMBER m_text NOTIFY textChanged)$/;" unknown language:C++ class:ColumnPreferencesFrame
text input.h /^ Q_PROPERTY(QString text MEMBER m_text NOTIFY textChanged)$/;" property language:QtMoc class:ColumnPreferencesFrame typeref:typename:QString
MEMBER input.h /^ Q_PROPERTY(QString text MEMBER m_text NOTIFY textChanged)$/;" unknown language:C++
m_text input.h /^ Q_PROPERTY(QString text MEMBER m_text NOTIFY textChanged)$/;" unknown language:C++
NOTIFY input.h /^ Q_PROPERTY(QString text MEMBER m_text NOTIFY textChanged)$/;" unknown language:C++
textChanged input.h /^ Q_PROPERTY(QString text MEMBER m_text NOTIFY textChanged)$/;" unknown language:C++
Q_PROPERTY input.h /^ Q_PROPERTY( bool ShowNonprinting READ showsNonprinting WRITE setShowsNonprinting )$/;" unknown language:C++
MEMBER input.h /^ Q_PROPERTY(QString text MEMBER m_text NOTIFY textChanged)$/;" unknown language:C++ class:ColumnPreferencesFrame
m_text input.h /^ Q_PROPERTY(QString text MEMBER m_text NOTIFY textChanged)$/;" unknown language:C++ class:ColumnPreferencesFrame
NOTIFY input.h /^ Q_PROPERTY(QString text MEMBER m_text NOTIFY textChanged)$/;" unknown language:C++ class:ColumnPreferencesFrame
textChanged input.h /^ Q_PROPERTY(QString text MEMBER m_text NOTIFY textChanged)$/;" unknown language:C++ class:ColumnPreferencesFrame
Q_PROPERTY input.h /^ Q_PROPERTY( bool ShowNonprinting READ showsNonprinting WRITE setShowsNonprinting )$/;" unknown language:C++ class:ColumnPreferencesFrame
ShowNonprinting input.h /^ Q_PROPERTY( bool ShowNonprinting READ showsNonprinting WRITE setShowsNonprinting )$/;" property language:QtMoc class:ColumnPreferencesFrame typeref:typename:bool
READ input.h /^ Q_PROPERTY( bool ShowNonprinting READ showsNonprinting WRITE setShowsNonprinting )$/;" unknown language:C++
showsNonprinting input.h /^ Q_PROPERTY( bool ShowNonprinting READ showsNonprinting WRITE setShowsNonprinting )$/;" unknown language:C++
WRITE input.h /^ Q_PROPERTY( bool ShowNonprinting READ showsNonprinting WRITE setShowsNonprinting )$/;" unknown language:C++
setShowsNonprinting input.h /^ Q_PROPERTY( bool ShowNonprinting READ showsNonprinting WRITE setShowsNonprinting )$/;" unknown language:C++
READ input.h /^ Q_PROPERTY( bool ShowNonprinting READ showsNonprinting WRITE setShowsNonprinting )$/;" unknown language:C++ class:ColumnPreferencesFrame
showsNonprinting input.h /^ Q_PROPERTY( bool ShowNonprinting READ showsNonprinting WRITE setShowsNonprinting )$/;" unknown language:C++ class:ColumnPreferencesFrame
WRITE input.h /^ Q_PROPERTY( bool ShowNonprinting READ showsNonprinting WRITE setShowsNonprinting )$/;" unknown language:C++ class:ColumnPreferencesFrame
setShowsNonprinting input.h /^ Q_PROPERTY( bool ShowNonprinting READ showsNonprinting WRITE setShowsNonprinting )$/;" unknown language:C++ class:ColumnPreferencesFrame
field4 input.h /^ int field4;$/;" member language:C++ class:ColumnPreferencesFrame typeref:typename:int
8 changes: 5 additions & 3 deletions parsers/cxx/cxx_parser_tokenizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1705,9 +1705,11 @@ bool cxxParserParseNextToken(void)
if (in_subparser)
pushLanguage(g_cxx.eLangType);

g_cxx.pToken->iCorkIndex = makeSimpleRefTag(g_cxx.pToken->pszWord,
CXXTagKindUNKNOWN,
CXXTagUnknownRoleREFERENCED);
tagEntryInfo oEntry;
initRefTagEntry(&oEntry, vStringValue(g_cxx.pToken->pszWord),
CXXTagKindUNKNOWN, CXXTagUnknownRoleREFERENCED);
oEntry.extensionFields.scopeIndex = cxxScopeGetDefTag();
g_cxx.pToken->iCorkIndex = makeTagEntry(&oEntry);
g_cxx.pToken->bCorkIndexForReftag = true;

if (in_subparser)
Expand Down

0 comments on commit 78fde67

Please sign in to comment.