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.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 46480 Build 48964: arc lint + arc unit
Event Timeline
clang/lib/AST/ASTImporter.cpp | ||
---|---|---|
2600 | Can you explain why we need to check D->isThisDeclarationADefinition() Does the test added hit all the combination of cases? |
clang/lib/AST/ASTImporter.cpp | ||
---|---|---|
2600 | By the time of this check, we already know that D and the existing (found) decl are structurally equivalent. If they are both definitions then they must be the same, so we keep on with the existing. Actually, this is not unorthodox with enums, this is the pattern that we follow with all kind of declarations. |
clang/unittests/AST/ASTImporterTest.cpp | ||
---|---|---|
4870 ↗ | (On Diff #244422) | Maybe it's better to use just non-raw string literals here? Decl *ToTU = getToTuDecl("enum class E;"); |
clang/lib/AST/ASTImporter.cpp | ||
---|---|---|
2600 | Good observation: The enum class case could be added to the generic redecl and ODR tests. This makes the single test in ASTImporterTest.cpp unnecessary, this case should be covered by the tests in ASTImporterGenericRedeclTest.cpp. |
Can you explain why we need to check D->isThisDeclarationADefinition()
Does the test added hit all the combination of cases?