Updated to LLVM/Clang revision 127600.

llvm-svn: 127634
This commit is contained in:
Sean Callanan 2011-03-15 00:17:19 +00:00
parent dfeda09345
commit fb0b7583a7
10 changed files with 107 additions and 24 deletions

View File

@ -120,6 +120,7 @@ namespace clang
namespace llvm
{
class LLVMContext;
class ExecutionEngine;
}

View File

@ -178,6 +178,7 @@ private:
ClangExpression &m_expr; ///< The expression to be parsed
std::auto_ptr<llvm::LLVMContext> m_llvm_context; ///< The LLVM context to generate IR into
std::auto_ptr<clang::FileManager> m_file_manager; ///< The Clang file manager object used by the compiler
std::auto_ptr<clang::CompilerInstance> m_compiler; ///< The Clang compiler used to parse expressions into IR
std::auto_ptr<clang::Builtin::Context> m_builtin_context; ///< Context for Clang built-ins

View File

@ -25,7 +25,7 @@ our @llvm_clang_slices; # paths to the single architecture static libraries (arc
our $llvm_configuration = $ENV{LLVM_CONFIGURATION};
our $llvm_revision = "124349";
our $llvm_revision = "127600";
our $llvm_source_dir = "$ENV{SRCROOT}";
our $cc = "$ENV{DEVELOPER_BIN_DIR}/gcc-4.2";
our $cxx = "$ENV{DEVELOPER_BIN_DIR}/g++-4.2";
@ -81,6 +81,7 @@ our @archive_files = (
"$llvm_configuration/lib/libLLVMX86CodeGen.a",
"$llvm_configuration/lib/libLLVMX86Disassembler.a",
"$llvm_configuration/lib/libLLVMX86Info.a",
"$llvm_configuration/lib/libLLVMX86Utils.a",
);
if (-l $llvm_dstroot)

View File

