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 | d5b207baabf18c03656387aeac87e62b5bb3c12b (patch) | |
tree | 70fe5727b1d7ab2baef68bea2024ff5a0fdf6888 /include | |
parent | 1010941954a44520d12037d8b6d81a4af89b57a6 (diff) | |
download | external_llvm-d5b207baabf18c03656387aeac87e62b5bb3c12b.zip external_llvm-d5b207baabf18c03656387aeac87e62b5bb3c12b.tar.gz external_llvm-d5b207baabf18c03656387aeac87e62b5bb3c12b.tar.bz2 |
Some compilers are picky about accessing the first element of a std::vector if
there's nothing in the vector. Pacify them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61536 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/ScheduleDAGSDNodes.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/llvm/CodeGen/ScheduleDAGSDNodes.h b/include/llvm/CodeGen/ScheduleDAGSDNodes.h index d7f0ea4..b9c6428 100644 --- a/include/llvm/CodeGen/ScheduleDAGSDNodes.h +++ b/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(); } |