llvm-project/clang/lib/Sema
Yaxun (Sam) Liu 98575708da [CUDA][HIP] Fix device template variables
Currently clang does not emit device template variables
instantiated only in host functions, however, nvcc is
able to do that:

https://godbolt.org/z/fneEfferY

This patch fixes this issue by refactoring and extending
the existing mechanism for emitting static device
var ODR-used by host only. Basically clang records
device variables ODR-used by host code and force
them to be emitted in device compilation. The existing
mechanism makes sure these device variables ODR-used
by host code are added to llvm.compiler-used, therefore
they are guaranteed not to be deleted.

It also fixes non-ODR-use of static device variable by host code
causing static device variable to be emitted and registered,
which should not.

Reviewed by: Artem Belevich

Differential Revision: https://reviews.llvm.org/D102237
2021-05-12 11:13:29 -04:00
..
AnalysisBasedWarnings.cpp [-Wcalled-once] Do not run analysis on Obj-C++ 2021-04-22 15:20:52 +03:00
CMakeLists.txt [clang] Make libBasic not depend on MC 2021-04-28 12:16:22 -04:00
CodeCompleteConsumer.cpp [Sema] Use isa<> instead of dyn_cast<> as pointer is never dereferenced. NFCI. 2020-11-15 12:58:36 +00:00
CoroutineStmtBuilder.h
DeclSpec.cpp [OpenCL] Refactor diagnostic for OpenCL extension/feature 2021-03-12 11:43:53 +03:00
DelayedDiagnostic.cpp
IdentifierResolver.cpp
JumpDiagnostics.cpp Implemented [[clang::musttail]] attribute for guaranteed tail calls. 2021-04-15 17:12:21 -07:00
MultiplexExternalSemaSource.cpp Make iteration over the DeclContext::lookup_result safe. 2021-03-17 08:59:04 +00:00
OpenCLBuiltins.td [OpenCL] Add inc/dec/cmpxchg C++ legacy atomics with generic 2021-04-26 09:46:11 +01:00
ParsedAttr.cpp Correct the tablegen for checking mutually exclusive stmt attrs 2021-04-13 15:20:30 -04:00
Scope.cpp
ScopeInfo.cpp [clang] Enable support for #pragma STDC FENV_ACCESS 2020-10-25 06:46:25 -07:00
Sema.cpp [OpenCL] Allow use of double type without extension pragma. 2021-05-11 12:54:38 +01:00
SemaAccess.cpp [clang] Fix an assertion crash in delayed access check. 2020-11-13 14:02:57 +01:00
SemaAttr.cpp [clang] Make libBasic not depend on MC 2021-04-28 12:16:22 -04:00
SemaAvailability.cpp Prune TargetInfo.h include from ParsedAttr.h, NFC 2020-03-11 20:47:11 -07:00
SemaCUDA.cpp [CUDA][HIP] Fix checking dependent initalizer 2021-02-04 18:04:54 -05:00
SemaCXXScopeSpec.cpp
SemaCast.cpp [Matrix] Implement C-style explicit type conversions in CXX for matrix types 2021-05-04 15:27:57 +01:00
SemaChecking.cpp [RISCV] Validate the SEW and LMUL operands to __builtin_rvv_vsetvli(max) 2021-05-10 12:11:13 -07:00
SemaCodeComplete.cpp Introduce -Wreserved-identifier 2021-05-04 11:19:01 +02:00
SemaConcept.cpp [clang] Use decltype((E)) for compound requirement type constraint 2021-03-30 22:00:33 +02:00
SemaConsumer.cpp
SemaCoroutine.cpp [C++20] [P1825] More implicit moves 2021-02-16 17:24:20 -05:00
SemaDecl.cpp [OpenMP] Overhaul `declare target` handling 2021-05-06 02:10:41 -05:00
SemaDeclAttr.cpp [AIX][TLS] Diagnose use of unimplemented TLS models 2021-05-11 17:21:08 -05:00
SemaDeclCXX.cpp Introduce -Wreserved-identifier 2021-05-04 11:19:01 +02:00
SemaDeclObjC.cpp [ObjC] Add a command line flag that disables recognition of objc_direct for testability 2021-04-06 11:17:01 -04:00
SemaExceptionSpec.cpp Update libstdc++ hack comment 2021-04-29 03:57:10 -07:00
SemaExpr.cpp [CUDA][HIP] Fix device template variables 2021-05-12 11:13:29 -04:00
SemaExprCXX.cpp [clang] Use decltype((E)) for compound requirement type constraint 2021-03-30 22:00:33 +02:00
SemaExprMember.cpp [OpenCL] Accept .rgba in OpenCL 3.0 2021-04-12 09:30:06 +01:00
SemaExprObjC.cpp [Sema] Don't set BlockDecl's DoesNotEscape bit if the parameter type of 2021-04-29 16:19:48 -07:00
SemaFixItUtils.cpp
SemaInit.cpp Remove warning "suggest braces" for aggregate initialization of an empty class with an aggregate base class. 2021-04-13 15:45:09 -04:00
SemaLambda.cpp Recommit of a2fdf9d4d7. 2021-02-05 11:27:30 -05:00
SemaLookup.cpp [OpenCL] Do not add builtins with unavailable types 2021-04-21 11:59:29 +01:00
SemaModule.cpp Change Module::ASTFile and ModuleFile::File => Optional<FileEntryRef>, NFC 2020-11-02 15:11:51 -05:00
SemaObjCProperty.cpp Make iteration over the DeclContext::lookup_result safe. 2021-03-17 08:59:04 +00:00
SemaOpenMP.cpp [OpenMP] Use compound operators for reduction combiner if available. 2021-05-11 11:39:12 -07:00
SemaOverload.cpp CWG2076: Permit implicit conversions within a single level of braces 2021-04-22 16:49:39 -07:00
SemaPseudoObject.cpp Revert "[NFC, Refactor] Modernize StorageClass from Specifiers.h to a scoped enum (II)" 2021-01-04 23:17:45 +01:00
SemaSYCL.cpp Recommit "[CUDA][HIP] Defer overloading resolution diagnostics for host device functions" 2020-10-19 17:48:04 -04:00
SemaStmt.cpp Introduce -Wreserved-identifier 2021-05-04 11:19:01 +02:00
SemaStmtAsm.cpp Revert "[NFC, Refactor] Modernize StorageClass from Specifiers.h to a scoped enum (II)" 2021-01-04 23:17:45 +01:00
SemaStmtAttr.cpp Implemented [[clang::musttail]] attribute for guaranteed tail calls. 2021-04-15 17:12:21 -07:00
SemaTemplate.cpp Introduce -Wreserved-identifier 2021-05-04 11:19:01 +02:00
SemaTemplateDeduction.cpp When performing template argument deduction to select a partial 2021-05-05 14:47:18 -07:00
SemaTemplateInstantiate.cpp Make iteration over the DeclContext::lookup_result safe. 2021-03-17 08:59:04 +00:00
SemaTemplateInstantiateDecl.cpp [clang] Remove libstdc++ friend template hack 2021-05-03 04:19:30 -07:00
SemaTemplateVariadic.cpp Revert "Following up on PR48517, fix handling of template arguments that refer" 2021-01-20 15:55:35 +01:00
SemaType.cpp [OpenCL] Allow use of double type without extension pragma. 2021-05-11 12:54:38 +01:00
TreeTransform.h Do not pass null attributes to BuildAttributedStmt during instantiation 2021-04-21 09:30:56 -04:00
TypeLocBuilder.cpp
TypeLocBuilder.h
UsedDeclVisitor.h DeferredDiagnosticsEmitter crashes 2020-10-08 11:42:21 -04:00