llvm-project/clang/tools/libclang
James Y Knight d614874900 [Clang] Implement __builtin_source_location.
This builtin returns the address of a global instance of the
`std::source_location::__impl` type, which must be defined (with an
appropriate shape) before calling the builtin.

It will be used to implement std::source_location in libc++ in a
future change. The builtin is compatible with GCC's implementation,
and libstdc++'s usage. An intentional divergence is that GCC declares
the builtin's return type to be `const void*` (for
ease-of-implementation reasons), while Clang uses the actual type,
`const std::source_location::__impl*`.

In order to support this new functionality, I've also added a new
'UnnamedGlobalConstantDecl'. This artificial Decl is modeled after
MSGuidDecl, and is used to represent a generic concept of an lvalue
constant with global scope, deduplicated by its value. It's possible
that MSGuidDecl itself, or some of the other similar sorts of things
in Clang might be able to be refactored onto this more-generic
concept, but there's enough special-case weirdness in MSGuidDecl that
I gave up attempting to share code there, at least for now.

Finally, for compatibility with libstdc++'s <source_location> header,
I've added a second exception to the "cannot cast from void* to T* in
constant evaluation" rule. This seems a bit distasteful, but feels
like the best available option.

Reviewers: aaron.ballman, erichkeane

Differential Revision: https://reviews.llvm.org/D120159
2022-03-28 18:29:02 -04:00
..
ARCMigrate.cpp
BuildSystem.cpp [llvm] Cleanup header dependencies in ADT and Support 2022-01-21 13:54:49 +01:00
CIndex.cpp [Clang] Implement __builtin_source_location. 2022-03-28 18:29:02 -04:00
CIndexCXX.cpp
CIndexCodeCompletion.cpp [CodeCompletion] Signature help for braced constructor calls 2022-01-03 20:14:59 +01:00
CIndexDiagnostic.cpp
CIndexDiagnostic.h
CIndexHigh.cpp [clang] Use llvm::is_contained (NFC) 2021-10-13 20:41:55 -07:00
CIndexInclusionStack.cpp SourceManager: Clarify that FileInfo always has a ContentCache, NFC 2020-10-23 12:38:53 -04:00
CIndexUSRs.cpp
CIndexer.cpp [SystemZ][z/OS] Set more text files as text 2021-04-19 09:31:46 -04:00
CIndexer.h
CLog.h
CMakeLists.txt [clang][cmake] Use `GNUInstallDirs` to support custom installation dirs 2022-01-21 23:58:08 +00:00
CXComment.cpp
CXComment.h
CXCompilationDatabase.cpp
CXCursor.cpp [OpenMP] Initial parsing/sema for the 'omp target parallel loop' construct 2022-03-24 09:19:00 -07:00
CXCursor.h
CXIndexDataConsumer.cpp Change Module::ASTFile and ModuleFile::File => Optional<FileEntryRef>, NFC 2020-11-02 15:11:51 -05:00
CXIndexDataConsumer.h [clang] Remove redundant member initialization (NFC) 2022-01-02 10:20:23 -08:00
CXLoadedDiagnostic.cpp [clang] Remove redundant member initialization (NFC) 2022-01-02 10:20:23 -08:00
CXLoadedDiagnostic.h
CXSourceLocation.cpp
CXSourceLocation.h [libclang] Fix error handler in translateSourceLocation. 2021-06-18 13:43:14 +01:00
CXStoredDiagnostic.cpp
CXString.cpp
CXString.h
CXTranslationUnit.h
CXType.cpp [Attr] Fix a btf_type_tag AST generation 2022-03-16 08:46:52 -07:00
CXType.h [clang] Remove unused forward declarations (NFC) 2022-01-09 12:21:00 -08:00
CursorVisitor.h [libclang]: visit BindingDecl in DecompositionDecl 2020-05-02 22:18:31 +02:00
FatalErrorHandler.cpp [clang] FatalErrorHandler.cpp - add explicit <stdio.h> include 2021-10-05 17:03:17 +01:00
Index_Internal.h
Indexing.cpp Frontend: Remove unused parameter from ASTUnit::LoadFromCompilerInvocationAction, NFC 2020-11-13 17:47:17 -05:00
Rewrite.cpp [libclang] Add CXRewriter to libclang API 2020-09-04 14:17:03 -07:00
libclang.map [clang] Fix libclang linking on Solaris 2021-08-07 21:14:15 +02:00
linker-script-to-export-list.py libclang: Fixes for the python script that generates the export list 2021-07-26 18:39:53 -07:00