[cfe-commits] r68278 - in /cfe/trunk/lib: Frontend/FixItRewriter.cpp Sema/SemaDecl.cpp

Douglas Gregor dgregor at apple.com
Wed Apr 1 20:14:15 PDT 2009


Author: dgregor
Date: Wed Apr  1 22:14:12 2009
New Revision: 68278

URL: http://llvm.org/viewvc/llvm-project?rev=68278&view=rev
Log:
Clean up -fixit output slightly

Modified:
    cfe/trunk/lib/Frontend/FixItRewriter.cpp
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Frontend/FixItRewriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FixItRewriter.cpp?rev=68278&r1=68277&r2=68278&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/FixItRewriter.cpp (original)
+++ cfe/trunk/lib/Frontend/FixItRewriter.cpp Wed Apr  1 22:14:12 2009
@@ -57,8 +57,9 @@
     OutFile = &llvm::outs();
   } else {
     llvm::sys::Path Path(InFileName);
+    std::string Suffix = Path.getSuffix();
     Path.eraseSuffix();
-    Path.appendSuffix("cpp");
+    Path.appendSuffix("fixit." + Suffix);
     std::string Err;
     OutFile = new llvm::raw_fd_ostream(Path.toString().c_str(), 
                                        // set binary mode (critical for Windoze)

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=68278&r1=68277&r2=68278&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Apr  1 22:14:12 2009
@@ -2706,11 +2706,12 @@
   // Verify 6.9.1p6: 'every identifier in the identifier list shall be declared'
   // for a K&R function.
   if (!FTI.hasPrototype) {
-    for (unsigned i = 0, e = FTI.NumArgs; i != e; ++i) {
+    for (int i = FTI.NumArgs; i != 0; /* decrement in loop */) {
+      --i;
       if (FTI.ArgInfo[i].Param == 0) {
-        std::string Code = "int ";
+        std::string Code = "  int ";
         Code += FTI.ArgInfo[i].Ident->getName();
-        Code += ";\n ";
+        Code += ";\n";
         Diag(FTI.ArgInfo[i].IdentLoc, diag::ext_param_not_declared)
           << FTI.ArgInfo[i].Ident
           << CodeModificationHint::CreateInsertion(LocAfterDecls, Code);





More information about the cfe-commits mailing list