Skip to content

Commit dadad98

Browse files
tbaederrkrishna2803
authored andcommitted
[clang][bytecode] Clean up {Compiler,Interp}.h (llvm#151335)
Remove else after return and remove some unused includes.
1 parent 5888122 commit dadad98

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

clang/lib/AST/ByteCode/Compiler.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "clang/AST/Decl.h"
2222
#include "clang/AST/Expr.h"
2323
#include "clang/AST/StmtVisitor.h"
24-
#include "clang/Basic/TargetInfo.h"
2524

2625
namespace clang {
2726
class QualType;

clang/lib/AST/ByteCode/Interp.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "InterpStack.h"
2626
#include "InterpState.h"
2727
#include "MemberPointer.h"
28-
#include "Opcode.h"
2928
#include "PrimType.h"
3029
#include "Program.h"
3130
#include "State.h"
@@ -1131,8 +1130,9 @@ inline bool CmpHelperEQ<Pointer>(InterpState &S, CodePtr OpPC, CompareFn Fn) {
11311130
S.FFDiag(Loc, diag::note_constexpr_pointer_comparison_past_end)
11321131
<< LHS.toDiagnosticString(S.getASTContext());
11331132
return false;
1134-
} else if (RHS.isOnePastEnd() && !LHS.isOnePastEnd() && !LHS.isZero() &&
1135-
LHS.getOffset() == 0) {
1133+
}
1134+
if (RHS.isOnePastEnd() && !LHS.isOnePastEnd() && !LHS.isZero() &&
1135+
LHS.getOffset() == 0) {
11361136
const SourceInfo &Loc = S.Current->getSource(OpPC);
11371137
S.FFDiag(Loc, diag::note_constexpr_pointer_comparison_past_end)
11381138
<< RHS.toDiagnosticString(S.getASTContext());
@@ -1150,8 +1150,9 @@ inline bool CmpHelperEQ<Pointer>(InterpState &S, CodePtr OpPC, CompareFn Fn) {
11501150
const SourceInfo &Loc = S.Current->getSource(OpPC);
11511151
S.FFDiag(Loc, diag::note_constexpr_literal_comparison);
11521152
return false;
1153-
} else if (const auto *CE = dyn_cast<CallExpr>(E);
1154-
CE && IsOpaqueConstantCall(CE)) {
1153+
}
1154+
if (const auto *CE = dyn_cast<CallExpr>(E);
1155+
CE && IsOpaqueConstantCall(CE)) {
11551156
const SourceInfo &Loc = S.Current->getSource(OpPC);
11561157
S.FFDiag(Loc, diag::note_constexpr_opaque_call_comparison)
11571158
<< P.toDiagnosticString(S.getASTContext());
@@ -3266,7 +3267,8 @@ inline bool InvalidCast(InterpState &S, CodePtr OpPC, CastKind Kind,
32663267
S.CCEDiag(Loc, diag::note_constexpr_invalid_cast)
32673268
<< static_cast<unsigned>(Kind) << S.Current->getRange(OpPC);
32683269
return !Fatal;
3269-
} else if (Kind == CastKind::Volatile) {
3270+
}
3271+
if (Kind == CastKind::Volatile) {
32703272
if (!S.checkingPotentialConstantExpression()) {
32713273
const auto *E = cast<CastExpr>(S.Current->getExpr(OpPC));
32723274
if (S.getLangOpts().CPlusPlus)
@@ -3277,7 +3279,8 @@ inline bool InvalidCast(InterpState &S, CodePtr OpPC, CastKind Kind,
32773279
}
32783280

32793281
return false;
3280-
} else if (Kind == CastKind::Dynamic) {
3282+
}
3283+
if (Kind == CastKind::Dynamic) {
32813284
assert(!S.getLangOpts().CPlusPlus20);
32823285
S.CCEDiag(S.Current->getSource(OpPC), diag::note_constexpr_invalid_cast)
32833286
<< diag::ConstexprInvalidCastKind::Dynamic;

0 commit comments

Comments
 (0)