[Lldb-commits] [lldb] r346156 - Properly cast from DeclContext to Decl.
Zachary Turner via lldb-commits
lldb-commits at lists.llvm.org
Mon Nov 5 11:25:39 PST 2018
Author: zturner
Date: Mon Nov 5 11:25:39 2018
New Revision: 346156
URL: http://llvm.org/viewvc/llvm-project?rev=346156&view=rev
Log:
Properly cast from DeclContext to Decl.
Apparently there's a special procedure for doing this. Not
following this silently breaks builds.
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/source/Symbol/ClangASTContext.cpp
Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=346156&r1=346155&r2=346156&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Mon Nov 5 11:25:39 2018
@@ -194,10 +194,9 @@ public:
uint32_t GetPointerByteSize() override;
- static clang::TranslationUnitDecl *
- GetTranslationUnitDecl(clang::ASTContext *ast);
+ static clang::DeclContext *GetTranslationUnitDecl(clang::ASTContext *ast);
- clang::TranslationUnitDecl *GetTranslationUnitDecl() {
+ clang::DeclContext *GetTranslationUnitDecl() {
return GetTranslationUnitDecl(getASTContext());
}
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=346156&r1=346155&r2=346156&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Mon Nov 5 11:25:39 2018
@@ -1285,7 +1285,7 @@ CompilerType ClangASTContext::GetCString
return CompilerType(ast, ast->getPointerType(char_type));
}
-clang::TranslationUnitDecl *
+clang::DeclContext *
ClangASTContext::GetTranslationUnitDecl(clang::ASTContext *ast) {
return ast->getTranslationUnitDecl();
}
@@ -8966,7 +8966,7 @@ ClangASTContext::ConvertStringToFloatVal
#define DEPTH_INCREMENT 2
void ClangASTContext::Dump(Stream &s) {
- TranslationUnitDecl *tu = GetTranslationUnitDecl();
+ Decl *tu = Decl::castFromDeclContext(GetTranslationUnitDecl());
tu->dump(s.AsRawOstream());
}
More information about the lldb-commits
mailing list