[lld] r276118 - [ELF] - Fixed integral constant overflow warning under MSVS 2015. NFC.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 20 07:26:48 PDT 2016
Author: grimar
Date: Wed Jul 20 09:26:48 2016
New Revision: 276118
URL: http://llvm.org/viewvc/llvm-project?rev=276118&view=rev
Log:
[ELF] - Fixed integral constant overflow warning under MSVS 2015. NFC.
Under MSVS 2015 I observed integral constant overflow warning when aggregate initialization was used
to init the bit field. Patch fixes that.
Modified:
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/SymbolTable.h
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=276118&r1=276117&r2=276118&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Wed Jul 20 09:26:48 2016
@@ -174,13 +174,13 @@ static uint8_t getMinVisibility(uint8_t
// Find an existing symbol or create and insert a new one.
template <class ELFT>
std::pair<Symbol *, bool> SymbolTable<ELFT>::insert(StringRef Name) {
- auto P = Symtab.insert({Name, {(int)SymVector.size(), false}});
+ auto P = Symtab.insert({Name, SymIndex((int)SymVector.size(), false)});
SymIndex &V = P.first->second;
bool IsNew = P.second;
if (V.Idx == -1) {
IsNew = true;
- V = {(int)SymVector.size(), true};
+ V = SymIndex((int)SymVector.size(), true);
}
Symbol *Sym;
Modified: lld/trunk/ELF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.h?rev=276118&r1=276117&r2=276118&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.h (original)
+++ lld/trunk/ELF/SymbolTable.h Wed Jul 20 09:26:48 2016
@@ -102,6 +102,7 @@ private:
std::map<std::string, SymbolBody *> getDemangledSyms();
struct SymIndex {
+ SymIndex(int Idx, bool Traced) : Idx(Idx), Traced(Traced) {}
int Idx : 31;
unsigned Traced : 1;
};
More information about the llvm-commits
mailing list