[lldb-dev] llvm/clang source revs on Linux

dawn at burble.org dawn at burble.org
Tue Sep 27 15:07:32 PDT 2011


When are folks planning to start using a later revision of llvm/clang for the
Linux port?  In my troubles to get lldb building on Linux using the documented
revision, I updated to the current llvm and clang revs.  I've attached a patch
which gets me over some of the initial errors until I get to the following
error:

[...]
ClangExpressionParser.cpp: In function 'void LLVMErrorHandler(void*,
	        const std::string&)':
ClangExpressionParser.cpp:108:11: error: 'class clang::Diagnostic' has
no member named 'Report'
ClangExpressionParser.cpp: In function 'clang::FrontendAction*
CreateFrontendBaseAction(clang::CompilerInstance&)':
ClangExpressionParser.cpp:135:67: error: no matching function for call
to 'clang::GeneratePCHAction::GeneratePCHAction()'
[...]

The code is:
    static void LLVMErrorHandler(void *UserData, const std::string &Message) {
	Diagnostic &Diags = *static_cast<Diagnostic*>(UserData);

	Diags.Report(diag::err_fe_error_backend) << Message;
	    
	// We cannot recover from llvm errors.
	exit(1);
    }

Should this be using class DiagnosticsEngine instead of Diagnostic?
It's not obvious how or where LLVMErrorHandler is used, so I'm having
trouble figuring this one out. 

Would folks prefer that I continue down this path or backup and fix the 
documented revision?  

Thanks again,
-Dawn

-------------- next part --------------
Index: source/Expression/ASTDumper.cpp
===================================================================
--- source/Expression/ASTDumper.cpp	(revision 140618)
+++ source/Expression/ASTDumper.cpp	(working copy)
@@ -416,7 +416,11 @@
         switch (type->getScalarTypeKind())
         {
             default:                                m_stream.Printf("~\n"); break;
-            case clang::Type::STK_Pointer:          m_stream.Printf("STK_Pointer\n"); break;
+            case clang::Type::STK_CPointer:         m_stream.Printf("STK_CPointer\n"); break;
+            case clang::Type::STK_BlockPointer:     m_stream.Printf("STK_BlockPointer\n"); break;
+            case clang::Type::STK_ObjCObjectPointer:
+						    m_stream.Printf("STK_ObjCObjectPointer\n");
+						    break;
             case clang::Type::STK_MemberPointer:    m_stream.Printf("STK_MemberPointer\n"); break;
             case clang::Type::STK_Bool:             m_stream.Printf("STK_Bool\n"); break;
             case clang::Type::STK_Integral:         m_stream.Printf("STK_Integral\n"); break;
Index: source/Expression/ClangASTSource.cpp
===================================================================
--- source/Expression/ClangASTSource.cpp	(revision 140618)
+++ source/Expression/ClangASTSource.cpp	(working copy)
@@ -197,27 +197,27 @@
         unsigned NumArgs = func_proto_type->getNumArgs();
         unsigned ArgIndex;
         
-        ParmVarDecl **param_var_decls = new ParmVarDecl*[NumArgs];
+        SmallVector<ParmVarDecl *, 16> param_var_decls;
+	param_var_decls.reserve(NumArgs);
         
         for (ArgIndex = 0; ArgIndex < NumArgs; ++ArgIndex)
         {
             QualType arg_qual_type (func_proto_type->getArgType(ArgIndex));
             
-            param_var_decls[ArgIndex] = ParmVarDecl::Create (m_ast_source.m_ast_context,
-                                                             const_cast<DeclContext*>(m_decl_context),
-                                                             SourceLocation(),
-                                                             SourceLocation(),
-                                                             NULL,
-                                                             arg_qual_type,
-                                                             NULL,
-                                                             SC_Static,
-                                                             SC_Static,
-                                                             NULL);
+            ParmVarDecl *NewDecl = ParmVarDecl::Create (m_ast_source.m_ast_context,
+                                                        const_cast<DeclContext*>(m_decl_context),
+                                                        SourceLocation(),
+                                                        SourceLocation(),
+                                                        NULL,
+                                                        arg_qual_type,
+                                                        NULL,
+                                                        SC_Static,
+                                                        SC_Static,
+                                                        NULL);
+            param_var_decls.push_back(NewDecl);
         }
         
-        func_decl->setParams(param_var_decls, NumArgs);
-        
-        delete [] param_var_decls;
+        func_decl->setParams(param_var_decls);
     }
     
     m_decls.push_back(func_decl);
Index: source/Expression/ClangExpressionParser.cpp
===================================================================
--- source/Expression/ClangExpressionParser.cpp	(revision 140618)
+++ source/Expression/ClangExpressionParser.cpp	(working copy)
@@ -41,7 +41,7 @@
 #include "clang/Frontend/FrontendPluginRegistry.h"
 #include "clang/Frontend/TextDiagnosticBuffer.h"
 #include "clang/Frontend/TextDiagnosticPrinter.h"
-#include "clang/Frontend/VerifyDiagnosticsClient.h"
+#include "clang/Frontend/VerifyDiagnosticConsumer.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Parse/ParseAST.h"
 #include "clang/Rewrite/FrontendActions.h"
@@ -67,8 +67,8 @@
 #include "llvm/Support/DynamicLibrary.h"
 #include "llvm/Support/Host.h"
 #include "llvm/Support/Signals.h"
-#include "llvm/Target/TargetRegistry.h"
-#include "llvm/Target/TargetSelect.h"
+#include "llvm/Support/TargetRegistry.h"
+#include "llvm/Support/TargetSelect.h"
 
 using namespace clang;
 using namespace llvm;


More information about the lldb-dev mailing list