[llvm-commits] [llvm] r115551 - in /llvm/trunk: include/llvm/MC/MCContext.h lib/MC/MCContext.cpp lib/MC/MCDwarf.cpp lib/MC/MCParser/AsmParser.cpp

Kevin Enderby enderby at apple.com
Mon Oct 4 13:17:24 PDT 2010


Author: enderby
Date: Mon Oct  4 15:17:24 2010
New Revision: 115551

URL: http://llvm.org/viewvc/llvm-project?rev=115551&view=rev
Log:
Incorporate suggestions by Daniel Dunbar after his review.  Thanks Daniel!

1) Changed ValidateDwarfFileNumber() to isValidDwarfFileNumber() to be better
   named.  Since it is just a predicate and isn't actually changing any state.

2) Added a missing return in the comments for setCurrentDwarfLoc() in 
   include/llvm/MC/MCContext.h for fix formatting.

3) Changed clearDwarfLocSeen() to ClearDwarfLocSeen() since it does change
   state.

4) Simplified the last test in isValidDwarfFileNumber() to just a one line
   boolean test of MCDwarfFiles[FileNumber] != 0 for the final return statement.


Modified:
    llvm/trunk/include/llvm/MC/MCContext.h
    llvm/trunk/lib/MC/MCContext.cpp
    llvm/trunk/lib/MC/MCDwarf.cpp
    llvm/trunk/lib/MC/MCParser/AsmParser.cpp

Modified: llvm/trunk/include/llvm/MC/MCContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCContext.h?rev=115551&r1=115550&r2=115551&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCContext.h (original)
+++ llvm/trunk/include/llvm/MC/MCContext.h Mon Oct  4 15:17:24 2010
@@ -160,7 +160,7 @@
     /// GetDwarfFile - creates an entry in the dwarf file and directory tables.
     unsigned GetDwarfFile(StringRef FileName, unsigned FileNumber);
 
-    bool ValidateDwarfFileNumber(unsigned FileNumber);
+    bool isValidDwarfFileNumber(unsigned FileNumber);
 
     bool hasDwarfFiles(void) {
       return MCDwarfFiles.size() != 0;
@@ -177,7 +177,8 @@
     }
 
     /// setCurrentDwarfLoc - saves the information from the currently parsed
-    /// dwarf .loc directive and sets DwarfLocSeen.  When the next instruction      /// is assembled an entry in the line number table with this information and
+    /// dwarf .loc directive and sets DwarfLocSeen.  When the next instruction
+    /// is assembled an entry in the line number table with this information and
     /// the address of the instruction will be created.
     void setCurrentDwarfLoc(unsigned FileNum, unsigned Line, unsigned Column,
                             unsigned Flags, unsigned Isa) {
@@ -188,7 +189,7 @@
       CurrentDwarfLoc.setIsa(Isa);
       DwarfLocSeen = true;
     }
-    void clearDwarfLocSeen() { DwarfLocSeen = false; }
+    void ClearDwarfLocSeen() { DwarfLocSeen = false; }
 
     bool getDwarfLocSeen() { return DwarfLocSeen; }
     const MCDwarfLoc &getCurrentDwarfLoc() { return CurrentDwarfLoc; }

Modified: llvm/trunk/lib/MC/MCContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=115551&r1=115550&r2=115551&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCContext.cpp (original)
+++ llvm/trunk/lib/MC/MCContext.cpp Mon Oct  4 15:17:24 2010
@@ -255,15 +255,11 @@
   return FileNumber;
 }
 
-/// ValidateDwarfFileNumber - takes a dwarf file number and returns true if it
+/// isValidDwarfFileNumber - takes a dwarf file number and returns true if it
 /// currently is assigned and false otherwise.
-bool MCContext::ValidateDwarfFileNumber(unsigned FileNumber) {
+bool MCContext::isValidDwarfFileNumber(unsigned FileNumber) {
   if(FileNumber == 0 || FileNumber >= MCDwarfFiles.size())
     return false;
 
-  MCDwarfFile *&ExistingFile = MCDwarfFiles[FileNumber];
-  if (ExistingFile)
-    return true;
-  else
-    return false;
+  return MCDwarfFiles[FileNumber] != 0;
 }

Modified: llvm/trunk/lib/MC/MCDwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=115551&r1=115550&r2=115551&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCDwarf.cpp (original)
+++ llvm/trunk/lib/MC/MCDwarf.cpp Mon Oct  4 15:17:24 2010
@@ -76,7 +76,7 @@
   MCLineEntry LineEntry(LineSym, DwarfLoc);
 
   // clear DwarfLocSeen saying the current .loc info is now used.
-  MCOS->getContext().clearDwarfLocSeen();
+  MCOS->getContext().ClearDwarfLocSeen();
 
   // Get the MCLineSection for this section, if one does not exist for this
   // section create it.

Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=115551&r1=115550&r2=115551&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Mon Oct  4 15:17:24 2010
@@ -2031,7 +2031,7 @@
   int64_t FileNumber = getTok().getIntVal();
   if (FileNumber < 1)
     return TokError("file number less than one in '.loc' directive");
-  if (!getContext().ValidateDwarfFileNumber(FileNumber))
+  if (!getContext().isValidDwarfFileNumber(FileNumber))
     return TokError("unassigned file number in '.loc' directive");
   Lex();
 





More information about the llvm-commits mailing list