forked from OSchip/llvm-project
Fix a bug that mergeCases table does not match the merge constants.
MergeCases table should not have an entry for MergeContents because atoms with MergeContents attribute should never have name. This issue was not caught by a test because getting a value of 6th element of an array of array actually gets the first element's value of the next array, and that happened to be a valid value. Added asserts to catch that error. llvm-svn: 203322
This commit is contained in:
parent
bc28340573
commit
7caea31189
|
@ -98,8 +98,8 @@ public:
|
|||
// by linker
|
||||
mergeAsWeakAndAddressUsed, // Is C++ definition inline definition whose
|
||||
// address was taken.
|
||||
mergeByContent, // Merge with other constants with same content
|
||||
mergeSameNameAndSize, // Another atom with different size is error
|
||||
mergeByContent, // Merge with other constants with same content.
|
||||
};
|
||||
|
||||
enum ContentType {
|
||||
|
|
|
@ -113,6 +113,8 @@ static MergeResolution mergeCases[][5] = {
|
|||
|
||||
static MergeResolution mergeSelect(DefinedAtom::Merge first,
|
||||
DefinedAtom::Merge second) {
|
||||
assert(first != DefinedAtom::mergeByContent);
|
||||
assert(second != DefinedAtom::mergeByContent);
|
||||
return mergeCases[first][second];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue