OSDN Git Service
(root)
/
android-x86
/
external-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
d604b8c
)
[MetadataTest] Fix off-by-one strncpy warning reported by gcc8. (NFC)
author
Florian Hahn
<florian.hahn@arm.com>
Sun, 25 Nov 2018 19:38:02 +0000
(19:38 +0000)
committer
Florian Hahn
<florian.hahn@arm.com>
Sun, 25 Nov 2018 19:38:02 +0000
(19:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347528
91177308
-0d34-0410-b5e6-
96231b3b80d8
unittests/IR/MetadataTest.cpp
patch
|
blob
|
history
diff --git
a/unittests/IR/MetadataTest.cpp
b/unittests/IR/MetadataTest.cpp
index
b2ffb80
..
3f744cd
100644
(file)
--- a/
unittests/IR/MetadataTest.cpp
+++ b/
unittests/IR/MetadataTest.cpp
@@
-147,11
+147,9
@@
TEST_F(MDStringTest, CreateSame) {
// Test that MDString prints out the string we fed it.
TEST_F(MDStringTest, PrintingSimple) {
- char *str = new char[13];
- strncpy(str, "testing 1 2 3", 13);
- MDString *s = MDString::get(Context, StringRef(str, 13));
- strncpy(str, "aaaaaaaaaaaaa", 13);
- delete[] str;
+ char str[14] = "testing 1 2 3";
+ MDString *s = MDString::get(Context, StringRef(&str[0], 13));
+ strncpy(str, "aaaaaaaaaaaaa", 14);
std::string Str;
raw_string_ostream oss(Str);