[clang-tools-extra] r189228 - Fixed some issues that resulted in erroneous duplicate symbol error messages.
John Thompson
John.Thompson.JTSoftware at gmail.com
Mon Aug 26 08:17:23 PDT 2013
Author: jtsoftware
Date: Mon Aug 26 10:17:23 2013
New Revision: 189228
URL: http://llvm.org/viewvc/llvm-project?rev=189228&view=rev
Log:
Fixed some issues that resulted in erroneous duplicate symbol error messages.
Added:
clang-tools-extra/trunk/test/modularize/Inputs/Anonymous.h
clang-tools-extra/trunk/test/modularize/Inputs/NamespaceClasses.h
clang-tools-extra/trunk/test/modularize/Inputs/TemplateClasses.h
clang-tools-extra/trunk/test/modularize/NoProblemsAnonymous.modularize
clang-tools-extra/trunk/test/modularize/NoProblemsNamespaceClasses.modularize
clang-tools-extra/trunk/test/modularize/NoProblemsTemplateClasses.modularize
Modified:
clang-tools-extra/trunk/modularize/Modularize.cpp
clang-tools-extra/trunk/test/modularize/Inputs/SomeTypes.h
Modified: clang-tools-extra/trunk/modularize/Modularize.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/Modularize.cpp?rev=189228&r1=189227&r2=189228&view=diff
==============================================================================
--- clang-tools-extra/trunk/modularize/Modularize.cpp (original)
+++ clang-tools-extra/trunk/modularize/Modularize.cpp Mon Aug 26 10:17:23 2013
@@ -418,13 +418,23 @@ public:
if (isa<NamespaceDecl>(ND) || isa<UsingDirectiveDecl>(ND) ||
isa<NamespaceAliasDecl>(ND) ||
isa<ClassTemplateSpecializationDecl>(ND) || isa<UsingDecl>(ND) ||
+ isa<ClassTemplateDecl>(ND) || isa<TemplateTypeParmDecl>(ND) ||
+ isa<TypeAliasTemplateDecl>(ND) ||
isa<UsingShadowDecl>(ND) || isa<FunctionDecl>(ND) ||
isa<FunctionTemplateDecl>(ND) ||
(isa<TagDecl>(ND) &&
!cast<TagDecl>(ND)->isThisDeclarationADefinition()))
return true;
- std::string Name = ND->getNameAsString();
+ // Skip anonymous declarations.
+ if (!ND->getDeclName())
+ return true;
+
+ // Get the qualified name.
+ std::string Name;
+ llvm::raw_string_ostream OS(Name);
+ ND->printQualifiedName(OS);
+ OS.flush();
if (Name.empty())
return true;
Added: clang-tools-extra/trunk/test/modularize/Inputs/Anonymous.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/modularize/Inputs/Anonymous.h?rev=189228&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/modularize/Inputs/Anonymous.h (added)
+++ clang-tools-extra/trunk/test/modularize/Inputs/Anonymous.h Mon Aug 26 10:17:23 2013
@@ -0,0 +1,11 @@
+// Exercise some anonymous type issues.
+
+// Anonymous enum.
+enum {
+ Tag1
+};
+
+// Anonymous enum typedef.
+typedef enum {
+ Tag2
+} AnonymousEnum;
Added: clang-tools-extra/trunk/test/modularize/Inputs/NamespaceClasses.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/modularize/Inputs/NamespaceClasses.h?rev=189228&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/modularize/Inputs/NamespaceClasses.h (added)
+++ clang-tools-extra/trunk/test/modularize/Inputs/NamespaceClasses.h Mon Aug 26 10:17:23 2013
@@ -0,0 +1,20 @@
+// Define same class name in different namespaces.
+
+namespace Namespace1 {
+ class NamespaceClass {
+ public:
+ NamespaceClass() : Member(0) {}
+ private:
+ int Member;
+ };
+}
+
+namespace Namespace2 {
+ class NamespaceClass {
+ public:
+ NamespaceClass() : Member(0) {}
+ private:
+ int Member;
+ };
+}
+
Modified: clang-tools-extra/trunk/test/modularize/Inputs/SomeTypes.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/modularize/Inputs/SomeTypes.h?rev=189228&r1=189227&r2=189228&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/modularize/Inputs/SomeTypes.h (original)
+++ clang-tools-extra/trunk/test/modularize/Inputs/SomeTypes.h Mon Aug 26 10:17:23 2013
@@ -14,25 +14,3 @@ public:
private:
int Member;
};
-
-/*
-This currently doesn't work. Can't handle same name in different namespaces.
-namespace Namespace1 {
- class NamespaceClass {
- public:
- NamespaceClass() : Member(0) {}
- private:
- int Member;
- };
-}
-
-namespace Namespace2 {
- class NamespaceClass {
- public:
- NamespaceClass() : Member(0) {}
- private:
- int Member;
- };
-}
-*/
-
Added: clang-tools-extra/trunk/test/modularize/Inputs/TemplateClasses.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/modularize/Inputs/TemplateClasses.h?rev=189228&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/modularize/Inputs/TemplateClasses.h (added)
+++ clang-tools-extra/trunk/test/modularize/Inputs/TemplateClasses.h Mon Aug 26 10:17:23 2013
@@ -0,0 +1,15 @@
+// Exercise some template issues. Should not produce errors.
+
+// Forward declaration.
+template<class T> class TemplateClass;
+
+// Full declaration.
+template<class T>class TemplateClass {
+public:
+ TemplateClass() {}
+private:
+ T Member;
+};
+
+// Template alias.
+template<class T> using TemplateClassAlias = TemplateClass<T>;
Added: clang-tools-extra/trunk/test/modularize/NoProblemsAnonymous.modularize
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/modularize/NoProblemsAnonymous.modularize?rev=189228&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/modularize/NoProblemsAnonymous.modularize (added)
+++ clang-tools-extra/trunk/test/modularize/NoProblemsAnonymous.modularize Mon Aug 26 10:17:23 2013
@@ -0,0 +1,3 @@
+# RUN: modularize %s -x c++
+
+Inputs/Anonymous.h
Added: clang-tools-extra/trunk/test/modularize/NoProblemsNamespaceClasses.modularize
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/modularize/NoProblemsNamespaceClasses.modularize?rev=189228&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/modularize/NoProblemsNamespaceClasses.modularize (added)
+++ clang-tools-extra/trunk/test/modularize/NoProblemsNamespaceClasses.modularize Mon Aug 26 10:17:23 2013
@@ -0,0 +1,3 @@
+# RUN: modularize %s -x c++
+
+Inputs/NamespaceClasses.h
Added: clang-tools-extra/trunk/test/modularize/NoProblemsTemplateClasses.modularize
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/modularize/NoProblemsTemplateClasses.modularize?rev=189228&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/modularize/NoProblemsTemplateClasses.modularize (added)
+++ clang-tools-extra/trunk/test/modularize/NoProblemsTemplateClasses.modularize Mon Aug 26 10:17:23 2013
@@ -0,0 +1,3 @@
+# RUN: modularize %s -x c++
+
+Inputs/TemplateClasses.h
More information about the cfe-commits
mailing list