Skip to content

Commit 4a50956

Browse files
committed
Convert two more files that were using Windows line endings and remove
a stray single '\r' from one file. These are the last line ending issues I can find in the files containing parts of LLVM's file headers. llvm-svn: 351634
1 parent d92d70b commit 4a50956

File tree

3 files changed

+81
-81
lines changed

3 files changed

+81
-81
lines changed
Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
1-
//===--- ElseAfterReturnCheck.cpp - clang-tidy-----------------------------===//
2-
//
3-
// The LLVM Compiler Infrastructure
4-
//
5-
// This file is distributed under the University of Illinois Open Source
6-
// License. See LICENSE.TXT for details.
7-
//
8-
//===----------------------------------------------------------------------===//
9-
10-
#include "ElseAfterReturnCheck.h"
11-
#include "clang/AST/ASTContext.h"
12-
#include "clang/ASTMatchers/ASTMatchFinder.h"
13-
#include "clang/Tooling/FixIt.h"
14-
15-
using namespace clang::ast_matchers;
16-
17-
namespace clang {
18-
namespace tidy {
19-
namespace readability {
20-
21-
void ElseAfterReturnCheck::registerMatchers(MatchFinder *Finder) {
22-
const auto ControlFlowInterruptorMatcher =
23-
stmt(anyOf(returnStmt().bind("return"), continueStmt().bind("continue"),
24-
breakStmt().bind("break"),
25-
expr(ignoringImplicit(cxxThrowExpr().bind("throw")))));
26-
Finder->addMatcher(
27-
compoundStmt(forEach(
28-
ifStmt(unless(isConstexpr()),
29-
hasThen(stmt(
30-
anyOf(ControlFlowInterruptorMatcher,
31-
compoundStmt(has(ControlFlowInterruptorMatcher))))),
32-
hasElse(stmt().bind("else")))
33-
.bind("if"))),
34-
this);
35-
}
36-
37-
void ElseAfterReturnCheck::check(const MatchFinder::MatchResult &Result) {
38-
const auto *If = Result.Nodes.getNodeAs<IfStmt>("if");
39-
SourceLocation ElseLoc = If->getElseLoc();
40-
std::string ControlFlowInterruptor;
41-
for (const auto *BindingName : {"return", "continue", "break", "throw"})
42-
if (Result.Nodes.getNodeAs<Stmt>(BindingName))
43-
ControlFlowInterruptor = BindingName;
44-
45-
DiagnosticBuilder Diag = diag(ElseLoc, "do not use 'else' after '%0'")
46-
<< ControlFlowInterruptor;
47-
Diag << tooling::fixit::createRemoval(ElseLoc);
48-
49-
// FIXME: Removing the braces isn't always safe. Do a more careful analysis.
50-
// FIXME: Change clang-format to correctly un-indent the code.
51-
if (const auto *CS = Result.Nodes.getNodeAs<CompoundStmt>("else"))
52-
Diag << tooling::fixit::createRemoval(CS->getLBracLoc())
53-
<< tooling::fixit::createRemoval(CS->getRBracLoc());
54-
}
55-
56-
} // namespace readability
57-
} // namespace tidy
58-
} // namespace clang
1+
//===--- ElseAfterReturnCheck.cpp - clang-tidy-----------------------------===//
2+
//
3+
// The LLVM Compiler Infrastructure
4+
//
5+
// This file is distributed under the University of Illinois Open Source
6+
// License. See LICENSE.TXT for details.
7+
//
8+
//===----------------------------------------------------------------------===//
9+
10+
#include "ElseAfterReturnCheck.h"
11+
#include "clang/AST/ASTContext.h"
12+
#include "clang/ASTMatchers/ASTMatchFinder.h"
13+
#include "clang/Tooling/FixIt.h"
14+
15+
using namespace clang::ast_matchers;
16+
17+
namespace clang {
18+
namespace tidy {
19+
namespace readability {
20+
21+
void ElseAfterReturnCheck::registerMatchers(MatchFinder *Finder) {
22+
const auto ControlFlowInterruptorMatcher =
23+
stmt(anyOf(returnStmt().bind("return"), continueStmt().bind("continue"),
24+
breakStmt().bind("break"),
25+
expr(ignoringImplicit(cxxThrowExpr().bind("throw")))));
26+
Finder->addMatcher(
27+
compoundStmt(forEach(
28+
ifStmt(unless(isConstexpr()),
29+
hasThen(stmt(
30+
anyOf(ControlFlowInterruptorMatcher,
31+
compoundStmt(has(ControlFlowInterruptorMatcher))))),
32+
hasElse(stmt().bind("else")))
33+
.bind("if"))),
34+
this);
35+
}
36+
37+
void ElseAfterReturnCheck::check(const MatchFinder::MatchResult &Result) {
38+
const auto *If = Result.Nodes.getNodeAs<IfStmt>("if");
39+
SourceLocation ElseLoc = If->getElseLoc();
40+
std::string ControlFlowInterruptor;
41+
for (const auto *BindingName : {"return", "continue", "break", "throw"})
42+
if (Result.Nodes.getNodeAs<Stmt>(BindingName))
43+
ControlFlowInterruptor = BindingName;
44+
45+
DiagnosticBuilder Diag = diag(ElseLoc, "do not use 'else' after '%0'")
46+
<< ControlFlowInterruptor;
47+
Diag << tooling::fixit::createRemoval(ElseLoc);
48+
49+
// FIXME: Removing the braces isn't always safe. Do a more careful analysis.
50+
// FIXME: Change clang-format to correctly un-indent the code.
51+
if (const auto *CS = Result.Nodes.getNodeAs<CompoundStmt>("else"))
52+
Diag << tooling::fixit::createRemoval(CS->getLBracLoc())
53+
<< tooling::fixit::createRemoval(CS->getRBracLoc());
54+
}
55+
56+
} // namespace readability
57+
} // namespace tidy
58+
} // namespace clang

