Skip to content

Commit

Permalink
Improve GetFunctionCall
Browse files Browse the repository at this point in the history
  • Loading branch information
kchristin22 committed Oct 26, 2024
1 parent 6176de4 commit 96ede8f
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions lib/Differentiator/VisitorBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,24 +531,21 @@ namespace clad {
Expr* VisitorBase::GetFunctionCall(const std::string& funcName,
const std::string& nmspace,
llvm::SmallVectorImpl<Expr*>& callArgs) {
NamespaceDecl* NSD = nullptr;
CXXScopeSpec SS;

DeclContext* DC = m_Context.getTranslationUnitDecl();
if (!nmspace.empty()) {
NSD = utils::LookupNSD(m_Sema, nmspace, /*shouldExist=*/true);
NamespaceDecl* NSD =
utils::LookupNSD(m_Sema, nmspace, /*shouldExist=*/true);
SS.Extend(m_Context, NSD, noLoc, noLoc);
DC = NSD;
}
DeclContext* DC = NSD;

IdentifierInfo* II = &m_Context.Idents.get(funcName);
DeclarationName name(II);
DeclarationNameInfo DNI(name, noLoc);
LookupResult R(m_Sema, DNI, Sema::LookupOrdinaryName);

if (DC)
m_Sema.LookupQualifiedName(R, DC);
else
m_Sema.LookupQualifiedName(R, m_Context.getTranslationUnitDecl());
m_Sema.LookupQualifiedName(R, DC);
Expr* UnresolvedLookup = nullptr;
if (!R.empty())
UnresolvedLookup =
Expand Down

0 comments on commit 96ede8f

Please sign in to comment.