[llvm] r240124 - IRBuilder: Add unit tests for construction of globals with address space
Tobias Grosser
tobias at grosser.es
Fri Jun 19 00:19:17 PDT 2015
Author: grosser
Date: Fri Jun 19 02:19:17 2015
New Revision: 240124
URL: http://llvm.org/viewvc/llvm-project?rev=240124&view=rev
Log:
IRBuilder: Add unit tests for construction of globals with address space
This was forgotten in r240113. Thanks Eric for paying attention.
Modified:
llvm/trunk/unittests/IR/IRBuilderTest.cpp
Modified: llvm/trunk/unittests/IR/IRBuilderTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/IRBuilderTest.cpp?rev=240124&r1=240123&r2=240124&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/IRBuilderTest.cpp (original)
+++ llvm/trunk/unittests/IR/IRBuilderTest.cpp Fri Jun 19 02:19:17 2015
@@ -320,5 +320,17 @@ TEST_F(IRBuilderTest, InsertExtractEleme
EXPECT_EQ(Elt2, X2);
}
+TEST_F(IRBuilderTest, CreateGlobalStringPtr) {
+ IRBuilder<> Builder(BB);
+ auto String1a = Builder.CreateGlobalStringPtr("TestString", "String1a");
+ auto String1b = Builder.CreateGlobalStringPtr("TestString", "String1b", 0);
+ auto String2 = Builder.CreateGlobalStringPtr("TestString", "String2", 1);
+ auto String3 = Builder.CreateGlobalString("TestString", "String3", 2);
+
+ EXPECT_TRUE(String1a->getType()->getPointerAddressSpace() == 0);
+ EXPECT_TRUE(String1b->getType()->getPointerAddressSpace() == 0);
+ EXPECT_TRUE(String2->getType()->getPointerAddressSpace() == 1);
+ EXPECT_TRUE(String3->getType()->getPointerAddressSpace() == 2);
+}
}
More information about the llvm-commits
mailing list