diff options
author | Michael Buch <michaelbuch12@gmail.com> | 2025-04-16 17:05:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-16 17:05:53 +0200 |
commit | 99c08ff1cb96fc4f471aca0dd253060b3f32e8bc (patch) | |
tree | ad0c002d6ec23b6f4a24dfc95bbd870f2fb1f016 /clang/lib/Lex/Preprocessor.cpp | |
parent | ef1abbe32e66c16118ded6dd9f7b1a55dea8c2b6 (diff) | |
download | llvm-99c08ff1cb96fc4f471aca0dd253060b3f32e8bc.zip llvm-99c08ff1cb96fc4f471aca0dd253060b3f32e8bc.tar.gz llvm-99c08ff1cb96fc4f471aca0dd253060b3f32e8bc.tar.bz2 |
Revert "[clang] Unify `SourceLocation` and `IdentifierInfo*` pair-like data structures to `IdentifierLoc`" (#135974)
Reverts llvm/llvm-project#135808
Example from the LLDB macOS CI:
https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/as-lldb-cmake/24084/execution/node/54/log/?consoleFull
```
/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp:360:49: error: no viable conversion from 'std::pair<clang::IdentifierInfo *, clang::SourceLocation>' to 'clang::ModuleIdPath' (aka 'ArrayRef<IdentifierLoc>')
clang::Module *top_level_module = DoGetModule(clang_path.front(), false);
^~~~~~~~~~~~~~~~~~
/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:41:40: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'std::pair<clang::IdentifierInfo *, clang::SourceLocation>' to 'const llvm::ArrayRef<clang::IdentifierLoc> &' for 1st argument
class LLVM_GSL_POINTER [[nodiscard]] ArrayRef {
^
/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:41:40: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'std::pair<clang::IdentifierInfo *, clang::SourceLocation>' to 'llvm::ArrayRef<clang::IdentifierLoc> &&' for 1st argument
/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:70:18: note: candidate constructor not viable: no known conversion from 'std::pair<clang::IdentifierInfo *, clang::SourceLocation>' to 'std::nullopt_t' for 1st argument
/*implicit*/ ArrayRef(std::nullopt_t) {}
```
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r-- | clang/lib/Lex/Preprocessor.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index 4c050bf..c25a3ef 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -1159,8 +1159,8 @@ bool Preprocessor::LexAfterModuleImport(Token &Result) { if (Result.is(tok::colon) && ModuleDeclState.isNamedModule()) { std::string Name = ModuleDeclState.getPrimaryName().str(); Name += ":"; - NamedModuleImportPath.emplace_back(Result.getLocation(), - getIdentifierInfo(Name)); + NamedModuleImportPath.push_back( + {getIdentifierInfo(Name), Result.getLocation()}); CurLexerCallback = CLK_LexAfterModuleImport; return true; } @@ -1258,8 +1258,8 @@ bool Preprocessor::LexAfterModuleImport(Token &Result) { if (ModuleImportExpectsIdentifier && Result.getKind() == tok::identifier) { // We expected to see an identifier here, and we did; continue handling // identifiers. - NamedModuleImportPath.emplace_back(Result.getLocation(), - Result.getIdentifierInfo()); + NamedModuleImportPath.push_back( + std::make_pair(Result.getIdentifierInfo(), Result.getLocation())); ModuleImportExpectsIdentifier = false; CurLexerCallback = CLK_LexAfterModuleImport; return true; @@ -1302,12 +1302,12 @@ bool Preprocessor::LexAfterModuleImport(Token &Result) { // If the FlatModuleName ends with colon, it implies it is a partition. if (!FlatModuleName.empty() && FlatModuleName.back() != ':') FlatModuleName += "."; - FlatModuleName += Piece.getIdentifierInfo()->getName(); + FlatModuleName += Piece.first->getName(); } - SourceLocation FirstPathLoc = NamedModuleImportPath[0].getLoc(); + SourceLocation FirstPathLoc = NamedModuleImportPath[0].second; NamedModuleImportPath.clear(); - NamedModuleImportPath.emplace_back(FirstPathLoc, - getIdentifierInfo(FlatModuleName)); + NamedModuleImportPath.push_back( + std::make_pair(getIdentifierInfo(FlatModuleName), FirstPathLoc)); } Module *Imported = nullptr; |