Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
gojakuch committed Oct 1, 2024
1 parent 2c88aed commit f16011f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
13 changes: 7 additions & 6 deletions include/clad/Differentiator/VisitorBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -364,16 +364,17 @@ namespace clad {
/// \param[in] D The declaration to build a DeclRefExpr for.
/// \param[in] SS The scope specifier for the declaration.
/// \returns the DeclRefExpr for the given declaration.
clang::DeclRefExpr* BuildDeclRef(clang::DeclaratorDecl* D,
const clang::CXXScopeSpec* SS = nullptr,
clang::ExprValueKind VK = clang::VK_LValue);
clang::DeclRefExpr*
BuildDeclRef(clang::DeclaratorDecl* D,
const clang::CXXScopeSpec* SS = nullptr,
clang::ExprValueKind VK = clang::VK_LValue);
/// Builds a DeclRefExpr to a given Decl, adding proper nested name
/// qualifiers.
/// \param[in] D The declaration to build a DeclRefExpr for.
/// \param[in] NNS The nested name specifier to use.
clang::DeclRefExpr* BuildDeclRef(clang::DeclaratorDecl* D,
clang::NestedNameSpecifier* NNS,
clang::ExprValueKind VK = clang::VK_LValue);
clang::DeclRefExpr*
BuildDeclRef(clang::DeclaratorDecl* D, clang::NestedNameSpecifier* NNS,
clang::ExprValueKind VK = clang::VK_LValue);

/// Stores the result of an expression in a temporary variable (of the same
/// type as is the result of the expression) and returns a reference to it.
Expand Down
10 changes: 6 additions & 4 deletions lib/Differentiator/VisitorBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ namespace clad {
}

DeclRefExpr* VisitorBase::BuildDeclRef(DeclaratorDecl* D,
const CXXScopeSpec* SS /*=nullptr*/,
const CXXScopeSpec* SS /*=nullptr*/,
ExprValueKind VK /*=VK_LValue*/) {
QualType T = D->getType();
T = T.getNonReferenceType();
Expand All @@ -245,13 +245,13 @@ namespace clad {
}

DeclRefExpr* VisitorBase::BuildDeclRef(DeclaratorDecl* D,
NestedNameSpecifier* NNS,
NestedNameSpecifier* NNS,
ExprValueKind VK /*=VK_LValue*/) {
std::vector<NestedNameSpecifier*> NNChain;
CXXScopeSpec CSS;
while (NNS) {
// FIXME: proper support for dependent NNS needs to be added.
//if (!NNS->isDependent()) return BuildDeclRef(D);
// if (!NNS->isDependent()) return BuildDeclRef(D);

NNChain.push_back(NNS);
NNS = NNS->getPrefix();
Expand All @@ -261,7 +261,9 @@ namespace clad {

for (size_t i = 0; i < NNChain.size(); ++i) {
NNS = NNChain[i];
// FIXME: this needs to be extended to support more NNS kinds. An inspiration can be take from getFullyQualifiedNestedNameSpecifier in llvm-project/clang/lib/AST/QualTypeNames.cpp
// FIXME: this needs to be extended to support more NNS kinds. An
// inspiration can be take from getFullyQualifiedNestedNameSpecifier in
// llvm-project/clang/lib/AST/QualTypeNames.cpp
if (NNS->getKind() == NestedNameSpecifier::Namespace) {
NamespaceDecl* NS = NNS->getAsNamespace();
CSS.Extend(m_Context, NS, noLoc, noLoc);
Expand Down

0 comments on commit f16011f

Please sign in to comment.