Skip to content

Commit 8031a14

Browse files
authored
LLVM and SPIRV-LLVM-Translator pulldown (WW39)
LLVM: llvm/llvm-project@5a73346 SPIRV-LLVM-Translator: KhronosGroup/SPIRV-LLVM-Translator@c734c5c
2 parents 4c6cda3 + 5730c6a commit 8031a14

File tree

2,815 files changed

+94145
-35265
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,815 files changed

+94145
-35265
lines changed

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ d8f0e6caa91e230a486c948ab643174e40bdf215
3131

3232
# Remove line-endings added by r320089. NFC.
3333
100a0eedc00b2bf48bcdc6c209c000745a4a0e48
34+
35+
# Cleanup __config indention. NFC.
36+
2b772b930e097ed6f06d698a51e291c7fd318baa

clang-tools-extra/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
include(CMakeDependentOption)
22

3+
option(CLANG_TIDY_ENABLE_STATIC_ANALYZER
4+
"Include static analyzer checks in clang-tidy" ON)
5+
36
add_subdirectory(clang-apply-replacements)
47
add_subdirectory(clang-reorder-fields)
58
add_subdirectory(modularize)

clang-tools-extra/clang-tidy/CMakeLists.txt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ set(LLVM_LINK_COMPONENTS
33
Support
44
)
55

