aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Interp.cpp
diff options
context:
space:
mode:
authorNick Sarnie <nick.sarnie@intel.com>2025-06-03 10:25:20 -0400
committerGitHub <noreply@github.com>2025-06-03 14:25:20 +0000
commitd9df71045441e02d33cd01fad203862c7efd637e (patch)
tree6c2b140c9d0b07d70c665c4e9af84b699de064e6 /clang/lib/AST/ByteCode/Interp.cpp
parente29eb6637d6b8ee54f746a9c914304f83309c4ee (diff)
downloadllvm-d9df71045441e02d33cd01fad203862c7efd637e.zip
llvm-d9df71045441e02d33cd01fad203862c7efd637e.tar.gz
llvm-d9df71045441e02d33cd01fad203862c7efd637e.tar.bz2
[clang][Sema] Fix and reapply 'Declare builtins used in #pragma intrinsic #138205' (#142019)
I had to revert https://github.com/llvm/llvm-project/pull/138205 in https://github.com/llvm/llvm-project/pull/141994 because it broke the Chrome build. The problem came down to the following: ```c++ unsigned __int64 _umul128(unsigned __int64, unsigned __int64, unsigned __int64 *); namespace {} #pragma intrinsic(_umul128) void foo() { unsigned __int64 carry; unsigned __int64 low = _umul128(0, 0, &carry); } ``` When processing the `#pragma intrinsic` line, we do a name lookup to see if the builtin was previously declared. In this case the lookup fails because the current namespace of the parser and sema is the above namespace scope. The processing of the pragma happens as part of the namespace close parsing. This is usually fine because most pragmas don't care about scopes. However, that's not true for this and other MS pragmas. To fix this, we change the `#pragma intrinsic` processing to be the same as other MS pragmas such as "optimize". Those are processed like a declaration, and because of that we have the correct current scope, so the lookup succeeds. I added a test case that locks down the Chrome fix, as well as manually tested the Chrome build and confirmed it passed.
Diffstat (limited to 'clang/lib/AST/ByteCode/Interp.cpp')
0 files changed, 0 insertions, 0 deletions