@@ -368,6 +368,14 @@ static FunctionProtoTypeLoc getPrototypeLoc(Expr *Fn) {
}
if (auto F = Target.getAs()) {
+// In some edge cases the AST can contain a "trivial" FunctionProtoTypeLoc
+// which has null parameters. Avoid these as they don't contain useful
+//
@@ -368,6 +368,14 @@ static FunctionProtoTypeLoc getPrototypeLoc(Expr *Fn) {
}
if (auto F = Target.getAs()) {
+// In some edge cases the AST can contain a "trivial" FunctionProtoTypeLoc
hokein wrote:
nit: We have a duplicated one in ` SemaCodeComplete
https://github.com/hokein updated
https://github.com/llvm/llvm-project/pull/145711
>From 2bd778b5b5c5ffc0a36cf0e0e71034fe16c48ad0 Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Wed, 25 Jun 2025 16:12:40 +0200
Subject: [PATCH 1/2] [clang] Create alias for the common `std::pair` type used in Sou
https://github.com/hokein updated
https://github.com/llvm/llvm-project/pull/142585
>From 4b1cdc30ddb476d7e30519e5fe5ab6c298b59809 Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Sat, 10 May 2025 07:44:51 +0200
Subject: [PATCH 1/4] [AST] Restructure the CXXForRanageStmt class to reduce
the size
https://github.com/hokein updated
https://github.com/llvm/llvm-project/pull/142585
>From 1a233dbb9d58cf488551caf29d441f2c6a5b68b5 Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Tue, 3 Jun 2025 08:42:37 +0200
Subject: [PATCH 1/2] [clang][modules] Remove the workaround for the lambda
issue.
Th
https://github.com/hokein updated
https://github.com/llvm/llvm-project/pull/142585
>From 1a233dbb9d58cf488551caf29d441f2c6a5b68b5 Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Tue, 3 Jun 2025 08:42:37 +0200
Subject: [PATCH 1/3] [clang][modules] Remove the workaround for the lambda
issue.
Th
https://github.com/hokein updated
https://github.com/llvm/llvm-project/pull/142585
>From b6b83987f117ed037fb4de4fc5be7740bab295e1 Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Tue, 3 Jun 2025 08:42:37 +0200
Subject: [PATCH] [clang][AST] Reduce AST node size
---
clang/include/clang/AST/Expr.
https://github.com/hokein closed
https://github.com/llvm/llvm-project/pull/142585
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hokein created
https://github.com/llvm/llvm-project/pull/142840
This increases clang's template instantiation depths.
I can see 7% increase (1510 -> 1612 on my local machine) for the
`clang/test/SemaTemplate/instantiation-depth-default.cpp` case.
No performance regressions
https://github.com/hokein approved this pull request.
https://github.com/llvm/llvm-project/pull/142063
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -832,13 +835,11 @@ FileID
SourceManager::getFileIDLocal(SourceLocation::UIntTy SLocOffset) const {
unsigned LessIndex = 0;
// upper bound of the search range.
unsigned GreaterIndex = LocalSLocEntryTable.size();
- if (LastFileIDLookup.ID >= 0) {
-// Use the LastFi
@@ -1304,6 +1304,13 @@ checkExprLifetimeImpl(Sema &SemaRef, const
InitializedEntity *InitEntity,
if (LK == LK_FullExpression)
return;
+ if (LK == LK_Extended && SemaRef.getLangOpts().CPlusPlus23) {
hokein wrote:
Is the `LK == LK_Extended` check necess
https://github.com/hokein commented:
There are some test failures in the presubmit checks, you probably need to
update these tests.
https://github.com/llvm/llvm-project/pull/145164
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.
@@ -1901,9 +1903,8 @@ class SourceManager : public
RefCountedBase {
FileID getFileID(SourceLocation::UIntTy SLocOffset) const {
// If our one-entry cache covers this offset, just return it.
-if (isOffsetInFileID(LastFileIDLookup, SLocOffset))
+if (SLocOffset >=
https://github.com/hokein updated
https://github.com/llvm/llvm-project/pull/146782
>From 50c6fcb2a1167b65255d2edce9ef34789b85a7a5 Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Wed, 2 Jul 2025 16:22:48 +0200
Subject: [PATCH 1/3] Cache the Offset for LastFileIDLookup.
---
clang/include/clang/
hokein wrote:
> The design is, the higher 32 bits are used for module file index and the
> lower bits are used for offsets. Could you give a concrete example why the
> current implementation is problematic?
I don’t have a concrete failure case, but I noticed this while working on
64-bit sourc
https://github.com/hokein approved this pull request.
https://github.com/llvm/llvm-project/pull/145734
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hokein closed
https://github.com/llvm/llvm-project/pull/145670
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -832,13 +835,11 @@ FileID
SourceManager::getFileIDLocal(SourceLocation::UIntTy SLocOffset) const {
unsigned LessIndex = 0;
// upper bound of the search range.
unsigned GreaterIndex = LocalSLocEntryTable.size();
- if (LastFileIDLookup.ID >= 0) {
-// Use the LastFi
https://github.com/hokein updated
https://github.com/llvm/llvm-project/pull/146782
>From 50c6fcb2a1167b65255d2edce9ef34789b85a7a5 Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Wed, 2 Jul 2025 16:22:48 +0200
Subject: [PATCH 1/2] Cache the Offset for LastFileIDLookup.
---
clang/include/clang/
@@ -1901,9 +1903,8 @@ class SourceManager : public
RefCountedBase {
FileID getFileID(SourceLocation::UIntTy SLocOffset) const {
// If our one-entry cache covers this offset, just return it.
-if (isOffsetInFileID(LastFileIDLookup, SLocOffset))
+if (SLocOffset >=
@@ -849,7 +850,12 @@ FileID
SourceManager::getFileIDLocal(SourceLocation::UIntTy SLocOffset) const {
FileID Res = FileID::get(int(GreaterIndex));
// Remember it. We have good locality across FileID lookups.
LastFileIDLookup = Res;
- NumLinearScans += Nu
@@ -1901,9 +1903,8 @@ class SourceManager : public
RefCountedBase {
FileID getFileID(SourceLocation::UIntTy SLocOffset) const {
// If our one-entry cache covers this offset, just return it.
-if (isOffsetInFileID(LastFileIDLookup, SLocOffset))
+if (SLocOffset >=
hokein wrote:
> Yes, indeed. For example, in `AST/ast-dump-for-range-lifetime.cpp` we move
> from: `-MaterializeTemporaryExpr {{.*}} 'C':'P2718R0::C' xvalue extended by
> Var {{.*}} '__range1' 'C &&'` to: `-MaterializeTemporaryExpr {{.*}}
> 'C':'P2718R0::C' xvalue`. At a first look it seems l
https://github.com/hokein updated
https://github.com/llvm/llvm-project/pull/146604
>From 7b06dabcc8fafee1e9ff3261264c36a44cb7b0a3 Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Tue, 1 Jul 2025 22:04:51 +0200
Subject: [PATCH] [SourceManager] Speedup getFileIDLocal with a separate Offset
Table.
@@ -855,35 +857,24 @@ FileID
SourceManager::getFileIDLocal(SourceLocation::UIntTy SLocOffset) const {
break;
}
- NumProbes = 0;
- while (true) {
-unsigned MiddleIndex = (GreaterIndex-LessIndex)/2+LessIndex;
-SourceLocation::UIntTy MidOffset =
-getLoc
@@ -855,35 +857,24 @@ FileID
SourceManager::getFileIDLocal(SourceLocation::UIntTy SLocOffset) const {
break;
}
- NumProbes = 0;
- while (true) {
-unsigned MiddleIndex = (GreaterIndex-LessIndex)/2+LessIndex;
-SourceLocation::UIntTy MidOffset =
-getLoc
Author: Haojian Wu
Date: 2025-07-01T22:33:23+02:00
New Revision: ac76e4d8a9aedc23123571b3801684babb78424f
URL:
https://github.com/llvm/llvm-project/commit/ac76e4d8a9aedc23123571b3801684babb78424f
DIFF:
https://github.com/llvm/llvm-project/commit/ac76e4d8a9aedc23123571b3801684babb78424f.diff
LO
https://github.com/hokein closed
https://github.com/llvm/llvm-project/pull/146510
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -855,35 +857,24 @@ FileID
SourceManager::getFileIDLocal(SourceLocation::UIntTy SLocOffset) const {
break;
}
- NumProbes = 0;
- while (true) {
-unsigned MiddleIndex = (GreaterIndex-LessIndex)/2+LessIndex;
-SourceLocation::UIntTy MidOffset =
-getLoc
@@ -1341,6 +1341,14 @@ checkExprLifetimeImpl(Sema &SemaRef, const
InitializedEntity *InitEntity,
}
if (IsGslPtrValueFromGslTempOwner && DiagLoc.isValid()) {
+
+if (SemaRef.getLangOpts().CPlusPlus23) {
hokein wrote:
the analysis is done he
@@ -682,6 +682,11 @@ class DeclarationNameTable {
DeclarationName getCXXLiteralOperatorName(const IdentifierInfo *II);
};
+struct CXXOperatorSourceInfo {
+ SourceLocation::UIntTy BeginOpNameLoc;
hokein wrote:
Interesting -- this patch was rebased recently
@@ -698,8 +703,7 @@ class DeclarationNameLoc {
// The location (if any) of the operator keyword is stored elsewhere.
struct CXXOpName {
-SourceLocation::UIntTy BeginOpNameLoc;
-SourceLocation::UIntTy EndOpNameLoc;
+CXXOperatorSourceInfo* OInfo;
https://github.com/hokein created
https://github.com/llvm/llvm-project/pull/146412
Converting back and forth for the source location raw encoding is unnecessary.
>From 21619dbe7f13c73c8657fac0410fe87ab8baeea4 Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Mon, 30 Jun 2025 17:06:01 +0200
Subj
hokein wrote:
> Sorry for being dumb... how are we getting away with only storing 40 bits?
> Does that not just artificially limit our source-location size for
> statements? And, frankly, then our entire space? I guess 8 2x-increases in
> source-location size are nice, but I was sort of hoping
hokein wrote:
> I did a light pass of the 1st 1/4 of this or so. The smuggling back and forth
> to raw-encoding seems strange? WHy are we doing that here?
In this patch, to keep AST node size as small as possible, we're using 40 bits
of `StmtBits` to store the SourceLocation, we need this back
@@ -742,8 +742,12 @@ class CXXBoolLiteralExpr : public Expr {
SourceLocation getBeginLoc() const { return getLocation(); }
SourceLocation getEndLoc() const { return getLocation(); }
- SourceLocation getLocation() const { return CXXBoolLiteralExprBits.Loc; }
- void setLoc
https://github.com/hokein closed
https://github.com/llvm/llvm-project/pull/145711
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hokein updated
https://github.com/llvm/llvm-project/pull/145711
>From 2bd778b5b5c5ffc0a36cf0e0e71034fe16c48ad0 Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Wed, 25 Jun 2025 16:12:40 +0200
Subject: [PATCH 1/2] [clang] Create alias for the common `std::pair` type used in Sou
Author: Haojian Wu
Date: 2025-07-02T09:11:55+02:00
New Revision: 0588e8188c647460b641b09467fe6b13a8d510d5
URL:
https://github.com/llvm/llvm-project/commit/0588e8188c647460b641b09467fe6b13a8d510d5
DIFF:
https://github.com/llvm/llvm-project/commit/0588e8188c647460b641b09467fe6b13a8d510d5.diff
LO
https://github.com/hokein closed
https://github.com/llvm/llvm-project/pull/146412
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Author: Haojian Wu
Date: 2025-07-01T12:07:35+02:00
New Revision: 2ee884a9db293d8906056414753b64918517be4a
URL:
https://github.com/llvm/llvm-project/commit/2ee884a9db293d8906056414753b64918517be4a
DIFF:
https://github.com/llvm/llvm-project/commit/2ee884a9db293d8906056414753b64918517be4a.diff
LO
https://github.com/hokein edited
https://github.com/llvm/llvm-project/pull/146314
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
hokein wrote:
Although this is still a draft, it should be ready for an initial round of
review. Any feedback or suggestions would be greatly appreciated.
@AaronBallman @cor3ntin @erichkeane @ilya-biryukov
https://github.com/llvm/llvm-project/pull/146314
_
https://github.com/hokein created
https://github.com/llvm/llvm-project/pull/146510
Avoid reading the `LocalSLocEntryTable` twice per loop iteration. NFC.
https://llvm-compile-time-tracker.com/compare.php?from=0b6ddb02efdcbdac9426e8d857499ea0580303cd&to=1aa335ccfb07ba96177b89b1933aa6b980fa14f6&s
https://github.com/hokein created
https://github.com/llvm/llvm-project/pull/148788
The `Declarator` class is large (4584 bytes) and used as a stack-local variable
during parsing.
This patch reduces the default size of its `DeclTypeInfo` member, reducing the
overall size down to 3880 bytes. Th
https://github.com/hokein created
https://github.com/llvm/llvm-project/pull/147028
This patch stops storing a source range in `CXXOperatorCallExpr` and keeps only
the begin location.
This change allows us to retain the optimization #141058 when switching to
64-bit source locations.
Performan
@@ -43,17 +46,24 @@ namespace clang {
// Macro locations have the top bit set, we rotate by one so it is the low bit.
class SourceLocationEncoding {
using UIntTy = SourceLocation::UIntTy;
- constexpr static unsigned UIntBits = CHAR_BIT * sizeof(UIntTy);
static UIntTy en
@@ -158,9 +158,9 @@ class CXXOperatorCallExpr final : public CallExpr {
: getOperatorLoc();
}
- SourceLocation getBeginLoc() const { return Range.getBegin(); }
- SourceLocation getEndLoc() const { return Range.getEnd(); }
- SourceRange getSourceRange() cons
hokein wrote:
I'm landing this PR now, happy to address any post comments.
https://github.com/llvm/llvm-project/pull/146604
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hokein closed
https://github.com/llvm/llvm-project/pull/146604
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
hokein wrote:
Thank.
https://github.com/llvm/llvm-project/pull/147028
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hokein closed
https://github.com/llvm/llvm-project/pull/147028
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hokein closed
https://github.com/llvm/llvm-project/pull/146782
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Author: Haojian Wu
Date: 2025-07-07T16:43:46+02:00
New Revision: 7c2182a132c709316f7795197978a610a9dfdeae
URL:
https://github.com/llvm/llvm-project/commit/7c2182a132c709316f7795197978a610a9dfdeae
DIFF:
https://github.com/llvm/llvm-project/commit/7c2182a132c709316f7795197978a610a9dfdeae.diff
LO
https://github.com/hokein approved this pull request.
This change looks good to me.
https://github.com/llvm/llvm-project/pull/145164
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
hokein wrote:
> I have debug the issue, seems we cannot move the __range variable check to
> the start of checkExprLifetimeImpl, we may missing extending lifetime of
> temporaries.
Ah, that makes sense -- I missed the fact that this part of the code is also
responsible for extending the objec
Author: Haojian Wu
Date: 2025-07-07T09:57:41+02:00
New Revision: 7fea83e3143e1a88a096a37ecd13668e2da94b93
URL:
https://github.com/llvm/llvm-project/commit/7fea83e3143e1a88a096a37ecd13668e2da94b93
DIFF:
https://github.com/llvm/llvm-project/commit/7fea83e3143e1a88a096a37ecd13668e2da94b93.diff
LO
Author: Haojian Wu
Date: 2025-07-07T17:07:37+02:00
New Revision: b7c4ac2db4cdd99203b836bd94b3392fd7536de5
URL:
https://github.com/llvm/llvm-project/commit/b7c4ac2db4cdd99203b836bd94b3392fd7536de5
DIFF:
https://github.com/llvm/llvm-project/commit/b7c4ac2db4cdd99203b836bd94b3392fd7536de5.diff
LO
hokein wrote:
> Why is this a new review? What changed from the last one I looked at?
Ah, right -- this patch is actually derived from the previous one, and it is
simpler. That older patch became a bit outdated since some of its changes were
split out and already landed in main. I found it eas
https://github.com/hokein closed
https://github.com/llvm/llvm-project/pull/146314
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
hokein wrote:
Closing it in favor of #147292
https://github.com/llvm/llvm-project/pull/146314
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
hokein wrote:
> Ah, not a problem, the new one is fine. I was just very thrown/wondering why
> I was reviewing something so similar again.
Sorry for not being clearer about that. I’ll go ahead and close the previous
review. The new one should already incorporate your review comments from the
hokein wrote:
We seem to have lost track of this. This patch has been around for a while, and
it needs a rebase before it can be merged.
>From what I can tell, part 1 splitting out deduction guide source tracking has
>already landed, and the missing piece for alias templates (#103016) is done
Author: Haojian Wu
Date: 2025-07-10T10:46:27+02:00
New Revision: a709621cd545b061782b03136286227867b452a6
URL:
https://github.com/llvm/llvm-project/commit/a709621cd545b061782b03136286227867b452a6
DIFF:
https://github.com/llvm/llvm-project/commit/a709621cd545b061782b03136286227867b452a6.diff
LO
3101 - 3165 of 3165 matches
Mail list logo