Implement basic support for merging function declarations across

translation units.

llvm-svn: 95794
This commit is contained in:
Douglas Gregor
2010-02-10 19:54:31 +00:00
parent cc152d6159
commit bb7930c17e
6 changed files with 213 additions and 39 deletions

View File

@@ -57,14 +57,21 @@ void ASTMergeAction::ExecuteAction() {
for (DeclContext::decl_iterator D = TU->decls_begin(),
DEnd = TU->decls_end();
D != DEnd; ++D) {
// FIXME: We only merge variables whose names start with x. Why
// would anyone want anything else?
if (VarDecl *VD = dyn_cast<VarDecl>(*D))
// FIXME: We only merge variables whose names start with x and functions
// whose names start with 'f'. Why would anyone want anything else?
if (VarDecl *VD = dyn_cast<VarDecl>(*D)) {
if (VD->getIdentifier() &&
*VD->getIdentifier()->getNameStart() == 'x') {
Decl *Merged = Importer.Import(VD);
(void)Merged;
}
} else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(*D)) {
if (FD->getIdentifier() &&
*FD->getIdentifier()->getNameStart() == 'f') {
Decl *Merged = Importer.Import(FD);
(void)Merged;
}
}
}
delete Unit;