Skip to content

Commit e5b8d31

Browse files
committed
chore: cleanups
1 parent 8dcf6b3 commit e5b8d31

File tree

3 files changed

+23
-49
lines changed

3 files changed

+23
-49
lines changed

src/lib/AST/ASTVisitor.cpp

Lines changed: 19 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,6 +1573,7 @@ class ASTVisitor
15731573
}
15741574

15751575
// #define CHECK_IN_FILE_FILTER
1576+
15761577
// This also sets IsFileInRootDir
15771578
bool
15781579
inExtractedFile(
@@ -1629,18 +1630,10 @@ class ASTVisitor
16291630

16301631
file_ = files::makePosixStyle(loc.getFilename());
16311632

1632-
#ifdef CHECK_IN_FILE_FILTER
1633-
// skip system header
1634-
if(currentMode() == ExtractMode::Normal &&
1635-
source_.isInSystemHeader(D->getLocation()))
1636-
#else
1637-
16381633
// skip system header
16391634
if(source_.isInSystemHeader(D->getLocation()))
1640-
#endif
16411635
return false;
16421636

1643-
16441637
auto [it, inserted] = fileFilter_.emplace(
16451638
loc.getIncludeLoc().getRawEncoding(),
16461639
FileFilter());
@@ -1653,12 +1646,7 @@ class ASTVisitor
16531646

16541647
// don't extract if the declaration is in a file
16551648
// that should not be visited
1656-
#ifdef CHECK_IN_FILE_FILTER
1657-
if(currentMode() == ExtractMode::Normal &&
1658-
! ff.include)
1659-
#else
16601649
if(! ff.include)
1661-
#endif
16621650
return false;
16631651
// VFALCO we could assert that the prefix
16641652
// matches and just lop off the
@@ -1675,12 +1663,6 @@ class ASTVisitor
16751663
shouldExtract(
16761664
const Decl* D)
16771665
{
1678-
#ifdef CHECK_IN_FILE_FILTER
1679-
return inExtractedFile(D);
1680-
#elif 0
1681-
return inExtractedFile(D) ||
1682-
currentMode() != ExtractMode::Normal;
1683-
#elif 1
16841666
bool extract = inExtractedFile(D);
16851667
// if we're extracting a declaration as a dependency,
16861668
// override the current extraction mode if
@@ -1689,7 +1671,6 @@ class ASTVisitor
16891671
mode = ExtractMode::Normal;
16901672

16911673
return extract || currentMode() != ExtractMode::Normal;
1692-
#endif
16931674
}
16941675

16951676
std::string
@@ -2271,7 +2252,6 @@ class ASTVisitor
22712252
parent->Implicit &= currentMode() != ExtractMode::Normal;
22722253
static_cast<RecordInfo*>(parent)->Friends.emplace_back(I.id);
22732254
}
2274-
22752255
return;
22762256
}
22772257
if(FunctionTemplateDecl* FT = dyn_cast<FunctionTemplateDecl>(ND))
@@ -2396,9 +2376,6 @@ traverse(EnumDecl* D)
23962376
if(! shouldExtract(D))
23972377
return true;
23982378

2399-
// MRDOX_ASSERT(! D->getDeclContext()->isRecord() ||
2400-
// A != AccessSpecifier::AS_none);
2401-
24022379
SymbolID id;
24032380
if(! extractSymbolID(D, id))
24042381
return false;
@@ -2419,9 +2396,6 @@ traverse(FieldDecl* D)
24192396
if(! shouldExtract(D))
24202397
return true;
24212398

2422-
// MRDOX_ASSERT(D->getDeclContext()->isRecord() &&
2423-
// A != AccessSpecifier::AS_none);
2424-
24252399
SymbolID id;
24262400
if(! extractSymbolID(D, id))
24272401
return false;
@@ -2622,6 +2596,10 @@ traverse(TypedefNameTy* D,
26222596

26232597
//------------------------------------------------
26242598

2599+
/** This function will be unnecessary once ClassScopeFunctionSpecializationDecl is
2600+
removed (see https://github.com/llvm/llvm-project/pull/66636). For now we approximate
2601+
its changes by building a DependentFunctionTemplateSpecializationInfo from scratch.
2602+
*/
26252603
bool
26262604
ASTVisitor::
26272605
traverse(ClassScopeFunctionSpecializationDecl* D)
@@ -2633,12 +2611,8 @@ traverse(ClassScopeFunctionSpecializationDecl* D)
26332611
are members of class templates, it is impossible to know what the
26342612
primary template is until the enclosing class template is instantiated.
26352613
while such declarations are valid C++ (see CWG 727, N4090, and [temp.expl.spec] p3),
2636-
GCC does not consider them to be valid. Consequently, we do not extract the SymbolID
2637-
of the primary template. In the future, we could take a best-effort approach to find
2638-
the primary template, but this is only possible when none of the candidates are dependent
2639-
upon a template parameter of the enclosing class template.
2614+
GCC does not consider them to be valid.
26402615
*/
2641-
26422616
DeclContext* DC = D->getDeclContext();
26432617
CXXMethodDecl* MD = D->getSpecialization();
26442618

@@ -2880,9 +2854,7 @@ class ASTVisitorConsumer
28802854
*sema_);
28812855

