[cfe-commits] r126897 - /cfe/trunk/lib/Analysis/CFG.cpp
John McCall
rjmccall at apple.com
Wed Mar 2 15:33:56 PST 2011
On Mar 2, 2011, at 3:25 PM, Matt Beaumont-Gay wrote:
> Author: matthewbg
> Date: Wed Mar 2 17:25:06 2011
> New Revision: 126897
>
> URL: http://llvm.org/viewvc/llvm-project?rev=126897&view=rev
> Log:
> Keep GCC from complaining about falling off the end of the function.
>
> Modified:
> cfe/trunk/lib/Analysis/CFG.cpp
>
> Modified: cfe/trunk/lib/Analysis/CFG.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=126897&r1=126896&r2=126897&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Analysis/CFG.cpp (original)
> +++ cfe/trunk/lib/Analysis/CFG.cpp Wed Mar 2 17:25:06 2011
> @@ -2774,6 +2774,7 @@
>
> const CXXDestructorDecl *CFGImplicitDtor::getDestructorDecl() const {
> switch (getKind()) {
> + default: assert(0 && "Unknown CFGElement");
> case CFGElement::Invalid:
> case CFGElement::Statement:
> case CFGElement::Initializer:
The general style in Clang is (1) to use llvm_unreachable(msg) instead of assert(0 && msg) and (2) to not add default cases to switches which are supposed to be exhaustive. Please move this to after the switch and follow it with a return 0.
John.
More information about the cfe-commits
mailing list