[llvm-branch-commits] [llvm-gcc-branch] r70311 - /llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-types.cpp
Bill Wendling
isanbard at gmail.com
Tue Apr 28 11:43:47 PDT 2009
Author: void
Date: Tue Apr 28 13:43:46 2009
New Revision: 70311
URL: http://llvm.org/viewvc/llvm-project?rev=70311&view=rev
Log:
--- Merging r70301 into '.':
U gcc/llvm-types.cpp
Prevent the code handling virtual base classes
from getting confused by similar ObjC types.
6831493.
Modified:
llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-types.cpp
Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-types.cpp?rev=70311&r1=70310&r2=70311&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-types.cpp Tue Apr 28 13:43:46 2009
@@ -1685,11 +1685,11 @@
// If already in table, reuse.
if (!newTy) {
newTy = copy_node(oldTy);
- tree F2 = 0, prevF2 = 0;
+ tree F2 = 0, prevF2 = 0, F;
// Copy the fields up to the TYPE_DECL separator.
// VAR_DECLs can also appear, representing static members. Possibly some
// other junk I haven't hit yet, just skip anything that's not a FIELD:(
- for (tree F = TYPE_FIELDS(oldTy); F; prevF2 = F2, F = TREE_CHAIN(F)) {
+ for (F = TYPE_FIELDS(oldTy); F; prevF2 = F2, F = TREE_CHAIN(F)) {
if (TREE_CODE(F) == TYPE_DECL)
break;
if (TREE_CODE(F) == FIELD_DECL) {
@@ -1701,6 +1701,14 @@
TREE_CHAIN(F2) = 0;
}
}
+ // If we didn't find a TYPE_DECL this isn't the virtual base class case.
+ // The ObjC trees for bitfield instance variables can look similar enough
+ // to the C++ virtual base case to get this far, but these don't have
+ // the TYPE_DECL sentinel, nor the virtual base class allocation problem.
+ if (!F || TREE_CODE(F) != TYPE_DECL) {
+ BaseTypesMap[oldTy] = oldTy;
+ return oldTy;
+ }
BaseTypesMap[oldTy] = newTy;
BaseTypesMap[newTy] = oldTy;
/* Prevent gcc's garbage collector from destroying newTy. The
More information about the llvm-branch-commits
mailing list