28822856
// traverse the translation unit
2883-
// visitor.traverseContext(
2884-
visitor.traverseDecl(
2885-
Context.getTranslationUnitDecl());
2857+
visitor.traverseDecl(Context.getTranslationUnitDecl());
28862858

28872859
// VFALCO If we returned from the function early
28882860
// then this line won't execute, which means we
@@ -2902,13 +2874,13 @@ class ASTVisitorConsumer
29022874
nor one that introduces a new type via returning a local class.
29032875
*/
29042876
bool
2905-
shouldSkipFunctionBody(Decl* D) override
2877+
shouldSkipFunctionBody(Decl*) override
29062878
{
29072879
return true;
29082880
}
29092881

29102882
bool
2911-
HandleTopLevelDecl(DeclGroupRef DG) override
2883+
HandleTopLevelDecl(DeclGroupRef) override
29122884
{
29132885
return true;
29142886
}
@@ -2935,16 +2907,16 @@ class ASTVisitorConsumer
29352907
D->setImplicit();
29362908
}
29372909

2938-
void HandleInlineFunctionDefinition(FunctionDecl* D) override { }
2939-
void HandleTagDeclDefinition(TagDecl* D) override { }
2940-
void HandleTagDeclRequiredDefinition(const TagDecl* D) override { }
2941-
void HandleInterestingDecl(DeclGroupRef DG) override { }
2942-
void CompleteTentativeDefinition(VarDecl* D) override { }
2943-
void CompleteExternalDeclaration(VarDecl* D) override { }
2944-
void AssignInheritanceModel(CXXRecordDecl* D) override { }
2945-
void HandleVTable(CXXRecordDecl* D) override { }
2946-
void HandleImplicitImportDecl(ImportDecl* D) override { }
2947-
void HandleTopLevelDeclInObjCContainer(DeclGroupRef DG) override { }
2910+
void HandleInlineFunctionDefinition(FunctionDecl*) override { }
2911+
void HandleTagDeclDefinition(TagDecl*) override { }
2912+
void HandleTagDeclRequiredDefinition(const TagDecl*) override { }
2913+
void HandleInterestingDecl(DeclGroupRef) override { }
2914+
void CompleteTentativeDefinition(VarDecl*) override { }
2915+
void CompleteExternalDeclaration(VarDecl*) override { }
2916+
void AssignInheritanceModel(CXXRecordDecl*) override { }
2917+
void HandleVTable(CXXRecordDecl*) override { }
2918+
void HandleImplicitImportDecl(ImportDecl*) override { }
2919+
void HandleTopLevelDeclInObjCContainer(DeclGroupRef) override { }
29482920

29492921
public:
29502922
ASTVisitorConsumer(

src/lib/Lib/ExecutionContext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ report(
6262
// update Info references once we switch to using Info*
6363
#if 0
6464
{
65-
std::shared_lock read_lock(mutex_);
65+
std::shared_lock<std::shared_mutex> read_lock(mutex_);
6666
}
6767
#endif
6868

69-
std::unique_lock write_lock(mutex_);
69+
std::unique_lock<std::shared_mutex> write_lock(mutex_);
7070
// add all new Info to the existing set. after this call,
7171
// info will only contain duplicates which will require merging
7272
info_.merge(info);

src/lib/Lib/ExecutionContext.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ class ExecutionContext
5858
virtual
5959
mrdox::Expected<InfoSet>
6060
results() = 0;
61+
62+
virtual ~ExecutionContext() = default;
6163
};
6264

6365
// ----------------------------------------------------------------

0 commit comments

Comments
 (0)