6+
configure_file(
7+
${CMAKE_CURRENT_SOURCE_DIR}/clang-tidy-config.h.cmake
8+
${CMAKE_CURRENT_BINARY_DIR}/clang-tidy-config.h)
9+
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
10+
611
add_clang_library(clangTidy
712
ClangTidy.cpp
813
ClangTidyCheck.cpp
@@ -34,7 +39,7 @@ clang_target_link_libraries(clangTidy
3439
clangToolingCore
3540
)
3641

37-
if(CLANG_ENABLE_STATIC_ANALYZER)
42+
if(CLANG_TIDY_ENABLE_STATIC_ANALYZER)
3843
clang_target_link_libraries(clangTidy
3944
PRIVATE
4045
clangStaticAnalyzerCore
@@ -46,6 +51,7 @@ endif()
4651
# If you add a check, also add it to ClangTidyForceLinker.h in this directory.
4752
add_subdirectory(android)
4853
add_subdirectory(abseil)
54+
add_subdirectory(altera)
4955
add_subdirectory(boost)
5056
add_subdirectory(bugprone)
5157
add_subdirectory(cert)
@@ -59,7 +65,7 @@ add_subdirectory(llvm)
5965
add_subdirectory(llvmlibc)
6066
add_subdirectory(misc)
6167
add_subdirectory(modernize)
62-
if(CLANG_ENABLE_STATIC_ANALYZER)
68+
if(CLANG_TIDY_ENABLE_STATIC_ANALYZER)
6369
add_subdirectory(mpi)
6470
endif()
6571
add_subdirectory(objc)
@@ -71,6 +77,7 @@ add_subdirectory(zircon)
7177
set(ALL_CLANG_TIDY_CHECKS
7278
clangTidyAndroidModule
7379
clangTidyAbseilModule
80+
clangTidyAlteraModule
7481
clangTidyBoostModule
7582
clangTidyBugproneModule
7683
clangTidyCERTModule
@@ -91,7 +98,7 @@ set(ALL_CLANG_TIDY_CHECKS
9198
clangTidyReadabilityModule
9299
clangTidyZirconModule
93100
)
94-
if(CLANG_ENABLE_STATIC_ANALYZER)
101+
if(CLANG_TIDY_ENABLE_STATIC_ANALYZER)
95102
list(APPEND ALL_CLANG_TIDY_CHECKS clangTidyMPIModule)
96103
endif()
97104
set(ALL_CLANG_TIDY_CHECKS ${ALL_CLANG_TIDY_CHECKS} PARENT_SCOPE)

clang-tools-extra/clang-tidy/ClangTidy.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
#include "ClangTidyModuleRegistry.h"
2121
#include "ClangTidyProfiling.h"
2222
#include "ExpandModularHeadersPPCallbacks.h"
23+
#include "clang-tidy-config.h"
2324
#include "clang/AST/ASTConsumer.h"
2425
#include "clang/AST/ASTContext.h"
2526
#include "clang/AST/Decl.h"
2627
#include "clang/ASTMatchers/ASTMatchFinder.h"
27-
#include "clang/Config/config.h"
2828
#include "clang/Format/Format.h"
2929
#include "clang/Frontend/ASTConsumers.h"
3030
#include "clang/Frontend/CompilerInstance.h"
@@ -47,10 +47,10 @@
4747
#include <algorithm>
4848
#include <utility>
4949

50-
#if CLANG_ENABLE_STATIC_ANALYZER
50+
#if CLANG_TIDY_ENABLE_STATIC_ANALYZER
5151
#include "clang/Analysis/PathDiagnostic.h"
5252
#include "clang/StaticAnalyzer/Frontend/AnalysisConsumer.h"
53-
#endif // CLANG_ENABLE_STATIC_ANALYZER
53+
#endif // CLANG_TIDY_ENABLE_STATIC_ANALYZER
5454

5555
using namespace clang::ast_matchers;
5656
using namespace clang::driver;
@@ -63,7 +63,7 @@ namespace clang {
6363
namespace tidy {
6464

6565
namespace {
66-
#if CLANG_ENABLE_STATIC_ANALYZER
66+
#if CLANG_TIDY_ENABLE_STATIC_ANALYZER
6767
static const char *AnalyzerCheckNamePrefix = "clang-analyzer-";
6868

6969
class AnalyzerDiagnosticConsumer : public ento::PathDiagnosticConsumer {
@@ -95,7 +95,7 @@ class AnalyzerDiagnosticConsumer : public ento::PathDiagnosticConsumer {
9595
private:
9696
ClangTidyContext &Context;
9797
};
98-
#endif // CLANG_ENABLE_STATIC_ANALYZER
98+
#endif // CLANG_TIDY_ENABLE_STATIC_ANALYZER
9999

100100
class ErrorReporter {
101101
public:
@@ -324,7 +324,7 @@ ClangTidyASTConsumerFactory::ClangTidyASTConsumerFactory(
324324
}
325325
}
326326

327-
#if CLANG_ENABLE_STATIC_ANALYZER
327+
#if CLANG_TIDY_ENABLE_STATIC_ANALYZER
328328
static void setStaticAnalyzerCheckerOpts(const ClangTidyOptions &Opts,
329329
AnalyzerOptionsRef AnalyzerOptions) {
330330
StringRef AnalyzerPrefix(AnalyzerCheckNamePrefix);
@@ -369,7 +369,7 @@ static CheckersList getAnalyzerCheckersAndPackages(ClangTidyContext &Context,
369369
}
370370
return List;
371371
}
372-
#endif // CLANG_ENABLE_STATIC_ANALYZER
372+
#endif // CLANG_TIDY_ENABLE_STATIC_ANALYZER
373373

374374
std::unique_ptr<clang::ASTConsumer>
375375
ClangTidyASTConsumerFactory::CreateASTConsumer(
@@ -424,7 +424,7 @@ ClangTidyASTConsumerFactory::CreateASTConsumer(
424424
if (!Checks.empty())
425425
Consumers.push_back(Finder->newASTConsumer());
426426

427-
#if CLANG_ENABLE_STATIC_ANALYZER
427+
#if CLANG_TIDY_ENABLE_STATIC_ANALYZER
428428
AnalyzerOptionsRef AnalyzerOptions = Compiler.getAnalyzerOpts();
429429
AnalyzerOptions->CheckersAndPackages = getAnalyzerCheckersAndPackages(
430430
Context, Context.canEnableAnalyzerAlphaCheckers());
@@ -440,7 +440,7 @@ ClangTidyASTConsumerFactory::CreateASTConsumer(
440440
new AnalyzerDiagnosticConsumer(Context));
441441
Consumers.push_back(std::move(AnalysisConsumer));
442442
}
443-
#endif // CLANG_ENABLE_STATIC_ANALYZER
443+
#endif // CLANG_TIDY_ENABLE_STATIC_ANALYZER
444444
return std::make_unique<ClangTidyASTConsumer>(
445445
std::move(Consumers), std::move(Profiling), std::move(Finder),
446446
std::move(Checks));
@@ -453,11 +453,11 @@ std::vector<std::string> ClangTidyASTConsumerFactory::getCheckNames() {
453453
CheckNames.emplace_back(CheckFactory.getKey());
454454
}
455455

456-
#if CLANG_ENABLE_STATIC_ANALYZER
456+
#if CLANG_TIDY_ENABLE_STATIC_ANALYZER
457457
for (const auto &AnalyzerCheck : getAnalyzerCheckersAndPackages(
458458
Context, Context.canEnableAnalyzerAlphaCheckers()))
459459
CheckNames.push_back(AnalyzerCheckNamePrefix + AnalyzerCheck.first);
460-
#endif // CLANG_ENABLE_STATIC_ANALYZER
460+
#endif // CLANG_TIDY_ENABLE_STATIC_ANALYZER
461461

462462
llvm::sort(CheckNames);
463463
return CheckNames;

clang-tools-extra/clang-tidy/ClangTidyForceLinker.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYFORCELINKER_H
1010
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYFORCELINKER_H
1111

12-
#include "clang/Config/config.h"
12+
#include "clang-tidy-config.h"
1313
#include "llvm/Support/Compiler.h"
1414

1515
namespace clang {
@@ -20,6 +20,11 @@ extern volatile int AbseilModuleAnchorSource;
2020
static int LLVM_ATTRIBUTE_UNUSED AbseilModuleAnchorDestination =
2121
AbseilModuleAnchorSource;
2222

23+
// This anchor is used to force the linker to link the AlteraModule.
24+
extern volatile int AlteraModuleAnchorSource;
25+
static int LLVM_ATTRIBUTE_UNUSED AlteraModuleAnchorDestination =
26+
AlteraModuleAnchorSource;
27+
2328
// This anchor is used to force the linker to link the AndroidModule.
2429
extern volatile int AndroidModuleAnchorSource;
2530
static int LLVM_ATTRIBUTE_UNUSED AndroidModuleAnchorDestination =
@@ -90,7 +95,7 @@ extern volatile int ModernizeModuleAnchorSource;
9095
static int LLVM_ATTRIBUTE_UNUSED ModernizeModuleAnchorDestination =
9196
ModernizeModuleAnchorSource;
9297

93-
#if CLANG_ENABLE_STATIC_ANALYZER && \
98+
#if CLANG_TIDY_ENABLE_STATIC_ANALYZER && \
9499
!defined(CLANG_TIDY_DISABLE_STATIC_ANALYZER_CHECKS)
95100
// This anchor is used to force the linker to link the MPIModule.
96101
extern volatile int MPIModuleAnchorSource;
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//===--- AlteraTidyModule.cpp - clang-tidy --------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "../ClangTidy.h"
10+
#include "../ClangTidyModule.h"
11+
#include "../ClangTidyModuleRegistry.h"
12+
#include "StructPackAlignCheck.h"
13+
14+
using namespace clang::ast_matchers;
15+
16+
namespace clang {
17+
namespace tidy {
18+
namespace altera {
19+
20+
class AlteraModule : public ClangTidyModule {
21+
public:
22+
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
23+
CheckFactories.registerCheck<StructPackAlignCheck>(
24+
"altera-struct-pack-align");
25+
}
26+
};
27+
28+
} // namespace altera
29+
30+
// Register the AlteraTidyModule using this statically initialized variable.
31+
static ClangTidyModuleRegistry::Add<altera::AlteraModule>
32+
X("altera-module", "Adds Altera FPGA OpenCL lint checks.");
33+
34+
// This anchor is used to force the linker to link in the generated object file
35+
// and thus register the AlteraModule.
36+
volatile int AlteraModuleAnchorSource = 0;
37+
38+
} // namespace tidy
39+
} // namespace clang
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
set(LLVM_LINK_COMPONENTS
2+
FrontendOpenMP
3+
support
4+
)
5+
6+
add_clang_library(clangTidyAlteraModule
7+
AlteraTidyModule.cpp
8+
StructPackAlignCheck.cpp
9+
10+
LINK_LIBS
11+
clangTidy
12+
clangTidyUtils
13+
)
14+
15+
clang_target_link_libraries(clangTidyAlteraModule
16+
PRIVATE
17+
clangAnalysis
18+
clangAST
19+
clangASTMatchers
20+
clangBasic
21+
clangLex
22+
)

0 commit comments

Comments
 (0)