[llvm-commits] [dragonegg] r149198 - in /dragonegg/trunk: include/dragonegg/Internals.h src/Backend.cpp src/Convert.cpp
Duncan Sands
baldrick at free.fr
Sun Jan 29 09:37:38 PST 2012
Author: baldrick
Date: Sun Jan 29 11:37:38 2012
New Revision: 149198
URL: http://llvm.org/viewvc/llvm-project?rev=149198&view=rev
Log:
A Twine shouldn't be returned from a function call (according to
the Twine docs at least). While there, ensure a C string is passed
to decode_reg_name if REGISTER_PREFIX is defined (pointed out by
Jin-Gu Kang).
Modified:
dragonegg/trunk/include/dragonegg/Internals.h
dragonegg/trunk/src/Backend.cpp
dragonegg/trunk/src/Convert.cpp
Modified: dragonegg/trunk/include/dragonegg/Internals.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/dragonegg/Internals.h?rev=149198&r1=149197&r2=149198&view=diff
==============================================================================
--- dragonegg/trunk/include/dragonegg/Internals.h (original)
+++ dragonegg/trunk/include/dragonegg/Internals.h Sun Jan 29 11:37:38 2012
@@ -159,7 +159,7 @@
void register_ctor_dtor(Function *, int, bool);
const char *extractRegisterName(tree_node *);
void handleVisibility(tree_node *decl, GlobalValue *GV);
-Twine getLLVMAssemblerName(tree_node *);
+std::string getLLVMAssemblerName(tree_node *);
/// Return true if and only if field no. N from struct type T is a padding
/// element added to match llvm struct type size and gcc struct type size.
Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=149198&r1=149197&r2=149198&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Sun Jan 29 11:37:38 2012
@@ -1080,14 +1080,14 @@
std::string Name;
if (TREE_CODE(decl) != CONST_DECL) // CONST_DECLs do not have assembler names.
- Name = getLLVMAssemblerName(decl).str();
+ Name = getLLVMAssemblerName(decl);
// Now handle ordinary static variables and functions (in memory).
// Also handle vars declared register invalidly.
if (!Name.empty() && Name[0] == 1) {
#ifdef REGISTER_PREFIX
if (strlen (REGISTER_PREFIX) != 0) {
- int reg_number = decode_reg_name(Name);
+ int reg_number = decode_reg_name(Name.c_str());
if (reg_number >= 0 || reg_number == -3)
error("register name given for non-register variable %q+D", decl);
}
@@ -1296,16 +1296,16 @@
/// getLLVMAssemblerName - Get the assembler name (DECL_ASSEMBLER_NAME) for the
/// declaration, with any leading star replaced by '\1'.
-Twine getLLVMAssemblerName(union tree_node *decl) {
+std::string getLLVMAssemblerName(union tree_node *decl) {
tree Ident = DECL_ASSEMBLER_NAME(decl);
if (!Ident)
- return "";
+ return std::string();
const char *Name = IDENTIFIER_POINTER(Ident);
if (*Name != '*')
- return Name;
+ return std::string(Name);
- return "\1" + Twine(Name + 1);
+ return "\1" + std::string(Name + 1);
}
/// FinalizePlugin - Shutdown the plugin.
Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=149198&r1=149197&r2=149198&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Sun Jan 29 11:37:38 2012
@@ -483,7 +483,7 @@
}
void TreeToLLVM::StartFunctionBody() {
- std::string Name = getLLVMAssemblerName(FnDecl).str();
+ std::string Name = getLLVMAssemblerName(FnDecl);
// TODO: Add support for dropping the leading '\1' in order to support
// unsigned bswap(unsigned) __asm__("llvm.bswap");
// This would also require adjustments in make_decl_llvm.
More information about the llvm-commits
mailing list