summaryrefslogtreecommitdiffstats
path: root/lldb/source/Symbol/ClangUtil.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2018-12-17 16:15:13 +0000
committerZachary Turner <zturner@google.com>2018-12-17 16:15:13 +0000
commit1639c6bbb186c733ffb4f54c9f77522f262fe2ba (patch)
tree35af036db10a9a2c44fda9485e1019e60ad1c374 /lldb/source/Symbol/ClangUtil.cpp
parentb472512a77884a1f9a89bcec80f4a4709d0a6ecf (diff)
downloadbcm5719-llvm-1639c6bbb186c733ffb4f54c9f77522f262fe2ba.tar.gz
bcm5719-llvm-1639c6bbb186c733ffb4f54c9f77522f262fe2ba.zip
[Clang AST Context] Add a few helper functions.
The first one allows us to add an enumerator to an enum if we already have an APSInt, since ultimately the implementation just constructs one anyway. The second is just a general utility function to covert a CompilerType to a clang::TagDecl. llvm-svn: 349360
Diffstat (limited to 'lldb/source/Symbol/ClangUtil.cpp')
-rw-r--r--lldb/source/Symbol/ClangUtil.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lldb/source/Symbol/ClangUtil.cpp b/lldb/source/Symbol/ClangUtil.cpp
index 7a67df48ee6..687fba7c7c3 100644
--- a/lldb/source/Symbol/ClangUtil.cpp
+++ b/lldb/source/Symbol/ClangUtil.cpp
@@ -48,3 +48,11 @@ CompilerType ClangUtil::RemoveFastQualifiers(const CompilerType &ct) {
qual_type.removeLocalFastQualifiers();
return CompilerType(ct.GetTypeSystem(), qual_type.getAsOpaquePtr());
}
+
+clang::TagDecl *ClangUtil::GetAsTagDecl(const CompilerType &type) {
+ clang::QualType qual_type = ClangUtil::GetCanonicalQualType(type);
+ if (qual_type.isNull())
+ return nullptr;
+
+ return qual_type->getAsTagDecl();
+}
OpenPOWER on IntegriCloud