[clang] [clang] Reduce the small vector size for DeclTypeInfo. (PR #148788)

2025-07-14 Thread Haojian Wu via cfe-commits
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

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2025-07-10 Thread Haojian Wu via cfe-commits
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

[clang] a709621 - [Lex] Use SourceLocation::UIntTy for the MacroDefStart, NFC

2025-07-10 Thread Haojian Wu via cfe-commits
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

[clang] [clang-tools-extra] [lldb] [clang] Extend SourceLocation to 64 bits. (PR #147292)

2025-07-08 Thread Haojian Wu via 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

[clang] [clang-tools-extra] WIP: Extend SourceLocation to 64 bits. (PR #146314)

2025-07-08 Thread Haojian Wu via 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

[clang] [clang-tools-extra] WIP: Extend SourceLocation to 64 bits. (PR #146314)

2025-07-08 Thread Haojian Wu via cfe-commits
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

[clang] [clang-tools-extra] [clang] Extend SourceLocation to 64 bits. (PR #147292)

2025-07-07 Thread Haojian Wu via cfe-commits
@@ -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

[clang] [clang-tools-extra] [clang] Extend SourceLocation to 64 bits. (PR #147292)

2025-07-07 Thread Haojian Wu via cfe-commits
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

[clang] b7c4ac2 - NFC, use structured binding to simplify the code.

2025-07-07 Thread Haojian Wu via cfe-commits
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

[clang] 7c2182a - NFC, use structured binding to simplify the code in SourceManager.cpp.

2025-07-07 Thread Haojian Wu via 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

[clang] [Sema] Fix lifetime extension for temporaries in range-based for loops in C++23 (PR #145164)

2025-07-07 Thread Haojian Wu via cfe-commits
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

[clang] [Sema] Fix lifetime extension for temporaries in range-based for loops in C++23 (PR #145164)

2025-07-07 Thread Haojian Wu via 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

[clang] [clang] Remove source range from CXXOperatorCallExpr (PR #147028)

2025-07-07 Thread Haojian Wu via 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

[clang] [clang] Remove source range from CXXOperatorCallExpr (PR #147028)

2025-07-07 Thread Haojian Wu via 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

[clang] 7fea83e - [clang] NFC, use LocalLocOffsetTable in getFIleIDLocal.

2025-07-07 Thread Haojian Wu via cfe-commits
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

[clang] [clang] Speedup getFileIDLocal with a separate offset table. (PR #146604)

2025-07-07 Thread Haojian Wu via 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

[clang] [clang] Speedup getFileIDLocal with a separate offset table. (PR #146604)

2025-07-07 Thread Haojian Wu via cfe-commits
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

[clang] [clang] Speedup getFileIDLocal with a separate offset table. (PR #146604)

2025-07-04 Thread Haojian Wu via cfe-commits
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.

[clang] [clang] SourceManager: Cache offsets for LastFileIDLookup to speed up getFileID (PR #146782)

2025-07-04 Thread Haojian Wu via 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

[clang] [clang] Remove source range from CXXOperatorCallExpr (PR #147028)

2025-07-04 Thread Haojian Wu via cfe-commits
@@ -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

[clang] [clang] Remove source range from CXXOperatorCallExpr (PR #147028)

2025-07-04 Thread Haojian Wu via cfe-commits
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

[clang] [Sema] Fix lifetime extension for temporaries in range-based for loops in C++23 (PR #145164)

2025-07-04 Thread Haojian Wu via cfe-commits
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

[clang] [clang] SourceManager: Cache offsets for LastFileIDLookup to speed up getFileID (PR #146782)

2025-07-03 Thread Haojian Wu via cfe-commits
@@ -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 >=

[clang] [clang] SourceManager: Cache offsets for LastFileIDLookup to speed up getFileID (PR #146782)

2025-07-03 Thread Haojian Wu via cfe-commits
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/

[clang] [clang] SourceManager: Cache offsets for LastFileIDLookup to speed up getFileID (PR #146782)

2025-07-03 Thread Haojian Wu via 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

[clang] [clang] SourceManager: Cache offsets for LastFileIDLookup to speed up getFileID (PR #146782)

2025-07-03 Thread Haojian Wu via cfe-commits
@@ -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 >=

[clang] [Sema] Fix lifetime extension for temporaries in range-based for loops in C++23 (PR #145164)

2025-07-03 Thread Haojian Wu via cfe-commits
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.

[clang] [Sema] Fix lifetime extension for temporaries in range-based for loops in C++23 (PR #145164)

2025-07-03 Thread Haojian Wu via cfe-commits
@@ -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

[clang] [clang] SourceManager: Cache offsets for LastFileIDLookup to speed up getFileID (PR #146782)

2025-07-03 Thread Haojian Wu via cfe-commits
@@ -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

[clang] [clang] SourceManager: Cache offsets for LastFileIDLookup to speed up getFileID (PR #146782)

2025-07-03 Thread Haojian Wu via 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

[clang] [clang] SourceManager: Cache offsets for LastFileIDLookup to speed up getFileID (PR #146782)

2025-07-03 Thread Haojian Wu via cfe-commits
@@ -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 >=

[clang] [clang] SourceManager: Cache offsets for LastFileIDLookup to speed up getFileID (PR #146782)

2025-07-03 Thread Haojian Wu via cfe-commits
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/

[clang] 0588e81 - [Serialization] Use the SourceLocation::UIntTy instead of the raw type

2025-07-02 Thread Haojian Wu via cfe-commits
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

[clang] ac76e4d - [Serialization] Use SourceLocation::UIntTy for the offset type, NFC

2025-07-01 Thread Haojian Wu via cfe-commits
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

[clang] [clang] Improve getFileIDLocal binary search. (PR #146510)

2025-07-01 Thread Haojian Wu via 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

[clang] [clang] Improve getFileIDLocal binary search. (PR #146510)

2025-07-01 Thread Haojian Wu via cfe-commits
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

[clang] [clang] Improve getFileIDLocal binary search. (PR #146510)

2025-07-01 Thread Haojian Wu via 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

[clang] [clang] Improve getFileIDLocal binary search. (PR #146510)

2025-07-01 Thread Haojian Wu via 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

[clang] [clang] Improve getFileIDLocal binary search. (PR #146510)

2025-07-01 Thread Haojian Wu via cfe-commits
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

[clang-tools-extra] 2ee884a - [clang-doc] Remove the unused clangd header.

2025-07-01 Thread Haojian Wu via 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

[clang] [clang] Don't use raw source location in DeclarationName, NFC (PR #146412)

2025-07-01 Thread Haojian Wu via cfe-commits
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

[clang] [clang] Don't use raw source location in DeclarationName, NFC (PR #146412)

2025-06-30 Thread Haojian Wu via cfe-commits
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

[clang] [clang-tools-extra] WIP: Extend SourceLocation to 64 bits. (PR #146314)

2025-06-30 Thread Haojian Wu via cfe-commits
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

[clang] [clang-tools-extra] WIP: Extend SourceLocation to 64 bits. (PR #146314)

2025-06-30 Thread Haojian Wu via cfe-commits
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

[clang] [clang-tools-extra] WIP: Extend SourceLocation to 64 bits. (PR #146314)

2025-06-30 Thread Haojian Wu via cfe-commits
@@ -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

[clang] [clang-tools-extra] WIP: Extend SourceLocation to 64 bits. (PR #146314)

2025-06-30 Thread Haojian Wu via cfe-commits
@@ -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;

[clang] [clang-tools-extra] WIP: Extend SourceLocation to 64 bits. (PR #146314)

2025-06-30 Thread Haojian Wu via cfe-commits
@@ -682,6 +682,11 @@ class DeclarationNameTable { DeclarationName getCXXLiteralOperatorName(const IdentifierInfo *II); }; +struct CXXOperatorSourceInfo { + SourceLocation::UIntTy BeginOpNameLoc; hokein wrote: Interesting -- this patch was rebased recently

[clang] [Sema] Fix lifetime extension for temporaries in range-based for loops in C++23 (PR #145164)

2025-06-30 Thread Haojian Wu via cfe-commits
@@ -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

[clang] WIP: Extend SourceLocation to 64 bits. (PR #146314)

2025-06-30 Thread Haojian Wu via cfe-commits
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

[clang] WIP: Extend SourceLocation to 64 bits. (PR #146314)

2025-06-30 Thread Haojian Wu via 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 _

[clang] [clang] NFC: Add alias for std::pair used in SourceLocation (PR #145711)

2025-06-26 Thread Haojian Wu via cfe-commits
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

[clang] [clang] NFC: Add alias for std::pair used in SourceLocation (PR #145711)

2025-06-26 Thread Haojian Wu via 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

[clang] [clang] NFC: Add alias for std::pair used in SourceLocation (PR #145711)

2025-06-26 Thread Haojian Wu via 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

[clang] [Serialization] Fix source location data loss during decoding. (PR #145529)

2025-06-25 Thread Haojian Wu via cfe-commits
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

[clang] [Sema] Avoid deep recursion in AnalyzeImplicitConversions (PR #145734)

2025-06-25 Thread Haojian Wu via cfe-commits
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

[clang] [Serialization] Remove delta encoding optimization (PR #145670)

2025-06-25 Thread Haojian Wu via 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

[clang] a945fb1 - [clang] NFC, move the SourceLocationEncoding.h header guard to the begining of the file

2025-06-25 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2025-06-25T16:26:40+02:00 New Revision: a945fb1481e01f9631fde5f6174276532c33fc98 URL: https://github.com/llvm/llvm-project/commit/a945fb1481e01f9631fde5f6174276532c33fc98 DIFF: https://github.com/llvm/llvm-project/commit/a945fb1481e01f9631fde5f6174276532c33fc98.diff LO

[clang] [clang] NFC: Add alias for std::pair used in SourceLocation (PR #145711)

2025-06-25 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/145711 Introduce a type alias for the commonly used `std::pair` to improve code readability, and make it easier for future updates (64-bit source locations). >From 2bd778b5b5c5ffc0a36cf0e0e71034fe16c48ad0 Mon Sep 17 0

[clang] [Serialization] Remove delta encoding optimization (PR #145670)

2025-06-25 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/145670 >From d2cac7f56f5adf2ddfe084e684562a56f5c5dc65 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Wed, 25 Jun 2025 12:30:18 +0200 Subject: [PATCH 1/2] [Serialization] Remove delta encoding. --- clang/include/clang

[clang] [Serialization] Remove delta encoding optimization (PR #145670)

2025-06-25 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/145670 See the discussion in https://github.com/llvm/llvm-project/pull/145529. This will slightly increase the PCM size (~5%), some data (in-memory preamble size in clangd): - SemaExpr.cpp: 77MB -> 80MB - FindTarget.

[clang] [Serialization] Fix source location data loss during decoding. (PR #145529)

2025-06-25 Thread Haojian Wu via cfe-commits
hokein wrote: > > Yeah, the current situation conflicts with 64-bit source location. We > > discussed this. The conclusion is, if we need large source location space, > > use 48 bits and leave upper 16 bits for module file index. 48 bits should > > be enough for most cases. Thanks, this makes

[clang] [Serialization] Fix source location data loss during decoding. (PR #145529)

2025-06-24 Thread Haojian Wu via cfe-commits
hokein wrote: > Sorry. I failed to understand the problem. In what case, may the encoder > produce up to 33 bits? The newly-added testcase shows the issue -- the encoded value for the delta is `1<<32`, relevant code https://github.com/llvm/llvm-project/blob/c3c923c8d62c1e85fe396a499c921c8a475

[clang] [Serialization] Fix source location data loss during decoding. (PR #145529)

2025-06-24 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/145529 The delta encoding can produce values up to 33 bits, but the current decoding logic only preserves the lower 32 bits, potentially causing data loss. This patch fixes the issue by preserving the lower 33 bits for

[clang-tools-extra] [clangd] Guard against trivial FunctionProtoTypeLoc when creating inlay hints (PR #143087)

2025-06-06 Thread Haojian Wu via cfe-commits
@@ -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

[clang-tools-extra] [clangd] Guard against trivial FunctionProtoTypeLoc when creating inlay hints (PR #143087)

2025-06-06 Thread Haojian Wu via cfe-commits
@@ -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 +//

[clang-tools-extra] [clangd] Guard against trivial FunctionProtoTypeLoc when creating inlay hints (PR #143087)

2025-06-06 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. https://github.com/llvm/llvm-project/pull/143087 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Reduce TemplateDeclInstantiator size. (PR #142983)

2025-06-06 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/142983 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Reduce TemplateDeclInstantiator size. (PR #142983)

2025-06-06 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/142983 >From 61be4bfea92d52cfc3e48a3cabb1bc80cbebb7fa Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Thu, 5 Jun 2025 15:38:58 +0200 Subject: [PATCH 1/2] [clang] Reduce TemplateDeclInstantiator size. --- clang/include

[clang] [clang] Reduce TemplateDeclInstantiator size. (PR #142983)

2025-06-05 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/142983 This gives us another ~1.85% improvement (1617->1647 for the `instantiation-depth-default.cpp`) on clang's template instantiation depths, No performance regressions have been observed: https://llvm-compile-ti

[clang] [clang] Reduce LateInstantiatedAttrVec vector default size. (PR #142840)

2025-06-05 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/142840 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Reduce LateInstantiatedAttrVec vector default size. (PR #142840)

2025-06-04 Thread Haojian Wu via 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

[clang] [clang][AST] Reduce some AST node size. (PR #142585)

2025-06-03 Thread Haojian Wu via cfe-commits
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

[clang] [clang][AST] Reduce some AST node size. (PR #142585)

2025-06-03 Thread Haojian Wu via cfe-commits
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.

[clang] [clang][AST] Reduce some AST node size. (PR #142585)

2025-06-03 Thread Haojian Wu via cfe-commits
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

[clang] [clang][AST] Reduce some AST node size. (PR #142585)

2025-06-03 Thread Haojian Wu via cfe-commits
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

[clang] [clang][AST] Reduce some AST node size. (PR #142585)

2025-06-03 Thread Haojian Wu via cfe-commits
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

[clang] [clang][AST] Reduce some AST node size. (PR #142585)

2025-06-03 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/142585 This patch reduces the size of several AST nodes by moving some fields into the free bitfield space in the base `Stmt` class: * `CXXForRangeStmt`: 96 → 88 bytes * `ChooseExpr`: 56 → 48 bytes * `ArrayTypeTraitExp

[clang] [clang][modules] Remove the workaround for the lambda issue. (PR #142547)

2025-06-03 Thread Haojian Wu via cfe-commits
@@ -1702,36 +1702,7 @@ static NamedDecl* getLambdaCallOperatorHelper(const CXXRecordDecl &RD) { assert(allLookupResultsAreTheSame(Calls) && "More than one lambda call operator!"); - - // FIXME: If we have multiple call operators, we might be in a situation - // w

[clang] [clang][modules] Fix lambda and its enclosing function are not loaded from same module. (PR #142467)

2025-06-02 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/142467 This is a follow-up fix to https://github.com/llvm/llvm-project/pull/109167. Previously, we stored a mapping between the enclosing function and the lambda class declaration. When loading the enclosing function,

[clang-tools-extra] [clangd] Log the paths of loaded config files without --log=verbose (PR #142063)

2025-05-30 Thread Haojian Wu via cfe-commits
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

[clang] [Clang] Optimize some `getBeginLoc` implementations (PR #141058)

2025-05-23 Thread Haojian Wu via cfe-commits
@@ -2901,34 +2907,44 @@ class CallExpr : public Expr { // // * An optional of type FPOptionsOverride. // - // Note that we store the offset in bytes from the this pointer to the start - // of the trailing objects. It would be perfectly possible to compute it - // based

[clang-tools-extra] [clang-tidy] Don't run use-nullptr check on objective-c code. (PR #141229)

2025-05-23 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/141229 `nullptr` doesn't exist in objective-c. Right now, if an objective-c file compiled with `-std=c23` flag, it will trigger this check. This patch suppresses the check warning. >From 07e1b67719f10d3fb31e2cdbe944

[clang-tools-extra] [clang-tidy] Don't run use-nullptr check on objective-c code. (PR #141229)

2025-05-23 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/141229 >From 7d6ba7c08e260d75ad33c06f069898a528fe6159 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 23 May 2025 14:16:52 +0200 Subject: [PATCH] [clang-tidy] Don't run use-nullptr check on objective-c code. If we

[clang] [clang] Fixed an assertion failure triggered when instantiating a template with an expr that references an invalid decl (PR #140905)

2025-05-21 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/140905 Fixes #140898 >From d8a728d1e32c2bd317d11a0d8f46e6d66c0bb125 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Wed, 21 May 2025 16:07:54 +0200 Subject: [PATCH] [clang] Fixed an assertion failure triggered when i

[clang] WIP [clang] Recursively instantiate constexpr template functions. (PR #140865)

2025-05-21 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/140865 See https://github.com/llvm/llvm-project/issues/120108 TODO: test the patch >From 31b94099a420dc9606c84771e9ba6365fadafe20 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Wed, 21 May 2025 10:14:28 +0200 Subject

[clang] [clang] Fix assertion failure in constexpr union deserialization (PR #140179)

2025-05-16 Thread Haojian Wu via cfe-commits
@@ -414,7 +414,7 @@ let Class = PropertyTypeCase in { let Read = [{ node.getUnionValue() }]; } def : Creator<[{ -return APValue(cast(fieldDecl), std::move(value)); +return APValue(cast_if_present(fieldDecl), std::move(value)); hokein wrote: Ad

[clang] [clang] Fix assertion failure in constexpr union deserialization (PR #140179)

2025-05-16 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/140179 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix assertion failure in constexpr union deserialization (PR #140179)

2025-05-16 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. Thanks for the fix. I think we need a release note in clang/docs/ReleaseNotes.rst https://github.com/llvm/llvm-project/pull/140179 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://li

[clang] Reland "Reland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter" (PR #139253)

2025-05-12 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/139253 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reland "Reland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter" (PR #139253)

2025-05-12 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/139253 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-se

[clang] Reland "Reland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter" (PR #139253)

2025-05-12 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/139253 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reland "Reland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter" (PR #139253)

2025-05-12 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/139253 >From b8ba1ae30227fd7c946c5f5e57fb83e47f3bbe69 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 9 May 2025 10:24:01 +0200 Subject: [PATCH 1/6] Reland "Reland [Modules] Remove unnecessary check when generatin

[clang] Reland "Reland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter" (PR #139253)

2025-05-09 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/139253 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reland "Reland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter" (PR #139253)

2025-05-09 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/139253 >From b8ba1ae30227fd7c946c5f5e57fb83e47f3bbe69 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 9 May 2025 10:24:01 +0200 Subject: [PATCH] Reland "Reland [Modules] Remove unnecessary check when generating na

[clang] Reland "Reland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter" (PR #139253)

2025-05-09 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/139253 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reland "Reland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter" (PR #139253)

2025-05-09 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/139253 This relands the patch https://github.com/llvm/llvm-project/commit/67b298f6d82e0b4bb648ac0dabe895e816a77ef1 >From 47211ed01154f9b53395b1c4c33014c7d3bf3c25 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 9

[clang] [clang] Implement some missing interfaces for DelegatingDeserializationListener (PR #133424)

2025-03-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/133424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement some missing interfaces for DelegatingDeserializationListener (PR #133424)

2025-03-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/133424 >From 8eda8337877f85a2e59cb71faeb0da3ed6bff9ee Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 28 Mar 2025 12:05:41 +0100 Subject: [PATCH] [clang] Implement some missing interfaces for DelegatingDeserializa

[clang] [clang] Implement some missing interfaces for DelegatingDeserializationListener (PR #133424)

2025-03-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/133424 Split from the https://github.com/llvm/llvm-project/pull/133395 per the review comment. This patch also moves the `DelegatingDeserializationListener` close to `ASTDeserializationListener`. >From b081c35a3a6b70

[clang] [clang] Fix the crash when dumping deserialized decls (PR #133395)

2025-03-28 Thread Haojian Wu via cfe-commits
@@ -57,6 +59,8 @@ class ASTDeserializationListener { /// A module import was read from the AST file. virtual void ModuleImportRead(serialization::SubmoduleID ID, SourceLocation ImportLoc) {} + /// The deserialization of the AST file was fini

  1   2   3   4   5   6   7   8   9   10   >