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 <hokein...@gmail.com> Date: Mon, 30 Jun 2025 17:06:01 +0200 Subject: [PATCH] [clang] Don't use raw source location type in DeclarationName. --- clang/include/clang/AST/DeclarationName.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/clang/include/clang/AST/DeclarationName.h b/clang/include/clang/AST/DeclarationName.h index 9bf740b3bf7ce..284228dc0ee47 100644 --- a/clang/include/clang/AST/DeclarationName.h +++ b/clang/include/clang/AST/DeclarationName.h @@ -698,13 +698,13 @@ class DeclarationNameLoc { // The location (if any) of the operator keyword is stored elsewhere. struct CXXOpName { - SourceLocation::UIntTy BeginOpNameLoc; - SourceLocation::UIntTy EndOpNameLoc; + SourceLocation BeginOpNameLoc; + SourceLocation EndOpNameLoc; }; // The location (if any) of the operator keyword is stored elsewhere. struct CXXLitOpName { - SourceLocation::UIntTy OpNameLoc; + SourceLocation OpNameLoc; }; // struct {} CXXUsingDirective; @@ -720,12 +720,12 @@ class DeclarationNameLoc { void setNamedTypeLoc(TypeSourceInfo *TInfo) { NamedType.TInfo = TInfo; } void setCXXOperatorNameRange(SourceRange Range) { - CXXOperatorName.BeginOpNameLoc = Range.getBegin().getRawEncoding(); - CXXOperatorName.EndOpNameLoc = Range.getEnd().getRawEncoding(); + CXXOperatorName.BeginOpNameLoc = Range.getBegin(); + CXXOperatorName.EndOpNameLoc = Range.getEnd(); } void setCXXLiteralOperatorNameLoc(SourceLocation Loc) { - CXXLiteralOperatorName.OpNameLoc = Loc.getRawEncoding(); + CXXLiteralOperatorName.OpNameLoc = Loc; } public: @@ -739,12 +739,12 @@ class DeclarationNameLoc { /// Return the beginning location of the getCXXOperatorNameRange() range. SourceLocation getCXXOperatorNameBeginLoc() const { - return SourceLocation::getFromRawEncoding(CXXOperatorName.BeginOpNameLoc); + return CXXOperatorName.BeginOpNameLoc; } /// Return the end location of the getCXXOperatorNameRange() range. SourceLocation getCXXOperatorNameEndLoc() const { - return SourceLocation::getFromRawEncoding(CXXOperatorName.EndOpNameLoc); + return CXXOperatorName.EndOpNameLoc; } /// Return the range of the operator name (without the operator keyword). @@ -759,7 +759,7 @@ class DeclarationNameLoc { /// keyword). Assumes that the object stores location information of a literal /// operator. SourceLocation getCXXLiteralOperatorNameLoc() const { - return SourceLocation::getFromRawEncoding(CXXLiteralOperatorName.OpNameLoc); + return CXXLiteralOperatorName.OpNameLoc; } /// Construct location information for a constructor, destructor or conversion _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits