[llvm-commits] [PATCH] More changes to build LLVM with xlC 12.1 on AIX 7.1
Kai
kai at redstar.de
Wed Oct 31 04:54:05 PDT 2012
Hi!
Here are a couple more changes required for xlC:
xlc_alignoftest.diff:
The AlignOf unittest must use GNU style __attribute()__, too.
xlc_backinserter.diff:
xlC does not find std::copy and std::back_inserter if the namespace is
missing. Error message is:
"../llvm-git/include/llvm/Analysis/BlockFrequencyImpl.h", line 274.52:
1540-0274 (S) The name lookup for "back_inserter" did not find a
declaration.
"../llvm-git/include/llvm/Analysis/BlockFrequencyImpl.h", line 274.52:
1540-1226 (I) Declarations for non-dependent names are resolved in the
template definition.
"../llvm-git/include/llvm/Analysis/BlockFrequencyImpl.h", line 274.52:
1540-1227 (I) "back_inserter" does not depend on a template argument.
xlc_debuginfo.diff:
DWARFDebugArangeSet uses Header as a (public) type name and a (private)
member name. This leads to the error message:
"../llvm-git/lib/DebugInfo/DWARFDebugArangeSet.h", line 51.10: 1540-0416
(S) "Header" cannot be declared because its name has already been used.
"../llvm-git/lib/DebugInfo/DWARFDebugArangeSet.h", line 51.3: 1540-0426
(I) The name "Header" is used on line 51 of
"../llvm-git/lib/DebugInfo/DWARFDebugArangeSet.h".
I renamed the member Header to HeaderData to resolve it.
xlc_unittests.diff:
xlC does not find the right template if a template parameter is NULL.
Help is to provide the type. Error message is:
"../llvm-git/utils/unittest/googletest/include/gtest/gtest.h", line
1318.7: 1540-0207 (S) No common type found for operands with type "int"
and "const int *".
"../llvm-git/utils/unittest/googletest/include/gtest/gtest.h", line
1306.17: 1540-0700 (I) The previous message was produced while
processing "testing::internal::CmpHelperEQ<int,const int *>(const char
*, const char *, const int &, const int * const &)".
"../llvm-git/utils/unittest/googletest/include/gtest/gtest.h", line
1354.12: 1540-0700 (I) The previous message was produced while
processing "testing::internal::EqHelper<0>::Compare<int,const int
*>(const char *, const char *, const int &, const int * const &)".
"../llvm-git/unittests/ADT/ImmutableMapTest.cpp", line 40.3: 1540-0700
(I) The previous message was produced while processing
"<unnamed>::ImmutableMapTest_MultiElemIntMapTest_Test::TestBody()".
Please review and commit if it looks good.
Regards
Kai
-------------- next part --------------
diff --git a/include/llvm/ADT/PostOrderIterator.h b/include/llvm/ADT/PostOrderIterator.h
index 7f6350e..59fa3f3 100644
--- a/include/llvm/ADT/PostOrderIterator.h
+++ b/include/llvm/ADT/PostOrderIterator.h
@@ -260,7 +260,7 @@ class ReversePostOrderTraversal {
typedef typename GT::NodeType NodeType;
std::vector<NodeType*> Blocks; // Block list in normal PO order
inline void Initialize(NodeType *BB) {
- copy(po_begin(BB), po_end(BB), back_inserter(Blocks));
+ std::copy(po_begin(BB), po_end(BB), std::back_inserter(Blocks));
}
public:
typedef typename std::vector<NodeType*>::reverse_iterator rpo_iterator;
diff --git a/include/llvm/Analysis/BlockFrequencyImpl.h b/include/llvm/Analysis/BlockFrequencyImpl.h
index 5168ab7..e0217a9 100644
--- a/include/llvm/Analysis/BlockFrequencyImpl.h
+++ b/include/llvm/Analysis/BlockFrequencyImpl.h
@@ -271,7 +271,7 @@ class BlockFrequencyImpl {
BlockT *EntryBlock = fn->begin();
- copy(po_begin(EntryBlock), po_end(EntryBlock), back_inserter(POT));
+ std::copy(po_begin(EntryBlock), po_end(EntryBlock), std::back_inserter(POT));
unsigned RPOidx = 0;
for (rpot_iterator I = rpot_begin(), E = rpot_end(); I != E; ++I) {
-------------- next part --------------
diff --git a/unittests/Support/AlignOfTest.cpp b/unittests/Support/AlignOfTest.cpp
index f2d1170..c9ad757 100644
--- a/unittests/Support/AlignOfTest.cpp
+++ b/unittests/Support/AlignOfTest.cpp
@@ -28,7 +28,7 @@ struct alignas(1) A1 { };
struct alignas(2) A2 { };
struct alignas(4) A4 { };
struct alignas(8) A8 { };
-#elif defined(__GNUC__)
+#elif defined(__GNUC__) || defined(__IBM_ATTRIBUTES)
struct A1 { } __attribute__((aligned(1)));
struct A2 { } __attribute__((aligned(2)));
struct A4 { } __attribute__((aligned(4)));
-------------- next part --------------
diff --git a/unittests/ADT/ImmutableMapTest.cpp b/unittests/ADT/ImmutableMapTest.cpp
index 774581c..89b7179 100644
--- a/unittests/ADT/ImmutableMapTest.cpp
+++ b/unittests/ADT/ImmutableMapTest.cpp
@@ -36,8 +36,8 @@ TEST(ImmutableMapTest, MultiElemIntMapTest) {
EXPECT_TRUE(S.isEmpty());
EXPECT_FALSE(S2.isEmpty());
- EXPECT_EQ(0, S.lookup(3));
- EXPECT_EQ(0, S.lookup(9));
+ EXPECT_EQ(static_cast<int *>(0), S.lookup(3));
+ EXPECT_EQ(static_cast<int *>(0), S.lookup(9));
EXPECT_EQ(10, *S2.lookup(3));
EXPECT_EQ(11, *S2.lookup(4));
diff --git a/unittests/ADT/ilistTest.cpp b/unittests/ADT/ilistTest.cpp
index 09a699a..f67de6d 100644
--- a/unittests/ADT/ilistTest.cpp
+++ b/unittests/ADT/ilistTest.cpp
@@ -27,8 +27,8 @@ TEST(ilistTest, Basic) {
ilist<Node> List;
List.push_back(Node(1));
EXPECT_EQ(1, List.back().Value);
- EXPECT_EQ(0, List.back().getPrevNode());
- EXPECT_EQ(0, List.back().getNextNode());
+ EXPECT_EQ(static_cast<Node *>(0), List.back().getPrevNode());
+ EXPECT_EQ(static_cast<Node *>(0), List.back().getNextNode());
List.push_back(Node(2));
EXPECT_EQ(2, List.back().Value);
diff --git a/unittests/Support/CommandLineTest.cpp b/unittests/Support/CommandLineTest.cpp
index 13e9038..6c6ac33 100644
--- a/unittests/Support/CommandLineTest.cpp
+++ b/unittests/Support/CommandLineTest.cpp
@@ -24,7 +24,7 @@ class TempEnvVar {
TempEnvVar(const char *name, const char *value)
: name(name) {
const char *old_value = getenv(name);
- EXPECT_EQ(NULL, old_value) << old_value;
+ EXPECT_EQ(static_cast<const char *>(NULL), old_value) << old_value;
#if HAVE_SETENV
setenv(name, value, true);
#else
diff --git a/unittests/Support/DataExtractorTest.cpp b/unittests/Support/DataExtractorTest.cpp
index ec8bd3d..4a92332 100644
--- a/unittests/Support/DataExtractorTest.cpp
+++ b/unittests/Support/DataExtractorTest.cpp
@@ -94,7 +94,7 @@ TEST(DataExtractorTest, Strings) {
EXPECT_EQ(stringData, DE.getCStr(&offset));
EXPECT_EQ(11U, offset);
- EXPECT_EQ(NULL, DE.getCStr(&offset));
+ EXPECT_EQ(static_cast<const char *>(NULL), DE.getCStr(&offset));
EXPECT_EQ(11U, offset);
}
diff --git a/unittests/Support/ValueHandleTest.cpp b/unittests/Support/ValueHandleTest.cpp
index 2e5e5b1..717307d 100644
--- a/unittests/Support/ValueHandleTest.cpp
+++ b/unittests/Support/ValueHandleTest.cpp
@@ -274,7 +274,7 @@ TEST_F(ValueHandle, CallbackVH_CallbackOnRAUW) {
private:
virtual void deleted() { DeletedCalls++; CallbackVH::deleted(); }
virtual void allUsesReplacedWith(Value *new_value) {
- EXPECT_EQ(NULL, AURWArgument);
+ EXPECT_EQ(static_cast<Value*>(NULL), AURWArgument);
AURWArgument = new_value;
}
};
@@ -282,7 +282,7 @@ TEST_F(ValueHandle, CallbackVH_CallbackOnRAUW) {
RecordingVH RVH;
RVH = BitcastV.get();
EXPECT_EQ(0, RVH.DeletedCalls);
- EXPECT_EQ(NULL, RVH.AURWArgument);
+ EXPECT_EQ(static_cast<Value*>(NULL), RVH.AURWArgument);
BitcastV->replaceAllUsesWith(ConstantV);
EXPECT_EQ(0, RVH.DeletedCalls);
EXPECT_EQ(ConstantV, RVH.AURWArgument);
@@ -309,7 +309,7 @@ TEST_F(ValueHandle, CallbackVH_DeletionCanRAUW) {
virtual void allUsesReplacedWith(Value *new_value) {
ASSERT_TRUE(NULL != getValPtr());
EXPECT_EQ(1U, getValPtr()->getNumUses());
- EXPECT_EQ(NULL, AURWArgument);
+ EXPECT_EQ(static_cast<Value*>(NULL), AURWArgument);
AURWArgument = new_value;
}
};
@@ -372,8 +372,8 @@ TEST_F(ValueHandle, DestroyingOtherVHOnSameValueDoesntBreakIteration) {
WeakVH ShouldBeVisited2(BitcastV.get());
BitcastV.reset();
- EXPECT_EQ(NULL, static_cast<Value*>(ShouldBeVisited1));
- EXPECT_EQ(NULL, static_cast<Value*>(ShouldBeVisited2));
+ EXPECT_EQ(static_cast<Value*>(NULL), static_cast<Value*>(ShouldBeVisited1));
+ EXPECT_EQ(static_cast<Value*>(NULL), static_cast<Value*>(ShouldBeVisited2));
}
}
-------------- next part --------------
diff --git a/lib/DebugInfo/DWARFDebugArangeSet.cpp b/lib/DebugInfo/DWARFDebugArangeSet.cpp
index 2efbfd1..7dff9ff 100644
--- a/lib/DebugInfo/DWARFDebugArangeSet.cpp
+++ b/lib/DebugInfo/DWARFDebugArangeSet.cpp
@@ -16,7 +16,7 @@ using namespace llvm;
void DWARFDebugArangeSet::clear() {
Offset = -1U;
- std::memset(&Header, 0, sizeof(Header));
+ std::memset(&HeaderData, 0, sizeof(Header));
ArangeDescriptors.clear();
}
@@ -66,15 +66,15 @@ DWARFDebugArangeSet::extract(DataExtractor data, uint32_t *offset_ptr) {
// descriptor on the target system. This header is followed by a series
// of tuples. Each tuple consists of an address and a length, each in
// the size appropriate for an address on the target architecture.
- Header.Length = data.getU32(offset_ptr);
- Header.Version = data.getU16(offset_ptr);
- Header.CuOffset = data.getU32(offset_ptr);
- Header.AddrSize = data.getU8(offset_ptr);
- Header.SegSize = data.getU8(offset_ptr);
+ HeaderData.Length = data.getU32(offset_ptr);
+ HeaderData.Version = data.getU16(offset_ptr);
+ HeaderData.CuOffset = data.getU32(offset_ptr);
+ HeaderData.AddrSize = data.getU8(offset_ptr);
+ HeaderData.SegSize = data.getU8(offset_ptr);
// Perform basic validation of the header fields.
- if (!data.isValidOffsetForDataOfSize(Offset, Header.Length) ||
- (Header.AddrSize != 4 && Header.AddrSize != 8)) {
+ if (!data.isValidOffsetForDataOfSize(Offset, HeaderData.Length) ||
+ (HeaderData.AddrSize != 4 && HeaderData.AddrSize != 8)) {
clear();
return false;
}
@@ -84,7 +84,7 @@ DWARFDebugArangeSet::extract(DataExtractor data, uint32_t *offset_ptr) {
// size of an address). The header is padded, if necessary, to the
// appropriate boundary.
const uint32_t header_size = *offset_ptr - Offset;
- const uint32_t tuple_size = Header.AddrSize * 2;
+ const uint32_t tuple_size = HeaderData.AddrSize * 2;
uint32_t first_tuple_offset = 0;
while (first_tuple_offset < header_size)
first_tuple_offset += tuple_size;
@@ -94,11 +94,11 @@ DWARFDebugArangeSet::extract(DataExtractor data, uint32_t *offset_ptr) {
Descriptor arangeDescriptor;
assert(sizeof(arangeDescriptor.Address) == sizeof(arangeDescriptor.Length));
- assert(sizeof(arangeDescriptor.Address) >= Header.AddrSize);
+ assert(sizeof(arangeDescriptor.Address) >= HeaderData.AddrSize);
while (data.isValidOffset(*offset_ptr)) {
- arangeDescriptor.Address = data.getUnsigned(offset_ptr, Header.AddrSize);
- arangeDescriptor.Length = data.getUnsigned(offset_ptr, Header.AddrSize);
+ arangeDescriptor.Address = data.getUnsigned(offset_ptr, HeaderData.AddrSize);
+ arangeDescriptor.Length = data.getUnsigned(offset_ptr, HeaderData.AddrSize);
// Each set of tuples is terminated by a 0 for the address and 0
// for the length.
@@ -115,11 +115,11 @@ DWARFDebugArangeSet::extract(DataExtractor data, uint32_t *offset_ptr) {
void DWARFDebugArangeSet::dump(raw_ostream &OS) const {
OS << format("Address Range Header: length = 0x%8.8x, version = 0x%4.4x, ",
- Header.Length, Header.Version)
+ HeaderData.Length, HeaderData.Version)
<< format("cu_offset = 0x%8.8x, addr_size = 0x%2.2x, seg_size = 0x%2.2x\n",
- Header.CuOffset, Header.AddrSize, Header.SegSize);
+ HeaderData.CuOffset, HeaderData.AddrSize, HeaderData.SegSize);
- const uint32_t hex_width = Header.AddrSize * 2;
+ const uint32_t hex_width = HeaderData.AddrSize * 2;
for (DescriptorConstIter pos = ArangeDescriptors.begin(),
end = ArangeDescriptors.end(); pos != end; ++pos)
OS << format("[0x%*.*" PRIx64 " -", hex_width, hex_width, pos->Address)
@@ -145,7 +145,7 @@ uint32_t DWARFDebugArangeSet::findAddress(uint64_t address) const {
std::find_if(ArangeDescriptors.begin(), end, // Range
DescriptorContainsAddress(address)); // Predicate
if (pos != end)
- return Header.CuOffset;
+ return HeaderData.CuOffset;
return -1U;
}
diff --git a/lib/DebugInfo/DWARFDebugArangeSet.h b/lib/DebugInfo/DWARFDebugArangeSet.h
index 9a2a6d0..d768676 100644
--- a/lib/DebugInfo/DWARFDebugArangeSet.h
+++ b/lib/DebugInfo/DWARFDebugArangeSet.h
@@ -48,7 +48,7 @@ private:
typedef DescriptorColl::const_iterator DescriptorConstIter;
uint32_t Offset;
- Header Header;
+ Header HeaderData;
DescriptorColl ArangeDescriptors;
public:
@@ -58,11 +58,11 @@ public:
bool extract(DataExtractor data, uint32_t *offset_ptr);
void dump(raw_ostream &OS) const;
- uint32_t getCompileUnitDIEOffset() const { return Header.CuOffset; }
- uint32_t getOffsetOfNextEntry() const { return Offset + Header.Length + 4; }
+ uint32_t getCompileUnitDIEOffset() const { return HeaderData.CuOffset; }
+ uint32_t getOffsetOfNextEntry() const { return Offset + HeaderData.Length + 4; }
uint32_t findAddress(uint64_t address) const;
uint32_t getNumDescriptors() const { return ArangeDescriptors.size(); }
- const struct Header &getHeader() const { return Header; }
+ const struct Header &getHeader() const { return HeaderData; }
const Descriptor *getDescriptor(uint32_t i) const {
if (i < ArangeDescriptors.size())
return &ArangeDescriptors[i];
More information about the llvm-commits
mailing list