Skip to content

Commit a176e69

Browse files
Merge branch 'main' into mapsatconvtopublicintrinsic
2 parents 491755c + 82fecab commit a176e69

File tree

182 files changed

+4937
-1721
lines changed

Some content is hidden

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

182 files changed

+4937
-1721
lines changed

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6843,6 +6843,45 @@ the configuration (without a prefix: ``Auto``).
68436843
68446844
For example: BOOST_PP_STRINGIZE
68456845

6846+
.. _WrapNamespaceBodyWithEmptyLines:
6847+
6848+
**WrapNamespaceBodyWithEmptyLines** (``WrapNamespaceBodyWithEmptyLinesStyle``) :versionbadge:`clang-format 20` :ref:`<WrapNamespaceBodyWithEmptyLines>`
6849+
Wrap namespace body with empty lines.
6850+
6851+
Possible values:
6852+
6853+
* ``WNBWELS_Never`` (in configuration: ``Never``)
6854+
Remove all empty lines at the beginning and the end of namespace body.
6855+
6856+
.. code-block:: c++
6857+
6858+
namespace N1 {
6859+
namespace N2
6860+
function();
6861+
}
6862+
}
6863+
6864+
* ``WNBWELS_Always`` (in configuration: ``Always``)
6865+
Always have at least one empty line at the beginning and the end of
6866+
namespace body except that the number of empty lines between consecutive
6867+
nested namespace definitions is not increased.
6868+
6869+
.. code-block:: c++
6870+
6871+
namespace N1 {
6872+
namespace N2 {
6873+
6874+
function();
6875+
6876+
}
6877+
}
6878+
6879+
* ``WNBWELS_Leave`` (in configuration: ``Leave``)
6880+
Keep existing newlines at the beginning and the end of namespace body.
6881+
``MaxEmptyLinesToKeep`` still applies.
6882+
6883+
6884+
68466885
.. END_FORMAT_STYLE_OPTIONS
68476886
68486887
Adding additional style options

clang/docs/ReleaseNotes.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,7 @@ clang-format
11271127
- Adds ``AllowShortNamespacesOnASingleLine`` option.
11281128
- Adds ``VariableTemplates`` option.
11291129
- Adds support for bash globstar in ``.clang-format-ignore``.
1130+
- Adds ``WrapNamespaceBodyWithEmptyLines`` option.
11301131

11311132
libclang
11321133
--------
@@ -1157,6 +1158,13 @@ New features
11571158
Crash and bug fixes
11581159
^^^^^^^^^^^^^^^^^^^
11591160

