Skip to content

Commit 870609e

Browse files
committed
Revert "Add caching of conditional directive chains (#468)"
This reverts commit f566848.
1 parent a39d2d6 commit 870609e

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

simplecpp.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3374,7 +3374,6 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL
33743374
// AlwaysFalse => drop all code in #if and #else
33753375
enum IfState : std::uint8_t { True, ElseIsTrue, AlwaysFalse };
33763376
std::stack<int> ifstates;
3377-
std::stack<const Token *> iftokens;
33783377
ifstates.push(True);
33793378

33803379
std::stack<const Token *> includetokenstack;
@@ -3700,24 +3699,15 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL
37003699
ifstates.push(AlwaysFalse);
37013700
else
37023701
ifstates.push(conditionIsTrue ? True : ElseIsTrue);
3703-
iftokens.push(rawtok);
37043702
} else if (ifstates.top() == True) {
37053703
ifstates.top() = AlwaysFalse;
3706-
iftokens.top()->nextcond = rawtok;
3707-
iftokens.top() = rawtok;
37083704
} else if (ifstates.top() == ElseIsTrue && conditionIsTrue) {
37093705
ifstates.top() = True;
3710-
iftokens.top()->nextcond = rawtok;
3711-
iftokens.top() = rawtok;
37123706
}
37133707
} else if (rawtok->str() == ELSE) {
37143708
ifstates.top() = (ifstates.top() == ElseIsTrue) ? True : AlwaysFalse;
3715-
iftokens.top()->nextcond = rawtok;
3716-
iftokens.top() = rawtok;
37173709
} else if (rawtok->str() == ENDIF) {
37183710
ifstates.pop();
3719-
iftokens.top()->nextcond = rawtok;
3720-
iftokens.pop();
37213711
} else if (rawtok->str() == UNDEF) {
37223712
if (ifstates.top() == True) {
37233713
const Token *tok = rawtok->next;
@@ -3729,10 +3719,7 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL
37293719
} else if (ifstates.top() == True && rawtok->str() == PRAGMA && rawtok->next && rawtok->next->str() == ONCE && sameline(rawtok,rawtok->next)) {
37303720
pragmaOnce.insert(rawtok->location.file());
37313721
}
3732-
if (ifstates.top() != True && rawtok->nextcond)
3733-
rawtok = rawtok->nextcond->previous;
3734-
else
3735-
rawtok = gotoNextLine(rawtok);
3722+
rawtok = gotoNextLine(rawtok);
37363723
continue;
37373724
}
37383725

simplecpp.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ namespace simplecpp {
157157
Location location;
158158
Token *previous{};
159159
Token *next{};
160-
mutable const Token *nextcond{};
161160

162161
const Token *previousSkipComments() const {
163162
const Token *tok = this->previous;

0 commit comments

Comments
 (0)