14c6595959
Simplify some of the patches by reverting some of the changed llvm / clang files to the original ones. git-svn-id: http://root.cern.ch/svn/root/trunk@49363 27541ba8-7e3a-0410-8455-c3a389f83636
74 lines
2.6 KiB
Diff
74 lines
2.6 KiB
Diff
--- /home/axel/build/llvm-orig/src/./tools/clang/include/clang/AST/Decl.h 2013-04-11 09:35:12.328974114 +0200
|
|
+++ ./tools/clang/include/clang/AST/Decl.h 2013-04-24 19:40:12.605511633 +0200
|
|
@@ -214,6 +214,9 @@
|
|
/// \brief Determine what kind of linkage this entity has.
|
|
Linkage getLinkage() const;
|
|
|
|
+ /// \brief Force a reevaluation of the kind of linkage this entity has.
|
|
+ void ClearLinkageCache();
|
|
+
|
|
/// \brief True if this decl has external linkage.
|
|
bool hasExternalLinkage() const {
|
|
return getLinkage() == ExternalLinkage;
|
|
--- /home/axel/build/llvm-orig/src/./tools/clang/lib/AST/Decl.cpp 2013-04-11 09:34:54.269161818 +0200
|
|
+++ ./tools/clang/lib/AST/Decl.cpp 2013-04-24 19:40:14.517496526 +0200
|
|
@@ -856,6 +856,15 @@
|
|
return LV;
|
|
}
|
|
|
|
+static void clearLinkageForClass(const CXXRecordDecl *record) {
|
|
+ for (CXXRecordDecl::decl_iterator
|
|
+ i = record->decls_begin(), e = record->decls_end(); i != e; ++i) {
|
|
+ Decl *child = *i;
|
|
+ if (isa<NamedDecl>(child))
|
|
+ cast<NamedDecl>(child)->ClearLinkageCache();
|
|
+ }
|
|
+}
|
|
+
|
|
void NamedDecl::anchor() { }
|
|
|
|
bool NamedDecl::isLinkageValid() const {
|
|
@@ -870,6 +879,42 @@
|
|
return getLVForDecl(this, LVForExplicitValue).getLinkage() == ExternalLinkage;
|
|
}
|
|
|
|
+void NamedDecl::ClearLinkageCache() {
|
|
+ // Note that we can't skip clearing the linkage of children just
|
|
+ // because the parent doesn't have cached linkage: we don't cache
|
|
+ // when computing linkage for parent contexts.
|
|
+
|
|
+ HasCachedLinkage = 0;
|
|
+
|
|
+ // If we're changing the linkage of a class, we need to reset the
|
|
+ // linkage of child declarations, too.
|
|
+ if (const CXXRecordDecl *record = dyn_cast<CXXRecordDecl>(this))
|
|
+ clearLinkageForClass(record);
|
|
+
|
|
+ if (ClassTemplateDecl *temp =
|
|
+ dyn_cast<ClassTemplateDecl>(const_cast<NamedDecl*>(this))) {
|
|
+ // Clear linkage for the template pattern.
|
|
+ CXXRecordDecl *record = temp->getTemplatedDecl();
|
|
+ record->HasCachedLinkage = 0;
|
|
+ clearLinkageForClass(record);
|
|
+
|
|
+ // We need to clear linkage for specializations, too.
|
|
+ for (ClassTemplateDecl::spec_iterator
|
|
+ i = temp->spec_begin(), e = temp->spec_end(); i != e; ++i)
|
|
+ i->ClearLinkageCache();
|
|
+ }
|
|
+
|
|
+ // Clear cached linkage for function template decls, too.
|
|
+ if (FunctionTemplateDecl *temp =
|
|
+ dyn_cast<FunctionTemplateDecl>(const_cast<NamedDecl*>(this))) {
|
|
+ temp->getTemplatedDecl()->ClearLinkageCache();
|
|
+ for (FunctionTemplateDecl::spec_iterator
|
|
+ i = temp->spec_begin(), e = temp->spec_end(); i != e; ++i)
|
|
+ i->ClearLinkageCache();
|
|
+ }
|
|
+
|
|
+}
|
|
+
|
|
Linkage NamedDecl::getLinkage() const {
|
|
if (HasCachedLinkage)
|
|
return Linkage(CachedLinkage);
|