@ -320,6 +320,7 @@ ASTResultSynthesizer::SynthesizeBodyResult (CompoundStmt *Body,
result_decl = VarDecl::Create(Ctx,
DC,
SourceLocation(),
SourceLocation(),
&result_ptr_id,
ptr_qual_type,
NULL,
@ -331,7 +332,7 @@ ASTResultSynthesizer::SynthesizeBodyResult (CompoundStmt *Body,
ExprResult address_of_expr = m_sema->CreateBuiltinUnaryOp(SourceLocation(), UO_AddrOf, last_expr);
m_sema->AddInitializerToDecl(result_decl, address_of_expr.take());
m_sema->AddInitializerToDecl(result_decl, address_of_expr.take(), true, true);
}
else
{
@ -339,7 +340,8 @@ ASTResultSynthesizer::SynthesizeBodyResult (CompoundStmt *Body,
result_decl = VarDecl::Create(Ctx,
DC,
SourceLocation(),
SourceLocation(),
SourceLocation(),
&result_id,
expr_qual_type,
NULL,
@ -349,7 +351,7 @@ ASTResultSynthesizer::SynthesizeBodyResult (CompoundStmt *Body,
if (!result_decl)
return false;
m_sema->AddInitializerToDecl(result_decl, last_expr);
m_sema->AddInitializerToDecl(result_decl, last_expr, true, true);
}
DC->addDecl(result_decl);

View File

@ -75,9 +75,9 @@ ASTStructExtractor::ExtractFromFunctionDecl(FunctionDecl *F)
if (!struct_layout)
return;
m_function.m_struct_size = struct_layout->getSize() / 8; // Clang returns sizes in bits.
m_function.m_struct_size = struct_layout->getSize().getQuantity(); // TODO Store m_struct_size as CharUnits
m_function.m_return_offset = struct_layout->getFieldOffset(struct_layout->getFieldCount() - 1) / 8;
m_function.m_return_size = (struct_layout->getDataSize() / 8) - m_function.m_return_offset;
m_function.m_return_size = struct_layout->getDataSize().getQuantity() - m_function.m_return_offset;
for (unsigned field_index = 0, num_fields = struct_layout->getFieldCount();
field_index < num_fields;

View File

@ -159,6 +159,7 @@ NameSearchContext::AddVarDecl(void *type)
clang::NamedDecl *Decl = VarDecl::Create(m_ast_source.m_ast_context,
const_cast<DeclContext*>(m_decl_context),
SourceLocation(),
SourceLocation(),
ii,
QualType::getFromOpaquePtr(type),
0,
@ -175,6 +176,7 @@ NameSearchContext::AddFunDecl (void *type)
clang::FunctionDecl *func_decl = FunctionDecl::Create (m_ast_source.m_ast_context,
const_cast<DeclContext*>(m_decl_context),
SourceLocation(),
SourceLocation(),
m_decl_name.getAsIdentifierInfo(),
QualType::getFromOpaquePtr(type),
NULL,
@ -204,6 +206,7 @@ NameSearchContext::AddFunDecl (void *type)
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,

View File

@ -47,13 +47,13 @@
#include "clang/Parse/ParseAST.h"
#include "clang/Rewrite/FrontendActions.h"
#include "clang/Sema/SemaConsumer.h"
#include "clang/StaticAnalyzer/FrontendActions.h"
#include "clang/StaticAnalyzer/Frontend/FrontendActions.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include "llvm/ExecutionEngine/JIT.h"
#include "llvm/Module.h"
#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/DynamicLibrary.h"
@ -112,7 +112,7 @@ static FrontendAction *CreateFrontendBaseAction(CompilerInstance &CI) {
case ASTDump: return new ASTDumpAction();
case ASTPrint: return new ASTPrintAction();
case ASTPrintXML: return new ASTPrintXMLAction();
case ASTDumpXML: return new ASTDumpXMLAction();
case ASTView: return new ASTViewAction();
case BoostCon: return new BoostConAction();
case DumpRawTokens: return new DumpRawTokensAction();
@ -127,7 +127,6 @@ static FrontendAction *CreateFrontendBaseAction(CompilerInstance &CI) {
case FixIt: return new FixItAction();
case GeneratePCH: return new GeneratePCHAction();
case GeneratePTH: return new GeneratePTHAction();
case InheritanceView: return new InheritanceViewAction();
case InitOnly: return new InitOnlyAction();
case ParseSyntaxOnly: return new SyntaxOnlyAction();
@ -196,7 +195,6 @@ ClangExpressionParser::ClangExpressionParser (ExecutionContextScope *exe_scope,
// 1. Create a new compiler instance.
m_compiler.reset(new CompilerInstance());
m_compiler->setLLVMContext(new LLVMContext());
// 2. Set options.
@ -305,10 +303,11 @@ ClangExpressionParser::ClangExpressionParser (ExecutionContextScope *exe_scope,
std::string module_name("$__lldb_module");
m_llvm_context.reset(new LLVMContext());
m_code_generator.reset(CreateLLVMCodeGen(m_compiler->getDiagnostics(),
module_name,
m_compiler->getCodeGenOpts(),
m_compiler->getLLVMContext()));
*m_llvm_context));
}
ClangExpressionParser::~ClangExpressionParser()

View File

@ -29,8 +29,7 @@ DynamicLoaderStatic::CreateInstance (Process* process, bool force)
{
const llvm::Triple &triple_ref = process->GetTarget().GetArchitecture().GetTriple();
const llvm::Triple::OSType os_type = triple_ref.getOS();
if ((os_type == llvm::Triple::UnknownOS) ||
(os_type == llvm::Triple::NoOS))
if ((os_type == llvm::Triple::UnknownOS))
create = true;
}

View File

@ -195,10 +195,14 @@ ParseLangArgs
switch (IK) {
case IK_None:
case IK_AST:
case IK_LLVM_IR:
assert (!"Invalid input kind!");
case IK_OpenCL:
LangStd = LangStandard::lang_opencl;
break;
case IK_CUDA:
LangStd = LangStandard::lang_cuda;
break;
case IK_Asm:
case IK_C:
case IK_PreprocessedC:
@ -1050,6 +1054,7 @@ ClangASTContext::CreateRecordType (const char *name, int kind, DeclContext *decl
(TagDecl::TagKind)kind,
decl_ctx,
SourceLocation(),
SourceLocation(),
name && name[0] ? &ast->Idents.get(name) : NULL);
return ast->getTagDeclType(decl).getAsOpaquePtr();
@ -1388,6 +1393,7 @@ ClangASTContext::AddMethodToCXXRecordType
{
cxx_method_decl = CXXDestructorDecl::Create (*ast,
cxx_record_decl,
SourceLocation(),
DeclarationNameInfo (ast->DeclarationNames.getCXXDestructorName (ast->getCanonicalType (record_qual_type)), SourceLocation()),
method_qual_type,
NULL,
@ -1398,6 +1404,7 @@ ClangASTContext::AddMethodToCXXRecordType
{
cxx_method_decl = CXXConstructorDecl::Create (*ast,
cxx_record_decl,
SourceLocation(),
DeclarationNameInfo (ast->DeclarationNames.getCXXConstructorName (ast->getCanonicalType (record_qual_type)), SourceLocation()),
method_qual_type,
NULL, // TypeSourceInfo *
@ -1415,23 +1422,27 @@ ClangASTContext::AddMethodToCXXRecordType
{
cxx_method_decl = CXXMethodDecl::Create (*ast,
cxx_record_decl,
SourceLocation(),
DeclarationNameInfo (ast->DeclarationNames.getCXXOperatorName (op_kind), SourceLocation()),
method_qual_type,
NULL, // TypeSourceInfo *
is_static,
SC_None,
is_inline);
is_inline,
SourceLocation());
}
else if (num_params == 0)
{
// Conversion operators don't take params...
cxx_method_decl = CXXConversionDecl::Create (*ast,
cxx_record_decl,
SourceLocation(),
DeclarationNameInfo (ast->DeclarationNames.getCXXConversionFunctionName (ast->getCanonicalType (function_Type->getResultType())), SourceLocation()),
method_qual_type,
NULL, // TypeSourceInfo *
is_inline,
is_explicit);
is_explicit,
SourceLocation());
}
}
@ -1439,12 +1450,14 @@ ClangASTContext::AddMethodToCXXRecordType
{
cxx_method_decl = CXXMethodDecl::Create (*ast,
cxx_record_decl,
SourceLocation(),
DeclarationNameInfo (decl_name, SourceLocation()),
method_qual_type,
NULL, // TypeSourceInfo *
is_static,
SC_None,
is_inline);
is_inline,
SourceLocation());
}
}
@ -1464,6 +1477,7 @@ ClangASTContext::AddMethodToCXXRecordType
params[param_index] = ParmVarDecl::Create (*ast,
cxx_method_decl,
SourceLocation(),
SourceLocation(),
NULL, // anonymous
method_function_prototype->getArgType(param_index),
NULL,
@ -1527,6 +1541,7 @@ ClangASTContext::AddFieldToRecordType
FieldDecl *field = FieldDecl::Create (*ast,
record_decl,
SourceLocation(),
SourceLocation(),
name ? &identifier_table->get(name) : NULL, // Identifier
QualType::getFromOpaquePtr(field_type), // Field type
NULL, // DeclaratorInfo *
@ -1790,6 +1805,7 @@ ClangASTContext::AddObjCClassIVar
ObjCIvarDecl *field = ObjCIvarDecl::Create (*ast,
class_interface_decl,
SourceLocation(),
SourceLocation(),
&identifier_table->get(name), // Identifier
QualType::getFromOpaquePtr(ivar_opaque_type), // Field type
NULL, // TypeSourceInfo *
@ -1957,6 +1973,7 @@ ClangASTContext::AddMethodToObjCObjectType
params.push_back (ParmVarDecl::Create (*ast,
objc_method_decl,
SourceLocation(),
SourceLocation(),
NULL, // anonymous
method_function_prototype->getArgType(param_index),
NULL,
@ -2328,7 +2345,6 @@ ClangASTContext::GetNumPointeeChildren (clang_type_t clang_type)
case clang::BuiltinType::LongDouble:
case clang::BuiltinType::Dependent:
case clang::BuiltinType::Overload:
case clang::BuiltinType::UndeducedAuto:
case clang::BuiltinType::ObjCId:
case clang::BuiltinType::ObjCClass:
case clang::BuiltinType::ObjCSel:
@ -3515,7 +3531,9 @@ ClangASTContext::GetDeclContextForType (clang_type_t clang_type)
case clang::Type::IncompleteArray: break;
case clang::Type::VariableArray: break;
case clang::Type::ConstantArray: break;
case clang::Type::DependentSizedArray: break;
case clang::Type::ExtVector: break;
case clang::Type::DependentSizedExtVector: break;
case clang::Type::Vector: break;
case clang::Type::Builtin: break;
case clang::Type::BlockPointer: break;
@ -3536,6 +3554,18 @@ ClangASTContext::GetDeclContextForType (clang_type_t clang_type)
case clang::Type::Decltype: break;
//case clang::Type::QualifiedName: break;
case clang::Type::TemplateSpecialization: break;
case clang::Type::DependentTemplateSpecialization: break;
case clang::Type::TemplateTypeParm: break;
case clang::Type::SubstTemplateTypeParm: break;
case clang::Type::SubstTemplateTypeParmPack:break;
case clang::Type::PackExpansion: break;
case clang::Type::UnresolvedUsing: break;
case clang::Type::Paren: break;
case clang::Type::Elaborated: break;
case clang::Type::Attributed: break;
case clang::Type::Auto: break;
case clang::Type::InjectedClassName: break;
case clang::Type::DependentName: break;
}
// No DeclContext in this type...
return NULL;
@ -3553,7 +3583,7 @@ ClangASTContext::GetUniqueNamespaceDeclaration (const char *name, const Declarat
ASTContext *ast = getASTContext();
if (decl_ctx == NULL)
decl_ctx = ast->getTranslationUnitDecl();
return NamespaceDecl::Create(*ast, decl_ctx, SourceLocation(), &ast->Idents.get(name));
return NamespaceDecl::Create(*ast, decl_ctx, SourceLocation(), SourceLocation(), &ast->Idents.get(name));
}
return NULL;
}
@ -3574,6 +3604,7 @@ ClangASTContext::CreateFunctionDeclaration (const char *name, clang_type_t funct
return FunctionDecl::Create(*ast,
ast->getTranslationUnitDecl(),
SourceLocation(),
SourceLocation(),
DeclarationName (&ast->Idents.get(name)),
QualType::getFromOpaquePtr(function_clang_type),
NULL,
@ -3586,6 +3617,7 @@ ClangASTContext::CreateFunctionDeclaration (const char *name, clang_type_t funct
return FunctionDecl::Create(*ast,
ast->getTranslationUnitDecl(),
SourceLocation(),
SourceLocation(),
DeclarationName (),
QualType::getFromOpaquePtr(function_clang_type),
NULL,
@ -3613,9 +3645,9 @@ ClangASTContext::CreateFunctionType (ASTContext *ast,
// TODO: Detect calling convention in DWARF?
FunctionProtoType::ExtProtoInfo proto_info;
proto_info.Variadic = is_variadic;
proto_info.HasExceptionSpec = false;
proto_info.HasAnyExceptionSpec = false;
proto_info.ExceptionSpecType = EST_None;
proto_info.TypeQuals = type_quals;
proto_info.RefQualifier = RQ_None;
proto_info.NumExceptions = 0;
proto_info.Exceptions = NULL;
@ -3633,6 +3665,7 @@ ClangASTContext::CreateParameterDeclaration (const char *name, clang_type_t para
return ParmVarDecl::Create(*ast,
ast->getTranslationUnitDecl(),
SourceLocation(),
SourceLocation(),
name && name[0] ? &ast->Idents.get(name) : NULL,
QualType::getFromOpaquePtr(param_type),
NULL,
@ -3779,8 +3812,8 @@ ClangASTContext::CreateEnumerationType
EnumDecl *enum_decl = EnumDecl::Create (*ast,
decl_ctx,
SourceLocation(),
name && name[0] ? &ast->Idents.get(name) : NULL,
SourceLocation(),
name && name[0] ? &ast->Idents.get(name) : NULL,
NULL,
false, // IsScoped
false, // IsScopedUsingClassTag
@ -4186,6 +4219,8 @@ ClangASTContext::IsFunctionPointerType (clang_type_t clang_type)
const clang::Type::TypeClass type_class = qual_type->getTypeClass();
switch (type_class)
{
default:
break;
case clang::Type::Typedef:
return ClangASTContext::IsFunctionPointerType (cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
@ -4225,6 +4260,8 @@ ClangASTContext::IsArrayType (clang_type_t clang_type, clang_type_t*member_type,
const clang::Type::TypeClass type_class = qual_type->getTypeClass();
switch (type_class)
{
default:
break;
case clang::Type::ConstantArray:
if (member_type)
*member_type = cast<ConstantArrayType>(qual_type)->getElementType().getAsOpaquePtr();
@ -4271,6 +4308,7 @@ ClangASTContext::CreateTypedefType (const char *name, clang_type_t clang_type, D
TypedefDecl *decl = TypedefDecl::Create (*ast,
decl_ctx,
SourceLocation(),
SourceLocation(),
name ? &identifier_table->get(name) : NULL, // Identifier
ast->CreateTypeSourceInfo(qual_type));

View File

@ -202,6 +202,22 @@ ClangASTType::GetEncoding (clang_type_t clang_type, uint32_t &count)
return GetEncoding(cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(), count);
break;
case clang::Type::DependentSizedArray:
case clang::Type::DependentSizedExtVector:
case clang::Type::UnresolvedUsing:
case clang::Type::Paren:
case clang::Type::Elaborated:
case clang::Type::Attributed:
case clang::Type::TemplateTypeParm:
case clang::Type::SubstTemplateTypeParm:
case clang::Type::SubstTemplateTypeParmPack:
case clang::Type::Auto:
case clang::Type::InjectedClassName:
case clang::Type::DependentName:
case clang::Type::DependentTemplateSpecialization:
case clang::Type::PackExpansion:
case clang::Type::ObjCObject:
case clang::Type::TypeOfExpr:
case clang::Type::TypeOf:
case clang::Type::Decltype:
@ -243,7 +259,7 @@ ClangASTType::GetFormat (clang_type_t clang_type)
case clang::Type::Builtin:
switch (cast<clang::BuiltinType>(qual_type)->getKind())
{
default: assert(0 && "Unknown builtin type!");
//default: assert(0 && "Unknown builtin type!");
case clang::BuiltinType::Void:
break;
@ -272,7 +288,6 @@ ClangASTType::GetFormat (clang_type_t clang_type)
case clang::BuiltinType::NullPtr:
case clang::BuiltinType::Overload:
case clang::BuiltinType::Dependent:
case clang::BuiltinType::UndeducedAuto:
case clang::BuiltinType::ObjCId:
case clang::BuiltinType::ObjCClass:
case clang::BuiltinType::ObjCSel: return lldb::eFormatHex;
@ -297,6 +312,22 @@ ClangASTType::GetFormat (clang_type_t clang_type)
case clang::Type::Typedef:
return ClangASTType::GetFormat(cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
case clang::Type::DependentSizedArray:
case clang::Type::DependentSizedExtVector:
case clang::Type::UnresolvedUsing:
case clang::Type::Paren:
case clang::Type::Elaborated:
case clang::Type::Attributed:
case clang::Type::TemplateTypeParm:
case clang::Type::SubstTemplateTypeParm:
case clang::Type::SubstTemplateTypeParmPack:
case clang::Type::Auto:
case clang::Type::InjectedClassName:
case clang::Type::DependentName:
case clang::Type::DependentTemplateSpecialization:
case clang::Type::PackExpansion:
case clang::Type::ObjCObject:
case clang::Type::TypeOfExpr:
case clang::Type::TypeOf:
case clang::Type::Decltype:
@ -1068,6 +1099,10 @@ ClangASTType::GetValueAsScalar
uint32_t offset = data_byte_offset;
switch (encoding)
{
case lldb::eEncodingInvalid:
break;
case lldb::eEncodingVector:
break;
case lldb::eEncodingUint:
if (byte_size <= sizeof(unsigned long long))
{
@ -1210,6 +1245,10 @@ ClangASTType::SetValueFromScalar
uint32_t byte_size = (bit_width + 7 ) / 8;
switch (encoding)
{
case lldb::eEncodingInvalid:
break;
case lldb::eEncodingVector:
break;
case lldb::eEncodingUint:
switch (byte_size)
{