diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2015-08-05 21:16:02 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2015-08-05 21:16:02 +0000 |
commit | 7282dd774f9f01693ef71ef633730e556db3398a (patch) | |
tree | 43d84479289fa78adb025dcdcf502119d477ac5f | |
parent | 3affe6e2640072b469fea3ff946b1421b3dc4e36 (diff) | |
download | bcm5719-llvm-7282dd774f9f01693ef71ef633730e556db3398a.tar.gz bcm5719-llvm-7282dd774f9f01693ef71ef633730e556db3398a.zip |
Replace &vector[0] with vector.data() to avoid invalid dereference caught by debug STL. Also move a '*' for consistency and fix an 80-col violation.
llvm-svn: 244134
-rw-r--r-- | llvm/tools/gold/gold-plugin.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp index 18cd621317e..a63cbbd6087 100644 --- a/llvm/tools/gold/gold-plugin.cpp +++ b/llvm/tools/gold/gold-plugin.cpp @@ -103,7 +103,7 @@ namespace options { // use only and will not be passed. static std::vector<const char *> extra; - static void process_plugin_option(const char* opt_) + static void process_plugin_option(const char *opt_) { if (opt_ == nullptr) return; @@ -322,7 +322,8 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file, message(LDPL_ERROR, "Failed to get a view of %s", file->name); return LDPS_ERR; } - BufferRef = MemoryBufferRef(StringRef((const char *)view, file->filesize), ""); + BufferRef = + MemoryBufferRef(StringRef((const char *)view, file->filesize), ""); } else { int64_t offset = 0; // Gold has found what might be IR part-way inside of a file, such as @@ -429,7 +430,7 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file, } if (!cf.syms.empty()) { - if (add_symbols(cf.handle, cf.syms.size(), &cf.syms[0]) != LDPS_OK) { + if (add_symbols(cf.handle, cf.syms.size(), cf.syms.data()) != LDPS_OK) { message(LDPL_ERROR, "Unable to add symbols!"); return LDPS_ERR; } @@ -583,7 +584,7 @@ getModuleForFile(LLVMContext &Context, claimed_file &F, ld_plugin_input_file &Info, raw_fd_ostream *ApiFile, StringSet<> &Internalize, StringSet<> &Maybe) { - if (get_symbols(F.handle, F.syms.size(), &F.syms[0]) != LDPS_OK) + if (get_symbols(F.handle, F.syms.size(), F.syms.data()) != LDPS_OK) message(LDPL_FATAL, "Failed to get symbol information"); const void *View; |