diff options
author | Nikolas Klauser <nikolasklauser@berlin.de> | 2024-09-22 09:25:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-22 09:25:52 +0200 |
commit | f5be5cdaad7edf52e39ad439cf5d608c930efca2 (patch) | |
tree | 9eac42ba689d68ba63b5e0a2adc8fba8fbd15e85 /clang/lib/Sema/SemaLookup.cpp | |
parent | 15e6b5d643618d0c477d31188f6894a31bad98d8 (diff) | |
download | llvm-f5be5cdaad7edf52e39ad439cf5d608c930efca2.zip llvm-f5be5cdaad7edf52e39ad439cf5d608c930efca2.tar.gz llvm-f5be5cdaad7edf52e39ad439cf5d608c930efca2.tar.bz2 |
[Clang] Add __builtin_common_type (#99473)
This implements the logic of the `common_type` base template as a
builtin alias. If there should be no `type` member, an empty class is
returned. Otherwise a specialization of a `type_identity`-like class is
returned. The base template (i.e. `std::common_type`) as well as the
empty class and `type_identity`-like struct are given as arguments to
the builtin.
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 76bfbde..ed5d44a 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -928,10 +928,15 @@ bool Sema::LookupBuiltin(LookupResult &R) { if (II == getASTContext().getMakeIntegerSeqName()) { R.addDecl(getASTContext().getMakeIntegerSeqDecl()); return true; - } else if (II == getASTContext().getTypePackElementName()) { + } + if (II == getASTContext().getTypePackElementName()) { R.addDecl(getASTContext().getTypePackElementDecl()); return true; } + if (II == getASTContext().getBuiltinCommonTypeName()) { + R.addDecl(getASTContext().getBuiltinCommonTypeDecl()); + return true; + } } // Check if this is an OpenCL Builtin, and if so, insert its overloads. |