diff options
Diffstat (limited to 'src/filedef.cpp')
-rw-r--r-- | src/filedef.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/filedef.cpp b/src/filedef.cpp index 9d9edcc..d360813 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -615,6 +615,7 @@ MemberDef *FileDef::getSourceMember(int lineNr) return result; } + void FileDef::addUsingDirective(NamespaceDef *nd) { if (usingDirList==0) @@ -648,6 +649,49 @@ void FileDef::addIncludeDependency(FileDef *fd,const char *incName,bool local) } } +void FileDef::addIncludedUsingDirectives() +{ + if (!visited) + { + visited=TRUE; + NamespaceList nl; + if (includeList) // file contains #includes + { + QListIterator<IncludeInfo> iii(*includeList); + IncludeInfo *ii; + for (;(ii=iii.current());++iii) // foreach #include... + { + if (ii->fileDef) // ...that is a known file + { + // recurse into this file + ii->fileDef->addIncludedUsingDirectives(); + } + } + // iterate through list from last to first + for (iii.toLast();(ii=iii.current());--iii) + { + if (ii->fileDef) + { + NamespaceList *unl = ii->fileDef->usingDirList; + if (unl) + { + NamespaceListIterator nli(*unl); + NamespaceDef *nd; + for (nli.toLast();(nd=nli.current());--nli) + { + // append each using directive found in a #include file + if (usingDirList==0) usingDirList = new NamespaceList; + usingDirList->prepend(nd); + } + } + } + } + } + // add elements of nl to usingDirList + } +} + + void FileDef::addIncludedByDependency(FileDef *fd,const char *incName,bool local) { //printf("FileDef::addIncludedByDependency(%p,%s,%d)\n",fd,incName,local); |