clang/lib/Basic/Targets/ARC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ using namespace clang::targets;
2222
void ARCTargetInfo::getTargetDefines(const LangOptions &Opts,
2323
MacroBuilder &Builder) const {
2424
Builder.defineMacro("__arc__");
25-
}
25+
}
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
;===- ./lib/WindowsManifest/LLVMBuild.txt ----------------------*- Conf -*--===;
2-
;
3-
; The LLVM Compiler Infrastructure
4-
;
5-
; This file is distributed under the University of Illinois Open Source
6-
; License. See LICENSE.TXT for details.
7-
;
8-
;===------------------------------------------------------------------------===;
9-
;
10-
; This is an LLVMBuild description file for the components in this subdirectory.
11-
;
12-
; For more information on the LLVMBuild system, please see:
13-
;
14-
; http://llvm.org/docs/LLVMBuild.html
15-
;
16-
;===------------------------------------------------------------------------===;
17-
18-
[component_0]
19-
type = Library
20-
name = WindowsManifest
21-
parent = Libraries
22-
required_libraries = Support
1+
;===- ./lib/WindowsManifest/LLVMBuild.txt ----------------------*- Conf -*--===;
2+
;
3+
; The LLVM Compiler Infrastructure
4+
;
5+
; This file is distributed under the University of Illinois Open Source
6+
; License. See LICENSE.TXT for details.
7+
;
8+
;===------------------------------------------------------------------------===;
9+
;
10+
; This is an LLVMBuild description file for the components in this subdirectory.
11+
;
12+
; For more information on the LLVMBuild system, please see:
13+
;
14+
; http://llvm.org/docs/LLVMBuild.html
15+
;
16+
;===------------------------------------------------------------------------===;
17+
18+
[component_0]
19+
type = Library
20+
name = WindowsManifest
21+
parent = Libraries
22+
required_libraries = Support

0 commit comments

Comments
 (0)