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 | bb7930c17e9831c3499bbbf1703cca408f0b83b7 (patch) | |
tree | 8412469afce189026118c98b620ab182e70eeb8a /clang/lib/Frontend/ASTMerge.cpp | |
parent | cc152d61596078d5682919189e424fea405708bc (diff) | |
download | bcm5719-llvm-bb7930c17e9831c3499bbbf1703cca408f0b83b7.tar.gz bcm5719-llvm-bb7930c17e9831c3499bbbf1703cca408f0b83b7.zip |
Implement basic support for merging function declarations across
translation units.
llvm-svn: 95794
Diffstat (limited to 'clang/lib/Frontend/ASTMerge.cpp')
-rw-r--r-- | clang/lib/Frontend/ASTMerge.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/Frontend/ASTMerge.cpp b/clang/lib/Frontend/ASTMerge.cpp index f2de09a74cc..fd34ddae12b 100644 --- a/clang/lib/Frontend/ASTMerge.cpp +++ b/clang/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; |