This is an archive of the discontinued LLVM Phabricator instance.

Use enums instead of unsigned where possible
ClosedPublic

Authored by emaste on May 6 2014, 12:15 PM.

Diff Detail

Event Timeline

emaste updated this revision to Diff 9122.May 6 2014, 12:15 PM
emaste retitled this revision from to Use enums instead of unsigned where possible.
emaste updated this object.
emaste edited the test plan for this revision. (Show Details)
emaste added a subscriber: Unknown Object (MLST).
echristo accepted this revision.May 6 2014, 12:24 PM
echristo added a reviewer: echristo.
echristo added a subscriber: echristo.

Might want add a comment above EmitDeclare about the custom tag which is why we can't use llvm::dwarf::Tag.

Otherwise lgtm.

-eric

This revision is now accepted and ready to land.May 6 2014, 12:24 PM
emaste updated this revision to Diff 9135.May 6 2014, 2:17 PM
emaste edited edge metadata.

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; }

Go ahead and commit this too, you'll just want to commit them in close
proximity to avoid number of bots that hate you.

-eric

emaste closed this revision.May 7 2014, 6:56 AM