diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-02-10 19:54:31 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-02-10 19:54:31 +0000 |
commit | a404ea673cbee5e74af710a5f1ab571e71580b67 (patch) | |
tree | 717ca8b7974e8c1874186ad8ea4d89736c2eef9a /lib/Frontend/ASTMerge.cpp | |
parent | 4c863ef92c2b74572090da245c87e1487b0b596c (diff) |
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
Diffstat (limited to 'lib/Frontend/ASTMerge.cpp')
-rw-r--r-- | lib/Frontend/ASTMerge.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/Frontend/ASTMerge.cpp b/lib/Frontend/ASTMerge.cpp index f2de09a74c..fd34ddae12 100644 --- a/lib/Frontend/ASTMerge.cpp +++ b/lib/Frontend/ASTMerge.cpp @@ -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; |