[PATCH] Use enums instead of unsigned where possible

Ed Maste emaste at freebsd.org
Tue May 6 14:17:59 PDT 2014


Add comment suggested by echristo

It turns out I missed a related llvm change in the diff (included here)  - should I put it in a separate LLVM review?  (Or put the cast in CGDebugInfo.cpp?)
--- a/include/llvm/DebugInfo.h                                                  
+++ b/include/llvm/DebugInfo.h                                                  
@@ -413,7 +413,9 @@ class DICompileUnit : public DIScope {                      
 public:                                                                        
   explicit DICompileUnit(const MDNode *N = 0) : DIScope(N) {}                  
                                                                                
-  unsigned getLanguage() const { return getUnsignedField(2); }                 
+  llvm::dwarf::SourceLanguage getLanguage() const {                            
+    return static_cast<llvm::dwarf::SourceLanguage>(getUnsignedField(2));      
+  }                                                                            
   StringRef getProducer() const { return getStringField(3); }                  
                                                                                
   bool isOptimized() const { return getUnsignedField(4) != 0; }

http://reviews.llvm.org/D3626

Files:
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3626.9135.patch
Type: text/x-patch
Size: 4200 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140506/88086247/attachment.bin>


More information about the cfe-commits mailing list