mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-09 10:55:03 +00:00
PR30831: Teach template type diffing to cope with TemplateSpecializationTypes
that desugar to non-TSTs (such as injected-class-names). llvm-svn: 285437
This commit is contained in:
parent
4f69f924df
commit
e0ab873a84
@ -936,6 +936,9 @@ class TemplateDiff {
|
||||
++(*this);
|
||||
}
|
||||
|
||||
/// Return true if the iterator is non-singular.
|
||||
bool isValid() const { return TST; }
|
||||
|
||||
/// isEnd - Returns true if the iterator is one past the end.
|
||||
bool isEnd() const {
|
||||
assert(TST && "InternalIterator is invalid with a null TST.");
|
||||
@ -995,21 +998,21 @@ class TemplateDiff {
|
||||
}
|
||||
};
|
||||
|
||||
bool UseDesugaredIterator;
|
||||
InternalIterator SugaredIterator;
|
||||
InternalIterator DesugaredIterator;
|
||||
|
||||
public:
|
||||
TSTiterator(ASTContext &Context, const TemplateSpecializationType *TST)
|
||||
: UseDesugaredIterator(TST->isSugared() && !TST->isTypeAlias()),
|
||||
SugaredIterator(TST),
|
||||
: SugaredIterator(TST),
|
||||
DesugaredIterator(
|
||||
GetTemplateSpecializationType(Context, TST->desugar())) {}
|
||||
(TST->isSugared() && !TST->isTypeAlias())
|
||||
? GetTemplateSpecializationType(Context, TST->desugar())
|
||||
: nullptr) {}
|
||||
|
||||
/// &operator++ - Increment the iterator to the next template argument.
|
||||
TSTiterator &operator++() {
|
||||
++SugaredIterator;
|
||||
if (UseDesugaredIterator)
|
||||
if (DesugaredIterator.isValid())
|
||||
++DesugaredIterator;
|
||||
return *this;
|
||||
}
|
||||
@ -1032,12 +1035,12 @@ class TemplateDiff {
|
||||
/// hasDesugaredTA - Returns true if there is another TemplateArgument
|
||||
/// available.
|
||||
bool hasDesugaredTA() const {
|
||||
return UseDesugaredIterator && !DesugaredIterator.isEnd();
|
||||
return DesugaredIterator.isValid() && !DesugaredIterator.isEnd();
|
||||
}
|
||||
|
||||
/// getDesugaredTA - Returns the desugared TemplateArgument.
|
||||
reference getDesugaredTA() const {
|
||||
assert(UseDesugaredIterator &&
|
||||
assert(DesugaredIterator.isValid() &&
|
||||
"Desugared TemplateArgument should not be used.");
|
||||
return *DesugaredIterator;
|
||||
}
|
||||
|
@ -1492,3 +1492,8 @@ void run(A_reg<float> reg, A_ptr<float> ptr, A_ref<float> ref) {
|
||||
// CHECK-NOELIDE-NOTREE: {{[0-9]*}} errors generated.
|
||||
// CHECK-ELIDE-TREE: {{[0-9]*}} errors generated.
|
||||
// CHECK-NOELIDE-TREE: {{[0-9]*}} errors generated.
|
||||
|
||||
namespace pr30831 {
|
||||
template <typename T> struct A { static A<T> const a; };
|
||||
template <typename T> A<T> A<T>::a = A<T>();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user