Skip to content

Commit 9f7098b

Browse files
committed
Simplify the marking of invalid functions
Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent 85b6a92 commit 9f7098b

File tree

2 files changed

+0
-28
lines changed

2 files changed

+0
-28
lines changed

src/CppParser/Parser.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3140,29 +3140,6 @@ static bool IsInvalid(clang::Stmt* Body, std::unordered_set<clang::Stmt*>& Bodie
31403140
return false;
31413141
}
31423142

3143-
std::stack<clang::Scope> Parser::GetScopesFor(clang::FunctionDecl* FD)
3144-
{
3145-
using namespace clang;
3146-
3147-
std::stack<DeclContext*> Contexts;
3148-
DeclContext* DC = FD;
3149-
while (DC)
3150-
{
3151-
Contexts.push(DC);
3152-
DC = DC->getParent();
3153-
}
3154-
std::stack<Scope> Scopes;
3155-
while (!Contexts.empty())
3156-
{
3157-
Scope S(Scopes.empty() ? 0 : &Scopes.top(),
3158-
Scope::ScopeFlags::DeclScope, c->getDiagnostics());
3159-
S.setEntity(Contexts.top());
3160-
Scopes.push(S);
3161-
Contexts.pop();
3162-
}
3163-
return Scopes;
3164-
}
3165-
31663143
void Parser::MarkValidity(Function* F)
31673144
{
31683145
using namespace clang;
@@ -3177,12 +3154,8 @@ void Parser::MarkValidity(Function* F)
31773154
SemaDiagnostics->Decl = FD;
31783155
c->getSema().getDiagnostics().setClient(SemaDiagnostics.get(), false);
31793156

3180-
auto TUScope = c->getSema().TUScope;
3181-
std::stack<Scope> Scopes = GetScopesFor(FD);
3182-
c->getSema().TUScope = &Scopes.top();
31833157
c->getSema().InstantiateFunctionDefinition(FD->getBeginLoc(), FD,
31843158
/*Recursive*/true);
3185-
c->getSema().TUScope = TUScope;
31863159
F->isInvalid = FD->isInvalidDecl();
31873160
if (!F->isInvalid)
31883161
{

src/CppParser/Parser.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ class Parser
137137
Parameter* WalkParameter(const clang::ParmVarDecl* PVD,
138138
const clang::SourceLocation& ParamStartLoc);
139139
void SetBody(const clang::FunctionDecl* FD, Function* F);
140-
std::stack<clang::Scope> GetScopesFor(clang::FunctionDecl* FD);
141140
void MarkValidity(Function* F);
142141
void WalkFunction(const clang::FunctionDecl* FD, Function* F);
143142
int GetAlignAs(const clang::AlignedAttr* alignedAttr);

0 commit comments

Comments
 (0)