[llvm-commits] [dragonegg] r148638 - /dragonegg/trunk/src/Backend.cpp
Duncan Sands
baldrick at free.fr
Sat Jan 21 09:06:39 PST 2012
Author: baldrick
Date: Sat Jan 21 11:06:39 2012
New Revision: 148638
URL: http://llvm.org/viewvc/llvm-project?rev=148638&view=rev
Log:
When printing register names in diagnostics we were printing with
a star in front, eg `*f2' where gcc would print `f2'. This is due
to gcc printing the diagnostic using cp_printer, while we get the
default printer because language data has been freed by the time
that we run. Since we know perfectly well the string that should
be printed, just print it directly.
Modified:
dragonegg/trunk/src/Backend.cpp
Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=148638&r1=148637&r2=148638&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Sat Jan 21 11:06:39 2012
@@ -1001,28 +1001,29 @@
/// well-formed. If not, emit error messages and return true. If so, return
/// false.
bool ValidateRegisterVariable(tree decl) {
- int RegNumber = decode_reg_name(extractRegisterName(decl));
+ const char *RegName = extractRegisterName(decl);
+ int RegNumber = decode_reg_name(RegName);
if (errorcount || sorrycount)
return true; // Do not process broken code.
/* Detect errors in declaring global registers. */
if (RegNumber == -1)
- error("register name not specified for %q+D", decl);
+ error("register name not specified for %<%s%>", RegName);
else if (RegNumber < 0)
- error("invalid register name for %q+D", decl);
+ error("invalid register name for %<%s%>", RegName);
else if (TYPE_MODE(TREE_TYPE(decl)) == BLKmode)
- error("data type of %q+D isn%'t suitable for a register", decl);
+ error("data type of %<%s%> isn%'t suitable for a register", RegName);
#if 0 // FIXME: enable this.
else if (!HARD_REGNO_MODE_OK(RegNumber, TYPE_MODE(TREE_TYPE(decl))))
- error("register specified for %q+D isn%'t suitable for data type",
- decl);
+ error("register specified for %<%s%> isn%'t suitable for data type",
+ RegName);
#endif
else if (DECL_INITIAL(decl) != 0 && TREE_STATIC(decl))
error("global register variable has initial value");
else if (AGGREGATE_TYPE_P(TREE_TYPE(decl)))
- sorry("LLVM cannot handle register variable %q+D, report a bug",
- decl);
+ sorry("LLVM cannot handle register variable %<%s%>, report a bug",
+ RegName);
else {
if (TREE_THIS_VOLATILE(decl))
warning(0, "volatile register variables don%'t work as you might wish");
@@ -1285,8 +1286,8 @@
/// extractRegisterName - Get a register name given its decl. In 4.2 unlike 4.0
/// these names have been run through set_user_assembler_name which means they
/// may have a leading star at this point; compensate.
-const char* extractRegisterName(tree decl) {
- const char* Name = IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(decl));
+const char *extractRegisterName(tree decl) {
+ const char *Name = IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(decl));
return (*Name == '*') ? Name + 1 : Name;
}
More information about the llvm-commits
mailing list