Skip to content

Commit f8624cc

Browse files
committed
second comment pass - usage and defn
1 parent 3e41bfc commit f8624cc

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

clang/include/clang/3C/3C.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ class _3CInterface {
106106

107107
// Constraint Building.
108108

109+
// Create ConstraintVariables to hold constraints
109110
bool addVariables();
110111

111112
// Build initial constraints.

clang/include/clang/3C/ConstraintVariables.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ class PointerVariableConstraint : public ConstraintVariable {
379379

380380
const CAtoms &getCvars() const { return Vars; }
381381

382+
// Include new ConstAtoms, supplemental info, and merge function pointers
382383
void mergeDeclaration(ConstraintVariable *From, ProgramInfo &I,
383384
std::string &ReasonFailed) override;
384385

@@ -528,6 +529,7 @@ class FunctionVariableConstraint : public ConstraintVariable {
528529
return S->getKind() == FunctionVariable;
529530
}
530531

532+
// Merge return value and all params
531533
void mergeDeclaration(ConstraintVariable *FromCV, ProgramInfo &I,
532534
std::string &ReasonFailed) override;
533535

clang/include/clang/3C/ProgramInfo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ class ProgramInfo : public ProgramVariableAdder {
178178
void specialCaseVarIntros(ValueDecl *D, ASTContext *Context);
179179

180180
// Inserts the given FVConstraint set into the extern or static function map.
181+
// Returns the merged version if it was a redeclaration, or the constraint
182+
// parameter if it was new.
181183
FunctionVariableConstraint *
182184
insertNewFVConstraint(FunctionDecl *FD, FVConstraint *FVCon, ASTContext *C);
183185

clang/lib/3C/ConstraintBuilder.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -619,12 +619,8 @@ void VariableAdderConsumer::HandleTranslationUnit(ASTContext &C) {
619619

620620
VariableAdderVisitor VAV = VariableAdderVisitor(&C, Info);
621621
TranslationUnitDecl *TUD = C.getTranslationUnitDecl();
622-
// Generate constraints.
622+
// Collect Variables.
623623
for (const auto &D : TUD->decls()) {
624-
// The order of these traversals CANNOT be changed because both the type
625-
// variable and constraint gen visitor require that variables have been
626-
// added to ProgramInfo, and the constraint gen visitor requires the type
627-
// variable information gathered in the type variable traversal.
628624
VAV.TraverseDecl(D);
629625
}
630626

@@ -657,6 +653,10 @@ void ConstraintBuilderConsumer::HandleTranslationUnit(ASTContext &C) {
657653

658654
// Generate constraints.
659655
for (const auto &D : TUD->decls()) {
656+
// The order of these traversals CANNOT be changed because the constraint
657+
// gen visitor requires the type variable information gathered in the type
658+
// variable traversal.
659+
660660
CSBV.TraverseDecl(D);
661661
TV.TraverseDecl(D);
662662
GV.TraverseDecl(D);

clang/lib/3C/ProgramInfo.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -558,11 +558,9 @@ void ProgramInfo::addVariable(clang::DeclaratorDecl *D,
558558
return;
559559
}
560560

561-
// Store the FVConstraint in the global and Variables maps. In doing this,
562-
// insertNewFVConstraint might replace the atoms in F with the atoms of a
563-
// FVConstraint that already exists in the map. Doing this loses any
564-
// constraints that might have effected the original atoms, so do not create
565-
// any constraint on F before this function is called.
561+
// Store the FVConstraint in the global and Variables maps. It may be
562+
// merged with others if this is a redeclaration, and the merged version
563+
// is returned.
566564
F = insertNewFVConstraint(FD, F, AstContext);
567565
NewCV = F;
568566

0 commit comments

Comments
 (0)