Skip to content

Commit 3bac0f4

Browse files
Merge branch 'llvm:main' into cfi-show
2 parents 6333c04 + 94d5c54 commit 3bac0f4

File tree

240 files changed

+17959
-2616
lines changed

Some content is hidden

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

240 files changed

+17959
-2616
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,9 @@ Improvements to Clang's diagnostics
279279
- The :doc:`ThreadSafetyAnalysis` attributes ``ACQUIRED_BEFORE(...)`` and
280280
``ACQUIRED_AFTER(...)`` have been moved to the stable feature set and no
281281
longer require ``-Wthread-safety-beta`` to be used.
282+
- The :doc:`ThreadSafetyAnalysis` gains basic alias-analysis of capability
283+
pointers under ``-Wthread-safety-beta`` (still experimental), which reduces
284+
both false positives but also false negatives through more precise analysis.
282285

283286
Improvements to Clang's time-trace
284287
----------------------------------
@@ -308,6 +311,8 @@ Bug Fixes in This Version
308311
- Builtin elementwise operators now accept vector arguments that have different
309312
qualifiers on their elements. For example, vector of 4 ``const float`` values
310313
and vector of 4 ``float`` values. (#GH155405)
314+
- Fixed a failed assertion with a negative limit parameter value inside of
315+
``__has_embed``. (#GH157842)
311316

312317
Bug Fixes to Compiler Builtins
313318
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "llvm/ADT/PointerUnion.h"
3636
#include "llvm/ADT/SmallVector.h"
3737
#include "llvm/Support/Casting.h"
38+
#include <functional>
3839
#include <sstream>
3940
#include <string>
4041
#include <utility>
@@ -386,6 +387,11 @@ class SExprBuilder {
386387
SelfVar->setKind(til::Variable::VK_SFun);
387388
}
388389

390+
// Create placeholder for this: we don't know the VarDecl on construction yet.
391+
til::LiteralPtr *createThisPlaceholder() {
392+
return new (Arena) til::LiteralPtr(nullptr);
393+
}
394+
389395
// Translate a clang expression in an attribute to a til::SExpr.
390396
// Constructs the context from D, DeclExp, and SelfDecl.
391397
CapabilityExpr translateAttrExpr(const Expr *AttrExp, const NamedDecl *D,
@@ -394,8 +400,8 @@ class SExprBuilder {
394400

395401
CapabilityExpr translateAttrExpr(const Expr *AttrExp, CallingContext *Ctx);
396402

397-
// Translate a variable reference.
398-
til::LiteralPtr *createVariable(const VarDecl *VD);
403+
// Translate a VarDecl to its canonical TIL expression.
404+
til::SExpr *translateVariable(const VarDecl *VD, CallingContext *Ctx);
399405

400406
// Translate a clang statement or expression to a TIL expression.
401407
// Also performs substitution of variables; Ctx provides the context.
@@ -412,6 +418,10 @@ class SExprBuilder {
412418
const til::SCFG *getCFG() const { return Scfg; }
413419
til::SCFG *getCFG() { return Scfg; }
414420

421+
void setLookupLocalVarExpr(std::function<const Expr *(const NamedDecl *)> F) {
422+
LookupLocalVarExpr = std::move(F);
423+
}
424+
415425
private:
416426
// We implement the CFGVisitor API
417427
friend class CFGWalker;
@@ -445,6 +455,7 @@ class SExprBuilder {
445455
const AbstractConditionalOperator *C, CallingContext *Ctx);
446456

447457
til::SExpr *translateDeclStmt(const DeclStmt *S, CallingContext *Ctx);
458+
til::SExpr *translateStmtExpr(const StmtExpr *SE, CallingContext *Ctx);
448459

449460
// Map from statements in the clang CFG to SExprs in the til::SCFG.
450461
using StatementMap = llvm::DenseMap<const Stmt *, til::SExpr *>;
@@ -531,6 +542,11 @@ class SExprBuilder {
531542
std::vector<til::Phi *> IncompleteArgs;
532543
til::BasicBlock *CurrentBB = nullptr;
533544
BlockInfo *CurrentBlockInfo = nullptr;
545+
546+
// Recursion guard.
547+
llvm::DenseSet<const ValueDecl *> VarsBeingTranslated;
548+
// Context-dependent lookup of currently valid definitions of local variables.
549+
std::function<const Expr *(const NamedDecl *)> LookupLocalVarExpr;
534550
};
535551

536552
#ifndef NDEBUG

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,9 @@ def warn_drv_overriding_option : Warning<
485485
def warn_drv_overriding_deployment_version
486486
: Warning<"overriding deployment version from '%0' to '%1'">,
487487
InGroup<DiagGroup<"overriding-deployment-version">>;
488+
def warn_drv_overriding_complex_range : Warning<
489+
"'%1' sets complex range to \"%3\" overriding the setting of \"%2\" that was implied by '%0'">,
490+
InGroup<DiagGroup<"overriding-complex-range">>;
488491
def warn_drv_treating_input_as_cxx : Warning<
489492
"treating '%0' input as '%1' when in C++ mode, this behavior is deprecated">,
490493
InGroup<Deprecated>;

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3281,7 +3281,8 @@ defm declspec : BoolOption<"f", "declspec",
32813281
def fmodules_cache_path : Joined<["-"], "fmodules-cache-path=">, Group<i_Group>,
32823282
Flags<[]>, Visibility<[ClangOption, CC1Option]>,
32833283
MetaVarName<"<directory>">,
3284-
HelpText<"Specify the module cache path">;
3284+
HelpText<"Specify the module cache path">,
3285+
MarshallingInfoString<HeaderSearchOpts<"ModuleCachePath">>;
32853286
def fmodules_user_build_path : Separate<["-"], "fmodules-user-build-path">, Group<i_Group>,
32863287
Flags<[]>, Visibility<[ClangOption, CC1Option]>,
32873288
MetaVarName<"<directory>">,

clang/include/clang/Lex/HeaderSearch.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,9 @@ void ApplyHeaderSearchOptions(HeaderSearch &HS,
986986
const LangOptions &Lang,
987987
const llvm::Triple &triple);
988988

989+
void normalizeModuleCachePath(FileManager &FileMgr, StringRef Path,
990+
SmallVectorImpl<char> &NormalizedPath);
991+
989992
} // namespace clang
990993

991994
#endif // LLVM_CLANG_LEX_HEADERSEARCH_H

0 commit comments

Comments
 (0)