aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Symbol/ClangExternalASTSourceCallbacks.cpp
diff options
context:
space:
mode:
authorKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
committerKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
commitb9c1b51e45b845debb76d8658edabca70ca56079 (patch)
treedfcb5a13ef2b014202340f47036da383eaee74aa /lldb/source/Symbol/ClangExternalASTSourceCallbacks.cpp
parentd5aa73376966339caad04013510626ec2e42c760 (diff)
downloadllvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip
llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz
llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.bz2
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
Diffstat (limited to 'lldb/source/Symbol/ClangExternalASTSourceCallbacks.cpp')
-rw-r--r--lldb/source/Symbol/ClangExternalASTSourceCallbacks.cpp238
1 files changed, 126 insertions, 112 deletions
diff --git a/lldb/source/Symbol/ClangExternalASTSourceCallbacks.cpp b/lldb/source/Symbol/ClangExternalASTSourceCallbacks.cpp
index 6c804f4..e39baea 100644
--- a/lldb/source/Symbol/ClangExternalASTSourceCallbacks.cpp
+++ b/lldb/source/Symbol/ClangExternalASTSourceCallbacks.cpp
@@ -13,7 +13,7 @@
// C++ Includes
// Other libraries and framework includes
-// Clang headers like to use NDEBUG inside of them to enable/disable debug
+// Clang headers like to use NDEBUG inside of them to enable/disable debug
// related features using "#ifndef NDEBUG" preprocessor blocks to do one thing
// or another. This is bad because it means that if clang was built in release
// mode, it assumes that you are building in release mode which is not always
@@ -46,131 +46,145 @@
using namespace clang;
using namespace lldb_private;
-bool
-ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName
-(
+bool ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(
const clang::DeclContext *decl_ctx,
- clang::DeclarationName clang_decl_name
-)
-{
- if (m_callback_find_by_name)
- {
- llvm::SmallVector <clang::NamedDecl *, 3> results;
-
- m_callback_find_by_name (m_callback_baton, decl_ctx, clang_decl_name, &results);
-
- SetExternalVisibleDeclsForName(decl_ctx, clang_decl_name, results);
-
- return (results.size() != 0);
- }
-
- std::string decl_name (clang_decl_name.getAsString());
-
- switch (clang_decl_name.getNameKind()) {
- // Normal identifiers.
- case clang::DeclarationName::Identifier:
- //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"Identifier\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
- if (clang_decl_name.getAsIdentifierInfo()->getBuiltinID() != 0)
- {
- SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- return false;
- }
- break;
-
- case clang::DeclarationName::ObjCZeroArgSelector:
- //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"ObjCZeroArgSelector\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
- SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- return false;
-
- case clang::DeclarationName::ObjCOneArgSelector:
- //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"ObjCOneArgSelector\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
- SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- return false;
-
- case clang::DeclarationName::ObjCMultiArgSelector:
- //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"ObjCMultiArgSelector\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
- SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- return false;
-
- case clang::DeclarationName::CXXConstructorName:
- //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXConstructorName\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
- SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- return false;
-
-
- case clang::DeclarationName::CXXDestructorName:
- //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXDestructorName\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
- SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- return false;
-
- case clang::DeclarationName::CXXConversionFunctionName:
- //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXConversionFunctionName\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
- SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- return false;
-
- case clang::DeclarationName::CXXOperatorName:
- //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXOperatorName\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
- SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- return false;
-
- case clang::DeclarationName::CXXLiteralOperatorName:
- //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXLiteralOperatorName\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
- SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- return false;
-
- case clang::DeclarationName::CXXUsingDirective:
- //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXUsingDirective\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
- SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- return false;
+ clang::DeclarationName clang_decl_name) {
+ if (m_callback_find_by_name) {
+ llvm::SmallVector<clang::NamedDecl *, 3> results;
+
+ m_callback_find_by_name(m_callback_baton, decl_ctx, clang_decl_name,
+ &results);
+
+ SetExternalVisibleDeclsForName(decl_ctx, clang_decl_name, results);
+
+ return (results.size() != 0);
+ }
+
+ std::string decl_name(clang_decl_name.getAsString());
+
+ switch (clang_decl_name.getNameKind()) {
+ // Normal identifiers.
+ case clang::DeclarationName::Identifier:
+ // printf
+ // ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
+ // = %p, decl_name = { kind = \"Identifier\", name = \"%s\")\n", decl_ctx,
+ // decl_name.c_str());
+ if (clang_decl_name.getAsIdentifierInfo()->getBuiltinID() != 0) {
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
}
+ break;
+
+ case clang::DeclarationName::ObjCZeroArgSelector:
+ // printf
+ // ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
+ // = %p, decl_name = { kind = \"ObjCZeroArgSelector\", name = \"%s\")\n",
+ // decl_ctx, decl_name.c_str());
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
+
+ case clang::DeclarationName::ObjCOneArgSelector:
+ // printf
+ // ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
+ // = %p, decl_name = { kind = \"ObjCOneArgSelector\", name = \"%s\")\n",
+ // decl_ctx, decl_name.c_str());
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
+
+ case clang::DeclarationName::ObjCMultiArgSelector:
+ // printf
+ // ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
+ // = %p, decl_name = { kind = \"ObjCMultiArgSelector\", name = \"%s\")\n",
+ // decl_ctx, decl_name.c_str());
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
+
+ case clang::DeclarationName::CXXConstructorName:
+ // printf
+ // ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
+ // = %p, decl_name = { kind = \"CXXConstructorName\", name = \"%s\")\n",
+ // decl_ctx, decl_name.c_str());
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
+
+ case clang::DeclarationName::CXXDestructorName:
+ // printf
+ // ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
+ // = %p, decl_name = { kind = \"CXXDestructorName\", name = \"%s\")\n",
+ // decl_ctx, decl_name.c_str());
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
+
+ case clang::DeclarationName::CXXConversionFunctionName:
+ // printf
+ // ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
+ // = %p, decl_name = { kind = \"CXXConversionFunctionName\", name =
+ // \"%s\")\n", decl_ctx, decl_name.c_str());
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
+ case clang::DeclarationName::CXXOperatorName:
+ // printf
+ // ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
+ // = %p, decl_name = { kind = \"CXXOperatorName\", name = \"%s\")\n",
+ // decl_ctx, decl_name.c_str());
SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
return false;
+
+ case clang::DeclarationName::CXXLiteralOperatorName:
+ // printf
+ // ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
+ // = %p, decl_name = { kind = \"CXXLiteralOperatorName\", name = \"%s\")\n",
+ // decl_ctx, decl_name.c_str());
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
+
+ case clang::DeclarationName::CXXUsingDirective:
+ // printf
+ // ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
+ // = %p, decl_name = { kind = \"CXXUsingDirective\", name = \"%s\")\n",
+ // decl_ctx, decl_name.c_str());
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
+ }
+
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
}
-void
-ClangExternalASTSourceCallbacks::CompleteType (TagDecl *tag_decl)
-{
- if (m_callback_tag_decl)
- m_callback_tag_decl (m_callback_baton, tag_decl);
+void ClangExternalASTSourceCallbacks::CompleteType(TagDecl *tag_decl) {
+ if (m_callback_tag_decl)
+ m_callback_tag_decl(m_callback_baton, tag_decl);
}
-void
-ClangExternalASTSourceCallbacks::CompleteType (ObjCInterfaceDecl *objc_decl)
-{
- if (m_callback_objc_decl)
- m_callback_objc_decl (m_callback_baton, objc_decl);
+void ClangExternalASTSourceCallbacks::CompleteType(
+ ObjCInterfaceDecl *objc_decl) {
+ if (m_callback_objc_decl)
+ m_callback_objc_decl(m_callback_baton, objc_decl);
}
-bool
-ClangExternalASTSourceCallbacks::layoutRecordType(
+bool ClangExternalASTSourceCallbacks::layoutRecordType(
const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets)
-{
- if (m_callback_layout_record_type)
- return m_callback_layout_record_type(m_callback_baton,
- Record,
- Size,
- Alignment,
- FieldOffsets,
- BaseOffsets,
- VirtualBaseOffsets);
-
- return false;
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+ &VirtualBaseOffsets) {
+ if (m_callback_layout_record_type)
+ return m_callback_layout_record_type(m_callback_baton, Record, Size,
+ Alignment, FieldOffsets, BaseOffsets,
+ VirtualBaseOffsets);
+
+ return false;
}
-void
-ClangExternalASTSourceCallbacks::FindExternalLexicalDecls (const clang::DeclContext *decl_ctx,
- llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant,
- llvm::SmallVectorImpl<clang::Decl *> &decls)
-{
- if (m_callback_tag_decl && decl_ctx)
- {
- clang::TagDecl *tag_decl = llvm::dyn_cast<clang::TagDecl>(const_cast<clang::DeclContext *>(decl_ctx));
- if (tag_decl)
- CompleteType(tag_decl);
- }
+void ClangExternalASTSourceCallbacks::FindExternalLexicalDecls(
+ const clang::DeclContext *decl_ctx,
+ llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant,
+ llvm::SmallVectorImpl<clang::Decl *> &decls) {
+ if (m_callback_tag_decl && decl_ctx) {
+ clang::TagDecl *tag_decl = llvm::dyn_cast<clang::TagDecl>(
+ const_cast<clang::DeclContext *>(decl_ctx));
+ if (tag_decl)
+ CompleteType(tag_decl);
+ }
}
-