2019-05-13 18:06:25 +08:00
|
|
|
//===- unittest/AST/ASTImporterTest.cpp - AST node import test ------------===//
|
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Type-parameterized tests for the correct import of redecl chains.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "ASTImporterFixtures.h"
|
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace ast_matchers {
|
|
|
|
|
|
|
|
using internal::BindableMatcher;
|
|
|
|
|
|
|
|
struct Function {
|
|
|
|
using DeclTy = FunctionDecl;
|
|
|
|
static constexpr auto *Prototype = "void X();";
|
|
|
|
static constexpr auto *Definition = "void X() {}";
|
|
|
|
BindableMatcher<Decl> getPattern() {
|
|
|
|
return functionDecl(hasName("X"), unless(isImplicit()));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Class {
|
|
|
|
using DeclTy = CXXRecordDecl;
|
|
|
|
static constexpr auto *Prototype = "class X;";
|
|
|
|
static constexpr auto *Definition = "class X {};";
|
|
|
|
BindableMatcher<Decl> getPattern() {
|
|
|
|
return cxxRecordDecl(hasName("X"), unless(isImplicit()));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
[ASTImporter] Added visibility check for scoped enums.
Summary:
ASTImporter makes now difference between C++11 scoped enums with same
name in different translation units if these are not visible outside.
Enum declarations are linked into decl chain correctly.
Reviewers: martong, a.sidorin, shafik, a_sidorin, teemperor
Reviewed By: shafik, a_sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, teemperor, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74554
2020-02-17 21:25:16 +08:00
|
|
|
struct EnumClass {
|
|
|
|
using DeclTy = EnumDecl;
|
|
|
|
static constexpr auto *Prototype = "enum class X;";
|
|
|
|
static constexpr auto *Definition = "enum class X {};";
|
|
|
|
BindableMatcher<Decl> getPattern() {
|
|
|
|
return enumDecl(hasName("X"), unless(isImplicit()));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-05-13 18:06:25 +08:00
|
|
|
struct Variable {
|
|
|
|
using DeclTy = VarDecl;
|
|
|
|
static constexpr auto *Prototype = "extern int X;";
|
|
|
|
static constexpr auto *Definition = "int X;";
|
|
|
|
BindableMatcher<Decl> getPattern() { return varDecl(hasName("X")); }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FunctionTemplate {
|
|
|
|
using DeclTy = FunctionTemplateDecl;
|
|
|
|
static constexpr auto *Prototype = "template <class T> void X();";
|
|
|
|
static constexpr auto *Definition =
|
|
|
|
R"(
|
|
|
|
template <class T> void X() {};
|
|
|
|
// Explicit instantiation is a must because of -fdelayed-template-parsing:
|
|
|
|
template void X<int>();
|
|
|
|
)";
|
|
|
|
BindableMatcher<Decl> getPattern() {
|
|
|
|
return functionTemplateDecl(hasName("X"), unless(isImplicit()));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ClassTemplate {
|
|
|
|
using DeclTy = ClassTemplateDecl;
|
|
|
|
static constexpr auto *Prototype = "template <class T> class X;";
|
|
|
|
static constexpr auto *Definition = "template <class T> class X {};";
|
|
|
|
BindableMatcher<Decl> getPattern() {
|
|
|
|
return classTemplateDecl(hasName("X"), unless(isImplicit()));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-02-25 21:47:38 +08:00
|
|
|
struct VariableTemplate {
|
|
|
|
using DeclTy = VarTemplateDecl;
|
|
|
|
static constexpr auto *Prototype = "template <class T> extern T X;";
|
|
|
|
static constexpr auto *Definition =
|
|
|
|
R"(
|
|
|
|
template <class T> T X;
|
|
|
|
template <> int X<int>;
|
|
|
|
)";
|
|
|
|
// There is no matcher for varTemplateDecl so use a work-around.
|
|
|
|
BindableMatcher<Decl> getPattern() {
|
|
|
|
return namedDecl(hasName("X"), unless(isImplicit()),
|
|
|
|
has(templateTypeParmDecl()));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-05-13 18:06:25 +08:00
|
|
|
struct FunctionTemplateSpec {
|
|
|
|
using DeclTy = FunctionDecl;
|
|
|
|
static constexpr auto *Prototype =
|
|
|
|
R"(
|
|
|
|
// Proto of the primary template.
|
|
|
|
template <class T>
|
|
|
|
void X();
|
|
|
|
// Proto of the specialization.
|
|
|
|
template <>
|
|
|
|
void X<int>();
|
|
|
|
)";
|
|
|
|
static constexpr auto *Definition =
|
|
|
|
R"(
|
|
|
|
// Proto of the primary template.
|
|
|
|
template <class T>
|
|
|
|
void X();
|
|
|
|
// Specialization and definition.
|
|
|
|
template <>
|
|
|
|
void X<int>() {}
|
|
|
|
)";
|
|
|
|
BindableMatcher<Decl> getPattern() {
|
|
|
|
return functionDecl(hasName("X"), isExplicitTemplateSpecialization());
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ClassTemplateSpec {
|
|
|
|
using DeclTy = ClassTemplateSpecializationDecl;
|
|
|
|
static constexpr auto *Prototype =
|
|
|
|
R"(
|
|
|
|
template <class T> class X;
|
|
|
|
template <> class X<int>;
|
|
|
|
)";
|
|
|
|
static constexpr auto *Definition =
|
|
|
|
R"(
|
|
|
|
template <class T> class X;
|
|
|
|
template <> class X<int> {};
|
|
|
|
)";
|
|
|
|
BindableMatcher<Decl> getPattern() {
|
|
|
|
return classTemplateSpecializationDecl(hasName("X"), unless(isImplicit()));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename TypeParam>
|
|
|
|
struct RedeclChain : ASTImporterOptionSpecificTestBase {
|
|
|
|
|
|
|
|
using DeclTy = typename TypeParam::DeclTy;
|
|
|
|
std::string getPrototype() { return TypeParam::Prototype; }
|
|
|
|
std::string getDefinition() { return TypeParam::Definition; }
|
|
|
|
BindableMatcher<Decl> getPattern() const { return TypeParam().getPattern(); }
|
|
|
|
|
|
|
|
void CheckPreviousDecl(Decl *Prev, Decl *Current) {
|
|
|
|
ASSERT_NE(Prev, Current);
|
|
|
|
ASSERT_EQ(&Prev->getASTContext(), &Current->getASTContext());
|
|
|
|
EXPECT_EQ(Prev->getCanonicalDecl(), Current->getCanonicalDecl());
|
|
|
|
|
|
|
|
// Templates.
|
|
|
|
if (auto *PrevT = dyn_cast<TemplateDecl>(Prev)) {
|
|
|
|
EXPECT_EQ(Current->getPreviousDecl(), Prev);
|
|
|
|
auto *CurrentT = cast<TemplateDecl>(Current);
|
|
|
|
ASSERT_TRUE(PrevT->getTemplatedDecl());
|
|
|
|
ASSERT_TRUE(CurrentT->getTemplatedDecl());
|
|
|
|
EXPECT_EQ(CurrentT->getTemplatedDecl()->getPreviousDecl(),
|
|
|
|
PrevT->getTemplatedDecl());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Specializations.
|
|
|
|
if (auto *PrevF = dyn_cast<FunctionDecl>(Prev)) {
|
|
|
|
if (PrevF->getTemplatedKind() ==
|
|
|
|
FunctionDecl::TK_FunctionTemplateSpecialization) {
|
|
|
|
// There may be a hidden fwd spec decl before a spec decl.
|
|
|
|
// In that case the previous visible decl can be reached through that
|
|
|
|
// invisible one.
|
|
|
|
EXPECT_THAT(Prev, testing::AnyOf(
|
|
|
|
Current->getPreviousDecl(),
|
|
|
|
Current->getPreviousDecl()->getPreviousDecl()));
|
|
|
|
auto *ToTU = Prev->getTranslationUnitDecl();
|
|
|
|
auto *TemplateD = FirstDeclMatcher<FunctionTemplateDecl>().match(
|
|
|
|
ToTU, functionTemplateDecl());
|
|
|
|
auto *FirstSpecD = *(TemplateD->spec_begin());
|
|
|
|
EXPECT_EQ(FirstSpecD->getCanonicalDecl(), PrevF->getCanonicalDecl());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// The rest: Classes, Functions, etc.
|
|
|
|
EXPECT_EQ(Current->getPreviousDecl(), Prev);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TypedTest_PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition() {
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *FromTU = getTuDecl(getPrototype(), Lang_CXX03);
|
2019-05-13 18:06:25 +08:00
|
|
|
auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
|
|
|
|
ASSERT_FALSE(FromD->isThisDeclarationADefinition());
|
|
|
|
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *ImportedD = Import(FromD, Lang_CXX03);
|
2019-05-13 18:06:25 +08:00
|
|
|
Decl *ToTU = ImportedD->getTranslationUnitDecl();
|
|
|
|
|
|
|
|
EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 1u);
|
|
|
|
auto *ToD = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());
|
|
|
|
EXPECT_TRUE(ImportedD == ToD);
|
|
|
|
EXPECT_FALSE(ToD->isThisDeclarationADefinition());
|
|
|
|
if (auto *ToT = dyn_cast<TemplateDecl>(ToD)) {
|
|
|
|
EXPECT_TRUE(ToT->getTemplatedDecl());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TypedTest_DefinitionShouldBeImportedAsADefinition() {
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *FromTU = getTuDecl(getDefinition(), Lang_CXX03);
|
2019-05-13 18:06:25 +08:00
|
|
|
auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
|
|
|
|
ASSERT_TRUE(FromD->isThisDeclarationADefinition());
|
|
|
|
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *ImportedD = Import(FromD, Lang_CXX03);
|
2019-05-13 18:06:25 +08:00
|
|
|
Decl *ToTU = ImportedD->getTranslationUnitDecl();
|
|
|
|
|
|
|
|
EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 1u);
|
|
|
|
auto *ToD = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());
|
|
|
|
EXPECT_TRUE(ToD->isThisDeclarationADefinition());
|
|
|
|
if (auto *ToT = dyn_cast<TemplateDecl>(ToD)) {
|
|
|
|
EXPECT_TRUE(ToT->getTemplatedDecl());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TypedTest_ImportPrototypeAfterImportedPrototype() {
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *FromTU = getTuDecl(getPrototype() + getPrototype(), Lang_CXX03);
|
2019-05-13 18:06:25 +08:00
|
|
|
auto *From0 = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
|
|
|
|
auto *From1 = LastDeclMatcher<DeclTy>().match(FromTU, getPattern());
|
|
|
|
ASSERT_FALSE(From0->isThisDeclarationADefinition());
|
|
|
|
ASSERT_FALSE(From1->isThisDeclarationADefinition());
|
|
|
|
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *Imported0 = Import(From0, Lang_CXX03);
|
|
|
|
Decl *Imported1 = Import(From1, Lang_CXX03);
|
2019-05-13 18:06:25 +08:00
|
|
|
Decl *ToTU = Imported0->getTranslationUnitDecl();
|
|
|
|
|
|
|
|
EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);
|
|
|
|
auto *To0 = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());
|
|
|
|
auto *To1 = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());
|
|
|
|
EXPECT_TRUE(Imported0 == To0);
|
|
|
|
EXPECT_TRUE(Imported1 == To1);
|
|
|
|
EXPECT_FALSE(To0->isThisDeclarationADefinition());
|
|
|
|
EXPECT_FALSE(To1->isThisDeclarationADefinition());
|
|
|
|
|
|
|
|
CheckPreviousDecl(To0, To1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TypedTest_ImportDefinitionAfterImportedPrototype() {
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *FromTU = getTuDecl(getPrototype() + getDefinition(), Lang_CXX03);
|
2019-05-13 18:06:25 +08:00
|
|
|
auto *FromProto = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
|
|
|
|
auto *FromDef = LastDeclMatcher<DeclTy>().match(FromTU, getPattern());
|
|
|
|
ASSERT_FALSE(FromProto->isThisDeclarationADefinition());
|
|
|
|
ASSERT_TRUE(FromDef->isThisDeclarationADefinition());
|
|
|
|
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *ImportedProto = Import(FromProto, Lang_CXX03);
|
|
|
|
Decl *ImportedDef = Import(FromDef, Lang_CXX03);
|
2019-05-13 18:06:25 +08:00
|
|
|
Decl *ToTU = ImportedProto->getTranslationUnitDecl();
|
|
|
|
|
|
|
|
EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);
|
|
|
|
auto *ToProto = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());
|
|
|
|
auto *ToDef = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());
|
|
|
|
EXPECT_TRUE(ImportedProto == ToProto);
|
|
|
|
EXPECT_TRUE(ImportedDef == ToDef);
|
|
|
|
EXPECT_FALSE(ToProto->isThisDeclarationADefinition());
|
|
|
|
EXPECT_TRUE(ToDef->isThisDeclarationADefinition());
|
|
|
|
|
|
|
|
CheckPreviousDecl(ToProto, ToDef);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TypedTest_ImportPrototypeAfterImportedDefinition() {
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *FromTU = getTuDecl(getDefinition() + getPrototype(), Lang_CXX03);
|
2019-05-13 18:06:25 +08:00
|
|
|
auto *FromDef = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
|
|
|
|
auto *FromProto = LastDeclMatcher<DeclTy>().match(FromTU, getPattern());
|
|
|
|
ASSERT_TRUE(FromDef->isThisDeclarationADefinition());
|
|
|
|
ASSERT_FALSE(FromProto->isThisDeclarationADefinition());
|
|
|
|
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *ImportedDef = Import(FromDef, Lang_CXX03);
|
|
|
|
Decl *ImportedProto = Import(FromProto, Lang_CXX03);
|
2019-05-13 18:06:25 +08:00
|
|
|
Decl *ToTU = ImportedDef->getTranslationUnitDecl();
|
|
|
|
|
|
|
|
EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);
|
|
|
|
auto *ToDef = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());
|
|
|
|
auto *ToProto = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());
|
|
|
|
EXPECT_TRUE(ImportedDef == ToDef);
|
|
|
|
EXPECT_TRUE(ImportedProto == ToProto);
|
|
|
|
EXPECT_TRUE(ToDef->isThisDeclarationADefinition());
|
|
|
|
EXPECT_FALSE(ToProto->isThisDeclarationADefinition());
|
|
|
|
|
|
|
|
CheckPreviousDecl(ToDef, ToProto);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TypedTest_ImportPrototypes() {
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *FromTU0 = getTuDecl(getPrototype(), Lang_CXX03, "input0.cc");
|
|
|
|
Decl *FromTU1 = getTuDecl(getPrototype(), Lang_CXX03, "input1.cc");
|
2019-05-13 18:06:25 +08:00
|
|
|
auto *From0 = FirstDeclMatcher<DeclTy>().match(FromTU0, getPattern());
|
|
|
|
auto *From1 = FirstDeclMatcher<DeclTy>().match(FromTU1, getPattern());
|
|
|
|
ASSERT_FALSE(From0->isThisDeclarationADefinition());
|
|
|
|
ASSERT_FALSE(From1->isThisDeclarationADefinition());
|
|
|
|
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *Imported0 = Import(From0, Lang_CXX03);
|
|
|
|
Decl *Imported1 = Import(From1, Lang_CXX03);
|
2019-05-13 18:06:25 +08:00
|
|
|
Decl *ToTU = Imported0->getTranslationUnitDecl();
|
|
|
|
|
|
|
|
EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);
|
|
|
|
auto *To0 = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());
|
|
|
|
auto *To1 = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());
|
|
|
|
EXPECT_TRUE(Imported0 == To0);
|
|
|
|
EXPECT_TRUE(Imported1 == To1);
|
|
|
|
EXPECT_FALSE(To0->isThisDeclarationADefinition());
|
|
|
|
EXPECT_FALSE(To1->isThisDeclarationADefinition());
|
|
|
|
|
|
|
|
CheckPreviousDecl(To0, To1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TypedTest_ImportDefinitions() {
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *FromTU0 = getTuDecl(getDefinition(), Lang_CXX03, "input0.cc");
|
|
|
|
Decl *FromTU1 = getTuDecl(getDefinition(), Lang_CXX03, "input1.cc");
|
2019-05-13 18:06:25 +08:00
|
|
|
auto *From0 = FirstDeclMatcher<DeclTy>().match(FromTU0, getPattern());
|
|
|
|
auto *From1 = FirstDeclMatcher<DeclTy>().match(FromTU1, getPattern());
|
|
|
|
ASSERT_TRUE(From0->isThisDeclarationADefinition());
|
|
|
|
ASSERT_TRUE(From1->isThisDeclarationADefinition());
|
|
|
|
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *Imported0 = Import(From0, Lang_CXX03);
|
|
|
|
Decl *Imported1 = Import(From1, Lang_CXX03);
|
2019-05-13 18:06:25 +08:00
|
|
|
Decl *ToTU = Imported0->getTranslationUnitDecl();
|
|
|
|
|
|
|
|
EXPECT_EQ(Imported0, Imported1);
|
|
|
|
EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 1u);
|
|
|
|
auto *To0 = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());
|
|
|
|
EXPECT_TRUE(Imported0 == To0);
|
|
|
|
EXPECT_TRUE(To0->isThisDeclarationADefinition());
|
|
|
|
if (auto *ToT0 = dyn_cast<TemplateDecl>(To0)) {
|
|
|
|
EXPECT_TRUE(ToT0->getTemplatedDecl());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TypedTest_ImportDefinitionThenPrototype() {
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *FromTUDef = getTuDecl(getDefinition(), Lang_CXX03, "input0.cc");
|
|
|
|
Decl *FromTUProto = getTuDecl(getPrototype(), Lang_CXX03, "input1.cc");
|
2019-05-13 18:06:25 +08:00
|
|
|
auto *FromDef = FirstDeclMatcher<DeclTy>().match(FromTUDef, getPattern());
|
|
|
|
auto *FromProto =
|
|
|
|
FirstDeclMatcher<DeclTy>().match(FromTUProto, getPattern());
|
|
|
|
ASSERT_TRUE(FromDef->isThisDeclarationADefinition());
|
|
|
|
ASSERT_FALSE(FromProto->isThisDeclarationADefinition());
|
|
|
|
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *ImportedDef = Import(FromDef, Lang_CXX03);
|
|
|
|
Decl *ImportedProto = Import(FromProto, Lang_CXX03);
|
2019-05-13 18:06:25 +08:00
|
|
|
Decl *ToTU = ImportedDef->getTranslationUnitDecl();
|
|
|
|
|
|
|
|
EXPECT_NE(ImportedDef, ImportedProto);
|
|
|
|
EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);
|
|
|
|
auto *ToDef = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());
|
|
|
|
auto *ToProto = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());
|
|
|
|
EXPECT_TRUE(ImportedDef == ToDef);
|
|
|
|
EXPECT_TRUE(ImportedProto == ToProto);
|
|
|
|
EXPECT_TRUE(ToDef->isThisDeclarationADefinition());
|
|
|
|
EXPECT_FALSE(ToProto->isThisDeclarationADefinition());
|
|
|
|
|
|
|
|
CheckPreviousDecl(ToDef, ToProto);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TypedTest_ImportPrototypeThenDefinition() {
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *FromTUProto = getTuDecl(getPrototype(), Lang_CXX03, "input0.cc");
|
|
|
|
Decl *FromTUDef = getTuDecl(getDefinition(), Lang_CXX03, "input1.cc");
|
2019-05-13 18:06:25 +08:00
|
|
|
auto *FromProto =
|
|
|
|
FirstDeclMatcher<DeclTy>().match(FromTUProto, getPattern());
|
|
|
|
auto *FromDef = FirstDeclMatcher<DeclTy>().match(FromTUDef, getPattern());
|
|
|
|
ASSERT_TRUE(FromDef->isThisDeclarationADefinition());
|
|
|
|
ASSERT_FALSE(FromProto->isThisDeclarationADefinition());
|
|
|
|
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *ImportedProto = Import(FromProto, Lang_CXX03);
|
|
|
|
Decl *ImportedDef = Import(FromDef, Lang_CXX03);
|
2019-05-13 18:06:25 +08:00
|
|
|
Decl *ToTU = ImportedDef->getTranslationUnitDecl();
|
|
|
|
|
|
|
|
EXPECT_NE(ImportedDef, ImportedProto);
|
|
|
|
EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);
|
|
|
|
auto *ToProto = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());
|
|
|
|
auto *ToDef = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());
|
|
|
|
EXPECT_TRUE(ImportedDef == ToDef);
|
|
|
|
EXPECT_TRUE(ImportedProto == ToProto);
|
|
|
|
EXPECT_TRUE(ToDef->isThisDeclarationADefinition());
|
|
|
|
EXPECT_FALSE(ToProto->isThisDeclarationADefinition());
|
|
|
|
|
|
|
|
CheckPreviousDecl(ToProto, ToDef);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TypedTest_WholeRedeclChainIsImportedAtOnce() {
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *FromTU = getTuDecl(getPrototype() + getDefinition(), Lang_CXX03);
|
2019-05-13 18:06:25 +08:00
|
|
|
auto *FromD = // Definition
|
|
|
|
LastDeclMatcher<DeclTy>().match(FromTU, getPattern());
|
|
|
|
ASSERT_TRUE(FromD->isThisDeclarationADefinition());
|
|
|
|
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *ImportedD = Import(FromD, Lang_CXX03);
|
2019-05-13 18:06:25 +08:00
|
|
|
Decl *ToTU = ImportedD->getTranslationUnitDecl();
|
|
|
|
|
|
|
|
// The whole redecl chain is imported at once.
|
|
|
|
EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);
|
|
|
|
EXPECT_TRUE(cast<DeclTy>(ImportedD)->isThisDeclarationADefinition());
|
|
|
|
}
|
|
|
|
|
|
|
|
void TypedTest_ImportPrototypeThenProtoAndDefinition() {
|
|
|
|
{
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Decl *FromTU = getTuDecl(getPrototype(), Lang_CXX03, "input0.cc");
|
2019-05-13 18:06:25 +08:00
|
|
|
auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Import(FromD, Lang_CXX03);
|
2019-05-13 18:06:25 +08:00
|
|
|
}
|
|
|
|
{
|
|
|
|
Decl *FromTU =
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
getTuDecl(getPrototype() + getDefinition(), Lang_CXX03, "input1.cc");
|
2019-05-13 18:06:25 +08:00
|
|
|
auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
|
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".
I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.
Reviewers: shafik, hlopko
Reviewed By: hlopko
Subscribers: jfb, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81000
2020-06-02 22:10:39 +08:00
|
|
|
Import(FromD, Lang_CXX03);
|
2019-05-13 18:06:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Decl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
|
|
|
|
|
|
|
|
ASSERT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 3u);
|
|
|
|
DeclTy *ProtoD = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());
|
|
|
|
EXPECT_FALSE(ProtoD->isThisDeclarationADefinition());
|
|
|
|
|
|
|
|
DeclTy *DefinitionD = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());
|
|
|
|
EXPECT_TRUE(DefinitionD->isThisDeclarationADefinition());
|
|
|
|
|
|
|
|
EXPECT_TRUE(DefinitionD->getPreviousDecl());
|
|
|
|
EXPECT_FALSE(
|
|
|
|
DefinitionD->getPreviousDecl()->isThisDeclarationADefinition());
|
|
|
|
|
|
|
|
CheckPreviousDecl(ProtoD, DefinitionD->getPreviousDecl());
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#define ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(BaseTemplate, TypeParam, \
|
|
|
|
NamePrefix, TestCase) \
|
|
|
|
using BaseTemplate##TypeParam = BaseTemplate<TypeParam>; \
|
|
|
|
TEST_P(BaseTemplate##TypeParam, NamePrefix##TestCase) { \
|
|
|
|
TypedTest_##TestCase(); \
|
|
|
|
}
|
|
|
|
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(
|
|
|
|
RedeclChain, Function, ,
|
|
|
|
PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(
|
|
|
|
RedeclChain, Class, ,
|
|
|
|
PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
|
[ASTImporter] Added visibility check for scoped enums.
Summary:
ASTImporter makes now difference between C++11 scoped enums with same
name in different translation units if these are not visible outside.
Enum declarations are linked into decl chain correctly.
Reviewers: martong, a.sidorin, shafik, a_sidorin, teemperor
Reviewed By: shafik, a_sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, teemperor, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74554
2020-02-17 21:25:16 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(
|
|
|
|
RedeclChain, EnumClass, ,
|
|
|
|
PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
|
2019-05-13 18:06:25 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(
|
|
|
|
RedeclChain, Variable, ,
|
|
|
|
PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(
|
|
|
|
RedeclChain, FunctionTemplate, ,
|
|
|
|
PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(
|
|
|
|
RedeclChain, ClassTemplate, ,
|
|
|
|
PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
|
2020-02-25 21:47:38 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(
|
|
|
|
RedeclChain, VariableTemplate, ,
|
|
|
|
PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
|
2019-05-13 18:06:25 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(
|
|
|
|
RedeclChain, FunctionTemplateSpec, ,
|
|
|
|
PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(
|
|
|
|
RedeclChain, ClassTemplateSpec, ,
|
|
|
|
PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
|
|
|
|
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Function, ,
|
|
|
|
DefinitionShouldBeImportedAsADefinition)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Class, ,
|
|
|
|
DefinitionShouldBeImportedAsADefinition)
|
[ASTImporter] Added visibility check for scoped enums.
Summary:
ASTImporter makes now difference between C++11 scoped enums with same
name in different translation units if these are not visible outside.
Enum declarations are linked into decl chain correctly.
Reviewers: martong, a.sidorin, shafik, a_sidorin, teemperor
Reviewed By: shafik, a_sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, teemperor, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74554
2020-02-17 21:25:16 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, EnumClass, ,
|
|
|
|
DefinitionShouldBeImportedAsADefinition)
|
2019-05-13 18:06:25 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Variable, ,
|
|
|
|
DefinitionShouldBeImportedAsADefinition)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplate, ,
|
|
|
|
DefinitionShouldBeImportedAsADefinition)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplate, ,
|
|
|
|
DefinitionShouldBeImportedAsADefinition)
|
2020-02-25 21:47:38 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, VariableTemplate, ,
|
|
|
|
DefinitionShouldBeImportedAsADefinition)
|
2019-05-13 18:06:25 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplateSpec, ,
|
|
|
|
DefinitionShouldBeImportedAsADefinition)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplateSpec, ,
|
|
|
|
DefinitionShouldBeImportedAsADefinition)
|
|
|
|
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Function, ,
|
|
|
|
ImportPrototypeAfterImportedPrototype)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Class, ,
|
|
|
|
ImportPrototypeAfterImportedPrototype)
|
[ASTImporter] Added visibility check for scoped enums.
Summary:
ASTImporter makes now difference between C++11 scoped enums with same
name in different translation units if these are not visible outside.
Enum declarations are linked into decl chain correctly.
Reviewers: martong, a.sidorin, shafik, a_sidorin, teemperor
Reviewed By: shafik, a_sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, teemperor, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74554
2020-02-17 21:25:16 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, EnumClass, ,
|
|
|
|
ImportPrototypeAfterImportedPrototype)
|
2019-05-13 18:06:25 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Variable, ,
|
|
|
|
ImportPrototypeAfterImportedPrototype)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplate, ,
|
|
|
|
ImportPrototypeAfterImportedPrototype)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplate, ,
|
|
|
|
ImportPrototypeAfterImportedPrototype)
|
2020-02-25 21:47:38 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, VariableTemplate, ,
|
|
|
|
ImportPrototypeAfterImportedPrototype)
|
2019-05-13 18:06:25 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplateSpec, ,
|
|
|
|
ImportPrototypeAfterImportedPrototype)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplateSpec, ,
|
|
|
|
ImportPrototypeAfterImportedPrototype)
|
|
|
|
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Function, ,
|
|
|
|
ImportDefinitionAfterImportedPrototype)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Class, ,
|
|
|
|
ImportDefinitionAfterImportedPrototype)
|
[ASTImporter] Added visibility check for scoped enums.
Summary:
ASTImporter makes now difference between C++11 scoped enums with same
name in different translation units if these are not visible outside.
Enum declarations are linked into decl chain correctly.
Reviewers: martong, a.sidorin, shafik, a_sidorin, teemperor
Reviewed By: shafik, a_sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, teemperor, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74554
2020-02-17 21:25:16 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, EnumClass, ,
|
|
|
|
ImportDefinitionAfterImportedPrototype)
|
2019-05-13 18:06:25 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Variable, ,
|
|
|
|
ImportDefinitionAfterImportedPrototype)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplate, ,
|
|
|
|
ImportDefinitionAfterImportedPrototype)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplate, ,
|
|
|
|
ImportDefinitionAfterImportedPrototype)
|
2020-02-25 21:47:38 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, VariableTemplate, ,
|
|
|
|
ImportDefinitionAfterImportedPrototype)
|
2019-05-13 18:06:25 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplateSpec, ,
|
|
|
|
ImportDefinitionAfterImportedPrototype)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplateSpec, ,
|
|
|
|
ImportDefinitionAfterImportedPrototype)
|
|
|
|
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Function, ,
|
|
|
|
ImportPrototypeAfterImportedDefinition)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Class, ,
|
|
|
|
ImportPrototypeAfterImportedDefinition)
|
[ASTImporter] Added visibility check for scoped enums.
Summary:
ASTImporter makes now difference between C++11 scoped enums with same
name in different translation units if these are not visible outside.
Enum declarations are linked into decl chain correctly.
Reviewers: martong, a.sidorin, shafik, a_sidorin, teemperor
Reviewed By: shafik, a_sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, teemperor, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74554
2020-02-17 21:25:16 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, EnumClass, ,
|
|
|
|
ImportPrototypeAfterImportedDefinition)
|
2019-05-13 18:06:25 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Variable, ,
|
|
|
|
ImportPrototypeAfterImportedDefinition)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplate, ,
|
|
|
|
ImportPrototypeAfterImportedDefinition)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplate, ,
|
|
|
|
ImportPrototypeAfterImportedDefinition)
|
2020-02-25 21:47:38 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, VariableTemplate, ,
|
|
|
|
ImportPrototypeAfterImportedDefinition)
|
2019-05-13 18:06:25 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplateSpec, ,
|
|
|
|
ImportPrototypeAfterImportedDefinition)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplateSpec, ,
|
|
|
|
ImportPrototypeAfterImportedDefinition)
|
|
|
|
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Function, ,
|
|
|
|
ImportPrototypes)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Class, , ImportPrototypes)
|
[ASTImporter] Added visibility check for scoped enums.
Summary:
ASTImporter makes now difference between C++11 scoped enums with same
name in different translation units if these are not visible outside.
Enum declarations are linked into decl chain correctly.
Reviewers: martong, a.sidorin, shafik, a_sidorin, teemperor
Reviewed By: shafik, a_sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, teemperor, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74554
2020-02-17 21:25:16 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, EnumClass, ,
|
|
|
|
ImportPrototypes)
|
2019-05-13 18:06:25 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Variable, ,
|
|
|
|
ImportPrototypes)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplate, ,
|
|
|
|
ImportPrototypes)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplate, ,
|
|
|
|
ImportPrototypes)
|
2020-02-25 21:47:38 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, VariableTemplate, ,
|
|
|
|
ImportPrototypes)
|
2019-05-13 18:06:25 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplateSpec, ,
|
|
|
|
ImportPrototypes)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplateSpec, ,
|
|
|
|
ImportPrototypes)
|
|
|
|
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Function, ,
|
|
|
|
ImportDefinitions)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Class, , ImportDefinitions)
|
[ASTImporter] Added visibility check for scoped enums.
Summary:
ASTImporter makes now difference between C++11 scoped enums with same
name in different translation units if these are not visible outside.
Enum declarations are linked into decl chain correctly.
Reviewers: martong, a.sidorin, shafik, a_sidorin, teemperor
Reviewed By: shafik, a_sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, teemperor, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74554
2020-02-17 21:25:16 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, EnumClass, ,
|
|
|
|
ImportDefinitions)
|
2019-05-13 18:06:25 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Variable, ,
|
|
|
|
ImportDefinitions)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplate, ,
|
|
|
|
ImportDefinitions)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplate, ,
|
|
|
|
ImportDefinitions)
|
2020-02-25 21:47:38 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, VariableTemplate, ,
|
|
|
|
ImportDefinitions)
|
2019-05-13 18:06:25 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplateSpec, ,
|
|
|
|
ImportDefinitions)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplateSpec, ,
|
|
|
|
ImportDefinitions)
|
|
|
|
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Function, ,
|
|
|
|
ImportDefinitionThenPrototype)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Class, ,
|
|
|
|
ImportDefinitionThenPrototype)
|
[ASTImporter] Added visibility check for scoped enums.
Summary:
ASTImporter makes now difference between C++11 scoped enums with same
name in different translation units if these are not visible outside.
Enum declarations are linked into decl chain correctly.
Reviewers: martong, a.sidorin, shafik, a_sidorin, teemperor
Reviewed By: shafik, a_sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, teemperor, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74554
2020-02-17 21:25:16 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, EnumClass, ,
|
|
|
|
ImportDefinitionThenPrototype)
|
2019-05-13 18:06:25 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Variable, ,
|
|
|
|
ImportDefinitionThenPrototype)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplate, ,
|
|
|
|
ImportDefinitionThenPrototype)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplate, ,
|
|
|
|
ImportDefinitionThenPrototype)
|
2020-02-25 21:47:38 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, VariableTemplate, ,
|
|
|
|
ImportDefinitionThenPrototype)
|
2019-05-13 18:06:25 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplateSpec, ,
|
|
|
|
ImportDefinitionThenPrototype)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplateSpec, ,
|
|
|
|
ImportDefinitionThenPrototype)
|
|
|
|
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Function, ,
|
|
|
|
ImportPrototypeThenDefinition)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Class, ,
|
|
|
|
ImportPrototypeThenDefinition)
|
[ASTImporter] Added visibility check for scoped enums.
Summary:
ASTImporter makes now difference between C++11 scoped enums with same
name in different translation units if these are not visible outside.
Enum declarations are linked into decl chain correctly.
Reviewers: martong, a.sidorin, shafik, a_sidorin, teemperor
Reviewed By: shafik, a_sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, teemperor, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74554
2020-02-17 21:25:16 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, EnumClass, ,
|
|
|
|
ImportPrototypeThenDefinition)
|
2019-05-13 18:06:25 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Variable, ,
|
|
|
|
ImportPrototypeThenDefinition)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplate, ,
|
|
|
|
ImportPrototypeThenDefinition)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplate, ,
|
|
|
|
ImportPrototypeThenDefinition)
|
2020-02-25 21:47:38 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, VariableTemplate, ,
|
|
|
|
ImportPrototypeThenDefinition)
|
2019-05-13 18:06:25 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplateSpec, ,
|
|
|
|
ImportPrototypeThenDefinition)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplateSpec, ,
|
|
|
|
ImportPrototypeThenDefinition)
|
|
|
|
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Function, ,
|
|
|
|
WholeRedeclChainIsImportedAtOnce)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Variable, ,
|
|
|
|
WholeRedeclChainIsImportedAtOnce)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplate, ,
|
|
|
|
WholeRedeclChainIsImportedAtOnce)
|
2020-02-25 21:47:38 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, VariableTemplate, ,
|
|
|
|
WholeRedeclChainIsImportedAtOnce)
|
2019-05-13 18:06:25 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplateSpec, ,
|
|
|
|
WholeRedeclChainIsImportedAtOnce)
|
|
|
|
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Function, ,
|
|
|
|
ImportPrototypeThenProtoAndDefinition)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Variable, ,
|
|
|
|
ImportPrototypeThenProtoAndDefinition)
|
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplate, ,
|
|
|
|
ImportPrototypeThenProtoAndDefinition)
|
2020-02-25 21:47:38 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, VariableTemplate, ,
|
|
|
|
ImportPrototypeThenProtoAndDefinition)
|
2019-05-13 18:06:25 +08:00
|
|
|
ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplateSpec, ,
|
|
|
|
ImportPrototypeThenProtoAndDefinition)
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ParameterizedTests, RedeclChainFunction,
|
|
|
|
DefaultTestValuesForRunOptions, );
|
|
|
|
INSTANTIATE_TEST_CASE_P(ParameterizedTests, RedeclChainClass,
|
|
|
|
DefaultTestValuesForRunOptions, );
|
[ASTImporter] Added visibility check for scoped enums.
Summary:
ASTImporter makes now difference between C++11 scoped enums with same
name in different translation units if these are not visible outside.
Enum declarations are linked into decl chain correctly.
Reviewers: martong, a.sidorin, shafik, a_sidorin, teemperor
Reviewed By: shafik, a_sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, teemperor, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74554
2020-02-17 21:25:16 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ParameterizedTests, RedeclChainEnumClass,
|
|
|
|
DefaultTestValuesForRunOptions, );
|
2019-05-13 18:06:25 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ParameterizedTests, RedeclChainVariable,
|
|
|
|
DefaultTestValuesForRunOptions, );
|
|
|
|
INSTANTIATE_TEST_CASE_P(ParameterizedTests, RedeclChainFunctionTemplate,
|
|
|
|
DefaultTestValuesForRunOptions, );
|
|
|
|
INSTANTIATE_TEST_CASE_P(ParameterizedTests, RedeclChainClassTemplate,
|
|
|
|
DefaultTestValuesForRunOptions, );
|
2020-02-25 21:47:38 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ParameterizedTests, RedeclChainVariableTemplate,
|
|
|
|
DefaultTestValuesForRunOptions, );
|
2019-05-13 18:06:25 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ParameterizedTests, RedeclChainFunctionTemplateSpec,
|
|
|
|
DefaultTestValuesForRunOptions, );
|
|
|
|
INSTANTIATE_TEST_CASE_P(ParameterizedTests, RedeclChainClassTemplateSpec,
|
|
|
|
DefaultTestValuesForRunOptions, );
|
|
|
|
|
|
|
|
} // end namespace ast_matchers
|
|
|
|
} // end namespace clang
|