Bug 1772006 - Part 8: Allow building xpcom/string without unified builds, r=xpcom-reviewers,barret

The last remaining things requiring unified builds in this directory are the
explicit specializations. As each class' methods are now confined to a single
file, these can now be moved to the appropriate .cpp files.

Differential Revision: https://phabricator.services.mozilla.com/D148303
This commit is contained in:
Nika Layzell
2022-07-30 00:12:49 +00:00
parent 085d4c95eb
commit 51c14166ec
11 changed files with 46 additions and 43 deletions

View File

@@ -108,6 +108,7 @@ UNIFIED_SOURCES += [
"nsArrayEnumerator.cpp",
"nsArrayUtils.cpp",
"nsAtomTable.cpp",
"nsCharSeparatedTokenizer.cpp",
"nsCOMArray.cpp",
"nsCRT.cpp",
"nsDeque.cpp",

View File

@@ -0,0 +1,10 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsCharSeparatedTokenizer.h"
template class nsTSubstringSplitter<char>;
template class nsTSubstringSplitter<char16_t>;

View File

@@ -42,13 +42,13 @@ UNIFIED_SOURCES += [
"nsTDependentString.cpp",
"nsTDependentSubstring.cpp",
"nsTextFormatter.cpp",
"nsTLiteralString.cpp",
"nsTPromiseFlatString.cpp",
"nsTString.cpp",
"nsTStringComparator.cpp",
"nsTStringRepr.cpp",
"nsTSubstring.cpp",
"nsTSubstringTuple.cpp",
"precompiled_templates.cpp",
"RustStringAPI.cpp",
]
@@ -56,5 +56,3 @@ if CONFIG["MOZ_DEBUG"]:
UNIFIED_SOURCES += ["nsStringStats.cpp"]
FINAL_LIBRARY = "xul"
REQUIRES_UNIFIED_BUILD = True

View File

@@ -45,3 +45,6 @@ void nsTDependentString<T>::Rebind(const char_type* aStart,
MOZ_RELEASE_ASSERT(aStart <= aEnd, "Overflow!");
this->Rebind(aStart, aEnd - aStart);
}
template class nsTDependentString<char>;
template class nsTDependentString<char16_t>;

View File

@@ -4,6 +4,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// FIXME: Due to an include cycle, we need to include `nsTSubstring` first.
#include "nsTSubstring.h"
#include "nsTDependentSubstring.h"
template <typename T>
@@ -99,3 +101,6 @@ const nsTDependentSubstring<char16_t> Substring(char16ptr_t aStart,
static_cast<const char16_t*>(aEnd));
}
#endif
template class nsTDependentSubstring<char>;
template class nsTDependentSubstring<char16_t>;

View File

@@ -0,0 +1,10 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsTLiteralString.h"
template class nsTLiteralString<char>;
template class nsTLiteralString<char16_t>;

View File

@@ -21,3 +21,6 @@ void nsTPromiseFlatString<T>::Init(const substring_type& str) {
this->Assign(str);
}
}
template class nsTPromiseFlatString<char>;
template class nsTPromiseFlatString<char16_t>;

View File

@@ -68,3 +68,9 @@ void nsTString<T>::Rebind(const char_type* data, size_type length) {
this->SetData(const_cast<char_type*>(data), length, DataFlags::TERMINATED);
this->AssertValidDependentString();
}
template class nsTString<char>;
template class nsTString<char16_t>;
template class nsTAutoStringN<char, 64>;
template class nsTAutoStringN<char16_t, 64>;

View File

@@ -182,3 +182,6 @@ bool nsTStringRepr<T>::EqualsIgnoreCase(const std::string_view& aString) const {
}
} // namespace mozilla::detail
template class mozilla::detail::nsTStringRepr<char>;
template class mozilla::detail::nsTStringRepr<char16_t>;

View File

@@ -15,6 +15,7 @@
#include "nsCharTraits.h"
#include "nsISupports.h"
#include "nsString.h"
#include "nsTArray.h"
#ifdef DEBUG
# include "nsStringStats.h"
@@ -1688,3 +1689,6 @@ void nsTSubstring<T>::CompressWhitespace(bool aTrimLeading,
*to = char_type(0); // add the null
this->mLength = to - this->mData;
}
template class nsTSubstring<char>;
template class nsTSubstring<char16_t>;

View File

@@ -1,40 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsString.h"
// This file provides concrete instantiations for externed string template
// classes.
// ================
// Template classes
// ================
template class mozilla::detail::nsTStringRepr<char>;
template class mozilla::detail::nsTStringRepr<char16_t>;
template class nsTLiteralString<char>;
template class nsTLiteralString<char16_t>;
template class nsTSubstring<char>;
template class nsTSubstring<char16_t>;
template class nsTDependentSubstring<char>;
template class nsTDependentSubstring<char16_t>;
template class nsTString<char>;
template class nsTString<char16_t>;
template class nsTAutoStringN<char, 64>;
template class nsTAutoStringN<char16_t, 64>;
template class nsTDependentString<char>;
template class nsTDependentString<char16_t>;
template class nsTPromiseFlatString<char>;
template class nsTPromiseFlatString<char16_t>;
template class nsTSubstringSplitter<char>;
template class nsTSubstringSplitter<char16_t>;