llvm-project/clang/lib/Sema
Yaxun (Sam) Liu 049d860707 [CUDA][HIP] Fix constexpr variables for C++17
constexpr variables are compile time constants and implicitly const, therefore
they are safe to emit on both device and host side. Besides, in many cases
they are intended for both device and host, therefore it makes sense
to emit them on both device and host sides if necessary.

In most cases constexpr variables are used as rvalue and the variables
themselves do not need to be emitted. However if their address is taken,
then they need to be emitted.

For C++14, clang is able to handle that since clang emits them with
available_externally linkage together with the initializer.

However for C++17, the constexpr static data member of a class or template class
become inline variables implicitly. Therefore they become definitions with
linkonce_odr or weak_odr linkages. As such, they can not have available_externally
linkage.

This patch fixes that by adding implicit constant attribute to
file scope constexpr variables and constexpr static data members
in device compilation.

Differential Revision: https://reviews.llvm.org/D79237
2020-06-03 21:56:52 -04:00
..
AnalysisBasedWarnings.cpp [Clang] Add a new warning to warn when passing uninitialized variables as const reference parameters to a function 2020-06-02 10:21:02 -07:00
CMakeLists.txt [OpenMP][SYCL] Improve diagnosing of unsupported types usage 2020-05-29 18:00:48 +03:00
CodeCompleteConsumer.cpp Remove llvm::Error include form Diagnostic.h 2020-04-06 10:42:17 -07:00
CoroutineStmtBuilder.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DeclSpec.cpp [Clang] Enable _Complex __float128 2020-05-28 06:55:49 -05:00
DelayedDiagnostic.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
IdentifierResolver.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
JumpDiagnostics.cpp [CodeGen] Emit destructor calls to destruct compound literals 2020-03-10 14:08:28 -07:00
MultiplexExternalSemaSource.cpp recommit 1b978ddba0 [CUDA][HIP][OpenMP] Emit deferred diagnostics by a post-parsing AST travese 2020-03-23 12:09:07 -04:00
OpenCLBuiltins.td [OpenCL] Add sub-group builtin functions 2020-04-02 13:18:56 +01:00
ParsedAttr.cpp [Sema] Silence warnings when targeting x86 with VS2019 16.5.4 2020-05-06 09:11:59 -04:00
Scope.cpp Un-revert "[coroutines][PR40978] Emit error for co_yield within catch block" 2019-03-25 00:53:10 +00:00
ScopeInfo.cpp PR42104: Support instantiations of lambdas that implicitly capture 2019-06-04 17:17:20 +00:00
Sema.cpp [OpenMP][SYCL] Do not crash on attempt to diagnose unsupported type use 2020-05-30 12:27:58 +03:00
SemaAccess.cpp [c++20] Delete defaulted comparison functions if they would invoke an 2019-12-10 19:28:30 -08:00
SemaAttr.cpp [clang] Fix bug in #pragma float_control(push/pop) 2020-05-14 05:58:11 -07:00
SemaAvailability.cpp Prune TargetInfo.h include from ParsedAttr.h, NFC 2020-03-11 20:47:11 -07:00
SemaCUDA.cpp [CUDA][HIP] Fix constexpr variables for C++17 2020-06-03 21:56:52 -04:00
SemaCXXScopeSpec.cpp [Clang] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:04:18 +00:00
SemaCast.cpp [Matrix] Implement matrix index expressions ([][]). 2020-06-01 20:08:49 +01:00
SemaChecking.cpp [clang][Sema] SequenceChecker: C++17 sequencing rule for call expressions. 2020-06-03 12:35:12 +01:00
SemaCodeComplete.cpp [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec. 2020-04-23 17:21:25 -04:00
SemaConcept.cpp PR45589: Properly decompose overloaded `&&` and `||` operators in 2020-05-12 13:45:45 -07:00
SemaConsumer.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SemaCoroutine.cpp [coroutines] Don't build promise init with no args 2020-04-02 21:44:54 -04:00
SemaDecl.cpp [CUDA][HIP] Fix constexpr variables for C++17 2020-06-03 21:56:52 -04:00
SemaDeclAttr.cpp [Clang] Enable KF and KC mode for [_Complex] __float128 2020-05-28 15:48:15 -05:00
SemaDeclCXX.cpp PR23029 / C++ DR2233: Allow expanded parameter packs to follow 2020-06-02 13:48:59 -07:00
SemaDeclObjC.cpp [ObjC generics] Fix not inheriting type bounds in categories/extensions. 2020-04-24 16:32:28 -07:00
SemaExceptionSpec.cpp [Matrix] Implement matrix index expressions ([][]). 2020-06-01 20:08:49 +01:00
SemaExpr.cpp PR23029 / C++ DR2233: Allow expanded parameter packs to follow 2020-06-02 13:48:59 -07:00
SemaExprCXX.cpp [AST][RecoveryExpr] Build RecoveryExpr for "undef_var" cases. 2020-06-02 15:58:56 +02:00
SemaExprMember.cpp Resolve exception specifications after marking the corresponding 2019-12-15 22:02:30 -08:00
SemaExprObjC.cpp [SemaObjC] Add a warning for dictionary literals with duplicate keys 2020-05-05 15:30:39 -04:00
SemaFixItUtils.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SemaInit.cpp [AST] Fix a null initializer crash for InitListExpr 2020-06-02 10:48:48 +02:00
SemaLambda.cpp Rename warning identifiers from cxx2a to cxx20; NFC. 2020-04-22 14:31:13 -04:00
SemaLookup.cpp [Matrix] Add matrix type to Clang. 2020-05-11 18:55:45 +01:00
SemaModule.cpp [DeclCXX] Remove unknown external linkage specifications 2019-11-21 15:23:05 +02:00
SemaObjCProperty.cpp [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec. 2020-04-23 17:21:25 -04:00
SemaOpenMP.cpp [OpenMP][SYCL] Improve diagnosing of unsupported types usage 2020-05-29 18:00:48 +03:00
SemaOverload.cpp PR23029 / C++ DR2233: Allow expanded parameter packs to follow 2020-06-02 13:48:59 -07:00
SemaPseudoObject.cpp Reapply "Add support for #pragma float_control" with buildbot fixes 2020-05-04 05:51:25 -07:00
SemaSYCL.cpp [OpenMP][SYCL] Improve diagnosing of unsupported types usage 2020-05-29 18:00:48 +03:00
SemaStmt.cpp [AST][RecoveryExpr] Make DeduceAutoType fail if the auto is deduced from recovery exprs. 2020-05-29 09:54:28 +02:00
SemaStmtAsm.cpp Prohibit capture of _ExtInt in inline assembly. 2020-05-14 07:21:09 -07:00
SemaStmtAttr.cpp [clang] Add nomerge function attribute to clang 2020-05-21 17:07:39 -07:00
SemaTemplate.cpp [Matrix] Add matrix type to Clang. 2020-05-11 18:55:45 +01:00
SemaTemplateDeduction.cpp [AST][RecoveryExpr] Make DeduceAutoType fail if the auto is deduced from recovery exprs. 2020-05-29 09:54:28 +02:00
SemaTemplateInstantiate.cpp PR23029 / C++ DR2233: Allow expanded parameter packs to follow 2020-06-02 13:48:59 -07:00
SemaTemplateInstantiateDecl.cpp [CUDA][HIP] Fix constexpr variables for C++17 2020-06-03 21:56:52 -04:00
SemaTemplateVariadic.cpp Reland Implement _ExtInt as an extended int type specifier. 2020-04-17 10:45:48 -07:00
SemaType.cpp [OpenMP][SYCL] Improve diagnosing of unsupported types usage 2020-05-29 18:00:48 +03:00
TreeTransform.h [Matrix] Implement matrix index expressions ([][]). 2020-06-01 20:08:49 +01:00
TypeLocBuilder.cpp [NFC] avoid AlignedCharArray in clang 2019-07-29 23:12:48 +00:00
TypeLocBuilder.h [NFC] avoid AlignedCharArray in clang 2019-07-29 23:12:48 +00:00
UsedDeclVisitor.h recommit 1b978ddba0 [CUDA][HIP][OpenMP] Emit deferred diagnostics by a post-parsing AST travese 2020-03-23 12:09:07 -04:00