Skip to content

Commit bcaa2db

Browse files
committed
Only do noexcept processing when needed
1 parent 9ff5a7a commit bcaa2db

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

CppHeaderParser/CppHeaderParser.py

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -983,29 +983,32 @@ def __init__(self, nameStack, curClass, methinfo, curTemplate, doxygen, location
983983
self["rtnType"] = self["rtnType"].replace(" ,", ",")
984984

985985
# deal with "noexcept" specifier/operator
986-
cleaned = []
987-
hit = False
988-
parentCount = 0
989-
self["noexcept"] = ""
990-
for a in nameStack:
991-
if a == "noexcept":
992-
hit = True
993-
if hit:
994-
if a == "(":
995-
parentCount += 1
996-
elif a == ")":
997-
parentCount -= 1
998-
elif parentCount == 0 and a != "noexcept":
999-
hit = False
986+
self["noexcept"] = None
987+
if "noexcept" in nameStack:
988+
noexcept_idx = nameStack.index("noexcept")
989+
hit = True
990+
cleaned = nameStack[:noexcept_idx]
991+
parentCount = 0
992+
noexcept = "noexcept"
993+
for a in nameStack[noexcept_idx + 1 :]:
994+
if a == "noexcept":
995+
hit = True
996+
if hit:
997+
if a == "(":
998+
parentCount += 1
999+
elif a == ")":
1000+
parentCount -= 1
1001+
elif parentCount == 0 and a != "noexcept":
1002+
hit = False
1003+
cleaned.append(a)
1004+
continue # noexcept without parenthesis
1005+
if a == ")" and parentCount == 0:
1006+
hit = False
1007+
noexcept += a
1008+
else:
10001009
cleaned.append(a)
1001-
continue # noexcept without parenthesis
1002-
if a == ")" and parentCount == 0:
1003-
hit = False
1004-
self["noexcept"] += a
1005-
else:
1006-
cleaned.append(a)
1007-
nameStack = cleaned
1008-
self["noexcept"] = self["noexcept"] if self["noexcept"] else None
1010+
self["noexcept"] = noexcept
1011+
nameStack = cleaned
10091012

10101013
for spec in ["const", "final", "override"]:
10111014
self[spec] = False

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy