[dragonegg] r182565 - In very obscure circumstances GCC creates a basic type with no name. Just make

Duncan Sands baldrick at free.fr
Thu May 23 00:54:47 PDT 2013


Author: baldrick
Date: Thu May 23 02:54:47 2013
New Revision: 182565

URL: http://llvm.org/viewvc/llvm-project?rev=182565&view=rev
Log:
In very obscure circumstances GCC creates a basic type with no name.  Just make
up a name for the benefit of debug info in this case.  The invented name is the
same one that GCC itself seems to use when this happens.  Note that none of the
testcases exhibiting this behaviour compile with clang as they are too deep into
weird GCC extension territory.

Added:
    dragonegg/trunk/test/compilator/local/c++/nameless-type.cpp
Modified:
    dragonegg/trunk/src/Debug.cpp

Modified: dragonegg/trunk/src/Debug.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Debug.cpp?rev=182565&r1=182564&r2=182565&view=diff
==============================================================================
--- dragonegg/trunk/src/Debug.cpp (original)
+++ dragonegg/trunk/src/Debug.cpp Thu May 23 02:54:47 2013
@@ -429,6 +429,8 @@ void DebugInfo::EmitGlobalVariable(Globa
 DIType DebugInfo::createBasicType(tree type) {
 
   StringRef TypeName = GetNodeName(type);
+  if (TypeName.empty())
+    TypeName = "__unknown__";
   uint64_t Size = NodeSizeInBits(type);
   uint64_t Align = NodeAlignInBits(type);
 

Added: dragonegg/trunk/test/compilator/local/c++/nameless-type.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/test/compilator/local/c%2B%2B/nameless-type.cpp?rev=182565&view=auto
==============================================================================
--- dragonegg/trunk/test/compilator/local/c++/nameless-type.cpp (added)
+++ dragonegg/trunk/test/compilator/local/c++/nameless-type.cpp Thu May 23 02:54:47 2013
@@ -0,0 +1,19 @@
+namespace std {
+  namespace decimal {
+    class decimal64 {
+      public:
+	typedef float __decfloat64 __attribute__ ((mode (DD)));
+	explicit decimal64 (int __r):__val (__r) {}
+      private:
+	__decfloat64 __val;
+    };
+  }
+}
+
+int bar (const std::decimal::decimal64 & x) { }
+
+int foo ()
+{
+  std::decimal::decimal64 x(0);
+  bar (x);
+}





More information about the llvm-commits mailing list