1161+
- In loops where the loop condition is opaque (i.e. the analyzer cannot
1162+
determine whether it's true or false), the analyzer will no longer assume
1163+
execution paths that perform more that two iterations. These unjustified
1164+
assumptions caused false positive reports (e.g. 100+ out-of-bounds reports in
1165+
the FFMPEG codebase) in loops where the programmer intended only two or three
1166+
steps but the analyzer wasn't able to understand that the loop is limited.
1167+
11601168
Improvements
11611169
^^^^^^^^^^^^
11621170

clang/include/clang/Basic/CodeGenOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class CodeGenOptions : public CodeGenOptionsBase {
186186
std::string ProfileExcludeFiles;
187187

188188
/// The version string to put into coverage files.
189-
char CoverageVersion[4];
189+
char CoverageVersion[4] = {'0', '0', '0', '0'};
190190

191191
/// Enable additional debugging information.
192192
std::string DebugPass;

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,6 +1493,8 @@ def libomptarget_amdgcn_bc_path_EQ : Joined<["--"], "libomptarget-amdgcn-bc-path
14931493
HelpText<"Path to libomptarget-amdgcn bitcode library">, Alias<libomptarget_amdgpu_bc_path_EQ>;
14941494
def libomptarget_nvptx_bc_path_EQ : Joined<["--"], "libomptarget-nvptx-bc-path=">, Group<i_Group>,
14951495
HelpText<"Path to libomptarget-nvptx bitcode library">;
1496+
def libomptarget_spirv_bc_path_EQ : Joined<["--"], "libomptarget-spirv-bc-path=">, Group<i_Group>,
1497+
HelpText<"Path to libomptarget-spirv bitcode library">;
14961498
def dD : Flag<["-"], "dD">, Group<d_Group>, Visibility<[ClangOption, CC1Option]>,
14971499
HelpText<"Print macro definitions in -E mode in addition to normal output">;
14981500
def dI : Flag<["-"], "dI">, Group<d_Group>, Visibility<[ClangOption, CC1Option]>,

clang/include/clang/Format/Format.h

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5143,6 +5143,39 @@ struct FormatStyle {
51435143
/// \version 11
51445144
std::vector<std::string> WhitespaceSensitiveMacros;
51455145

5146+
/// Different styles for wrapping namespace body with empty lines.
5147+
enum WrapNamespaceBodyWithEmptyLinesStyle : int8_t {
5148+
/// Remove all empty lines at the beginning and the end of namespace body.
5149+
/// \code
5150+
/// namespace N1 {
5151+
/// namespace N2
5152+
/// function();
5153+
/// }
5154+
/// }
5155+
/// \endcode
5156+
WNBWELS_Never,
5157+
/// Always have at least one empty line at the beginning and the end of
5158+
/// namespace body except that the number of empty lines between consecutive
5159+
/// nested namespace definitions is not increased.
5160+
/// \code
5161+
/// namespace N1 {
5162+
/// namespace N2 {
5163+
///
5164+
/// function();
5165+
///
5166+
/// }
5167+
/// }
5168+
/// \endcode
5169+
WNBWELS_Always,
5170+
/// Keep existing newlines at the beginning and the end of namespace body.
5171+
/// ``MaxEmptyLinesToKeep`` still applies.
5172+
WNBWELS_Leave
5173+
};
5174+
5175+
/// Wrap namespace body with empty lines.
5176+
/// \version 20
5177+
WrapNamespaceBodyWithEmptyLinesStyle WrapNamespaceBodyWithEmptyLines;
5178+
51465179
bool operator==(const FormatStyle &R) const {
51475180
return AccessModifierOffset == R.AccessModifierOffset &&
51485181
AlignAfterOpenBracket == R.AlignAfterOpenBracket &&
@@ -5326,7 +5359,8 @@ struct FormatStyle {
53265359
UseTab == R.UseTab && VariableTemplates == R.VariableTemplates &&
53275360
VerilogBreakBetweenInstancePorts ==
53285361
R.VerilogBreakBetweenInstancePorts &&
5329-
WhitespaceSensitiveMacros == R.WhitespaceSensitiveMacros;
5362+
WhitespaceSensitiveMacros == R.WhitespaceSensitiveMacros &&
5363+
WrapNamespaceBodyWithEmptyLines == R.WrapNamespaceBodyWithEmptyLines;
53305364
}
53315365

53325366
std::optional<FormatStyle> GetLanguageStyle(LanguageKind Language) const;

clang/include/clang/Serialization/ASTWriter.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -997,13 +997,15 @@ class CXX20ModulesGenerator : public PCHGenerator {
997997
virtual Module *getEmittingModule(ASTContext &Ctx) override;
998998

999999
CXX20ModulesGenerator(Preprocessor &PP, InMemoryModuleCache &ModuleCache,
1000-
StringRef OutputFile, bool GeneratingReducedBMI);
1000+
StringRef OutputFile, bool GeneratingReducedBMI,
1001+
bool AllowASTWithErrors);
10011002

10021003
public:
10031004
CXX20ModulesGenerator(Preprocessor &PP, InMemoryModuleCache &ModuleCache,
1004-
StringRef OutputFile)
1005+
StringRef OutputFile, bool AllowASTWithErrors = false)
10051006
: CXX20ModulesGenerator(PP, ModuleCache, OutputFile,
1006-
/*GeneratingReducedBMI=*/false) {}
1007+
/*GeneratingReducedBMI=*/false,
1008+
AllowASTWithErrors) {}
10071009

10081010
void HandleTranslationUnit(ASTContext &Ctx) override;
10091011
};
@@ -1013,9 +1015,10 @@ class ReducedBMIGenerator : public CXX20ModulesGenerator {
10131015

10141016
public:
10151017
ReducedBMIGenerator(Preprocessor &PP, InMemoryModuleCache &ModuleCache,
1016-
StringRef OutputFile)
1018+
StringRef OutputFile, bool AllowASTWithErrors = false)
10171019
: CXX20ModulesGenerator(PP, ModuleCache, OutputFile,
1018-
/*GeneratingReducedBMI=*/true) {}
1020+
/*GeneratingReducedBMI=*/true,
1021+
AllowASTWithErrors) {}
10191022
};
10201023

