Implement basic support for merging function declarations across
translation units.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95794 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/ASTMerge.cpp b/lib/Frontend/ASTMerge.cpp
index f2de09a..fd34dda 100644
--- a/lib/Frontend/ASTMerge.cpp
+++ b/lib/Frontend/ASTMerge.cpp
@@ -57,14 +57,21 @@
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;