diff options
| author | Bill Wendling <isanbard@gmail.com> | 2009-01-01 01:14:31 +0000 |
|---|---|---|
| committer | Bill Wendling <isanbard@gmail.com> | 2009-01-01 01:14:31 +0000 |
| commit | 4f8b265825c592ef885157f0832ac6ad5aa72fd6 (patch) | |
| tree | 631f099f4c020c1ac70bcba402641e93c3f98062 /llvm/include | |
| parent | 163848021be5f594a4904e26e23ee892e0797c4d (diff) | |
| download | bcm5719-llvm-4f8b265825c592ef885157f0832ac6ad5aa72fd6.tar.gz bcm5719-llvm-4f8b265825c592ef885157f0832ac6ad5aa72fd6.zip | |
Some compilers are picky about accessing the first element of a std::vector if
there's nothing in the vector. Pacify them.
llvm-svn: 61536
Diffstat (limited to 'llvm/include')
| -rw-r--r-- | llvm/include/llvm/CodeGen/ScheduleDAGSDNodes.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/include/llvm/CodeGen/ScheduleDAGSDNodes.h b/llvm/include/llvm/CodeGen/ScheduleDAGSDNodes.h index d7f0ea49d48..b9c6428fba7 100644 --- a/llvm/include/llvm/CodeGen/ScheduleDAGSDNodes.h +++ b/llvm/include/llvm/CodeGen/ScheduleDAGSDNodes.h @@ -103,10 +103,13 @@ namespace llvm { /// SUnit *NewSUnit(SDNode *N) { #ifndef NDEBUG - const SUnit *Addr = &SUnits[0]; + const SUnit *Addr = 0; + if (SUnits.size() > 0) + Addr = &SUnits[0]; #endif SUnits.push_back(SUnit(N, (unsigned)SUnits.size())); - assert(Addr == &SUnits[0] && "SUnits std::vector reallocated on the fly!"); + assert((Addr == 0 || Addr == &SUnits[0]) && + "SUnits std::vector reallocated on the fly!"); SUnits.back().OrigNode = &SUnits.back(); return &SUnits.back(); } |