10211024
/// If we can elide the definition of \param D in reduced BMI.

clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ class CoreEngine {
126126
ExplodedNode *generateCallExitBeginNode(ExplodedNode *N,
127127
const ReturnStmt *RS);
128128

129+
/// Helper function called by `HandleBranch()`. If the currently handled
130+
/// branch corresponds to a loop, this returns the number of already
131+
/// completed iterations in that loop, otherwise the return value is
132+
/// `std::nullopt`. Note that this counts _all_ earlier iterations, including
133+
/// ones that were performed within an earlier iteration of an outer loop.
134+
std::optional<unsigned> getCompletedIterationCount(const CFGBlock *B,
135+
ExplodedNode *Pred) const;
136+
129137
public:
130138
/// Construct a CoreEngine object to analyze the provided CFG.
131139
CoreEngine(ExprEngine &exprengine,

clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,14 @@ class ExprEngine {
321321
NodeBuilderWithSinks &nodeBuilder,
322322
ExplodedNode *Pred);
323323

324-
/// ProcessBranch - Called by CoreEngine. Used to generate successor
325-
/// nodes by processing the 'effects' of a branch condition.
326-
void processBranch(const Stmt *Condition,
327-
NodeBuilderContext& BuilderCtx,
328-
ExplodedNode *Pred,
329-
ExplodedNodeSet &Dst,
330-
const CFGBlock *DstT,
331-
const CFGBlock *DstF);
324+
/// ProcessBranch - Called by CoreEngine. Used to generate successor nodes by
325+
/// processing the 'effects' of a branch condition. If the branch condition
326+
/// is a loop condition, IterationsCompletedInLoop is the number of completed
327+
/// iterations (otherwise it's std::nullopt).
328+
void processBranch(const Stmt *Condition, NodeBuilderContext &BuilderCtx,
329+
ExplodedNode *Pred, ExplodedNodeSet &Dst,
330+
const CFGBlock *DstT, const CFGBlock *DstF,
331+
std::optional<unsigned> IterationsCompletedInLoop);
332332

333333
/// Called by CoreEngine.
334334
/// Used to generate successor nodes for temporary destructors depending
@@ -588,6 +588,8 @@ class ExprEngine {
588588
void evalEagerlyAssumeBifurcation(ExplodedNodeSet &Dst, ExplodedNodeSet &Src,
589589
const Expr *Ex);
590590

591+
bool didEagerlyAssumeBifurcateAt(ProgramStateRef State, const Expr *Ex) const;
592+
591593
static std::pair<const ProgramPointTag *, const ProgramPointTag *>
592594
getEagerlyAssumeBifurcationTags();
593595

clang/lib/Basic/CodeGenOptions.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ CodeGenOptions::CodeGenOptions() {
1717
#include "clang/Basic/CodeGenOptions.def"
1818

1919
RelocationModel = llvm::Reloc::PIC_;
20-
memcpy(CoverageVersion, "408*", 4);
2120
}
2221

2322
void CodeGenOptions::resetNonModularOptions(StringRef ModuleFormat) {
@@ -54,7 +53,6 @@ void CodeGenOptions::resetNonModularOptions(StringRef ModuleFormat) {
5453
}
5554

5655
RelocationModel = llvm::Reloc::PIC_;
57-
memcpy(CoverageVersion, "408*", 4);
5856
}
5957

6058
} // end namespace clang

clang/lib/Driver/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ add_clang_library(clangDriver
7777
ToolChains/RISCVToolchain.cpp
7878
ToolChains/Solaris.cpp
7979
ToolChains/SPIRV.cpp
80+
ToolChains/SPIRVOpenMP.cpp
8081
ToolChains/TCE.cpp
8182
ToolChains/UEFI.cpp
8283
ToolChains/VEToolchain.cpp

0 commit comments

Comments
 (0)