summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangASTSource.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2010-06-22 23:46:24 +0000
committerSean Callanan <scallanan@apple.com>2010-06-22 23:46:24 +0000
commit468574bd34b2f0e03bfcfcbcf9c1b01c94afea9a (patch)
tree28149ea4a0fdc35db1598b21b6b0816f6f6b1bbd /lldb/source/Expression/ClangASTSource.cpp
parent8d87a1f30ac82ff7373fb13fde03b4349783d9eb (diff)
downloadbcm5719-llvm-468574bd34b2f0e03bfcfcbcf9c1b01c94afea9a.tar.gz
bcm5719-llvm-468574bd34b2f0e03bfcfcbcf9c1b01c94afea9a.zip
Added support to the expression parser for locating
externally-defined functions. llvm-svn: 106606
Diffstat (limited to 'lldb/source/Expression/ClangASTSource.cpp')
-rw-r--r--lldb/source/Expression/ClangASTSource.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp
index 3bae8b38380..3c18b70b6d4 100644
--- a/lldb/source/Expression/ClangASTSource.cpp
+++ b/lldb/source/Expression/ClangASTSource.cpp
@@ -97,3 +97,50 @@ clang::NamedDecl *NameSearchContext::AddVarDecl(void *type) {
return Decl;
}
+
+clang::NamedDecl *NameSearchContext::AddFunDecl(void *type) {
+ clang::FunctionDecl *Decl = FunctionDecl::Create(ASTSource.Context,
+ const_cast<DeclContext*>(DC),
+ SourceLocation(),
+ Name.getAsIdentifierInfo(),
+ QualType::getFromOpaquePtr(type),
+ NULL,
+ FunctionDecl::Static,
+ FunctionDecl::Static,
+ false,
+ true);
+
+ QualType QT = QualType::getFromOpaquePtr(type);
+ clang::Type *T = QT.getTypePtr();
+
+ if (T->isFunctionProtoType())
+ {
+ FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(T);
+
+ unsigned NumArgs = FPT->getNumArgs();
+ unsigned ArgIndex;
+
+ ParmVarDecl *ParmVarDecls[NumArgs];
+
+ for (ArgIndex = 0; ArgIndex < NumArgs; ++ArgIndex)
+ {
+ QualType ArgQT = FPT->getArgType(ArgIndex);
+
+ ParmVarDecls[ArgIndex] = ParmVarDecl::Create(ASTSource.Context,
+ const_cast<DeclContext*>(DC),
+ SourceLocation(),
+ NULL,
+ ArgQT,
+ NULL,
+ ParmVarDecl::Static,
+ ParmVarDecl::Static,
+ NULL);
+ }
+
+ Decl->setParams(ParmVarDecls, NumArgs);
+ }
+
+ Decls.push_back(Decl);
+
+ return Decl;
+}
OpenPOWER on IntegriCloud