[llvm-commits] [dragonegg] r152119 - /dragonegg/trunk/src/Types.cpp

Duncan Sands baldrick at free.fr
Tue Mar 6 05:18:49 PST 2012


Author: baldrick
Date: Tue Mar  6 07:18:49 2012
New Revision: 152119

URL: http://llvm.org/viewvc/llvm-project?rev=152119&view=rev
Log:
Add a central check for a property that is assumed in bits of code
scattered all over.

Modified:
    dragonegg/trunk/src/Types.cpp

Modified: dragonegg/trunk/src/Types.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Types.cpp?rev=152119&r1=152118&r2=152119&view=diff
==============================================================================
--- dragonegg/trunk/src/Types.cpp (original)
+++ dragonegg/trunk/src/Types.cpp Tue Mar  6 07:18:49 2012
@@ -415,6 +415,11 @@
 /// of the scalar GCC type 'type'.  All of the EmitReg* routines use this to
 /// determine the LLVM type to return.
 Type *getRegType(tree type) {
+  // Check that the type mode doesn't depend on the type variant (various bits
+  // of the plugin rely on this).
+  assert(TYPE_MODE(type) == TYPE_MODE(TYPE_MAIN_VARIANT(type))
+         && "Type mode differs between variants!");
+
   // LLVM doesn't care about variants such as const, volatile, or restrict.
   type = TYPE_MAIN_VARIANT(type);
 
@@ -1525,6 +1530,11 @@
 Type *ConvertType(tree type) {
   if (type == error_mark_node) return Type::getInt32Ty(Context);
 
+  // Check that the type mode doesn't depend on the type variant (various bits
+  // of the plugin rely on this).
+  assert(TYPE_MODE(type) == TYPE_MODE(TYPE_MAIN_VARIANT(type))
+         && "Type mode differs between variants!");
+
   // LLVM doesn't care about variants such as const, volatile, or restrict.
   type = TYPE_MAIN_VARIANT(type);
 





More information about the llvm-commits mailing list