This is an archive of the discontinued LLVM Phabricator instance.

[Clang Tablegen] Add llvm_unreachable() to getModifierName()
ClosedPublic

Authored by msearles on May 21 2018, 9:47 AM.

Details

Summary
Fix internal build failure:

../../../ClangDiagnosticsEmitter.cpp -o ClangDiagnosticsEmitter.o
../../../ClangDiagnosticsEmitter.cpp: In function 'llvm::StringRef 
{anonymous}::getModifierName({anonymous}::ModifierType)':
../../../ClangDiagnosticsEmitter.cpp:495:1: error: control reaches end of non-void function [-Werror=return-type]
}
^

Build failure triggered by git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332799 91177308-0d34-0410-b5e6-96231b3b80d8

Diff Detail

Repository
rL LLVM

Event Timeline

msearles created this revision.May 21 2018, 9:47 AM
rsmith added a subscriber: rsmith.May 21 2018, 9:52 AM

Please instead add an llvm_unreachable outside the switch, so that we still get warnings on missing switch cases if an enumerator is added.

msearles updated this revision to Diff 147807.May 21 2018, 10:05 AM
msearles retitled this revision from [Clang Tablegen] Add default case to getModifierName() to [Clang Tablegen] Add llvm_unreachable() to getModifierName().

Ah, yes. Adding llvm_unreachable() is better. Done.

EricWF accepted this revision.May 21 2018, 10:21 AM

LGTM.

utils/TableGen/ClangDiagnosticsEmitter.cpp
495 ↗(On Diff #147807)

Perhaps this should say "unhandled case" or similar?

This revision is now accepted and ready to land.May 21 2018, 10:21 AM
msearles updated this revision to Diff 147809.May 21 2018, 10:25 AM

Add comment per reviewer suggestion.

msearles marked an inline comment as done.May 21 2018, 10:25 AM
This revision was automatically updated to reflect the committed changes.