summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2011-11-19 02:54:21 +0000
committerSean Callanan <scallanan@apple.com>2011-11-19 02:54:21 +0000
commit7f27d6044e5c31ec53ecdeb5faa666d7a78c4e94 (patch)
tree6fed56e46e356ee318957cff19eb6494438040c0
parent3b608422e8ff9e50d05f5f6c1b4760f9fc339aa0 (diff)
downloadbcm5719-llvm-7f27d6044e5c31ec53ecdeb5faa666d7a78c4e94.tar.gz
bcm5719-llvm-7f27d6044e5c31ec53ecdeb5faa666d7a78c4e94.zip
Pulled in a new revision of LLVM/Clang and added
several patches. These patches fix a problem where templated types were not being completed the first time they were used, and fix a variety of minor issues I discovered while fixing that problem. One of the previous local patches was resolved in the most recent Clang, so I removed it. The others will be removed in due course. llvm-svn: 144984
-rw-r--r--lldb/include/lldb/Expression/ASTResultSynthesizer.h2
-rw-r--r--lldb/include/lldb/Expression/ASTStructExtractor.h2
-rw-r--r--lldb/scripts/build-llvm.pl4
-rw-r--r--lldb/scripts/clang.complete-type-being-laid-out.diff15
-rw-r--r--lldb/scripts/clang.instantiate-complete-type.diff15
-rw-r--r--lldb/scripts/clang.is-being-completed-from-lexical-storage.diff72
-rw-r--r--lldb/scripts/clang.require-complete-type.diff75
-rw-r--r--lldb/scripts/clang.visit-translation-unit-decl.diff28
-rw-r--r--lldb/source/Expression/ASTResultSynthesizer.cpp5
-rw-r--r--lldb/source/Expression/ASTStructExtractor.cpp5
-rw-r--r--lldb/source/Expression/IRForTarget.cpp6
-rw-r--r--lldb/source/Expression/IRInterpreter.cpp2
12 files changed, 155 insertions, 76 deletions
diff --git a/lldb/include/lldb/Expression/ASTResultSynthesizer.h b/lldb/include/lldb/Expression/ASTResultSynthesizer.h
index b32c19e435f..508a54217e5 100644
--- a/lldb/include/lldb/Expression/ASTResultSynthesizer.h
+++ b/lldb/include/lldb/Expression/ASTResultSynthesizer.h
@@ -77,7 +77,7 @@ public:
/// which need to be searched recursively. That job falls to
/// TransformTopLevelDecl.
//----------------------------------------------------------------------
- void HandleTopLevelDecl(clang::DeclGroupRef D);
+ bool HandleTopLevelDecl(clang::DeclGroupRef D);
//----------------------------------------------------------------------
/// Passthrough stub
diff --git a/lldb/include/lldb/Expression/ASTStructExtractor.h b/lldb/include/lldb/Expression/ASTStructExtractor.h
index ade512c9912..a1518de83d6 100644
--- a/lldb/include/lldb/Expression/ASTStructExtractor.h
+++ b/lldb/include/lldb/Expression/ASTStructExtractor.h
@@ -79,7 +79,7 @@ public:
/// which need to be searched recursively. That job falls to
/// TransformTopLevelDecl.
//----------------------------------------------------------------------
- void HandleTopLevelDecl(clang::DeclGroupRef D);
+ bool HandleTopLevelDecl(clang::DeclGroupRef D);
//----------------------------------------------------------------------
/// Passthrough stub
diff --git a/lldb/scripts/build-llvm.pl b/lldb/scripts/build-llvm.pl
index a534e01e0eb..3e494fe3026 100644
--- a/lldb/scripts/build-llvm.pl
+++ b/lldb/scripts/build-llvm.pl
@@ -21,8 +21,8 @@ our ($llvm_clang_basename, $llvm_clang_dirname) = fileparse ($llvm_clang_outfile
our $llvm_configuration = $ENV{LLVM_CONFIGURATION};
-our $llvm_revision = "144573";
-our $clang_revision = "144573";
+our $llvm_revision = "144982";
+our $clang_revision = "144982";
our $SRCROOT = "$ENV{SRCROOT}";
our $llvm_dstroot_zip = "$SRCROOT/llvm.zip";
diff --git a/lldb/scripts/clang.complete-type-being-laid-out.diff b/lldb/scripts/clang.complete-type-being-laid-out.diff
new file mode 100644
index 00000000000..da6232aa9a8
--- /dev/null
+++ b/lldb/scripts/clang.complete-type-being-laid-out.diff
@@ -0,0 +1,15 @@
+Index: lib/AST/RecordLayoutBuilder.cpp
+===================================================================
+--- lib/AST/RecordLayoutBuilder.cpp (revision 144982)
++++ lib/AST/RecordLayoutBuilder.cpp (working copy)
+@@ -2044,6 +2044,10 @@
+ // as soon as we begin to parse the definition. That definition is
+ // not a complete definition (which is what isDefinition() tests)
+ // until we *finish* parsing the definition.
++
++ if (D->hasExternalLexicalStorage())
++ getExternalSource()->CompleteType(const_cast<RecordDecl*>(D));
++
+ D = D->getDefinition();
+ assert(D && "Cannot get layout of forward declarations!");
+ assert(D->isCompleteDefinition() && "Cannot layout type before complete!");
diff --git a/lldb/scripts/clang.instantiate-complete-type.diff b/lldb/scripts/clang.instantiate-complete-type.diff
new file mode 100644
index 00000000000..80934509598
--- /dev/null
+++ b/lldb/scripts/clang.instantiate-complete-type.diff
@@ -0,0 +1,15 @@
+Index: lib/Sema/SemaTemplateInstantiate.cpp
+===================================================================
+--- lib/Sema/SemaTemplateInstantiate.cpp (revision 144982)
++++ lib/Sema/SemaTemplateInstantiate.cpp (working copy)
+@@ -1683,6 +1683,10 @@
+ TemplateSpecializationKind TSK,
+ bool Complain) {
+ bool Invalid = false;
++
++ RequireCompleteType(Pattern->getLocation(),
++ QualType(Pattern->getTypeForDecl(), 0),
++ diag::err_incomplete_type);
+
+ CXXRecordDecl *PatternDef
+ = cast_or_null<CXXRecordDecl>(Pattern->getDefinition());
diff --git a/lldb/scripts/clang.is-being-completed-from-lexical-storage.diff b/lldb/scripts/clang.is-being-completed-from-lexical-storage.diff
index 1ea0d84786b..998c4320630 100644
--- a/lldb/scripts/clang.is-being-completed-from-lexical-storage.diff
+++ b/lldb/scripts/clang.is-being-completed-from-lexical-storage.diff
@@ -1,6 +1,41 @@
+Index: lib/AST/ASTImporter.cpp
+===================================================================
+--- lib/AST/ASTImporter.cpp (revision 144982)
++++ lib/AST/ASTImporter.cpp (working copy)
+@@ -2300,7 +2300,8 @@
+
+ if (RecordDecl *FoundRecord = dyn_cast<RecordDecl>(Found)) {
+ if (RecordDecl *FoundDef = FoundRecord->getDefinition()) {
+- if (!D->isCompleteDefinition() || IsStructuralMatch(D, FoundDef)) {
++ if (FoundDef->isBeingCompletedFromLexicalStorage() ||
++ !D->isCompleteDefinition() || IsStructuralMatch(D, FoundDef)) {
+ // The record types structurally match, or the "from" translation
+ // unit only had a forward declaration anyway; call it the same
+ // function.
+Index: lib/AST/Decl.cpp
+===================================================================
+--- lib/AST/Decl.cpp (revision 144982)
++++ lib/AST/Decl.cpp (working copy)
+@@ -2405,8 +2405,14 @@
+ ExternalASTSource::Deserializing TheFields(Source);
+
+ SmallVector<Decl*, 64> Decls;
+- LoadedFieldsFromExternalStorage = true;
+- switch (Source->FindExternalLexicalDeclsBy<FieldDecl>(this, Decls)) {
++ LoadedFieldsFromExternalStorage = true;
++
++ setIsBeingCompletedFromLexicalStorage(true);
++ ExternalLoadResult LoadResult =
++ Source->FindExternalLexicalDeclsBy<FieldDecl>(this, Decls);
++ setIsBeingCompletedFromLexicalStorage(false);
++
++ switch (LoadResult) {
+ case ELR_Success:
+ break;
+
Index: include/clang/AST/DeclBase.h
===================================================================
---- include/clang/AST/DeclBase.h (revision 144573)
+--- include/clang/AST/DeclBase.h (revision 144982)
+++ include/clang/AST/DeclBase.h (working copy)
@@ -807,6 +807,12 @@
/// storage that contains additional declarations that are visible
@@ -41,38 +76,3 @@ Index: include/clang/AST/DeclBase.h
/// \brief Determine whether the given declaration is stored in the list of
/// declarations lexically within this context.
bool isDeclInLexicalTraversal(const Decl *D) const {
-Index: lib/AST/Decl.cpp
-===================================================================
---- lib/AST/Decl.cpp (revision 144573)
-+++ lib/AST/Decl.cpp (working copy)
-@@ -2405,8 +2405,14 @@
- ExternalASTSource::Deserializing TheFields(Source);
-
- SmallVector<Decl*, 64> Decls;
-- LoadedFieldsFromExternalStorage = true;
-- switch (Source->FindExternalLexicalDeclsBy<FieldDecl>(this, Decls)) {
-+ LoadedFieldsFromExternalStorage = true;
-+
-+ setIsBeingCompletedFromLexicalStorage(true);
-+ ExternalLoadResult LoadResult =
-+ Source->FindExternalLexicalDeclsBy<FieldDecl>(this, Decls);
-+ setIsBeingCompletedFromLexicalStorage(false);
-+
-+ switch (LoadResult) {
- case ELR_Success:
- break;
-
-Index: lib/AST/ASTImporter.cpp
-===================================================================
---- lib/AST/ASTImporter.cpp (revision 144573)
-+++ lib/AST/ASTImporter.cpp (working copy)
-@@ -2290,7 +2290,8 @@
-
- if (RecordDecl *FoundRecord = dyn_cast<RecordDecl>(Found)) {
- if (RecordDecl *FoundDef = FoundRecord->getDefinition()) {
-- if (!D->isCompleteDefinition() || IsStructuralMatch(D, FoundDef)) {
-+ if (FoundDef->isBeingCompletedFromLexicalStorage() ||
-+ !D->isCompleteDefinition() || IsStructuralMatch(D, FoundDef)) {
- // The record types structurally match, or the "from" translation
- // unit only had a forward declaration anyway; call it the same
- // function.
diff --git a/lldb/scripts/clang.require-complete-type.diff b/lldb/scripts/clang.require-complete-type.diff
new file mode 100644
index 00000000000..9e52947eebb
--- /dev/null
+++ b/lldb/scripts/clang.require-complete-type.diff
@@ -0,0 +1,75 @@
+Index: lib/Sema/SemaType.cpp
+===================================================================
+--- lib/Sema/SemaType.cpp (revision 144982)
++++ lib/Sema/SemaType.cpp (working copy)
+@@ -4065,6 +4065,34 @@
+ if (!T->isIncompleteType())
+ return false;
+
++ const TagType *Tag = T->getAs<TagType>();
++ const ObjCInterfaceType *IFace = 0;
++
++ if (Tag) {
++ // Avoid diagnosing invalid decls as incomplete.
++ if (Tag->getDecl()->isInvalidDecl())
++ return true;
++
++ // Give the external AST source a chance to complete the type.
++ if (Tag->getDecl()->hasExternalLexicalStorage()) {
++ Context.getExternalSource()->CompleteType(Tag->getDecl());
++ if (!Tag->isIncompleteType())
++ return false;
++ }
++ }
++ else if ((IFace = T->getAs<ObjCInterfaceType>())) {
++ // Avoid diagnosing invalid decls as incomplete.
++ if (IFace->getDecl()->isInvalidDecl())
++ return true;
++
++ // Give the external AST source a chance to complete the type.
++ if (IFace->getDecl()->hasExternalLexicalStorage()) {
++ Context.getExternalSource()->CompleteType(IFace->getDecl());
++ if (!IFace->isIncompleteType())
++ return false;
++ }
++ }
++
+ // If we have a class template specialization or a class member of a
+ // class template specialization, or an array with known size of such,
+ // try to instantiate it.
+@@ -4096,35 +4124,7 @@
+
+ if (diag == 0)
+ return true;
+-
+- const TagType *Tag = T->getAs<TagType>();
+- const ObjCInterfaceType *IFace = 0;
+-
+- if (Tag) {
+- // Avoid diagnosing invalid decls as incomplete.
+- if (Tag->getDecl()->isInvalidDecl())
+- return true;
+-
+- // Give the external AST source a chance to complete the type.
+- if (Tag->getDecl()->hasExternalLexicalStorage()) {
+- Context.getExternalSource()->CompleteType(Tag->getDecl());
+- if (!Tag->isIncompleteType())
+- return false;
+- }
+- }
+- else if ((IFace = T->getAs<ObjCInterfaceType>())) {
+- // Avoid diagnosing invalid decls as incomplete.
+- if (IFace->getDecl()->isInvalidDecl())
+- return true;
+
+- // Give the external AST source a chance to complete the type.
+- if (IFace->getDecl()->hasExternalLexicalStorage()) {
+- Context.getExternalSource()->CompleteType(IFace->getDecl());
+- if (!IFace->isIncompleteType())
+- return false;
+- }
+- }
+-
+ // We have an incomplete type. Produce a diagnostic.
+ Diag(Loc, PD) << T;
+
diff --git a/lldb/scripts/clang.visit-translation-unit-decl.diff b/lldb/scripts/clang.visit-translation-unit-decl.diff
deleted file mode 100644
index 045096ad586..00000000000
--- a/lldb/scripts/clang.visit-translation-unit-decl.diff
+++ /dev/null
@@ -1,28 +0,0 @@
-Index: lib/AST/ASTImporter.cpp
-===================================================================
---- lib/AST/ASTImporter.cpp (revision 144573)
-+++ lib/AST/ASTImporter.cpp (working copy)
-@@ -100,6 +100,7 @@
- bool IsStructuralMatch(EnumDecl *FromEnum, EnumDecl *ToRecord);
- bool IsStructuralMatch(ClassTemplateDecl *From, ClassTemplateDecl *To);
- Decl *VisitDecl(Decl *D);
-+ Decl *VisitTranslationUnitDecl(TranslationUnitDecl *D);
- Decl *VisitNamespaceDecl(NamespaceDecl *D);
- Decl *VisitTypedefNameDecl(TypedefNameDecl *D, bool IsAlias);
- Decl *VisitTypedefDecl(TypedefDecl *D);
-@@ -2030,6 +2031,15 @@
- return 0;
- }
-
-+Decl *ASTNodeImporter::VisitTranslationUnitDecl(TranslationUnitDecl *D) {
-+ TranslationUnitDecl *ToD =
-+ Importer.getToContext().getTranslationUnitDecl();
-+
-+ Importer.Imported(D, ToD);
-+
-+ return ToD;
-+}
-+
- Decl *ASTNodeImporter::VisitNamespaceDecl(NamespaceDecl *D) {
- // Import the major distinguishing characteristics of this namespace.
- DeclContext *DC, *LexicalDC;
diff --git a/lldb/source/Expression/ASTResultSynthesizer.cpp b/lldb/source/Expression/ASTResultSynthesizer.cpp
index cb832fa5a53..f28f8f1b735 100644
--- a/lldb/source/Expression/ASTResultSynthesizer.cpp
+++ b/lldb/source/Expression/ASTResultSynthesizer.cpp
@@ -108,7 +108,7 @@ ASTResultSynthesizer::TransformTopLevelDecl(Decl* D)
}
}
-void
+bool
ASTResultSynthesizer::HandleTopLevelDecl(DeclGroupRef D)
{
DeclGroupRef::iterator decl_iterator;
@@ -123,7 +123,8 @@ ASTResultSynthesizer::HandleTopLevelDecl(DeclGroupRef D)
}
if (m_passthrough)
- m_passthrough->HandleTopLevelDecl(D);
+ return m_passthrough->HandleTopLevelDecl(D);
+ return true;
}
bool
diff --git a/lldb/source/Expression/ASTStructExtractor.cpp b/lldb/source/Expression/ASTStructExtractor.cpp
index efad38304ad..7bc31a5d815 100644
--- a/lldb/source/Expression/ASTStructExtractor.cpp
+++ b/lldb/source/Expression/ASTStructExtractor.cpp
@@ -116,7 +116,7 @@ ASTStructExtractor::ExtractFromTopLevelDecl(Decl* D)
}
}
-void
+bool
ASTStructExtractor::HandleTopLevelDecl(DeclGroupRef D)
{
DeclGroupRef::iterator decl_iterator;
@@ -131,7 +131,8 @@ ASTStructExtractor::HandleTopLevelDecl(DeclGroupRef D)
}
if (m_passthrough)
- m_passthrough->HandleTopLevelDecl(D);
+ return m_passthrough->HandleTopLevelDecl(D);
+ return true;
}
void
diff --git a/lldb/source/Expression/IRForTarget.cpp b/lldb/source/Expression/IRForTarget.cpp
index ef3fa767614..cc97706dcf9 100644
--- a/lldb/source/Expression/IRForTarget.cpp
+++ b/lldb/source/Expression/IRForTarget.cpp
@@ -107,7 +107,7 @@ IRForTarget::FixFunctionLinkage(llvm::Function &llvm_function)
llvm_function.setLinkage(GlobalValue::ExternalLinkage);
- std::string name = llvm_function.getNameStr();
+ std::string name = llvm_function.getName().str();
return true;
}
@@ -141,7 +141,7 @@ IRForTarget::HasSideEffects (llvm::Function &llvm_function)
std::string ptr_name;
if (store_ptr->hasName())
- ptr_name = store_ptr->getNameStr();
+ ptr_name = store_ptr->getName().str();
if (isa <AllocaInst> (store_ptr))
break;
@@ -342,7 +342,7 @@ IRForTarget::ResolveFunctionPointers(llvm::Module &llvm_module,
bool is_decl = fun->isDeclaration();
if (log)
- log->Printf("Examining %s function %s", (is_decl ? "declaration" : "non-declaration"), fun->getNameStr().c_str());
+ log->Printf("Examining %s function %s", (is_decl ? "declaration" : "non-declaration"), fun->getName().str().c_str());
if (!is_decl)
continue;
diff --git a/lldb/source/Expression/IRInterpreter.cpp b/lldb/source/Expression/IRInterpreter.cpp
index 5bb59a6d35a..8e3a33d6b7d 100644
--- a/lldb/source/Expression/IRInterpreter.cpp
+++ b/lldb/source/Expression/IRInterpreter.cpp
@@ -617,7 +617,7 @@ public:
{
// Special-case "this", "self", and "_cmd"
- std::string name_str = value->getNameStr();
+ std::string name_str = value->getName().str();
if (name_str == "this" ||
name_str == "self" ||
OpenPOWER on IntegriCloud