Vendor import of clang trunk r338536:
https://llvm.org/svn/llvm-project/cfe/trunk@338536
This commit is contained in:
parent
486754660b
commit
c7e70c433e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/clang/dist/; revision=337139 svn path=/vendor/clang/clang-trunk-r338536/; revision=337140; tag=vendor/clang/clang-trunk-r338536
@ -1134,17 +1134,21 @@ the configuration (without a prefix: ``Auto``).
|
||||
.. code-block:: c++
|
||||
|
||||
true:
|
||||
SomeClass::Constructor()
|
||||
: aaaaaaaa(aaaaaaaa), aaaaaaaa(aaaaaaaa), aaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa) {
|
||||
return 0;
|
||||
}
|
||||
FitsOnOneLine::Constructor()
|
||||
: aaaaaaaaaaaaa(aaaaaaaaaaaaaa), aaaaaaaaaaaaa(aaaaaaaaaaaaaa) {}
|
||||
|
||||
DoesntFit::Constructor()
|
||||
: aaaaaaaaaaaaa(aaaaaaaaaaaaaa),
|
||||
aaaaaaaaaaaaa(aaaaaaaaaaaaaa),
|
||||
aaaaaaaaaaaaa(aaaaaaaaaaaaaa) {}
|
||||
|
||||
false:
|
||||
SomeClass::Constructor()
|
||||
: aaaaaaaa(aaaaaaaa), aaaaaaaa(aaaaaaaa),
|
||||
aaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa) {
|
||||
return 0;
|
||||
}
|
||||
FitsOnOneLine::Constructor()
|
||||
: aaaaaaaaaaaaa(aaaaaaaaaaaaaa), aaaaaaaaaaaaa(aaaaaaaaaaaaaa) {}
|
||||
|
||||
DoesntFit::Constructor()
|
||||
: aaaaaaaaaaaaa(aaaaaaaaaaaaaa), aaaaaaaaaaaaa(aaaaaaaaaaaaaa),
|
||||
aaaaaaaaaaaaa(aaaaaaaaaaaaaa) {}
|
||||
|
||||
**ConstructorInitializerIndentWidth** (``unsigned``)
|
||||
The number of characters to use for indentation of constructor
|
||||
|
@ -46,7 +46,9 @@ sections with improvements to Clang's support for those languages.
|
||||
Major New Features
|
||||
------------------
|
||||
|
||||
- ...
|
||||
- A new Implicit Conversion Sanitizer (``-fsanitize=implicit-conversion``) group
|
||||
was added. Please refer to the :ref:`release-notes-ubsan` section of the
|
||||
release notes for the details.
|
||||
|
||||
Improvements to Clang's diagnostics
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -280,10 +282,36 @@ Static Analyzer
|
||||
|
||||
...
|
||||
|
||||
.. _release-notes-ubsan:
|
||||
|
||||
Undefined Behavior Sanitizer (UBSan)
|
||||
------------------------------------
|
||||
|
||||
* ...
|
||||
* A new Implicit Conversion Sanitizer (``-fsanitize=implicit-conversion``) group
|
||||
was added.
|
||||
|
||||
Currently, only one type of issues is caught - implicit integer truncation
|
||||
(``-fsanitize=implicit-integer-truncation``), also known as integer demotion.
|
||||
While there is a ``-Wconversion`` diagnostic group that catches this kind of
|
||||
issues, it is both noisy, and does not catch **all** the cases.
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
unsigned char store = 0;
|
||||
|
||||
bool consume(unsigned int val);
|
||||
|
||||
void test(unsigned long val) {
|
||||
if (consume(val)) // the value may have been silently truncated.
|
||||
store = store + 768; // before addition, 'store' was promoted to int.
|
||||
(void)consume((unsigned int)val); // OK, the truncation is explicit.
|
||||
}
|
||||
|
||||
Just like other ``-fsanitize=integer`` checks, these issues are **not**
|
||||
undefined behaviour. But they are not *always* intentional, and are somewhat
|
||||
hard to track down. This group is **not** enabled by ``-fsanitize=undefined``,
|
||||
but the ``-fsanitize=implicit-integer-truncation`` check
|
||||
is enabled by ``-fsanitize=integer``.
|
||||
|
||||
Core Analysis Improvements
|
||||
==========================
|
||||
|
@ -89,6 +89,12 @@ Available checks are:
|
||||
- ``-fsanitize=function``: Indirect call of a function through a
|
||||
function pointer of the wrong type (Darwin/Linux, C++ and x86/x86_64
|
||||
only).
|
||||
- ``-fsanitize=implicit-integer-truncation``: Implicit conversion from
|
||||
integer of larger bit width to smaller bit width, if that results in data
|
||||
loss. That is, if the demoted value, after casting back to the original
|
||||
width, is not equal to the original value before the downcast.
|
||||
Issues caught by this sanitizer are not undefined behavior,
|
||||
but are often unintentional.
|
||||
- ``-fsanitize=integer-divide-by-zero``: Integer division by zero.
|
||||
- ``-fsanitize=nonnull-attribute``: Passing null pointer as a function
|
||||
parameter which is declared to never be null.
|
||||
@ -121,15 +127,21 @@ Available checks are:
|
||||
unsigned overflow in C++. You can use ``-fsanitize=shift-base`` or
|
||||
``-fsanitize=shift-exponent`` to check only left-hand side or
|
||||
right-hand side of shift operation, respectively.
|
||||
- ``-fsanitize=signed-integer-overflow``: Signed integer overflow,
|
||||
including all the checks added by ``-ftrapv``, and checking for
|
||||
overflow in signed division (``INT_MIN / -1``).
|
||||
- ``-fsanitize=signed-integer-overflow``: Signed integer overflow, where the
|
||||
result of a signed integer computation cannot be represented in its type.
|
||||
This includes all the checks covered by ``-ftrapv``, as well as checks for
|
||||
signed division overflow (``INT_MIN/-1``), but not checks for
|
||||
lossy implicit conversions performed before the computation
|
||||
(see ``-fsanitize=implicit-conversion``). Both of these two issues are
|
||||
handled by ``-fsanitize=implicit-conversion`` group of checks.
|
||||
- ``-fsanitize=unreachable``: If control flow reaches an unreachable
|
||||
program point.
|
||||
- ``-fsanitize=unsigned-integer-overflow``: Unsigned integer
|
||||
overflows. Note that unlike signed integer overflow, unsigned integer
|
||||
is not undefined behavior. However, while it has well-defined semantics,
|
||||
it is often unintentional, so UBSan offers to catch it.
|
||||
- ``-fsanitize=unsigned-integer-overflow``: Unsigned integer overflow, where
|
||||
the result of an unsigned integer computation cannot be represented in its
|
||||
type. Unlike signed integer overflow, this is not undefined behavior, but
|
||||
it is often unintentional. This sanitizer does not check for lossy implicit
|
||||
conversions performed before such a computation
|
||||
(see ``-fsanitize=implicit-conversion``).
|
||||
- ``-fsanitize=vla-bound``: A variable-length array whose bound
|
||||
does not evaluate to a positive value.
|
||||
- ``-fsanitize=vptr``: Use of an object whose vptr indicates that it is of
|
||||
@ -140,11 +152,17 @@ Available checks are:
|
||||
|
||||
You can also use the following check groups:
|
||||
- ``-fsanitize=undefined``: All of the checks listed above other than
|
||||
``unsigned-integer-overflow`` and the ``nullability-*`` checks.
|
||||
``unsigned-integer-overflow``, ``implicit-conversion`` and the
|
||||
``nullability-*`` group of checks.
|
||||
- ``-fsanitize=undefined-trap``: Deprecated alias of
|
||||
``-fsanitize=undefined``.
|
||||
- ``-fsanitize=integer``: Checks for undefined or suspicious integer
|
||||
behavior (e.g. unsigned integer overflow).
|
||||
Enables ``signed-integer-overflow``, ``unsigned-integer-overflow``,
|
||||
``shift``, ``integer-divide-by-zero``, and ``implicit-integer-truncation``.
|
||||
- ``-fsanitize=implicit-conversion``: Checks for suspicious behaviours of
|
||||
implicit conversions.
|
||||
Currently, only ``-fsanitize=implicit-integer-truncation`` is implemented.
|
||||
- ``-fsanitize=nullability``: Enables ``nullability-arg``,
|
||||
``nullability-assign``, and ``nullability-return``. While violating
|
||||
nullability does not have undefined behavior, it is often unintentional,
|
||||
|
@ -2155,13 +2155,8 @@ Objective-C++ Language Features
|
||||
OpenMP Features
|
||||
===============
|
||||
|
||||
Clang supports all OpenMP 3.1 directives and clauses. In addition, some
|
||||
features of OpenMP 4.0 are supported. For example, ``#pragma omp simd``,
|
||||
``#pragma omp for simd``, ``#pragma omp parallel for simd`` directives, extended
|
||||
set of atomic constructs, ``proc_bind`` clause for all parallel-based
|
||||
directives, ``depend`` clause for ``#pragma omp task`` directive (except for
|
||||
array sections), ``#pragma omp cancel`` and ``#pragma omp cancellation point``
|
||||
directives, and ``#pragma omp taskgroup`` directive.
|
||||
Clang supports all OpenMP 4.5 directives and clauses. See :doc:`OpenMPSupport`
|
||||
for additional details.
|
||||
|
||||
Use `-fopenmp` to enable OpenMP. Support for OpenMP can be disabled with
|
||||
`-fno-openmp`.
|
||||
@ -2783,6 +2778,7 @@ Execute ``clang-cl /?`` to see a list of supported options:
|
||||
/Brepro Emit an object file which can be reproduced over time
|
||||
/C Don't discard comments when preprocessing
|
||||
/c Compile only
|
||||
/d1PP Retain macro definitions in /E mode
|
||||
/d1reportAllClassLayout Dump record layout information
|
||||
/diagnostics:caret Enable caret and column diagnostics (on by default)
|
||||
/diagnostics:classic Disable column and caret diagnostics
|
||||
@ -2816,6 +2812,7 @@ Execute ``clang-cl /?`` to see a list of supported options:
|
||||
/GS- Disable buffer security check
|
||||
/GS Enable buffer security check
|
||||
/Gs<value> Set stack probe size
|
||||
/guard:<value> Enable Control Flow Guard with /guard:cf
|
||||
/Gv Set __vectorcall as a default calling convention
|
||||
/Gw- Don't put each data item in its own section
|
||||
/Gw Put each data item in its own section
|
||||
@ -2871,6 +2868,7 @@ Execute ``clang-cl /?`` to see a list of supported options:
|
||||
/WX- Do not treat warnings as errors
|
||||
/WX Treat warnings as errors
|
||||
/w Disable all warnings
|
||||
/X Don't add %INCLUDE% to the include search path
|
||||
/Y- Disable precompiled headers, overrides /Yc and /Yu
|
||||
/Yc<filename> Generate a pch file for all code up to and including <filename>
|
||||
/Yu<filename> Load a pch file and use it instead of all code up to and including <filename>
|
||||
@ -2894,8 +2892,15 @@ Execute ``clang-cl /?`` to see a list of supported options:
|
||||
OPTIONS:
|
||||
-### Print (but do not run) the commands to run for this compilation
|
||||
--analyze Run the static analyzer
|
||||
-faddrsig Emit an address-significance table
|
||||
-fansi-escape-codes Use ANSI escape codes for diagnostics
|
||||
-fblocks Enable the 'blocks' language feature
|
||||
-fcf-protection=<value> Instrument control-flow architecture protection. Options: return, branch, full, none.
|
||||
-fcf-protection Enable cf-protection in 'full' mode
|
||||
-fcolor-diagnostics Use colors in diagnostics
|
||||
-fcomplete-member-pointers
|
||||
Require member pointer base types to be complete if they would be significant under the Microsoft ABI
|
||||
-fcoverage-mapping Generate coverage mapping to enable code coverage analysis
|
||||
-fdebug-macro Emit macro debug information
|
||||
-fdelayed-template-parsing
|
||||
Parse templated function definitions at the end of the translation unit
|
||||
@ -2905,6 +2910,7 @@ Execute ``clang-cl /?`` to see a list of supported options:
|
||||
Print fix-its in machine parseable form
|
||||
-flto=<value> Set LTO mode to either 'full' or 'thin'
|
||||
-flto Enable LTO in 'full' mode
|
||||
-fmerge-all-constants Allow merging of constants
|
||||
-fms-compatibility-version=<value>
|
||||
Dot-separated value representing the Microsoft compiler version
|
||||
number to report in _MSC_VER (0 = don't define it (default))
|
||||
@ -2912,9 +2918,17 @@ Execute ``clang-cl /?`` to see a list of supported options:
|
||||
-fms-extensions Accept some non-standard constructs supported by the Microsoft compiler
|
||||
-fmsc-version=<value> Microsoft compiler version number to report in _MSC_VER
|
||||
(0 = don't define it (default))
|
||||
-fno-addrsig Don't emit an address-significance table
|
||||
-fno-builtin-<value> Disable implicit builtin knowledge of a specific function
|
||||
-fno-builtin Disable implicit builtin knowledge of functions
|
||||
-fno-complete-member-pointers
|
||||
Do not require member pointer base types to be complete if they would be significant under the Microsoft ABI
|
||||
-fno-coverage-mapping Disable code coverage analysis
|
||||
-fno-debug-macro Do not emit macro debug information
|
||||
-fno-delayed-template-parsing
|
||||
Disable delayed template parsing
|
||||
-fno-sanitize-address-poison-class-member-array-new-cookie
|
||||
Disable poisoning array cookies when using class member operator new[] in AddressSanitizer
|
||||
-fno-sanitize-address-use-after-scope
|
||||
Disable use-after-scope detection in AddressSanitizer
|
||||
-fno-sanitize-blacklist Don't use blacklist file for sanitizers
|
||||
@ -2950,6 +2964,8 @@ Execute ``clang-cl /?`` to see a list of supported options:
|
||||
Level of field padding for AddressSanitizer
|
||||
-fsanitize-address-globals-dead-stripping
|
||||
Enable linker dead stripping of globals in AddressSanitizer
|
||||
-fsanitize-address-poison-class-member-array-new-cookie
|
||||
Enable poisoning array cookies when using class member operator new[] in AddressSanitizer
|
||||
-fsanitize-address-use-after-scope
|
||||
Enable use-after-scope detection in AddressSanitizer
|
||||
-fsanitize-blacklist=<value>
|
||||
|
@ -160,7 +160,7 @@ typedef struct CXVersion {
|
||||
int Major;
|
||||
/**
|
||||
* The minor version number, e.g., the '7' in '10.7.3'. This value
|
||||
* will be negative if no minor version number was provided, e.g., for
|
||||
* will be negative if no minor version number was provided, e.g., for
|
||||
* version '10'.
|
||||
*/
|
||||
int Minor;
|
||||
@ -387,7 +387,7 @@ CINDEX_LINKAGE int clang_getFileUniqueID(CXFile file, CXFileUniqueID *outID);
|
||||
* multiple inclusions, either with the conventional
|
||||
* \#ifndef/\#define/\#endif macro guards or with \#pragma once.
|
||||
*/
|
||||
CINDEX_LINKAGE unsigned
|
||||
CINDEX_LINKAGE unsigned
|
||||
clang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file);
|
||||
|
||||
/**
|
||||
@ -786,7 +786,7 @@ typedef void *CXDiagnostic;
|
||||
* A group of CXDiagnostics.
|
||||
*/
|
||||
typedef void *CXDiagnosticSet;
|
||||
|
||||
|
||||
/**
|
||||
* Determine the number of diagnostics in a CXDiagnosticSet.
|
||||
*/
|
||||
@ -802,7 +802,7 @@ CINDEX_LINKAGE unsigned clang_getNumDiagnosticsInSet(CXDiagnosticSet Diags);
|
||||
* via a call to \c clang_disposeDiagnostic().
|
||||
*/
|
||||
CINDEX_LINKAGE CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags,
|
||||
unsigned Index);
|
||||
unsigned Index);
|
||||
|
||||
/**
|
||||
* Describes the kind of error that occurred (if any) in a call to
|
||||
@ -813,26 +813,26 @@ enum CXLoadDiag_Error {
|
||||
* Indicates that no error occurred.
|
||||
*/
|
||||
CXLoadDiag_None = 0,
|
||||
|
||||
|
||||
/**
|
||||
* Indicates that an unknown error occurred while attempting to
|
||||
* deserialize diagnostics.
|
||||
*/
|
||||
CXLoadDiag_Unknown = 1,
|
||||
|
||||
|
||||
/**
|
||||
* Indicates that the file containing the serialized diagnostics
|
||||
* could not be opened.
|
||||
*/
|
||||
CXLoadDiag_CannotLoad = 2,
|
||||
|
||||
|
||||
/**
|
||||
* Indicates that the serialized diagnostics file is invalid or
|
||||
* corrupt.
|
||||
*/
|
||||
CXLoadDiag_InvalidFile = 3
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Deserialize a set of diagnostics from a Clang diagnostics bitcode
|
||||
* file.
|
||||
@ -856,7 +856,7 @@ CINDEX_LINKAGE CXDiagnosticSet clang_loadDiagnostics(const char *file,
|
||||
CINDEX_LINKAGE void clang_disposeDiagnosticSet(CXDiagnosticSet Diags);
|
||||
|
||||
/**
|
||||
* Retrieve the child diagnostics of a CXDiagnostic.
|
||||
* Retrieve the child diagnostics of a CXDiagnostic.
|
||||
*
|
||||
* This CXDiagnosticSet does not need to be released by
|
||||
* clang_disposeDiagnosticSet.
|
||||
@ -888,7 +888,7 @@ CINDEX_LINKAGE CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit,
|
||||
* \param Unit the translation unit to query.
|
||||
*/
|
||||
CINDEX_LINKAGE CXDiagnosticSet
|
||||
clang_getDiagnosticSetFromTU(CXTranslationUnit Unit);
|
||||
clang_getDiagnosticSetFromTU(CXTranslationUnit Unit);
|
||||
|
||||
/**
|
||||
* Destroy a diagnostic.
|
||||
@ -934,7 +934,7 @@ enum CXDiagnosticDisplayOptions {
|
||||
* \c -fdiagnostics-print-source-range-info.
|
||||
*/
|
||||
CXDiagnostic_DisplaySourceRanges = 0x04,
|
||||
|
||||
|
||||
/**
|
||||
* Display the option name associated with this diagnostic, if any.
|
||||
*
|
||||
@ -943,12 +943,12 @@ enum CXDiagnosticDisplayOptions {
|
||||
* \c -fdiagnostics-show-option.
|
||||
*/
|
||||
CXDiagnostic_DisplayOption = 0x08,
|
||||
|
||||
|
||||
/**
|
||||
* Display the category number associated with this diagnostic, if any.
|
||||
*
|
||||
* The category number is displayed within brackets after the diagnostic text.
|
||||
* This option corresponds to the clang flag
|
||||
* This option corresponds to the clang flag
|
||||
* \c -fdiagnostics-show-category=id.
|
||||
*/
|
||||
CXDiagnostic_DisplayCategoryId = 0x10,
|
||||
@ -957,7 +957,7 @@ enum CXDiagnosticDisplayOptions {
|
||||
* Display the category name associated with this diagnostic, if any.
|
||||
*
|
||||
* The category name is displayed within brackets after the diagnostic text.
|
||||
* This option corresponds to the clang flag
|
||||
* This option corresponds to the clang flag
|
||||
* \c -fdiagnostics-show-category=name.
|
||||
*/
|
||||
CXDiagnostic_DisplayCategoryName = 0x20
|
||||
@ -1019,7 +1019,7 @@ CINDEX_LINKAGE CXString clang_getDiagnosticSpelling(CXDiagnostic);
|
||||
* diagnostic (if any).
|
||||
*
|
||||
* \returns A string that contains the command-line option used to enable this
|
||||
* warning, such as "-Wconversion" or "-pedantic".
|
||||
* warning, such as "-Wconversion" or "-pedantic".
|
||||
*/
|
||||
CINDEX_LINKAGE CXString clang_getDiagnosticOption(CXDiagnostic Diag,
|
||||
CXString *Disable);
|
||||
@ -1028,7 +1028,7 @@ CINDEX_LINKAGE CXString clang_getDiagnosticOption(CXDiagnostic Diag,
|
||||
* Retrieve the category number for this diagnostic.
|
||||
*
|
||||
* Diagnostics can be categorized into groups along with other, related
|
||||
* diagnostics (e.g., diagnostics under the same warning flag). This routine
|
||||
* diagnostics (e.g., diagnostics under the same warning flag). This routine
|
||||
* retrieves the category number for the given diagnostic.
|
||||
*
|
||||
* \returns The number of the category that contains this diagnostic, or zero
|
||||
@ -1041,7 +1041,7 @@ CINDEX_LINKAGE unsigned clang_getDiagnosticCategory(CXDiagnostic);
|
||||
* is now deprecated. Use clang_getDiagnosticCategoryText()
|
||||
* instead.
|
||||
*
|
||||
* \param Category A diagnostic category number, as returned by
|
||||
* \param Category A diagnostic category number, as returned by
|
||||
* \c clang_getDiagnosticCategory().
|
||||
*
|
||||
* \returns The name of the given diagnostic category.
|
||||
@ -1055,7 +1055,7 @@ CXString clang_getDiagnosticCategoryName(unsigned Category);
|
||||
* \returns The text of the given diagnostic category.
|
||||
*/
|
||||
CINDEX_LINKAGE CXString clang_getDiagnosticCategoryText(CXDiagnostic);
|
||||
|
||||
|
||||
/**
|
||||
* Determine the number of source ranges associated with the given
|
||||
* diagnostic.
|
||||
@ -1242,9 +1242,9 @@ enum CXTranslationUnit_Flags {
|
||||
* intent of producing a precompiled header.
|
||||
*/
|
||||
CXTranslationUnit_Incomplete = 0x02,
|
||||
|
||||
|
||||
/**
|
||||
* Used to indicate that the translation unit should be built with an
|
||||
* Used to indicate that the translation unit should be built with an
|
||||
* implicit precompiled header for the preamble.
|
||||
*
|
||||
* An implicit precompiled header is used as an optimization when a
|
||||
@ -1258,7 +1258,7 @@ enum CXTranslationUnit_Flags {
|
||||
* precompiled header to improve parsing performance.
|
||||
*/
|
||||
CXTranslationUnit_PrecompiledPreamble = 0x04,
|
||||
|
||||
|
||||
/**
|
||||
* Used to indicate that the translation unit should cache some
|
||||
* code-completion results with each reparse of the source file.
|
||||
@ -1343,7 +1343,7 @@ enum CXTranslationUnit_Flags {
|
||||
* to indicate that the translation unit is likely to be reparsed many times,
|
||||
* either explicitly (via \c clang_reparseTranslationUnit()) or implicitly
|
||||
* (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag
|
||||
* set contains an unspecified set of optimizations (e.g., the precompiled
|
||||
* set contains an unspecified set of optimizations (e.g., the precompiled
|
||||
* preamble) geared toward improving the performance of these routines. The
|
||||
* set of optimizations enabled may change from one version to the next.
|
||||
*/
|
||||
@ -1374,7 +1374,7 @@ clang_parseTranslationUnit(CXIndex CIdx,
|
||||
* command-line arguments so that the compilation can be configured in the same
|
||||
* way that the compiler is configured on the command line.
|
||||
*
|
||||
* \param CIdx The index object with which the translation unit will be
|
||||
* \param CIdx The index object with which the translation unit will be
|
||||
* associated.
|
||||
*
|
||||
* \param source_filename The name of the source file to load, or NULL if the
|
||||
@ -1383,7 +1383,7 @@ clang_parseTranslationUnit(CXIndex CIdx,
|
||||
* \param command_line_args The command-line arguments that would be
|
||||
* passed to the \c clang executable if it were being invoked out-of-process.
|
||||
* These command-line options will be parsed and will affect how the translation
|
||||
* unit is parsed. Note that the following options are ignored: '-c',
|
||||
* unit is parsed. Note that the following options are ignored: '-c',
|
||||
* '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'.
|
||||
*
|
||||
* \param num_command_line_args The number of command-line arguments in
|
||||
@ -1463,32 +1463,32 @@ enum CXSaveError {
|
||||
* Indicates that no error occurred while saving a translation unit.
|
||||
*/
|
||||
CXSaveError_None = 0,
|
||||
|
||||
|
||||
/**
|
||||
* Indicates that an unknown error occurred while attempting to save
|
||||
* the file.
|
||||
*
|
||||
* This error typically indicates that file I/O failed when attempting to
|
||||
* This error typically indicates that file I/O failed when attempting to
|
||||
* write the file.
|
||||
*/
|
||||
CXSaveError_Unknown = 1,
|
||||
|
||||
|
||||
/**
|
||||
* Indicates that errors during translation prevented this attempt
|
||||
* to save the translation unit.
|
||||
*
|
||||
*
|
||||
* Errors that prevent the translation unit from being saved can be
|
||||
* extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic().
|
||||
*/
|
||||
CXSaveError_TranslationErrors = 2,
|
||||
|
||||
|
||||
/**
|
||||
* Indicates that the translation unit to be saved was somehow
|
||||
* invalid (e.g., NULL).
|
||||
*/
|
||||
CXSaveError_InvalidTU = 3
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Saves a translation unit into a serialized representation of
|
||||
* that translation unit on disk.
|
||||
@ -1509,7 +1509,7 @@ enum CXSaveError {
|
||||
* CXSaveTranslationUnit_XXX flags.
|
||||
*
|
||||
* \returns A value that will match one of the enumerators of the CXSaveError
|
||||
* enumeration. Zero (CXSaveError_None) indicates that the translation unit was
|
||||
* enumeration. Zero (CXSaveError_None) indicates that the translation unit was
|
||||
* saved successfully, while a non-zero value indicates that a problem occurred.
|
||||
*/
|
||||
CINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU,
|
||||
@ -1543,7 +1543,7 @@ enum CXReparse_Flags {
|
||||
*/
|
||||
CXReparse_None = 0x0
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the set of flags that is suitable for reparsing a translation
|
||||
* unit.
|
||||
@ -1551,7 +1551,7 @@ enum CXReparse_Flags {
|
||||
* The set of flags returned provide options for
|
||||
* \c clang_reparseTranslationUnit() by default. The returned flag
|
||||
* set contains an unspecified set of optimizations geared toward common uses
|
||||
* of reparsing. The set of optimizations enabled may change from one version
|
||||
* of reparsing. The set of optimizations enabled may change from one version
|
||||
* to the next.
|
||||
*/
|
||||
CINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU);
|
||||
@ -1563,17 +1563,17 @@ CINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU);
|
||||
* created the given translation unit, for example because those source files
|
||||
* have changed (either on disk or as passed via \p unsaved_files). The
|
||||
* source code will be reparsed with the same command-line options as it
|
||||
* was originally parsed.
|
||||
* was originally parsed.
|
||||
*
|
||||
* Reparsing a translation unit invalidates all cursors and source locations
|
||||
* that refer into that translation unit. This makes reparsing a translation
|
||||
* unit semantically equivalent to destroying the translation unit and then
|
||||
* creating a new translation unit with the same command-line arguments.
|
||||
* However, it may be more efficient to reparse a translation
|
||||
* However, it may be more efficient to reparse a translation
|
||||
* unit using this routine.
|
||||
*
|
||||
* \param TU The translation unit whose contents will be re-parsed. The
|
||||
* translation unit must originally have been built with
|
||||
* translation unit must originally have been built with
|
||||
* \c clang_createTranslationUnitFromSourceFile().
|
||||
*
|
||||
* \param num_unsaved_files The number of unsaved file entries in \p
|
||||
@ -1584,7 +1584,7 @@ CINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU);
|
||||
* those files. The contents and name of these files (as specified by
|
||||
* CXUnsavedFile) are copied when necessary, so the client only needs to
|
||||
* guarantee their validity until the call to this function returns.
|
||||
*
|
||||
*
|
||||
* \param options A bitset of options composed of the flags in CXReparse_Flags.
|
||||
* The function \c clang_defaultReparseOptions() produces a default set of
|
||||
* options recommended for most uses, based on the translation unit.
|
||||
@ -1612,8 +1612,8 @@ enum CXTUResourceUsageKind {
|
||||
CXTUResourceUsage_AST_SideTables = 6,
|
||||
CXTUResourceUsage_SourceManager_Membuffer_Malloc = 7,
|
||||
CXTUResourceUsage_SourceManager_Membuffer_MMap = 8,
|
||||
CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc = 9,
|
||||
CXTUResourceUsage_ExternalASTSource_Membuffer_MMap = 10,
|
||||
CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc = 9,
|
||||
CXTUResourceUsage_ExternalASTSource_Membuffer_MMap = 10,
|
||||
CXTUResourceUsage_Preprocessor = 11,
|
||||
CXTUResourceUsage_PreprocessingRecord = 12,
|
||||
CXTUResourceUsage_SourceManager_DataStructures = 13,
|
||||
@ -1635,8 +1635,8 @@ const char *clang_getTUResourceUsageName(enum CXTUResourceUsageKind kind);
|
||||
|
||||
typedef struct CXTUResourceUsageEntry {
|
||||
/* The memory usage category. */
|
||||
enum CXTUResourceUsageKind kind;
|
||||
/* Amount of resources used.
|
||||
enum CXTUResourceUsageKind kind;
|
||||
/* Amount of resources used.
|
||||
The units will depend on the resource kind. */
|
||||
unsigned long amount;
|
||||
} CXTUResourceUsageEntry;
|
||||
@ -1819,7 +1819,7 @@ enum CXCursorKind {
|
||||
*/
|
||||
CXCursor_TypeRef = 43,
|
||||
CXCursor_CXXBaseSpecifier = 44,
|
||||
/**
|
||||
/**
|
||||
* A reference to a class template, function template, template
|
||||
* template parameter, or class template partial specialization.
|
||||
*/
|
||||
@ -1829,14 +1829,14 @@ enum CXCursorKind {
|
||||
*/
|
||||
CXCursor_NamespaceRef = 46,
|
||||
/**
|
||||
* A reference to a member of a struct, union, or class that occurs in
|
||||
* A reference to a member of a struct, union, or class that occurs in
|
||||
* some non-expression context, e.g., a designated initializer.
|
||||
*/
|
||||
CXCursor_MemberRef = 47,
|
||||
/**
|
||||
* A reference to a labeled statement.
|
||||
*
|
||||
* This cursor kind is used to describe the jump to "start_over" in the
|
||||
* This cursor kind is used to describe the jump to "start_over" in the
|
||||
* goto statement in the following example:
|
||||
*
|
||||
* \code
|
||||
@ -1849,7 +1849,7 @@ enum CXCursorKind {
|
||||
* A label reference cursor refers to a label statement.
|
||||
*/
|
||||
CXCursor_LabelRef = 48,
|
||||
|
||||
|
||||
/**
|
||||
* A reference to a set of overloaded functions or function templates
|
||||
* that has not yet been resolved to a specific function or function template.
|
||||
@ -1882,18 +1882,18 @@ enum CXCursorKind {
|
||||
* argument-dependent lookup (e.g., the "swap" function at the end of the
|
||||
* example).
|
||||
*
|
||||
* The functions \c clang_getNumOverloadedDecls() and
|
||||
* The functions \c clang_getNumOverloadedDecls() and
|
||||
* \c clang_getOverloadedDecl() can be used to retrieve the definitions
|
||||
* referenced by this cursor.
|
||||
*/
|
||||
CXCursor_OverloadedDeclRef = 49,
|
||||
|
||||
|
||||
/**
|
||||
* A reference to a variable that occurs in some non-expression
|
||||
* A reference to a variable that occurs in some non-expression
|
||||
* context, e.g., a C++ lambda capture list.
|
||||
*/
|
||||
CXCursor_VariableRef = 50,
|
||||
|
||||
|
||||
CXCursor_LastRef = CXCursor_VariableRef,
|
||||
|
||||
/* Error conditions */
|
||||
@ -2153,7 +2153,7 @@ enum CXCursorKind {
|
||||
* \endcode
|
||||
*/
|
||||
CXCursor_LambdaExpr = 144,
|
||||
|
||||
|
||||
/** Objective-c Boolean Literal.
|
||||
*/
|
||||
CXCursor_ObjCBoolLiteralExpr = 145,
|
||||
@ -2189,10 +2189,10 @@ enum CXCursorKind {
|
||||
* reported.
|
||||
*/
|
||||
CXCursor_UnexposedStmt = 200,
|
||||
|
||||
/** A labelled statement in a function.
|
||||
|
||||
/** A labelled statement in a function.
|
||||
*
|
||||
* This cursor kind is used to describe the "start_over:" label statement in
|
||||
* This cursor kind is used to describe the "start_over:" label statement in
|
||||
* the following example:
|
||||
*
|
||||
* \code
|
||||
@ -2650,7 +2650,7 @@ CINDEX_LINKAGE int clang_Cursor_isNull(CXCursor cursor);
|
||||
* Compute a hash value for the given cursor.
|
||||
*/
|
||||
CINDEX_LINKAGE unsigned clang_hashCursor(CXCursor);
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve the kind of the given cursor.
|
||||
*/
|
||||
@ -2718,7 +2718,7 @@ CINDEX_LINKAGE unsigned clang_isTranslationUnit(enum CXCursorKind);
|
||||
* element, such as a preprocessor directive or macro instantiation.
|
||||
*/
|
||||
CINDEX_LINKAGE unsigned clang_isPreprocessing(enum CXCursorKind);
|
||||
|
||||
|
||||
/***
|
||||
* Determine whether the given cursor represents a currently
|
||||
* unexposed piece of the AST (e.g., CXCursor_UnexposedStmt).
|
||||
@ -2785,7 +2785,7 @@ CINDEX_LINKAGE enum CXVisibilityKind clang_getCursorVisibility(CXCursor cursor);
|
||||
*
|
||||
* \returns The availability of the cursor.
|
||||
*/
|
||||
CINDEX_LINKAGE enum CXAvailabilityKind
|
||||
CINDEX_LINKAGE enum CXAvailabilityKind
|
||||
clang_getCursorAvailability(CXCursor cursor);
|
||||
|
||||
/**
|
||||
@ -2831,10 +2831,10 @@ typedef struct CXPlatformAvailability {
|
||||
*
|
||||
* \param cursor The cursor to query.
|
||||
*
|
||||
* \param always_deprecated If non-NULL, will be set to indicate whether the
|
||||
* \param always_deprecated If non-NULL, will be set to indicate whether the
|
||||
* entity is deprecated on all platforms.
|
||||
*
|
||||
* \param deprecated_message If non-NULL, will be set to the message text
|
||||
* \param deprecated_message If non-NULL, will be set to the message text
|
||||
* provided along with the unconditional deprecation of this entity. The client
|
||||
* is responsible for deallocating this string.
|
||||
*
|
||||
@ -2842,7 +2842,7 @@ typedef struct CXPlatformAvailability {
|
||||
* entity is unavailable on all platforms.
|
||||
*
|
||||
* \param unavailable_message If non-NULL, will be set to the message text
|
||||
* provided along with the unconditional unavailability of this entity. The
|
||||
* provided along with the unconditional unavailability of this entity. The
|
||||
* client is responsible for deallocating this string.
|
||||
*
|
||||
* \param availability If non-NULL, an array of CXPlatformAvailability instances
|
||||
@ -2850,15 +2850,15 @@ typedef struct CXPlatformAvailability {
|
||||
* the number of platforms for which availability information is available (as
|
||||
* returned by this function) or \c availability_size, whichever is smaller.
|
||||
*
|
||||
* \param availability_size The number of elements available in the
|
||||
* \param availability_size The number of elements available in the
|
||||
* \c availability array.
|
||||
*
|
||||
* \returns The number of platforms (N) for which availability information is
|
||||
* available (which is unrelated to \c availability_size).
|
||||
*
|
||||
* Note that the client is responsible for calling
|
||||
* \c clang_disposeCXPlatformAvailability to free each of the
|
||||
* platform-availability structures returned. There are
|
||||
* Note that the client is responsible for calling
|
||||
* \c clang_disposeCXPlatformAvailability to free each of the
|
||||
* platform-availability structures returned. There are
|
||||
* \c min(N, availability_size) such structures.
|
||||
*/
|
||||
CINDEX_LINKAGE int
|
||||
@ -2875,7 +2875,7 @@ clang_getCursorPlatformAvailability(CXCursor cursor,
|
||||
*/
|
||||
CINDEX_LINKAGE void
|
||||
clang_disposeCXPlatformAvailability(CXPlatformAvailability *availability);
|
||||
|
||||
|
||||
/**
|
||||
* Describe the "language" of the entity referred to by a cursor.
|
||||
*/
|
||||
@ -2948,7 +2948,7 @@ CINDEX_LINKAGE unsigned clang_CXCursorSet_insert(CXCursorSet cset,
|
||||
*
|
||||
* The semantic parent of a cursor is the cursor that semantically contains
|
||||
* the given \p cursor. For many declarations, the lexical and semantic parents
|
||||
* are equivalent (the lexical parent is returned by
|
||||
* are equivalent (the lexical parent is returned by
|
||||
* \c clang_getCursorLexicalParent()). They diverge when declarations or
|
||||
* definitions are provided out-of-line. For example:
|
||||
*
|
||||
@ -2983,7 +2983,7 @@ CINDEX_LINKAGE CXCursor clang_getCursorSemanticParent(CXCursor cursor);
|
||||
*
|
||||
* The lexical parent of a cursor is the cursor in which the given \p cursor
|
||||
* was actually written. For many declarations, the lexical and semantic parents
|
||||
* are equivalent (the semantic parent is returned by
|
||||
* are equivalent (the semantic parent is returned by
|
||||
* \c clang_getCursorSemanticParent()). They diverge when declarations or
|
||||
* definitions are provided out-of-line. For example:
|
||||
*
|
||||
@ -3046,18 +3046,18 @@ CINDEX_LINKAGE CXCursor clang_getCursorLexicalParent(CXCursor cursor);
|
||||
* \param cursor A cursor representing an Objective-C or C++
|
||||
* method. This routine will compute the set of methods that this
|
||||
* method overrides.
|
||||
*
|
||||
*
|
||||
* \param overridden A pointer whose pointee will be replaced with a
|
||||
* pointer to an array of cursors, representing the set of overridden
|
||||
* methods. If there are no overridden methods, the pointee will be
|
||||
* set to NULL. The pointee must be freed via a call to
|
||||
* set to NULL. The pointee must be freed via a call to
|
||||
* \c clang_disposeOverriddenCursors().
|
||||
*
|
||||
* \param num_overridden A pointer to the number of overridden
|
||||
* functions, will be set to the number of overridden functions in the
|
||||
* array pointed to by \p overridden.
|
||||
*/
|
||||
CINDEX_LINKAGE void clang_getOverriddenCursors(CXCursor cursor,
|
||||
CINDEX_LINKAGE void clang_getOverriddenCursors(CXCursor cursor,
|
||||
CXCursor **overridden,
|
||||
unsigned *num_overridden);
|
||||
|
||||
@ -3072,7 +3072,7 @@ CINDEX_LINKAGE void clang_disposeOverriddenCursors(CXCursor *overridden);
|
||||
* cursor.
|
||||
*/
|
||||
CINDEX_LINKAGE CXFile clang_getIncludedFile(CXCursor cursor);
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@ -3133,7 +3133,7 @@ CINDEX_LINKAGE CXSourceRange clang_getCursorExtent(CXCursor);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \defgroup CINDEX_TYPES Type information for CXCursors
|
||||
*
|
||||
@ -3582,7 +3582,7 @@ CINDEX_LINKAGE CXString clang_getDeclObjCTypeEncoding(CXCursor C);
|
||||
/**
|
||||
* Returns the Objective-C type encoding for the specified CXType.
|
||||
*/
|
||||
CINDEX_LINKAGE CXString clang_Type_getObjCEncoding(CXType type);
|
||||
CINDEX_LINKAGE CXString clang_Type_getObjCEncoding(CXType type);
|
||||
|
||||
/**
|
||||
* Retrieve the spelling of a given CXTypeKind.
|
||||
@ -3842,7 +3842,7 @@ CINDEX_LINKAGE unsigned clang_Cursor_isBitField(CXCursor C);
|
||||
* CX_CXXBaseSpecifier is virtual.
|
||||
*/
|
||||
CINDEX_LINKAGE unsigned clang_isVirtualBase(CXCursor);
|
||||
|
||||
|
||||
/**
|
||||
* Represents the C++ access control level to a base class for a
|
||||
* cursor with kind CX_CXXBaseSpecifier.
|
||||
@ -3887,7 +3887,7 @@ enum CX_StorageClass {
|
||||
CINDEX_LINKAGE enum CX_StorageClass clang_Cursor_getStorageClass(CXCursor);
|
||||
|
||||
/**
|
||||
* Determine the number of overloaded declarations referenced by a
|
||||
* Determine the number of overloaded declarations referenced by a
|
||||
* \c CXCursor_OverloadedDeclRef cursor.
|
||||
*
|
||||
* \param cursor The cursor whose overloaded declarations are being queried.
|
||||
@ -3906,18 +3906,18 @@ CINDEX_LINKAGE unsigned clang_getNumOverloadedDecls(CXCursor cursor);
|
||||
* \param index The zero-based index into the set of overloaded declarations in
|
||||
* the cursor.
|
||||
*
|
||||
* \returns A cursor representing the declaration referenced by the given
|
||||
* \c cursor at the specified \c index. If the cursor does not have an
|
||||
* \returns A cursor representing the declaration referenced by the given
|
||||
* \c cursor at the specified \c index. If the cursor does not have an
|
||||
* associated set of overloaded declarations, or if the index is out of bounds,
|
||||
* returns \c clang_getNullCursor();
|
||||
*/
|
||||
CINDEX_LINKAGE CXCursor clang_getOverloadedDecl(CXCursor cursor,
|
||||
CINDEX_LINKAGE CXCursor clang_getOverloadedDecl(CXCursor cursor,
|
||||
unsigned index);
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \defgroup CINDEX_ATTRIBUTES Information for attributes
|
||||
*
|
||||
@ -4021,7 +4021,7 @@ CINDEX_LINKAGE unsigned clang_visitChildren(CXCursor parent,
|
||||
* The visitor should return one of the \c CXChildVisitResult values
|
||||
* to direct clang_visitChildrenWithBlock().
|
||||
*/
|
||||
typedef enum CXChildVisitResult
|
||||
typedef enum CXChildVisitResult
|
||||
(^CXCursorVisitorBlock)(CXCursor cursor, CXCursor parent);
|
||||
|
||||
/**
|
||||
@ -4109,10 +4109,10 @@ CINDEX_LINKAGE CXString clang_getCursorSpelling(CXCursor);
|
||||
* Most of the times there is only one range for the complete spelling but for
|
||||
* Objective-C methods and Objective-C message expressions, there are multiple
|
||||
* pieces for each selector identifier.
|
||||
*
|
||||
*
|
||||
* \param pieceIndex the index of the spelling name piece. If this is greater
|
||||
* than the actual number of pieces, it will return a NULL (invalid) range.
|
||||
*
|
||||
*
|
||||
* \param options Reserved.
|
||||
*/
|
||||
CINDEX_LINKAGE CXSourceRange clang_Cursor_getSpellingNameRange(CXCursor,
|
||||
@ -4206,11 +4206,11 @@ CINDEX_LINKAGE CXString clang_getCursorPrettyPrinted(CXCursor Cursor,
|
||||
* Retrieve the display name for the entity referenced by this cursor.
|
||||
*
|
||||
* The display name contains extra information that helps identify the cursor,
|
||||
* such as the parameters of a function or template or the arguments of a
|
||||
* such as the parameters of a function or template or the arguments of a
|
||||
* class template specialization.
|
||||
*/
|
||||
CINDEX_LINKAGE CXString clang_getCursorDisplayName(CXCursor);
|
||||
|
||||
|
||||
/** For a cursor that is a reference, retrieve a cursor representing the
|
||||
* entity that it references.
|
||||
*
|
||||
@ -4274,10 +4274,10 @@ CINDEX_LINKAGE unsigned clang_isCursorDefinition(CXCursor);
|
||||
* };
|
||||
* \endcode
|
||||
*
|
||||
* The declarations and the definition of \c X are represented by three
|
||||
* different cursors, all of which are declarations of the same underlying
|
||||
* The declarations and the definition of \c X are represented by three
|
||||
* different cursors, all of which are declarations of the same underlying
|
||||
* entity. One of these cursor is considered the "canonical" cursor, which
|
||||
* is effectively the representative for the underlying entity. One can
|
||||
* is effectively the representative for the underlying entity. One can
|
||||
* determine if two cursors are declarations of the same underlying entity by
|
||||
* comparing their canonical cursors.
|
||||
*
|
||||
@ -4301,11 +4301,11 @@ CINDEX_LINKAGE int clang_Cursor_getObjCSelectorIndex(CXCursor);
|
||||
/**
|
||||
* Given a cursor pointing to a C++ method call or an Objective-C
|
||||
* message, returns non-zero if the method/message is "dynamic", meaning:
|
||||
*
|
||||
*
|
||||
* For a C++ method: the call is virtual.
|
||||
* For an Objective-C message: the receiver is an object instance, not 'super'
|
||||
* or a specific class.
|
||||
*
|
||||
*
|
||||
* If the method/message is "static" or the cursor does not point to a
|
||||
* method/message, it will return zero.
|
||||
*/
|
||||
@ -4575,7 +4575,7 @@ CINDEX_LINKAGE unsigned clang_CXXMethod_isDefaulted(CXCursor C);
|
||||
CINDEX_LINKAGE unsigned clang_CXXMethod_isPureVirtual(CXCursor C);
|
||||
|
||||
/**
|
||||
* Determine if a C++ member function or member function template is
|
||||
* Determine if a C++ member function or member function template is
|
||||
* declared 'static'.
|
||||
*/
|
||||
CINDEX_LINKAGE unsigned clang_CXXMethod_isStatic(CXCursor C);
|
||||
@ -4622,16 +4622,16 @@ CINDEX_LINKAGE unsigned clang_CXXMethod_isConst(CXCursor C);
|
||||
* \c CXCursor_NoDeclFound.
|
||||
*/
|
||||
CINDEX_LINKAGE enum CXCursorKind clang_getTemplateCursorKind(CXCursor C);
|
||||
|
||||
|
||||
/**
|
||||
* Given a cursor that may represent a specialization or instantiation
|
||||
* of a template, retrieve the cursor that represents the template that it
|
||||
* specializes or from which it was instantiated.
|
||||
*
|
||||
* This routine determines the template involved both for explicit
|
||||
* This routine determines the template involved both for explicit
|
||||
* specializations of templates and for implicit instantiations of the template,
|
||||
* both of which are referred to as "specializations". For a class template
|
||||
* specialization (e.g., \c std::vector<bool>), this routine will return
|
||||
* specialization (e.g., \c std::vector<bool>), this routine will return
|
||||
* either the primary template (\c std::vector) or, if the specialization was
|
||||
* instantiated from a class template partial specialization, the class template
|
||||
* partial specialization. For a class template partial specialization and a
|
||||
@ -4639,7 +4639,7 @@ CINDEX_LINKAGE enum CXCursorKind clang_getTemplateCursorKind(CXCursor C);
|
||||
* this routine will return the specialized template.
|
||||
*
|
||||
* For members of a class template (e.g., member functions, member classes, or
|
||||
* static data members), returns the specialized or instantiated member.
|
||||
* static data members), returns the specialized or instantiated member.
|
||||
* Although not strictly "templates" in the C++ language, members of class
|
||||
* templates have the same notions of specializations and instantiations that
|
||||
* templates do, so this routine treats them similarly.
|
||||
@ -4647,7 +4647,7 @@ CINDEX_LINKAGE enum CXCursorKind clang_getTemplateCursorKind(CXCursor C);
|
||||
* \param C A cursor that may be a specialization of a template or a member
|
||||
* of a template.
|
||||
*
|
||||
* \returns If the given cursor is a specialization or instantiation of a
|
||||
* \returns If the given cursor is a specialization or instantiation of a
|
||||
* template or a member thereof, the template or member that it specializes or
|
||||
* from which it was instantiated. Otherwise, returns a NULL cursor.
|
||||
*/
|
||||
@ -4659,11 +4659,11 @@ CINDEX_LINKAGE CXCursor clang_getSpecializedCursorTemplate(CXCursor C);
|
||||
*
|
||||
* \param C A cursor pointing to a member reference, a declaration reference, or
|
||||
* an operator call.
|
||||
* \param NameFlags A bitset with three independent flags:
|
||||
* \param NameFlags A bitset with three independent flags:
|
||||
* CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and
|
||||
* CXNameRange_WantSinglePiece.
|
||||
* \param PieceIndex For contiguous names or when passing the flag
|
||||
* CXNameRange_WantSinglePiece, only one piece with index 0 is
|
||||
* \param PieceIndex For contiguous names or when passing the flag
|
||||
* CXNameRange_WantSinglePiece, only one piece with index 0 is
|
||||
* available. When the CXNameRange_WantSinglePiece flag is not passed for a
|
||||
* non-contiguous names, this index can be used to retrieve the individual
|
||||
* pieces of the name. See also CXNameRange_WantSinglePiece.
|
||||
@ -4672,7 +4672,7 @@ CINDEX_LINKAGE CXCursor clang_getSpecializedCursorTemplate(CXCursor C);
|
||||
* name, or if the PieceIndex is out-of-range, a null-cursor will be returned.
|
||||
*/
|
||||
CINDEX_LINKAGE CXSourceRange clang_getCursorReferenceNameRange(CXCursor C,
|
||||
unsigned NameFlags,
|
||||
unsigned NameFlags,
|
||||
unsigned PieceIndex);
|
||||
|
||||
enum CXNameRefFlags {
|
||||
@ -4681,7 +4681,7 @@ enum CXNameRefFlags {
|
||||
* range.
|
||||
*/
|
||||
CXNameRange_WantQualifier = 0x1,
|
||||
|
||||
|
||||
/**
|
||||
* Include the explicit template arguments, e.g. \<int> in x.f<int>,
|
||||
* in the range.
|
||||
@ -4700,7 +4700,7 @@ enum CXNameRefFlags {
|
||||
*/
|
||||
CXNameRange_WantSinglePiece = 0x4
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@ -5153,7 +5153,7 @@ clang_getNumCompletionChunks(CXCompletionString completion_string);
|
||||
/**
|
||||
* Determine the priority of this code completion.
|
||||
*
|
||||
* The priority of a code completion indicates how likely it is that this
|
||||
* The priority of a code completion indicates how likely it is that this
|
||||
* particular completion is the completion that the user will select. The
|
||||
* priority is selected by various internal heuristics.
|
||||
*
|
||||
@ -5164,7 +5164,7 @@ clang_getNumCompletionChunks(CXCompletionString completion_string);
|
||||
*/
|
||||
CINDEX_LINKAGE unsigned
|
||||
clang_getCompletionPriority(CXCompletionString completion_string);
|
||||
|
||||
|
||||
/**
|
||||
* Determine the availability of the entity that this code-completion
|
||||
* string refers to.
|
||||
@ -5173,7 +5173,7 @@ clang_getCompletionPriority(CXCompletionString completion_string);
|
||||
*
|
||||
* \returns The availability of the completion string.
|
||||
*/
|
||||
CINDEX_LINKAGE enum CXAvailabilityKind
|
||||
CINDEX_LINKAGE enum CXAvailabilityKind
|
||||
clang_getCompletionAvailability(CXCompletionString completion_string);
|
||||
|
||||
/**
|
||||
@ -5206,7 +5206,7 @@ clang_getCompletionAnnotation(CXCompletionString completion_string,
|
||||
/**
|
||||
* Retrieve the parent context of the given completion string.
|
||||
*
|
||||
* The parent context of a completion string is the semantic parent of
|
||||
* The parent context of a completion string is the semantic parent of
|
||||
* the declaration (if any) that the code completion represents. For example,
|
||||
* a code completion for an Objective-C method would have the method's class
|
||||
* or protocol as its context.
|
||||
@ -5241,7 +5241,7 @@ clang_getCompletionBriefComment(CXCompletionString completion_string);
|
||||
*/
|
||||
CINDEX_LINKAGE CXCompletionString
|
||||
clang_getCursorCompletionString(CXCursor cursor);
|
||||
|
||||
|
||||
/**
|
||||
* Contains the results of code-completion.
|
||||
*
|
||||
@ -5378,12 +5378,12 @@ enum CXCompletionContext {
|
||||
* should be included. (This is equivalent to having no context bits set.)
|
||||
*/
|
||||
CXCompletionContext_Unexposed = 0,
|
||||
|
||||
|
||||
/**
|
||||
* Completions for any possible type should be included in the results.
|
||||
*/
|
||||
CXCompletionContext_AnyType = 1 << 0,
|
||||
|
||||
|
||||
/**
|
||||
* Completions for any possible value (variables, function calls, etc.)
|
||||
* should be included in the results.
|
||||
@ -5404,7 +5404,7 @@ enum CXCompletionContext {
|
||||
* included in the results.
|
||||
*/
|
||||
CXCompletionContext_CXXClassTypeValue = 1 << 4,
|
||||
|
||||
|
||||
/**
|
||||
* Completions for fields of the member being accessed using the dot
|
||||
* operator should be included in the results.
|
||||
@ -5420,7 +5420,7 @@ enum CXCompletionContext {
|
||||
* using the dot operator should be included in the results.
|
||||
*/
|
||||
CXCompletionContext_ObjCPropertyAccess = 1 << 7,
|
||||
|
||||
|
||||
/**
|
||||
* Completions for enum tags should be included in the results.
|
||||
*/
|
||||
@ -5433,7 +5433,7 @@ enum CXCompletionContext {
|
||||
* Completions for struct tags should be included in the results.
|
||||
*/
|
||||
CXCompletionContext_StructTag = 1 << 10,
|
||||
|
||||
|
||||
/**
|
||||
* Completions for C++ class names should be included in the results.
|
||||
*/
|
||||
@ -5448,7 +5448,7 @@ enum CXCompletionContext {
|
||||
* the results.
|
||||
*/
|
||||
CXCompletionContext_NestedNameSpecifier = 1 << 13,
|
||||
|
||||
|
||||
/**
|
||||
* Completions for Objective-C interfaces (classes) should be included
|
||||
* in the results.
|
||||
@ -5479,27 +5479,27 @@ enum CXCompletionContext {
|
||||
* the results.
|
||||
*/
|
||||
CXCompletionContext_ObjCSelectorName = 1 << 19,
|
||||
|
||||
|
||||
/**
|
||||
* Completions for preprocessor macro names should be included in
|
||||
* the results.
|
||||
*/
|
||||
CXCompletionContext_MacroName = 1 << 20,
|
||||
|
||||
|
||||
/**
|
||||
* Natural language completions should be included in the results.
|
||||
*/
|
||||
CXCompletionContext_NaturalLanguage = 1 << 21,
|
||||
|
||||
|
||||
/**
|
||||
* The current context is unknown, so set all contexts.
|
||||
*/
|
||||
CXCompletionContext_Unknown = ((1 << 22) - 1)
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns a default set of code-completion options that can be
|
||||
* passed to\c clang_codeCompleteAt().
|
||||
* passed to\c clang_codeCompleteAt().
|
||||
*/
|
||||
CINDEX_LINKAGE unsigned clang_defaultCodeCompleteOptions(void);
|
||||
|
||||
@ -5562,7 +5562,7 @@ CINDEX_LINKAGE unsigned clang_defaultCodeCompleteOptions(void);
|
||||
*
|
||||
* \param options Extra options that control the behavior of code
|
||||
* completion, expressed as a bitwise OR of the enumerators of the
|
||||
* CXCodeComplete_Flags enumeration. The
|
||||
* CXCodeComplete_Flags enumeration. The
|
||||
* \c clang_defaultCodeCompleteOptions() function returns a default set
|
||||
* of code-completion options.
|
||||
*
|
||||
@ -5581,7 +5581,7 @@ CXCodeCompleteResults *clang_codeCompleteAt(CXTranslationUnit TU,
|
||||
unsigned options);
|
||||
|
||||
/**
|
||||
* Sort the code-completion results in case-insensitive alphabetical
|
||||
* Sort the code-completion results in case-insensitive alphabetical
|
||||
* order.
|
||||
*
|
||||
* \param Results The set of results to sort.
|
||||
@ -5590,13 +5590,13 @@ CXCodeCompleteResults *clang_codeCompleteAt(CXTranslationUnit TU,
|
||||
CINDEX_LINKAGE
|
||||
void clang_sortCodeCompletionResults(CXCompletionResult *Results,
|
||||
unsigned NumResults);
|
||||
|
||||
|
||||
/**
|
||||
* Free the given set of code-completion results.
|
||||
*/
|
||||
CINDEX_LINKAGE
|
||||
void clang_disposeCodeCompleteResults(CXCodeCompleteResults *Results);
|
||||
|
||||
|
||||
/**
|
||||
* Determine the number of diagnostics produced prior to the
|
||||
* location where code completion was performed.
|
||||
@ -5620,7 +5620,7 @@ CXDiagnostic clang_codeCompleteGetDiagnostic(CXCodeCompleteResults *Results,
|
||||
/**
|
||||
* Determines what completions are appropriate for the context
|
||||
* the given code completion.
|
||||
*
|
||||
*
|
||||
* \param Results the code completion results to query
|
||||
*
|
||||
* \returns the kinds of completions that are appropriate for use
|
||||
@ -5676,7 +5676,7 @@ CXString clang_codeCompleteGetContainerUSR(CXCodeCompleteResults *Results);
|
||||
*/
|
||||
CINDEX_LINKAGE
|
||||
CXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *Results);
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@ -5700,7 +5700,7 @@ CINDEX_LINKAGE CXString clang_getClangVersion(void);
|
||||
* value enables crash recovery, while 0 disables it.
|
||||
*/
|
||||
CINDEX_LINKAGE void clang_toggleCrashRecovery(unsigned isEnabled);
|
||||
|
||||
|
||||
/**
|
||||
* Visitor invoked for each file in a translation unit
|
||||
* (used with clang_getInclusions()).
|
||||
@ -5745,7 +5745,7 @@ typedef enum {
|
||||
typedef void * CXEvalResult;
|
||||
|
||||
/**
|
||||
* If cursor is a statement declaration tries to evaluate the
|
||||
* If cursor is a statement declaration tries to evaluate the
|
||||
* statement and if its variable, tries to evaluate its initializer,
|
||||
* into its corresponding type.
|
||||
*/
|
||||
@ -5844,7 +5844,7 @@ CINDEX_LINKAGE unsigned clang_remap_getNumFiles(CXRemapping);
|
||||
|
||||
/**
|
||||
* Get the original and the associated filename from the remapping.
|
||||
*
|
||||
*
|
||||
* \param original If non-NULL, will be set to the original filename.
|
||||
*
|
||||
* \param transformed If non-NULL, will be set to the filename that the original
|
||||
@ -5896,7 +5896,7 @@ typedef enum {
|
||||
|
||||
/**
|
||||
* Find references of a declaration in a specific file.
|
||||
*
|
||||
*
|
||||
* \param cursor pointing to a declaration or a reference of one.
|
||||
*
|
||||
* \param file to search for references.
|
||||
@ -6255,11 +6255,11 @@ typedef struct {
|
||||
const CXIdxEntityInfo *referencedEntity;
|
||||
/**
|
||||
* Immediate "parent" of the reference. For example:
|
||||
*
|
||||
*
|
||||
* \code
|
||||
* Foo *var;
|
||||
* \endcode
|
||||
*
|
||||
*
|
||||
* The parent of reference of type 'Foo' is the variable 'var'.
|
||||
* For references inside statement bodies of functions/methods,
|
||||
* the parentEntity will be the function/method.
|
||||
@ -6294,16 +6294,16 @@ typedef struct {
|
||||
|
||||
CXIdxClientFile (*enteredMainFile)(CXClientData client_data,
|
||||
CXFile mainFile, void *reserved);
|
||||
|
||||
|
||||
/**
|
||||
* Called when a file gets \#included/\#imported.
|
||||
*/
|
||||
CXIdxClientFile (*ppIncludedFile)(CXClientData client_data,
|
||||
const CXIdxIncludedFileInfo *);
|
||||
|
||||
|
||||
/**
|
||||
* Called when a AST file (PCH or module) gets imported.
|
||||
*
|
||||
*
|
||||
* AST files will not get indexed (there will not be callbacks to index all
|
||||
* the entities in an AST file). The recommended action is that, if the AST
|
||||
* file is not already indexed, to initiate a new indexing job specific to
|
||||
@ -6405,7 +6405,7 @@ typedef enum {
|
||||
* Used to indicate that no special indexing options are needed.
|
||||
*/
|
||||
CXIndexOpt_None = 0x0,
|
||||
|
||||
|
||||
/**
|
||||
* Used to indicate that IndexerCallbacks#indexEntityReference should
|
||||
* be invoked for only one reference of an entity per source file that does
|
||||
@ -6492,16 +6492,16 @@ CINDEX_LINKAGE int clang_indexSourceFileFullArgv(
|
||||
/**
|
||||
* Index the given translation unit via callbacks implemented through
|
||||
* #IndexerCallbacks.
|
||||
*
|
||||
*
|
||||
* The order of callback invocations is not guaranteed to be the same as
|
||||
* when indexing a source file. The high level order will be:
|
||||
*
|
||||
*
|
||||
* -Preprocessor callbacks invocations
|
||||
* -Declaration/reference callbacks invocations
|
||||
* -Diagnostic callback invocations
|
||||
*
|
||||
* The parameters are the same as #clang_indexSourceFile.
|
||||
*
|
||||
*
|
||||
* \returns If there is a failure from which there is no recovery, returns
|
||||
* non-zero, otherwise returns 0.
|
||||
*/
|
||||
|
@ -41,7 +41,7 @@ class FileRemapper {
|
||||
public:
|
||||
FileRemapper();
|
||||
~FileRemapper();
|
||||
|
||||
|
||||
bool initFromDisk(StringRef outputDir, DiagnosticsEngine &Diag,
|
||||
bool ignoreIfFilesChanged);
|
||||
bool initFromFile(StringRef filePath, DiagnosticsEngine &Diag,
|
||||
|
@ -226,6 +226,12 @@ class ASTContext : public RefCountedBase<ASTContext> {
|
||||
using TypeInfoMap = llvm::DenseMap<const Type *, struct TypeInfo>;
|
||||
mutable TypeInfoMap MemoizedTypeInfo;
|
||||
|
||||
/// A cache from types to unadjusted alignment information. Only ARM and
|
||||
/// AArch64 targets need this information, keeping it separate prevents
|
||||
/// imposing overhead on TypeInfo size.
|
||||
using UnadjustedAlignMap = llvm::DenseMap<const Type *, unsigned>;
|
||||
mutable UnadjustedAlignMap MemoizedUnadjustedAlign;
|
||||
|
||||
/// A cache mapping from CXXRecordDecls to key functions.
|
||||
llvm::DenseMap<const CXXRecordDecl*, LazyDeclPtr> KeyFunctions;
|
||||
|
||||
@ -1522,7 +1528,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
|
||||
/// The sizeof operator requires this (C99 6.5.3.4p4).
|
||||
CanQualType getSizeType() const;
|
||||
|
||||
/// Return the unique signed counterpart of
|
||||
/// Return the unique signed counterpart of
|
||||
/// the integer type corresponding to size_t.
|
||||
CanQualType getSignedSizeType() const;
|
||||
|
||||
@ -2067,6 +2073,16 @@ class ASTContext : public RefCountedBase<ASTContext> {
|
||||
unsigned getTypeAlign(QualType T) const { return getTypeInfo(T).Align; }
|
||||
unsigned getTypeAlign(const Type *T) const { return getTypeInfo(T).Align; }
|
||||
|
||||
/// Return the ABI-specified natural alignment of a (complete) type \p T,
|
||||
/// before alignment adjustments, in bits.
|
||||
///
|
||||
/// This alignment is curently used only by ARM and AArch64 when passing
|
||||
/// arguments of a composite type.
|
||||
unsigned getTypeUnadjustedAlign(QualType T) const {
|
||||
return getTypeUnadjustedAlign(T.getTypePtr());
|
||||
}
|
||||
unsigned getTypeUnadjustedAlign(const Type *T) const;
|
||||
|
||||
/// Return the ABI-specified alignment of a type, in bits, or 0 if
|
||||
/// the type is incomplete and we cannot determine the alignment (for
|
||||
/// example, from alignment attributes).
|
||||
@ -2077,6 +2093,12 @@ class ASTContext : public RefCountedBase<ASTContext> {
|
||||
CharUnits getTypeAlignInChars(QualType T) const;
|
||||
CharUnits getTypeAlignInChars(const Type *T) const;
|
||||
|
||||
/// getTypeUnadjustedAlignInChars - Return the ABI-specified alignment of a type,
|
||||
/// in characters, before alignment adjustments. This method does not work on
|
||||
/// incomplete types.
|
||||
CharUnits getTypeUnadjustedAlignInChars(QualType T) const;
|
||||
CharUnits getTypeUnadjustedAlignInChars(const Type *T) const;
|
||||
|
||||
// getTypeInfoDataSizeInChars - Return the size of a type, in chars. If the
|
||||
// type is a record, its data size is returned.
|
||||
std::pair<CharUnits, CharUnits> getTypeInfoDataSizeInChars(QualType T) const;
|
||||
|
@ -23,11 +23,11 @@ namespace clang {
|
||||
NUM_BUILTIN_AST_DIAGNOSTICS
|
||||
};
|
||||
} // end namespace diag
|
||||
|
||||
|
||||
/// DiagnosticsEngine argument formatting function for diagnostics that
|
||||
/// involve AST nodes.
|
||||
///
|
||||
/// This function formats diagnostic arguments for various AST nodes,
|
||||
/// This function formats diagnostic arguments for various AST nodes,
|
||||
/// including types, declaration names, nested name specifiers, and
|
||||
/// declaration contexts, into strings that can be printed as part of
|
||||
/// diagnostics. It is meant to be used as the argument to
|
||||
|
@ -63,7 +63,7 @@ class Attr;
|
||||
private:
|
||||
/// The contexts we're importing to and from.
|
||||
ASTContext &ToContext, &FromContext;
|
||||
|
||||
|
||||
/// The file managers we're importing to and from.
|
||||
FileManager &ToFileManager, &FromFileManager;
|
||||
|
||||
@ -72,11 +72,11 @@ class Attr;
|
||||
|
||||
/// Whether the last diagnostic came from the "from" context.
|
||||
bool LastDiagFromFrom = false;
|
||||
|
||||
|
||||
/// Mapping from the already-imported types in the "from" context
|
||||
/// to the corresponding types in the "to" context.
|
||||
llvm::DenseMap<const Type *, const Type *> ImportedTypes;
|
||||
|
||||
|
||||
/// Mapping from the already-imported declarations in the "from"
|
||||
/// context to the corresponding declarations in the "to" context.
|
||||
llvm::DenseMap<Decl *, Decl *> ImportedDecls;
|
||||
@ -93,11 +93,11 @@ class Attr;
|
||||
/// the "from" source manager to the corresponding CXXBasesSpecifier
|
||||
/// in the "to" source manager.
|
||||
ImportedCXXBaseSpecifierMap ImportedCXXBaseSpecifiers;
|
||||
|
||||
|
||||
/// Declaration (from, to) pairs that are known not to be equivalent
|
||||
/// (which we have already complained about).
|
||||
NonEquivalentDeclSet NonEquivalentDecls;
|
||||
|
||||
|
||||
public:
|
||||
/// Create a new AST importer.
|
||||
///
|
||||
@ -115,13 +115,13 @@ class Attr;
|
||||
ASTImporter(ASTContext &ToContext, FileManager &ToFileManager,
|
||||
ASTContext &FromContext, FileManager &FromFileManager,
|
||||
bool MinimalImport);
|
||||
|
||||
|
||||
virtual ~ASTImporter();
|
||||
|
||||
|
||||
/// Whether the importer will perform a minimal import, creating
|
||||
/// to-be-completed forward declarations when possible.
|
||||
bool isMinimalImport() const { return Minimal; }
|
||||
|
||||
|
||||
/// Import the given type from the "from" context into the "to"
|
||||
/// context.
|
||||
///
|
||||
@ -142,10 +142,10 @@ class Attr;
|
||||
/// \returns the equivalent attribute in the "to" context.
|
||||
Attr *Import(const Attr *FromAttr);
|
||||
|
||||
/// Import the given declaration from the "from" context into the
|
||||
/// Import the given declaration from the "from" context into the
|
||||
/// "to" context.
|
||||
///
|
||||
/// \returns the equivalent declaration in the "to" context, or a NULL type
|
||||
/// \returns the equivalent declaration in the "to" context, or a NULL type
|
||||
/// if an error occurred.
|
||||
Decl *Import(Decl *FromD);
|
||||
Decl *Import(const Decl *FromD) {
|
||||
@ -163,7 +163,7 @@ class Attr;
|
||||
/// \returns the equivalent declaration context in the "to"
|
||||
/// context, or a NULL type if an error occurred.
|
||||
DeclContext *ImportContext(DeclContext *FromDC);
|
||||
|
||||
|
||||
/// Import the given expression from the "from" context into the
|
||||
/// "to" context.
|
||||
///
|
||||
@ -195,7 +195,7 @@ class Attr;
|
||||
/// Import the goven template name from the "from" context into the
|
||||
/// "to" context.
|
||||
TemplateName Import(TemplateName From);
|
||||
|
||||
|
||||
/// Import the given source location from the "from" context into
|
||||
/// the "to" context.
|
||||
///
|
||||
@ -229,7 +229,7 @@ class Attr;
|
||||
/// \returns the equivalent selector in the "to" context.
|
||||
Selector Import(Selector FromSel);
|
||||
|
||||
/// Import the given file ID from the "from" context into the
|
||||
/// Import the given file ID from the "from" context into the
|
||||
/// "to" context.
|
||||
///
|
||||
/// \returns the equivalent file ID in the source manager of the "to"
|
||||
@ -252,13 +252,13 @@ class Attr;
|
||||
/// Import the definition of the given declaration, including all of
|
||||
/// the declarations it contains.
|
||||
///
|
||||
/// This routine is intended to be used
|
||||
/// This routine is intended to be used
|
||||
void ImportDefinition(Decl *From);
|
||||
|
||||
/// Cope with a name conflict when importing a declaration into the
|
||||
/// given context.
|
||||
///
|
||||
/// This routine is invoked whenever there is a name conflict while
|
||||
/// This routine is invoked whenever there is a name conflict while
|
||||
/// importing a declaration. The returned name will become the name of the
|
||||
/// imported declaration. By default, the returned name is the same as the
|
||||
/// original name, leaving the conflict unresolve such that name lookup
|
||||
@ -270,7 +270,7 @@ class Attr;
|
||||
/// \param Name the name of the declaration being imported, which conflicts
|
||||
/// with other declarations.
|
||||
///
|
||||
/// \param DC the declaration context (in the "to" AST context) in which
|
||||
/// \param DC the declaration context (in the "to" AST context) in which
|
||||
/// the name is being imported.
|
||||
///
|
||||
/// \param IDNS the identifier namespace in which the name will be found.
|
||||
@ -286,25 +286,25 @@ class Attr;
|
||||
unsigned IDNS,
|
||||
NamedDecl **Decls,
|
||||
unsigned NumDecls);
|
||||
|
||||
|
||||
/// Retrieve the context that AST nodes are being imported into.
|
||||
ASTContext &getToContext() const { return ToContext; }
|
||||
|
||||
|
||||
/// Retrieve the context that AST nodes are being imported from.
|
||||
ASTContext &getFromContext() const { return FromContext; }
|
||||
|
||||
|
||||
/// Retrieve the file manager that AST nodes are being imported into.
|
||||
FileManager &getToFileManager() const { return ToFileManager; }
|
||||
|
||||
/// Retrieve the file manager that AST nodes are being imported from.
|
||||
FileManager &getFromFileManager() const { return FromFileManager; }
|
||||
|
||||
|
||||
/// Report a diagnostic in the "to" context.
|
||||
DiagnosticBuilder ToDiag(SourceLocation Loc, unsigned DiagID);
|
||||
|
||||
|
||||
/// Report a diagnostic in the "from" context.
|
||||
DiagnosticBuilder FromDiag(SourceLocation Loc, unsigned DiagID);
|
||||
|
||||
|
||||
/// Return the set of declarations that we know are not equivalent.
|
||||
NonEquivalentDeclSet &getNonEquivalentDecls() { return NonEquivalentDecls; }
|
||||
|
||||
@ -313,7 +313,7 @@ class Attr;
|
||||
///
|
||||
/// \param D A declaration in the "to" context.
|
||||
virtual void CompleteDecl(Decl* D);
|
||||
|
||||
|
||||
/// Subclasses can override this function to observe all of the \c From ->
|
||||
/// \c To declaration mappings as they are imported.
|
||||
virtual Decl *Imported(Decl *From, Decl *To) { return To; }
|
||||
@ -328,7 +328,7 @@ class Attr;
|
||||
/// RecordDecl can be found, we can complete it without the need for
|
||||
/// importation, eliminating this loop.
|
||||
virtual Decl *GetOriginalDecl(Decl *To) { return nullptr; }
|
||||
|
||||
|
||||
/// Determine whether the given types are structurally
|
||||
/// equivalent.
|
||||
bool IsStructurallyEquivalent(QualType From, QualType To,
|
||||
|
@ -40,7 +40,7 @@ inline bool isGenericLambdaCallOperatorSpecialization(const CXXMethodDecl *MD) {
|
||||
if (!MD) return false;
|
||||
const CXXRecordDecl *LambdaClass = MD->getParent();
|
||||
if (LambdaClass && LambdaClass->isGenericLambda())
|
||||
return isLambdaCallOperator(MD) &&
|
||||
return isLambdaCallOperator(MD) &&
|
||||
MD->isFunctionTemplateSpecialization();
|
||||
return false;
|
||||
}
|
||||
@ -51,11 +51,11 @@ inline bool isLambdaConversionOperator(CXXConversionDecl *C) {
|
||||
|
||||
inline bool isLambdaConversionOperator(Decl *D) {
|
||||
if (!D) return false;
|
||||
if (CXXConversionDecl *Conv = dyn_cast<CXXConversionDecl>(D))
|
||||
return isLambdaConversionOperator(Conv);
|
||||
if (FunctionTemplateDecl *F = dyn_cast<FunctionTemplateDecl>(D))
|
||||
if (CXXConversionDecl *Conv =
|
||||
dyn_cast_or_null<CXXConversionDecl>(F->getTemplatedDecl()))
|
||||
if (CXXConversionDecl *Conv = dyn_cast<CXXConversionDecl>(D))
|
||||
return isLambdaConversionOperator(Conv);
|
||||
if (FunctionTemplateDecl *F = dyn_cast<FunctionTemplateDecl>(D))
|
||||
if (CXXConversionDecl *Conv =
|
||||
dyn_cast_or_null<CXXConversionDecl>(F->getTemplatedDecl()))
|
||||
return isLambdaConversionOperator(Conv);
|
||||
return false;
|
||||
}
|
||||
@ -71,7 +71,7 @@ inline bool isGenericLambdaCallOperatorSpecialization(DeclContext *DC) {
|
||||
inline DeclContext *getLambdaAwareParentOfDeclContext(DeclContext *DC) {
|
||||
if (isLambdaCallOperator(DC))
|
||||
return DC->getParent()->getParent();
|
||||
else
|
||||
else
|
||||
return DC->getParent();
|
||||
}
|
||||
|
||||
|
@ -134,13 +134,13 @@ class ASTMutationListener {
|
||||
/// \param M The containing module in which the definition was made visible,
|
||||
/// if any.
|
||||
virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) {}
|
||||
|
||||
|
||||
/// An attribute was added to a RecordDecl
|
||||
///
|
||||
/// \param Attr The attribute that was added to the Record
|
||||
///
|
||||
/// \param Record The RecordDecl that got a new attribute
|
||||
virtual void AddedAttributeToRecord(const Attr *Attr,
|
||||
virtual void AddedAttributeToRecord(const Attr *Attr,
|
||||
const RecordDecl *Record) {}
|
||||
|
||||
// NOTE: If new methods are added they should also be added to
|
||||
|
@ -86,7 +86,7 @@ class Attr {
|
||||
attr::Kind getKind() const {
|
||||
return static_cast<attr::Kind>(AttrKind);
|
||||
}
|
||||
|
||||
|
||||
unsigned getSpellingListIndex() const { return SpellingListIndex; }
|
||||
const char *getSpelling() const;
|
||||
|
||||
|
@ -106,7 +106,7 @@ class specific_attr_iterator {
|
||||
specific_attr_iterator Right) {
|
||||
assert((Left.Current == nullptr) == (Right.Current == nullptr));
|
||||
if (Left.Current < Right.Current)
|
||||
Left.AdvanceToNext(Right.Current);
|
||||
Left.AdvanceToNext(Right.Current);
|
||||
else
|
||||
Right.AdvanceToNext(Left.Current);
|
||||
return Left.Current == Right.Current;
|
||||
|
@ -24,21 +24,21 @@ namespace clang {
|
||||
|
||||
class CXXRecordDecl;
|
||||
|
||||
// BaseSubobject - Uniquely identifies a direct or indirect base class.
|
||||
// BaseSubobject - Uniquely identifies a direct or indirect base class.
|
||||
// Stores both the base class decl and the offset from the most derived class to
|
||||
// the base class. Used for vtable and VTT generation.
|
||||
class BaseSubobject {
|
||||
/// Base - The base class declaration.
|
||||
const CXXRecordDecl *Base;
|
||||
|
||||
|
||||
/// BaseOffset - The offset from the most derived class to the base class.
|
||||
CharUnits BaseOffset;
|
||||
|
||||
|
||||
public:
|
||||
BaseSubobject() = default;
|
||||
BaseSubobject(const CXXRecordDecl *Base, CharUnits BaseOffset)
|
||||
: Base(Base), BaseOffset(BaseOffset) {}
|
||||
|
||||
|
||||
/// getBase - Returns the base class declaration.
|
||||
const CXXRecordDecl *getBase() const { return Base; }
|
||||
|
||||
@ -74,7 +74,7 @@ template<> struct DenseMapInfo<clang::BaseSubobject> {
|
||||
Base.getBaseOffset()));
|
||||
}
|
||||
|
||||
static bool isEqual(const clang::BaseSubobject &LHS,
|
||||
static bool isEqual(const clang::BaseSubobject &LHS,
|
||||
const clang::BaseSubobject &RHS) {
|
||||
return LHS == RHS;
|
||||
}
|
||||
|
@ -34,10 +34,10 @@ namespace clang {
|
||||
|
||||
class ASTContext;
|
||||
class NamedDecl;
|
||||
|
||||
|
||||
/// Represents an element in a path from a derived class to a
|
||||
/// base class.
|
||||
///
|
||||
/// base class.
|
||||
///
|
||||
/// Each step in the path references the link from a
|
||||
/// derived class to one of its direct base classes, along with a
|
||||
/// base "number" that identifies which base subobject of the
|
||||
@ -47,12 +47,12 @@ struct CXXBasePathElement {
|
||||
/// class to a base class, which will be followed by this base
|
||||
/// path element.
|
||||
const CXXBaseSpecifier *Base;
|
||||
|
||||
|
||||
/// The record decl of the class that the base is a base of.
|
||||
const CXXRecordDecl *Class;
|
||||
|
||||
|
||||
/// Identifies which base class subobject (of type
|
||||
/// \c Base->getType()) this base path element refers to.
|
||||
/// \c Base->getType()) this base path element refers to.
|
||||
///
|
||||
/// This value is only valid if \c !Base->isVirtual(), because there
|
||||
/// is no base numbering for the zero or one virtual bases of a
|
||||
@ -64,7 +64,7 @@ struct CXXBasePathElement {
|
||||
/// (which is not represented as part of the path) to a particular
|
||||
/// (direct or indirect) base class subobject.
|
||||
///
|
||||
/// Individual elements in the path are described by the \c CXXBasePathElement
|
||||
/// Individual elements in the path are described by the \c CXXBasePathElement
|
||||
/// structure, which captures both the link from a derived class to one of its
|
||||
/// direct bases and identification describing which base class
|
||||
/// subobject is being used.
|
||||
@ -121,7 +121,7 @@ class CXXBasePaths {
|
||||
|
||||
/// The type from which this search originated.
|
||||
CXXRecordDecl *Origin = nullptr;
|
||||
|
||||
|
||||
/// Paths - The actual set of paths that can be taken from the
|
||||
/// derived class to the same base class.
|
||||
std::list<CXXBasePath> Paths;
|
||||
@ -160,12 +160,12 @@ class CXXBasePaths {
|
||||
/// ambiguous paths while it is looking for a path from a derived
|
||||
/// type to a base type.
|
||||
bool FindAmbiguities;
|
||||
|
||||
|
||||
/// RecordPaths - Whether Sema::IsDerivedFrom should record paths
|
||||
/// while it is determining whether there are paths from a derived
|
||||
/// type to a base type.
|
||||
bool RecordPaths;
|
||||
|
||||
|
||||
/// DetectVirtual - Whether Sema::IsDerivedFrom should abort the search
|
||||
/// if it finds a path that goes across a virtual base. The virtual class
|
||||
/// is also recorded.
|
||||
@ -181,7 +181,7 @@ class CXXBasePaths {
|
||||
using paths_iterator = std::list<CXXBasePath>::iterator;
|
||||
using const_paths_iterator = std::list<CXXBasePath>::const_iterator;
|
||||
using decl_iterator = NamedDecl **;
|
||||
|
||||
|
||||
/// BasePaths - Construct a new BasePaths structure to record the
|
||||
/// paths for a derived-to-base search.
|
||||
explicit CXXBasePaths(bool FindAmbiguities = true, bool RecordPaths = true,
|
||||
@ -193,31 +193,31 @@ class CXXBasePaths {
|
||||
paths_iterator end() { return Paths.end(); }
|
||||
const_paths_iterator begin() const { return Paths.begin(); }
|
||||
const_paths_iterator end() const { return Paths.end(); }
|
||||
|
||||
|
||||
CXXBasePath& front() { return Paths.front(); }
|
||||
const CXXBasePath& front() const { return Paths.front(); }
|
||||
|
||||
|
||||
using decl_range = llvm::iterator_range<decl_iterator>;
|
||||
|
||||
decl_range found_decls();
|
||||
|
||||
|
||||
/// Determine whether the path from the most-derived type to the
|
||||
/// given base type is ambiguous (i.e., it refers to multiple subobjects of
|
||||
/// the same base type).
|
||||
bool isAmbiguous(CanQualType BaseType);
|
||||
|
||||
|
||||
/// Whether we are finding multiple paths to detect ambiguities.
|
||||
bool isFindingAmbiguities() const { return FindAmbiguities; }
|
||||
|
||||
|
||||
/// Whether we are recording paths.
|
||||
bool isRecordingPaths() const { return RecordPaths; }
|
||||
|
||||
|
||||
/// Specify whether we should be recording paths or not.
|
||||
void setRecordingPaths(bool RP) { RecordPaths = RP; }
|
||||
|
||||
|
||||
/// Whether we are detecting virtual bases.
|
||||
bool isDetectingVirtual() const { return DetectVirtual; }
|
||||
|
||||
|
||||
/// The virtual base discovered on the path (if we are merely
|
||||
/// detecting virtuals).
|
||||
const RecordType* getDetectedVirtual() const {
|
||||
@ -228,11 +228,11 @@ class CXXBasePaths {
|
||||
/// began
|
||||
CXXRecordDecl *getOrigin() const { return Origin; }
|
||||
void setOrigin(CXXRecordDecl *Rec) { Origin = Rec; }
|
||||
|
||||
|
||||
/// Clear the base-paths results.
|
||||
void clear();
|
||||
|
||||
/// Swap this data structure's contents with another CXXBasePaths
|
||||
|
||||
/// Swap this data structure's contents with another CXXBasePaths
|
||||
/// object.
|
||||
void swap(CXXBasePaths &Other);
|
||||
};
|
||||
|
@ -85,8 +85,8 @@ class CanQual {
|
||||
|
||||
/// Retrieve the underlying type pointer, which refers to a
|
||||
/// canonical type, or nullptr.
|
||||
const T *getTypePtrOrNull() const {
|
||||
return cast_or_null<T>(Stored.getTypePtrOrNull());
|
||||
const T *getTypePtrOrNull() const {
|
||||
return cast_or_null<T>(Stored.getTypePtrOrNull());
|
||||
}
|
||||
|
||||
/// Implicit conversion to a qualified type.
|
||||
@ -94,7 +94,7 @@ class CanQual {
|
||||
|
||||
/// Implicit conversion to bool.
|
||||
explicit operator bool() const { return !isNull(); }
|
||||
|
||||
|
||||
bool isNull() const {
|
||||
return Stored.isNull();
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ namespace clang {
|
||||
|
||||
/// fromQuantity - Construct a CharUnits quantity from a raw integer type.
|
||||
static CharUnits fromQuantity(QuantityType Quantity) {
|
||||
return CharUnits(Quantity);
|
||||
return CharUnits(Quantity);
|
||||
}
|
||||
|
||||
// Compound assignment.
|
||||
@ -87,7 +87,7 @@ namespace clang {
|
||||
CharUnits operator-- (int) {
|
||||
return CharUnits(Quantity--);
|
||||
}
|
||||
|
||||
|
||||
// Comparison operators.
|
||||
bool operator== (const CharUnits &Other) const {
|
||||
return Quantity == Other.Quantity;
|
||||
@ -97,21 +97,21 @@ namespace clang {
|
||||
}
|
||||
|
||||
// Relational operators.
|
||||
bool operator< (const CharUnits &Other) const {
|
||||
return Quantity < Other.Quantity;
|
||||
bool operator< (const CharUnits &Other) const {
|
||||
return Quantity < Other.Quantity;
|
||||
}
|
||||
bool operator<= (const CharUnits &Other) const {
|
||||
bool operator<= (const CharUnits &Other) const {
|
||||
return Quantity <= Other.Quantity;
|
||||
}
|
||||
bool operator> (const CharUnits &Other) const {
|
||||
return Quantity > Other.Quantity;
|
||||
bool operator> (const CharUnits &Other) const {
|
||||
return Quantity > Other.Quantity;
|
||||
}
|
||||
bool operator>= (const CharUnits &Other) const {
|
||||
return Quantity >= Other.Quantity;
|
||||
bool operator>= (const CharUnits &Other) const {
|
||||
return Quantity >= Other.Quantity;
|
||||
}
|
||||
|
||||
// Other predicates.
|
||||
|
||||
|
||||
/// isZero - Test whether the quantity equals zero.
|
||||
bool isZero() const { return Quantity == 0; }
|
||||
|
||||
@ -172,7 +172,7 @@ namespace clang {
|
||||
return CharUnits(-Quantity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Conversions.
|
||||
|
||||
/// getQuantity - Get the raw integer representation of this quantity.
|
||||
@ -205,7 +205,7 @@ namespace clang {
|
||||
}; // class CharUnit
|
||||
} // namespace clang
|
||||
|
||||
inline clang::CharUnits operator* (clang::CharUnits::QuantityType Scale,
|
||||
inline clang::CharUnits operator* (clang::CharUnits::QuantityType Scale,
|
||||
const clang::CharUnits &CU) {
|
||||
return CU * Scale;
|
||||
}
|
||||
@ -223,8 +223,8 @@ template<> struct DenseMapInfo<clang::CharUnits> {
|
||||
static clang::CharUnits getTombstoneKey() {
|
||||
clang::CharUnits::QuantityType Quantity =
|
||||
DenseMapInfo<clang::CharUnits::QuantityType>::getTombstoneKey();
|
||||
|
||||
return clang::CharUnits::fromQuantity(Quantity);
|
||||
|
||||
return clang::CharUnits::fromQuantity(Quantity);
|
||||
}
|
||||
|
||||
static unsigned getHashValue(const clang::CharUnits &CU) {
|
||||
@ -232,7 +232,7 @@ template<> struct DenseMapInfo<clang::CharUnits> {
|
||||
return DenseMapInfo<clang::CharUnits::QuantityType>::getHashValue(Quantity);
|
||||
}
|
||||
|
||||
static bool isEqual(const clang::CharUnits &LHS,
|
||||
static bool isEqual(const clang::CharUnits &LHS,
|
||||
const clang::CharUnits &RHS) {
|
||||
return LHS == RHS;
|
||||
}
|
||||
@ -241,7 +241,7 @@ template<> struct DenseMapInfo<clang::CharUnits> {
|
||||
template <> struct isPodLike<clang::CharUnits> {
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_CLANG_AST_CHARUNITS_H
|
||||
|
@ -98,7 +98,7 @@ class Comment {
|
||||
unsigned RenderKind : 2;
|
||||
unsigned CommandID : CommandInfo::NumCommandIDBits;
|
||||
};
|
||||
enum { NumInlineCommandCommentBits = NumInlineContentCommentBits + 2 +
|
||||
enum { NumInlineCommandCommentBits = NumInlineContentCommentBits + 2 +
|
||||
CommandInfo::NumCommandIDBits };
|
||||
|
||||
class HTMLTagCommentBitfields {
|
||||
@ -146,7 +146,7 @@ class Comment {
|
||||
/// Contains values from CommandMarkerKind enum.
|
||||
unsigned CommandMarker : 1;
|
||||
};
|
||||
enum { NumBlockCommandCommentBits = NumCommentBits +
|
||||
enum { NumBlockCommandCommentBits = NumCommentBits +
|
||||
CommandInfo::NumCommandIDBits + 1 };
|
||||
|
||||
class ParamCommandCommentBitfields {
|
||||
@ -987,7 +987,7 @@ struct DeclInfo {
|
||||
/// Declaration the comment is actually attached to (in the source).
|
||||
/// Should not be NULL.
|
||||
const Decl *CommentDecl;
|
||||
|
||||
|
||||
/// CurrentDecl is the declaration with which the FullComment is associated.
|
||||
///
|
||||
/// It can be different from \c CommentDecl. It happens when we decide
|
||||
@ -997,7 +997,7 @@ struct DeclInfo {
|
||||
///
|
||||
/// The information in the DeclInfo corresponds to CurrentDecl.
|
||||
const Decl *CurrentDecl;
|
||||
|
||||
|
||||
/// Parameters that can be referenced by \\param if \c CommentDecl is something
|
||||
/// that we consider a "function".
|
||||
ArrayRef<const ParmVarDecl *> ParamVars;
|
||||
@ -1119,21 +1119,21 @@ class FullComment : public Comment {
|
||||
}
|
||||
|
||||
child_iterator child_end() const {
|
||||
return reinterpret_cast<child_iterator>(Blocks.end());
|
||||
return reinterpret_cast<child_iterator>(Blocks.end());
|
||||
}
|
||||
|
||||
const Decl *getDecl() const LLVM_READONLY {
|
||||
return ThisDeclInfo->CommentDecl;
|
||||
}
|
||||
|
||||
|
||||
const DeclInfo *getDeclInfo() const LLVM_READONLY {
|
||||
if (!ThisDeclInfo->IsFilled)
|
||||
ThisDeclInfo->fill();
|
||||
return ThisDeclInfo;
|
||||
}
|
||||
|
||||
|
||||
ArrayRef<BlockContentComment *> getBlocks() const { return Blocks; }
|
||||
|
||||
|
||||
};
|
||||
} // end namespace comments
|
||||
} // end namespace clang
|
||||
|
@ -107,17 +107,17 @@ struct CommandInfo {
|
||||
/// \fn void f(int a);
|
||||
/// \endcode
|
||||
unsigned IsDeclarationCommand : 1;
|
||||
|
||||
|
||||
/// True if verbatim-like line command is a function declaration.
|
||||
unsigned IsFunctionDeclarationCommand : 1;
|
||||
|
||||
/// True if block command is further describing a container API; such
|
||||
/// as \@coclass, \@classdesign, etc.
|
||||
unsigned IsRecordLikeDetailCommand : 1;
|
||||
|
||||
|
||||
/// True if block command is a container API; such as \@interface.
|
||||
unsigned IsRecordLikeDeclarationCommand : 1;
|
||||
|
||||
|
||||
/// True if this command is unknown. This \c CommandInfo object was
|
||||
/// created during parsing.
|
||||
unsigned IsUnknownCommand : 1;
|
||||
@ -150,7 +150,7 @@ class CommandTraits {
|
||||
}
|
||||
|
||||
const CommandInfo *getTypoCorrectCommandInfo(StringRef Typo) const;
|
||||
|
||||
|
||||
const CommandInfo *getCommandInfo(unsigned CommandID) const;
|
||||
|
||||
const CommandInfo *registerUnknownCommand(StringRef CommandName);
|
||||
|
@ -76,7 +76,7 @@ class Token {
|
||||
/// unused (command spelling can be found with CommandTraits). Otherwise,
|
||||
/// contains the length of the string that starts at TextPtr.
|
||||
unsigned IntVal;
|
||||
|
||||
|
||||
public:
|
||||
SourceLocation getLocation() const LLVM_READONLY { return Loc; }
|
||||
void setLocation(SourceLocation SL) { Loc = SL; }
|
||||
@ -228,7 +228,7 @@ class Lexer {
|
||||
llvm::BumpPtrAllocator &Allocator;
|
||||
|
||||
DiagnosticsEngine &Diags;
|
||||
|
||||
|
||||
const CommandTraits &Traits;
|
||||
|
||||
const char *const BufferStart;
|
||||
|
@ -191,11 +191,11 @@ class Sema {
|
||||
void checkBlockCommandDuplicate(const BlockCommandComment *Command);
|
||||
|
||||
void checkDeprecatedCommand(const BlockCommandComment *Comment);
|
||||
|
||||
|
||||
void checkFunctionDeclVerbatimLine(const BlockCommandComment *Comment);
|
||||
|
||||
|
||||
void checkContainerDeclVerbatimLine(const BlockCommandComment *Comment);
|
||||
|
||||
|
||||
void checkContainerDecl(const BlockCommandComment *Comment);
|
||||
|
||||
/// Resolve parameter names to parameter indexes in function declaration.
|
||||
|
@ -98,7 +98,7 @@ class alignas(8) TypeSourceInfo {
|
||||
|
||||
/// Return the TypeLoc wrapper for the type source info.
|
||||
TypeLoc getTypeLoc() const; // implemented in TypeLoc.h
|
||||
|
||||
|
||||
/// Override the type stored in this TypeSourceInfo. Use with caution!
|
||||
void overrideType(QualType T) { Ty = T; }
|
||||
};
|
||||
@ -488,7 +488,7 @@ class LabelDecl : public NamedDecl {
|
||||
SourceLocation IdentL, IdentifierInfo *II,
|
||||
SourceLocation GnuLabelL);
|
||||
static LabelDecl *CreateDeserialized(ASTContext &C, unsigned ID);
|
||||
|
||||
|
||||
LabelStmt *getStmt() const { return TheStmt; }
|
||||
void setStmt(LabelStmt *T) { TheStmt = T; }
|
||||
|
||||
@ -511,8 +511,8 @@ class LabelDecl : public NamedDecl {
|
||||
};
|
||||
|
||||
/// Represent a C++ namespace.
|
||||
class NamespaceDecl : public NamedDecl, public DeclContext,
|
||||
public Redeclarable<NamespaceDecl>
|
||||
class NamespaceDecl : public NamedDecl, public DeclContext,
|
||||
public Redeclarable<NamespaceDecl>
|
||||
{
|
||||
/// The starting location of the source range, pointing
|
||||
/// to either the namespace or the inline keyword.
|
||||
@ -523,7 +523,7 @@ class NamespaceDecl : public NamedDecl, public DeclContext,
|
||||
|
||||
/// A pointer to either the anonymous namespace that lives just inside
|
||||
/// this namespace or to the first namespace in the chain (the latter case
|
||||
/// only when this is not the first in the chain), along with a
|
||||
/// only when this is not the first in the chain), along with a
|
||||
/// boolean value indicating whether this is an inline namespace.
|
||||
llvm::PointerIntPair<NamespaceDecl *, 1, bool> AnonOrFirstNamespaceAndInline;
|
||||
|
||||
@ -1931,7 +1931,7 @@ class FunctionDecl : public DeclaratorDecl, public DeclContext,
|
||||
bool isConstexprSpecified = false);
|
||||
|
||||
static FunctionDecl *CreateDeserialized(ASTContext &C, unsigned ID);
|
||||
|
||||
|
||||
DeclarationNameInfo getNameInfo() const {
|
||||
return DeclarationNameInfo(getDeclName(), getLocation(), DNLoc);
|
||||
}
|
||||
@ -2598,7 +2598,7 @@ class FieldDecl : public DeclaratorDecl, public Mergeable<FieldDecl> {
|
||||
InClassInitStyle InitStyle);
|
||||
|
||||
static FieldDecl *CreateDeserialized(ASTContext &C, unsigned ID);
|
||||
|
||||
|
||||
/// Returns the index of this field within its record,
|
||||
/// as appropriate for passing to ASTRecordLayout::getFieldOffset.
|
||||
unsigned getFieldIndex() const;
|
||||
@ -2754,7 +2754,7 @@ class EnumConstantDecl : public ValueDecl, public Mergeable<EnumConstantDecl> {
|
||||
QualType T, Expr *E,
|
||||
const llvm::APSInt &V);
|
||||
static EnumConstantDecl *CreateDeserialized(ASTContext &C, unsigned ID);
|
||||
|
||||
|
||||
const Expr *getInitExpr() const { return (const Expr*) Init; }
|
||||
Expr *getInitExpr() { return (Expr*) Init; }
|
||||
const llvm::APSInt &getInitVal() const { return Val; }
|
||||
@ -3812,7 +3812,7 @@ class RecordDecl : public TagDecl {
|
||||
|
||||
/// Finds the first data member which has a name.
|
||||
/// nullptr is returned if no named data member exists.
|
||||
const FieldDecl *findFirstNamedDataMember() const;
|
||||
const FieldDecl *findFirstNamedDataMember() const;
|
||||
|
||||
private:
|
||||
/// Deserialize just the fields.
|
||||
@ -3835,7 +3835,7 @@ class FileScopeAsmDecl : public Decl {
|
||||
SourceLocation RParenLoc);
|
||||
|
||||
static FileScopeAsmDecl *CreateDeserialized(ASTContext &C, unsigned ID);
|
||||
|
||||
|
||||
SourceLocation getAsmLoc() const { return getLocation(); }
|
||||
SourceLocation getRParenLoc() const { return RParenLoc; }
|
||||
void setRParenLoc(SourceLocation L) { RParenLoc = L; }
|
||||
@ -3927,9 +3927,9 @@ class BlockDecl : public Decl, public DeclContext {
|
||||
IsConversionFromLambda(false), DoesNotEscape(false) {}
|
||||
|
||||
public:
|
||||
static BlockDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L);
|
||||
static BlockDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L);
|
||||
static BlockDecl *CreateDeserialized(ASTContext &C, unsigned ID);
|
||||
|
||||
|
||||
SourceLocation getCaretLocation() const { return getLocation(); }
|
||||
|
||||
bool isVariadic() const { return IsVariadic; }
|
||||
@ -4009,7 +4009,7 @@ class BlockDecl : public Decl, public DeclContext {
|
||||
}
|
||||
|
||||
Decl *getBlockManglingContextDecl() const {
|
||||
return ManglingContextDecl;
|
||||
return ManglingContextDecl;
|
||||
}
|
||||
|
||||
void setBlockMangling(unsigned Number, Decl *Ctx) {
|
||||
@ -4145,16 +4145,16 @@ class ImportDecl final : public Decl,
|
||||
|
||||
/// The imported module, along with a bit that indicates whether
|
||||
/// we have source-location information for each identifier in the module
|
||||
/// name.
|
||||
/// name.
|
||||
///
|
||||
/// When the bit is false, we only have a single source location for the
|
||||
/// end of the import declaration.
|
||||
llvm::PointerIntPair<Module *, 1, bool> ImportedAndComplete;
|
||||
|
||||
|
||||
/// The next import in the list of imports local to the translation
|
||||
/// unit being parsed (not loaded from an AST file).
|
||||
ImportDecl *NextLocalImport = nullptr;
|
||||
|
||||
|
||||
ImportDecl(DeclContext *DC, SourceLocation StartLoc, Module *Imported,
|
||||
ArrayRef<SourceLocation> IdentifierLocs);
|
||||
|
||||
@ -4162,26 +4162,26 @@ class ImportDecl final : public Decl,
|
||||
SourceLocation EndLoc);
|
||||
|
||||
ImportDecl(EmptyShell Empty) : Decl(Import, Empty) {}
|
||||
|
||||
|
||||
public:
|
||||
/// Create a new module import declaration.
|
||||
static ImportDecl *Create(ASTContext &C, DeclContext *DC,
|
||||
static ImportDecl *Create(ASTContext &C, DeclContext *DC,
|
||||
SourceLocation StartLoc, Module *Imported,
|
||||
ArrayRef<SourceLocation> IdentifierLocs);
|
||||
|
||||
|
||||
/// Create a new module import declaration for an implicitly-generated
|
||||
/// import.
|
||||
static ImportDecl *CreateImplicit(ASTContext &C, DeclContext *DC,
|
||||
SourceLocation StartLoc, Module *Imported,
|
||||
static ImportDecl *CreateImplicit(ASTContext &C, DeclContext *DC,
|
||||
SourceLocation StartLoc, Module *Imported,
|
||||
SourceLocation EndLoc);
|
||||
|
||||
|
||||
/// Create a new, deserialized module import declaration.
|
||||
static ImportDecl *CreateDeserialized(ASTContext &C, unsigned ID,
|
||||
static ImportDecl *CreateDeserialized(ASTContext &C, unsigned ID,
|
||||
unsigned NumLocations);
|
||||
|
||||
|
||||
/// Retrieve the module that was imported by the import declaration.
|
||||
Module *getImportedModule() const { return ImportedAndComplete.getPointer(); }
|
||||
|
||||
|
||||
/// Retrieves the locations of each of the identifiers that make up
|
||||
/// the complete module name in the import declaration.
|
||||
///
|
||||
@ -4218,7 +4218,7 @@ class ExportDecl final : public Decl, public DeclContext {
|
||||
static ExportDecl *Create(ASTContext &C, DeclContext *DC,
|
||||
SourceLocation ExportLoc);
|
||||
static ExportDecl *CreateDeserialized(ASTContext &C, unsigned ID);
|
||||
|
||||
|
||||
SourceLocation getExportLoc() const { return getLocation(); }
|
||||
SourceLocation getRBraceLoc() const { return RBraceLoc; }
|
||||
void setRBraceLoc(SourceLocation L) { RBraceLoc = L; }
|
||||
|
@ -302,7 +302,7 @@ class alignas(8) Decl {
|
||||
/// global variable, etc.) that is lexically inside an objc container
|
||||
/// definition.
|
||||
unsigned TopLevelDeclInObjCContainer : 1;
|
||||
|
||||
|
||||
/// Whether statistic collection is enabled.
|
||||
static bool StatisticsEnabled;
|
||||
|
||||
@ -629,7 +629,7 @@ class alignas(8) Decl {
|
||||
assert(isFromASTFile() && "Only works on a deserialized declaration");
|
||||
*((unsigned*)this - 2) = ID;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
/// Determine the availability of the given declaration.
|
||||
///
|
||||
@ -879,7 +879,7 @@ class alignas(8) Decl {
|
||||
|
||||
/// Whether this particular Decl is a canonical one.
|
||||
bool isCanonicalDecl() const { return getCanonicalDecl() == this; }
|
||||
|
||||
|
||||
protected:
|
||||
/// Returns the next redeclaration or itself if this is the only decl.
|
||||
///
|
||||
@ -956,10 +956,10 @@ class alignas(8) Decl {
|
||||
/// Retrieve the previous declaration that declares the same entity
|
||||
/// as this declaration, or NULL if there is no previous declaration.
|
||||
Decl *getPreviousDecl() { return getPreviousDeclImpl(); }
|
||||
|
||||
|
||||
/// Retrieve the most recent declaration that declares the same entity
|
||||
/// as this declaration, or NULL if there is no previous declaration.
|
||||
const Decl *getPreviousDecl() const {
|
||||
const Decl *getPreviousDecl() const {
|
||||
return const_cast<Decl *>(this)->getPreviousDeclImpl();
|
||||
}
|
||||
|
||||
@ -974,7 +974,7 @@ class alignas(8) Decl {
|
||||
|
||||
/// Retrieve the most recent declaration that declares the same entity
|
||||
/// as this declaration (which may be this declaration).
|
||||
const Decl *getMostRecentDecl() const {
|
||||
const Decl *getMostRecentDecl() const {
|
||||
return const_cast<Decl *>(this)->getMostRecentDeclImpl();
|
||||
}
|
||||
|
||||
@ -1159,13 +1159,13 @@ class alignas(8) Decl {
|
||||
inline bool declaresSameEntity(const Decl *D1, const Decl *D2) {
|
||||
if (!D1 || !D2)
|
||||
return false;
|
||||
|
||||
|
||||
if (D1 == D2)
|
||||
return true;
|
||||
|
||||
|
||||
return D1->getCanonicalDecl() == D2->getCanonicalDecl();
|
||||
}
|
||||
|
||||
|
||||
/// PrettyStackTraceDecl - If a crash occurs, indicate that it happened when
|
||||
/// doing something to a specific decl.
|
||||
class PrettyStackTraceDecl : public llvm::PrettyStackTraceEntry {
|
||||
@ -1517,7 +1517,7 @@ class DeclContext {
|
||||
/// connected to this declaration context.
|
||||
///
|
||||
/// For declaration contexts that have multiple semantically connected but
|
||||
/// syntactically distinct contexts, such as C++ namespaces, this routine
|
||||
/// syntactically distinct contexts, such as C++ namespaces, this routine
|
||||
/// retrieves the complete set of such declaration contexts in source order.
|
||||
/// For example, given:
|
||||
///
|
||||
@ -1921,7 +1921,7 @@ class DeclContext {
|
||||
/// Determine whether the given declaration is stored in the list of
|
||||
/// declarations lexically within this context.
|
||||
bool isDeclInLexicalTraversal(const Decl *D) const {
|
||||
return D && (D->NextInContextAndBits.getPointer() || D == FirstDecl ||
|
||||
return D && (D->NextInContextAndBits.getPointer() || D == FirstDecl ||
|
||||
D == LastDecl);
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ class CXXBaseSpecifier {
|
||||
return EllipsisLoc;
|
||||
}
|
||||
|
||||
/// Returns the access specifier for this base specifier.
|
||||
/// Returns the access specifier for this base specifier.
|
||||
///
|
||||
/// This is the actual base specifier as used for semantic analysis, so
|
||||
/// the result can never be AS_none. To retrieve the access specifier as
|
||||
@ -564,7 +564,7 @@ class CXXRecordDecl : public RecordDecl {
|
||||
CXXRecordDecl *Definition;
|
||||
|
||||
/// The first friend declaration in this class, or null if there
|
||||
/// aren't any.
|
||||
/// aren't any.
|
||||
///
|
||||
/// This is actually currently stored in reverse order.
|
||||
LazyDeclPtr FirstFriend;
|
||||
@ -606,14 +606,14 @@ class CXXRecordDecl : public RecordDecl {
|
||||
|
||||
/// Whether this lambda is known to be dependent, even if its
|
||||
/// context isn't dependent.
|
||||
///
|
||||
///
|
||||
/// A lambda with a non-dependent context can be dependent if it occurs
|
||||
/// within the default argument of a function template, because the
|
||||
/// lambda will have been created with the enclosing context as its
|
||||
/// declaration context, rather than function. This is an unfortunate
|
||||
/// artifact of having to parse the default arguments before.
|
||||
/// artifact of having to parse the default arguments before.
|
||||
unsigned Dependent : 1;
|
||||
|
||||
|
||||
/// Whether this lambda is a generic lambda.
|
||||
unsigned IsGenericLambda : 1;
|
||||
|
||||
@ -626,28 +626,28 @@ class CXXRecordDecl : public RecordDecl {
|
||||
/// The number of explicit captures in this lambda.
|
||||
unsigned NumExplicitCaptures : 13;
|
||||
|
||||
/// The number used to indicate this lambda expression for name
|
||||
/// The number used to indicate this lambda expression for name
|
||||
/// mangling in the Itanium C++ ABI.
|
||||
unsigned ManglingNumber = 0;
|
||||
|
||||
|
||||
/// The declaration that provides context for this lambda, if the
|
||||
/// actual DeclContext does not suffice. This is used for lambdas that
|
||||
/// occur within default arguments of function parameters within the class
|
||||
/// or within a data member initializer.
|
||||
LazyDeclPtr ContextDecl;
|
||||
|
||||
/// The list of captures, both explicit and implicit, for this
|
||||
|
||||
/// The list of captures, both explicit and implicit, for this
|
||||
/// lambda.
|
||||
Capture *Captures = nullptr;
|
||||
|
||||
/// The type of the call method.
|
||||
TypeSourceInfo *MethodTyInfo;
|
||||
|
||||
LambdaDefinitionData(CXXRecordDecl *D, TypeSourceInfo *Info,
|
||||
bool Dependent, bool IsGeneric,
|
||||
LambdaCaptureDefault CaptureDefault)
|
||||
: DefinitionData(D), Dependent(Dependent), IsGenericLambda(IsGeneric),
|
||||
CaptureDefault(CaptureDefault), NumCaptures(0), NumExplicitCaptures(0),
|
||||
LambdaDefinitionData(CXXRecordDecl *D, TypeSourceInfo *Info,
|
||||
bool Dependent, bool IsGeneric,
|
||||
LambdaCaptureDefault CaptureDefault)
|
||||
: DefinitionData(D), Dependent(Dependent), IsGenericLambda(IsGeneric),
|
||||
CaptureDefault(CaptureDefault), NumCaptures(0), NumExplicitCaptures(0),
|
||||
MethodTyInfo(Info) {
|
||||
IsLambda = true;
|
||||
|
||||
@ -1205,22 +1205,22 @@ class CXXRecordDecl : public RecordDecl {
|
||||
return DD && DD->IsLambda;
|
||||
}
|
||||
|
||||
/// Determine whether this class describes a generic
|
||||
/// Determine whether this class describes a generic
|
||||
/// lambda function object (i.e. function call operator is
|
||||
/// a template).
|
||||
bool isGenericLambda() const;
|
||||
/// a template).
|
||||
bool isGenericLambda() const;
|
||||
|
||||
/// Retrieve the lambda call operator of the closure type
|
||||
/// if this is a closure type.
|
||||
CXXMethodDecl *getLambdaCallOperator() const;
|
||||
CXXMethodDecl *getLambdaCallOperator() const;
|
||||
|
||||
/// Retrieve the lambda static invoker, the address of which
|
||||
/// is returned by the conversion operator, and the body of which
|
||||
/// is forwarded to the lambda call operator.
|
||||
CXXMethodDecl *getLambdaStaticInvoker() const;
|
||||
/// is forwarded to the lambda call operator.
|
||||
CXXMethodDecl *getLambdaStaticInvoker() const;
|
||||
|
||||
/// Retrieve the generic lambda's template parameter list.
|
||||
/// Returns null if the class does not represent a lambda or a generic
|
||||
/// Returns null if the class does not represent a lambda or a generic
|
||||
/// lambda.
|
||||
TemplateParameterList *getGenericLambdaTemplateParameterList() const;
|
||||
|
||||
@ -1345,11 +1345,11 @@ class CXXRecordDecl : public RecordDecl {
|
||||
/// not overridden.
|
||||
bool isAbstract() const { return data().Abstract; }
|
||||
|
||||
/// Determine whether this class is standard-layout per
|
||||
/// Determine whether this class is standard-layout per
|
||||
/// C++ [class]p7.
|
||||
bool isStandardLayout() const { return data().IsStandardLayout; }
|
||||
|
||||
/// Determine whether this class was standard-layout per
|
||||
/// Determine whether this class was standard-layout per
|
||||
/// C++11 [class]p7, specifically using the C++11 rules without any DRs.
|
||||
bool isCXX11StandardLayout() const { return data().IsCXX11StandardLayout; }
|
||||
|
||||
@ -1900,25 +1900,25 @@ class CXXRecordDecl : public RecordDecl {
|
||||
/// If this is the closure type of a lambda expression, retrieve the
|
||||
/// number to be used for name mangling in the Itanium C++ ABI.
|
||||
///
|
||||
/// Zero indicates that this closure type has internal linkage, so the
|
||||
/// Zero indicates that this closure type has internal linkage, so the
|
||||
/// mangling number does not matter, while a non-zero value indicates which
|
||||
/// lambda expression this is in this particular context.
|
||||
unsigned getLambdaManglingNumber() const {
|
||||
assert(isLambda() && "Not a lambda closure type!");
|
||||
return getLambdaData().ManglingNumber;
|
||||
}
|
||||
|
||||
/// Retrieve the declaration that provides additional context for a
|
||||
|
||||
/// Retrieve the declaration that provides additional context for a
|
||||
/// lambda, when the normal declaration context is not specific enough.
|
||||
///
|
||||
/// Certain contexts (default arguments of in-class function parameters and
|
||||
/// Certain contexts (default arguments of in-class function parameters and
|
||||
/// the initializers of data members) have separate name mangling rules for
|
||||
/// lambdas within the Itanium C++ ABI. For these cases, this routine provides
|
||||
/// the declaration in which the lambda occurs, e.g., the function parameter
|
||||
/// the declaration in which the lambda occurs, e.g., the function parameter
|
||||
/// or the non-static data member. Otherwise, it returns NULL to imply that
|
||||
/// the declaration context suffices.
|
||||
Decl *getLambdaContextDecl() const;
|
||||
|
||||
|
||||
/// Set the mangling number and context declaration for a lambda
|
||||
/// class.
|
||||
void setLambdaMangling(unsigned ManglingNumber, Decl *ContextDecl) {
|
||||
@ -2799,7 +2799,7 @@ class CXXConversionDecl : public CXXMethodDecl {
|
||||
/// Determine whether this conversion function is a conversion from
|
||||
/// a lambda closure type to a block pointer.
|
||||
bool isLambdaToBlockPointerConversion() const;
|
||||
|
||||
|
||||
CXXConversionDecl *getCanonicalDecl() override {
|
||||
return cast<CXXConversionDecl>(FunctionDecl::getCanonicalDecl());
|
||||
}
|
||||
@ -2812,7 +2812,7 @@ class CXXConversionDecl : public CXXMethodDecl {
|
||||
static bool classofKind(Kind K) { return K == CXXConversion; }
|
||||
};
|
||||
|
||||
/// Represents a linkage specification.
|
||||
/// Represents a linkage specification.
|
||||
///
|
||||
/// For example:
|
||||
/// \code
|
||||
@ -2862,7 +2862,7 @@ class LinkageSpecDecl : public Decl, public DeclContext {
|
||||
SourceLocation LangLoc, LanguageIDs Lang,
|
||||
bool HasBraces);
|
||||
static LinkageSpecDecl *CreateDeserialized(ASTContext &C, unsigned ID);
|
||||
|
||||
|
||||
/// Return the language specified by this linkage specification.
|
||||
LanguageIDs getLanguage() const { return LanguageIDs(Language); }
|
||||
|
||||
@ -3770,7 +3770,7 @@ class StaticAssertDecl : public Decl {
|
||||
Expr *AssertExpr, StringLiteral *Message,
|
||||
SourceLocation RParenLoc, bool Failed);
|
||||
static StaticAssertDecl *CreateDeserialized(ASTContext &C, unsigned ID);
|
||||
|
||||
|
||||
Expr *getAssertExpr() { return AssertExprAndFailed.getPointer(); }
|
||||
const Expr *getAssertExpr() const { return AssertExprAndFailed.getPointer(); }
|
||||
|
||||
|
@ -254,7 +254,7 @@ inline void CXXRecordDecl::pushFriendDecl(FriendDecl *FD) {
|
||||
FD->NextFriend = data().FirstFriend;
|
||||
data().FirstFriend = FD;
|
||||
}
|
||||
|
||||
|
||||
} // namespace clang
|
||||
|
||||
#endif // LLVM_CLANG_AST_DECLFRIEND_H
|
||||
|
@ -54,7 +54,7 @@ class DeclContext::all_lookups_iterator {
|
||||
++It;
|
||||
} while (It != End &&
|
||||
It->first == DeclarationName::getUsingDirectiveName());
|
||||
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -587,7 +587,7 @@ class ObjCTypeParamDecl : public TypedefNameDecl {
|
||||
/// explicitly specified.
|
||||
SourceLocation ColonLoc;
|
||||
|
||||
ObjCTypeParamDecl(ASTContext &ctx, DeclContext *dc,
|
||||
ObjCTypeParamDecl(ASTContext &ctx, DeclContext *dc,
|
||||
ObjCTypeParamVariance variance, SourceLocation varianceLoc,
|
||||
unsigned index,
|
||||
SourceLocation nameLoc, IdentifierInfo *name,
|
||||
@ -659,7 +659,7 @@ class ObjCTypeParamList final
|
||||
unsigned End;
|
||||
};
|
||||
|
||||
union {
|
||||
union {
|
||||
/// Location of the left and right angle brackets.
|
||||
PODSourceRange Brackets;
|
||||
|
||||
@ -1123,7 +1123,7 @@ class ObjCContainerDecl : public NamedDecl, public DeclContext {
|
||||
ObjCPropertyDecl *>;
|
||||
using ProtocolPropertySet = llvm::SmallDenseSet<const ObjCProtocolDecl *, 8>;
|
||||
using PropertyDeclOrder = llvm::SmallVector<ObjCPropertyDecl *, 8>;
|
||||
|
||||
|
||||
/// This routine collects list of properties to be implemented in the class.
|
||||
/// This includes, class's and its conforming protocols' properties.
|
||||
/// Note, the superclass's properties are not included in the list.
|
||||
@ -1195,15 +1195,15 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
/// TypeForDecl - This indicates the Type object that represents this
|
||||
/// TypeDecl. It is a cache maintained by ASTContext::getObjCInterfaceType
|
||||
mutable const Type *TypeForDecl = nullptr;
|
||||
|
||||
|
||||
struct DefinitionData {
|
||||
/// The definition of this class, for quick access from any
|
||||
/// The definition of this class, for quick access from any
|
||||
/// declaration.
|
||||
ObjCInterfaceDecl *Definition = nullptr;
|
||||
|
||||
|
||||
/// When non-null, this is always an ObjCObjectType.
|
||||
TypeSourceInfo *SuperClassTInfo = nullptr;
|
||||
|
||||
|
||||
/// Protocols referenced in the \@interface declaration
|
||||
ObjCProtocolList ReferencedProtocols;
|
||||
|
||||
@ -1247,11 +1247,11 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
|
||||
/// One of the \c InheritedDesignatedInitializersState enumeratos.
|
||||
mutable unsigned InheritedDesignatedInitializers : 2;
|
||||
|
||||
|
||||
/// The location of the last location in this declaration, before
|
||||
/// the properties/methods. For example, this will be the '>', '}', or
|
||||
/// identifier,
|
||||
SourceLocation EndLoc;
|
||||
/// the properties/methods. For example, this will be the '>', '}', or
|
||||
/// identifier,
|
||||
SourceLocation EndLoc;
|
||||
|
||||
DefinitionData()
|
||||
: ExternallyCompleted(false), IvarListMissingImplementation(true),
|
||||
@ -1285,7 +1285,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
|
||||
/// Allocate the definition data for this class.
|
||||
void allocateDefinitionData();
|
||||
|
||||
|
||||
using redeclarable_base = Redeclarable<ObjCInterfaceDecl>;
|
||||
|
||||
ObjCInterfaceDecl *getNextRedeclarationImpl() override {
|
||||
@ -1334,7 +1334,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
SourceRange getSourceRange() const override LLVM_READONLY {
|
||||
if (isThisDeclarationADefinition())
|
||||
return ObjCContainerDecl::getSourceRange();
|
||||
|
||||
|
||||
return SourceRange(getAtStartLoc(), getLocation());
|
||||
}
|
||||
|
||||
@ -1390,7 +1390,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
// FIXME: Should make sure no callers ever do this.
|
||||
if (!hasDefinition())
|
||||
return protocol_iterator();
|
||||
|
||||
|
||||
if (data().ExternallyCompleted)
|
||||
LoadExternalDefinition();
|
||||
|
||||
@ -1453,7 +1453,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
if (data().ExternallyCompleted)
|
||||
LoadExternalDefinition();
|
||||
|
||||
return data().AllReferencedProtocols.empty()
|
||||
return data().AllReferencedProtocols.empty()
|
||||
? protocol_begin()
|
||||
: data().AllReferencedProtocols.begin();
|
||||
}
|
||||
@ -1462,11 +1462,11 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
// FIXME: Should make sure no callers ever do this.
|
||||
if (!hasDefinition())
|
||||
return all_protocol_iterator();
|
||||
|
||||
|
||||
if (data().ExternallyCompleted)
|
||||
LoadExternalDefinition();
|
||||
|
||||
return data().AllReferencedProtocols.empty()
|
||||
return data().AllReferencedProtocols.empty()
|
||||
? protocol_end()
|
||||
: data().AllReferencedProtocols.end();
|
||||
}
|
||||
@ -1476,17 +1476,17 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
|
||||
ivar_range ivars() const { return ivar_range(ivar_begin(), ivar_end()); }
|
||||
|
||||
ivar_iterator ivar_begin() const {
|
||||
ivar_iterator ivar_begin() const {
|
||||
if (const ObjCInterfaceDecl *Def = getDefinition())
|
||||
return ivar_iterator(Def->decls_begin());
|
||||
|
||||
return ivar_iterator(Def->decls_begin());
|
||||
|
||||
// FIXME: Should make sure no callers ever do this.
|
||||
return ivar_iterator();
|
||||
}
|
||||
|
||||
ivar_iterator ivar_end() const {
|
||||
ivar_iterator ivar_end() const {
|
||||
if (const ObjCInterfaceDecl *Def = getDefinition())
|
||||
return ivar_iterator(Def->decls_end());
|
||||
return ivar_iterator(Def->decls_end());
|
||||
|
||||
// FIXME: Should make sure no callers ever do this.
|
||||
return ivar_iterator();
|
||||
@ -1546,10 +1546,10 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
|
||||
/// Determine whether this particular declaration of this class is
|
||||
/// actually also a definition.
|
||||
bool isThisDeclarationADefinition() const {
|
||||
bool isThisDeclarationADefinition() const {
|
||||
return getDefinition() == this;
|
||||
}
|
||||
|
||||
|
||||
/// Determine whether this class has been defined.
|
||||
bool hasDefinition() const {
|
||||
// If the name of this class is out-of-date, bring it up-to-date, which
|
||||
@ -1561,16 +1561,16 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
|
||||
return Data.getPointer();
|
||||
}
|
||||
|
||||
/// Retrieve the definition of this class, or NULL if this class
|
||||
/// has been forward-declared (with \@class) but not yet defined (with
|
||||
|
||||
/// Retrieve the definition of this class, or NULL if this class
|
||||
/// has been forward-declared (with \@class) but not yet defined (with
|
||||
/// \@interface).
|
||||
ObjCInterfaceDecl *getDefinition() {
|
||||
return hasDefinition()? Data.getPointer()->Definition : nullptr;
|
||||
}
|
||||
|
||||
/// Retrieve the definition of this class, or NULL if this class
|
||||
/// has been forward-declared (with \@class) but not yet defined (with
|
||||
/// Retrieve the definition of this class, or NULL if this class
|
||||
/// has been forward-declared (with \@class) but not yet defined (with
|
||||
/// \@interface).
|
||||
const ObjCInterfaceDecl *getDefinition() const {
|
||||
return hasDefinition()? Data.getPointer()->Definition : nullptr;
|
||||
@ -1579,7 +1579,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
/// Starts the definition of this Objective-C class, taking it from
|
||||
/// a forward declaration (\@class) to a definition (\@interface).
|
||||
void startDefinition();
|
||||
|
||||
|
||||
/// Retrieve the superclass type.
|
||||
const ObjCObjectType *getSuperClassType() const {
|
||||
if (TypeSourceInfo *TInfo = getSuperClassTInfo())
|
||||
@ -1593,7 +1593,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
// FIXME: Should make sure no callers ever do this.
|
||||
if (!hasDefinition())
|
||||
return nullptr;
|
||||
|
||||
|
||||
if (data().ExternallyCompleted)
|
||||
LoadExternalDefinition();
|
||||
|
||||
@ -1604,7 +1604,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
// does not include any type arguments that apply to the superclass.
|
||||
ObjCInterfaceDecl *getSuperClass() const;
|
||||
|
||||
void setSuperClass(TypeSourceInfo *superClass) {
|
||||
void setSuperClass(TypeSourceInfo *superClass) {
|
||||
data().SuperClassTInfo = superClass;
|
||||
}
|
||||
|
||||
@ -1618,7 +1618,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
ObjCCategoryDecl *Current = nullptr;
|
||||
|
||||
void findAcceptableCategory();
|
||||
|
||||
|
||||
public:
|
||||
using value_type = ObjCCategoryDecl *;
|
||||
using reference = value_type;
|
||||
@ -1659,7 +1659,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
///
|
||||
/// Used in the \c visible_categories_iterator.
|
||||
static bool isVisibleCategory(ObjCCategoryDecl *Cat);
|
||||
|
||||
|
||||
public:
|
||||
/// Iterator that walks over the list of categories and extensions
|
||||
/// that are visible, i.e., not hidden in a non-imported submodule.
|
||||
@ -1765,7 +1765,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
///
|
||||
/// Used in the \c known_extensions_iterator.
|
||||
static bool isKnownExtension(ObjCCategoryDecl *Cat);
|
||||
|
||||
|
||||
public:
|
||||
friend class ASTDeclReader;
|
||||
friend class ASTDeclWriter;
|
||||
@ -1787,7 +1787,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
known_extensions_iterator known_extensions_begin() const {
|
||||
return known_extensions_iterator(getCategoryListRaw());
|
||||
}
|
||||
|
||||
|
||||
/// Retrieve an iterator to the end of the known-extensions list.
|
||||
known_extensions_iterator known_extensions_end() const {
|
||||
return known_extensions_iterator();
|
||||
@ -1804,7 +1804,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
// FIXME: Should make sure no callers ever do this.
|
||||
if (!hasDefinition())
|
||||
return nullptr;
|
||||
|
||||
|
||||
if (data().ExternallyCompleted)
|
||||
LoadExternalDefinition();
|
||||
|
||||
@ -1831,7 +1831,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
while (I != nullptr) {
|
||||
if (declaresSameEntity(this, I))
|
||||
return true;
|
||||
|
||||
|
||||
I = I->getSuperClass();
|
||||
}
|
||||
return false;
|
||||
@ -1841,7 +1841,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
/// to be incompatible with __weak references. Returns true if it is.
|
||||
bool isArcWeakrefUnavailable() const;
|
||||
|
||||
/// isObjCRequiresPropertyDefs - Checks that a class or one of its super
|
||||
/// isObjCRequiresPropertyDefs - Checks that a class or one of its super
|
||||
/// classes must not be auto-synthesized. Returns class decl. if it must not
|
||||
/// be; 0, otherwise.
|
||||
const ObjCInterfaceDecl *isObjCRequiresPropertyDefs() const;
|
||||
@ -1854,7 +1854,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
}
|
||||
|
||||
ObjCProtocolDecl *lookupNestedProtocol(IdentifierInfo *Name);
|
||||
|
||||
|
||||
// Lookup a method. First, we search locally. If a method isn't
|
||||
// found, we search referenced protocols and class categories.
|
||||
ObjCMethodDecl *lookupMethod(Selector Sel, bool isInstance,
|
||||
@ -1893,14 +1893,14 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
true /* followsSuper */,
|
||||
Cat);
|
||||
}
|
||||
|
||||
SourceLocation getEndOfDefinitionLoc() const {
|
||||
|
||||
SourceLocation getEndOfDefinitionLoc() const {
|
||||
if (!hasDefinition())
|
||||
return getLocation();
|
||||
|
||||
return data().EndLoc;
|
||||
|
||||
return data().EndLoc;
|
||||
}
|
||||
|
||||
|
||||
void setEndOfDefinitionLoc(SourceLocation LE) { data().EndLoc = LE; }
|
||||
|
||||
/// Retrieve the starting location of the superclass.
|
||||
@ -1909,7 +1909,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
|
||||
/// isImplicitInterfaceDecl - check that this is an implicitly declared
|
||||
/// ObjCInterfaceDecl node. This is for legacy objective-c \@implementation
|
||||
/// declaration without an \@interface declaration.
|
||||
bool isImplicitInterfaceDecl() const {
|
||||
bool isImplicitInterfaceDecl() const {
|
||||
return hasDefinition() ? data().Definition->isImplicit() : isImplicit();
|
||||
}
|
||||
|
||||
@ -1987,7 +1987,7 @@ class ObjCIvarDecl : public FieldDecl {
|
||||
bool synthesized=false);
|
||||
|
||||
static ObjCIvarDecl *CreateDeserialized(ASTContext &C, unsigned ID);
|
||||
|
||||
|
||||
/// Return the class interface that this ivar is logically contained
|
||||
/// in; this is either the interface where the ivar was declared, or the
|
||||
/// interface the ivar is conceptually a part of in the case of synthesized
|
||||
@ -2045,7 +2045,7 @@ class ObjCAtDefsFieldDecl : public FieldDecl {
|
||||
QualType T, Expr *BW);
|
||||
|
||||
static ObjCAtDefsFieldDecl *CreateDeserialized(ASTContext &C, unsigned ID);
|
||||
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classofKind(Kind K) { return K == ObjCAtDefsField; }
|
||||
@ -2087,7 +2087,7 @@ class ObjCProtocolDecl : public ObjCContainerDecl,
|
||||
ObjCProtocolDecl *Definition;
|
||||
|
||||
/// Referenced protocols
|
||||
ObjCProtocolList ReferencedProtocols;
|
||||
ObjCProtocolList ReferencedProtocols;
|
||||
};
|
||||
|
||||
/// Contains a pointer to the data associated with this class,
|
||||
@ -2107,7 +2107,7 @@ class ObjCProtocolDecl : public ObjCContainerDecl,
|
||||
assert(Data.getPointer() && "Objective-C protocol has no definition!");
|
||||
return *Data.getPointer();
|
||||
}
|
||||
|
||||
|
||||
void allocateDefinitionData();
|
||||
|
||||
using redeclarable_base = Redeclarable<ObjCProtocolDecl>;
|
||||
@ -2152,15 +2152,15 @@ class ObjCProtocolDecl : public ObjCContainerDecl,
|
||||
protocol_iterator protocol_begin() const {
|
||||
if (!hasDefinition())
|
||||
return protocol_iterator();
|
||||
|
||||
|
||||
return data().ReferencedProtocols.begin();
|
||||
}
|
||||
|
||||
protocol_iterator protocol_end() const {
|
||||
protocol_iterator protocol_end() const {
|
||||
if (!hasDefinition())
|
||||
return protocol_iterator();
|
||||
|
||||
return data().ReferencedProtocols.end();
|
||||
|
||||
return data().ReferencedProtocols.end();
|
||||
}
|
||||
|
||||
using protocol_loc_iterator = ObjCProtocolList::loc_iterator;
|
||||
@ -2173,22 +2173,22 @@ class ObjCProtocolDecl : public ObjCContainerDecl,
|
||||
protocol_loc_iterator protocol_loc_begin() const {
|
||||
if (!hasDefinition())
|
||||
return protocol_loc_iterator();
|
||||
|
||||
|
||||
return data().ReferencedProtocols.loc_begin();
|
||||
}
|
||||
|
||||
protocol_loc_iterator protocol_loc_end() const {
|
||||
if (!hasDefinition())
|
||||
return protocol_loc_iterator();
|
||||
|
||||
|
||||
return data().ReferencedProtocols.loc_end();
|
||||
}
|
||||
|
||||
unsigned protocol_size() const {
|
||||
unsigned protocol_size() const {
|
||||
if (!hasDefinition())
|
||||
return 0;
|
||||
|
||||
return data().ReferencedProtocols.size();
|
||||
|
||||
return data().ReferencedProtocols.size();
|
||||
}
|
||||
|
||||
/// setProtocolList - Set the list of protocols that this interface
|
||||
@ -2235,12 +2235,12 @@ class ObjCProtocolDecl : public ObjCContainerDecl,
|
||||
return hasDefinition()? Data.getPointer()->Definition : nullptr;
|
||||
}
|
||||
|
||||
/// Determine whether this particular declaration is also the
|
||||
/// Determine whether this particular declaration is also the
|
||||
/// definition.
|
||||
bool isThisDeclarationADefinition() const {
|
||||
return getDefinition() == this;
|
||||
}
|
||||
|
||||
|
||||
/// Starts the definition of this Objective-C protocol.
|
||||
void startDefinition();
|
||||
|
||||
@ -2251,10 +2251,10 @@ class ObjCProtocolDecl : public ObjCContainerDecl,
|
||||
SourceRange getSourceRange() const override LLVM_READONLY {
|
||||
if (isThisDeclarationADefinition())
|
||||
return ObjCContainerDecl::getSourceRange();
|
||||
|
||||
|
||||
return SourceRange(getAtStartLoc(), getLocation());
|
||||
}
|
||||
|
||||
|
||||
using redecl_range = redeclarable_base::redecl_range;
|
||||
using redecl_iterator = redeclarable_base::redecl_iterator;
|
||||
|
||||
@ -2316,7 +2316,7 @@ class ObjCCategoryDecl : public ObjCContainerDecl {
|
||||
/// class extension may have private ivars.
|
||||
SourceLocation IvarLBraceLoc;
|
||||
SourceLocation IvarRBraceLoc;
|
||||
|
||||
|
||||
ObjCCategoryDecl(DeclContext *DC, SourceLocation AtLoc,
|
||||
SourceLocation ClassNameLoc, SourceLocation CategoryNameLoc,
|
||||
IdentifierInfo *Id, ObjCInterfaceDecl *IDecl,
|
||||
@ -2431,7 +2431,7 @@ class ObjCCategoryDecl : public ObjCContainerDecl {
|
||||
|
||||
SourceLocation getCategoryNameLoc() const { return CategoryNameLoc; }
|
||||
void setCategoryNameLoc(SourceLocation Loc) { CategoryNameLoc = Loc; }
|
||||
|
||||
|
||||
void setIvarLBraceLoc(SourceLocation Loc) { IvarLBraceLoc = Loc; }
|
||||
SourceLocation getIvarLBraceLoc() const { return IvarLBraceLoc; }
|
||||
void setIvarRBraceLoc(SourceLocation Loc) { IvarRBraceLoc = Loc; }
|
||||
@ -2576,7 +2576,7 @@ class ObjCImplementationDecl : public ObjCImplDecl {
|
||||
/// \@implementation may have private ivars.
|
||||
SourceLocation IvarLBraceLoc;
|
||||
SourceLocation IvarRBraceLoc;
|
||||
|
||||
|
||||
/// Support for ivar initialization.
|
||||
/// The arguments used to initialize the ivars
|
||||
LazyCXXCtorInitializersPtr IvarInitializers;
|
||||
@ -2594,7 +2594,7 @@ class ObjCImplementationDecl : public ObjCImplDecl {
|
||||
ObjCInterfaceDecl *superDecl,
|
||||
SourceLocation nameLoc, SourceLocation atStartLoc,
|
||||
SourceLocation superLoc = SourceLocation(),
|
||||
SourceLocation IvarLBraceLoc=SourceLocation(),
|
||||
SourceLocation IvarLBraceLoc=SourceLocation(),
|
||||
SourceLocation IvarRBraceLoc=SourceLocation())
|
||||
: ObjCImplDecl(ObjCImplementation, DC, classInterface,
|
||||
classInterface ? classInterface->getIdentifier()
|
||||
@ -2616,7 +2616,7 @@ class ObjCImplementationDecl : public ObjCImplDecl {
|
||||
SourceLocation nameLoc,
|
||||
SourceLocation atStartLoc,
|
||||
SourceLocation superLoc = SourceLocation(),
|
||||
SourceLocation IvarLBraceLoc=SourceLocation(),
|
||||
SourceLocation IvarLBraceLoc=SourceLocation(),
|
||||
SourceLocation IvarRBraceLoc=SourceLocation());
|
||||
|
||||
static ObjCImplementationDecl *CreateDeserialized(ASTContext &C, unsigned ID);
|
||||
@ -2700,7 +2700,7 @@ class ObjCImplementationDecl : public ObjCImplDecl {
|
||||
std::string getNameAsString() const {
|
||||
return getName();
|
||||
}
|
||||
|
||||
|
||||
/// Produce a name to be used for class's metadata. It comes either via
|
||||
/// class's objc_runtime_name attribute or class name.
|
||||
StringRef getObjCRuntimeNameAsString() const;
|
||||
@ -2715,7 +2715,7 @@ class ObjCImplementationDecl : public ObjCImplDecl {
|
||||
SourceLocation getIvarLBraceLoc() const { return IvarLBraceLoc; }
|
||||
void setIvarRBraceLoc(SourceLocation Loc) { IvarRBraceLoc = Loc; }
|
||||
SourceLocation getIvarRBraceLoc() const { return IvarRBraceLoc; }
|
||||
|
||||
|
||||
using ivar_iterator = specific_decl_iterator<ObjCIvarDecl>;
|
||||
using ivar_range = llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>>;
|
||||
|
||||
@ -2760,9 +2760,9 @@ class ObjCCompatibleAliasDecl : public NamedDecl {
|
||||
SourceLocation L, IdentifierInfo *Id,
|
||||
ObjCInterfaceDecl* aliasedClass);
|
||||
|
||||
static ObjCCompatibleAliasDecl *CreateDeserialized(ASTContext &C,
|
||||
static ObjCCompatibleAliasDecl *CreateDeserialized(ASTContext &C,
|
||||
unsigned ID);
|
||||
|
||||
|
||||
const ObjCInterfaceDecl *getClassInterface() const { return AliasedClass; }
|
||||
ObjCInterfaceDecl *getClassInterface() { return AliasedClass; }
|
||||
void setClassInterface(ObjCInterfaceDecl *D) { AliasedClass = D; }
|
||||
|
@ -734,8 +734,8 @@ class DependentFunctionTemplateSpecializationInfo final
|
||||
};
|
||||
|
||||
/// Declaration of a redeclarable template.
|
||||
class RedeclarableTemplateDecl : public TemplateDecl,
|
||||
public Redeclarable<RedeclarableTemplateDecl>
|
||||
class RedeclarableTemplateDecl : public TemplateDecl,
|
||||
public Redeclarable<RedeclarableTemplateDecl>
|
||||
{
|
||||
using redeclarable_base = Redeclarable<RedeclarableTemplateDecl>;
|
||||
|
||||
@ -823,7 +823,7 @@ class RedeclarableTemplateDecl : public TemplateDecl,
|
||||
/// Pointer to the common data shared by all declarations of this
|
||||
/// template.
|
||||
mutable CommonBase *Common = nullptr;
|
||||
|
||||
|
||||
/// Retrieves the "common" pointer shared by all (re-)declarations of
|
||||
/// the same template. Calling this routine may implicitly allocate memory
|
||||
/// for the common pointer.
|
||||
@ -888,10 +888,10 @@ class RedeclarableTemplateDecl : public TemplateDecl,
|
||||
}
|
||||
|
||||
/// Retrieve the member template from which this template was
|
||||
/// instantiated, or nullptr if this template was not instantiated from a
|
||||
/// instantiated, or nullptr if this template was not instantiated from a
|
||||
/// member template.
|
||||
///
|
||||
/// A template is instantiated from a member template when the member
|
||||
/// A template is instantiated from a member template when the member
|
||||
/// template itself is part of a class template (or member thereof). For
|
||||
/// example, given
|
||||
///
|
||||
@ -1178,7 +1178,7 @@ class TemplateTypeParmDecl : public TypeDecl {
|
||||
unsigned D, unsigned P,
|
||||
IdentifierInfo *Id, bool Typename,
|
||||
bool ParameterPack);
|
||||
static TemplateTypeParmDecl *CreateDeserialized(const ASTContext &C,
|
||||
static TemplateTypeParmDecl *CreateDeserialized(const ASTContext &C,
|
||||
unsigned ID);
|
||||
|
||||
/// Whether this template type parameter was declared with
|
||||
@ -1312,12 +1312,12 @@ class NonTypeTemplateParmDecl final
|
||||
QualType T, TypeSourceInfo *TInfo, ArrayRef<QualType> ExpandedTypes,
|
||||
ArrayRef<TypeSourceInfo *> ExpandedTInfos);
|
||||
|
||||
static NonTypeTemplateParmDecl *CreateDeserialized(ASTContext &C,
|
||||
static NonTypeTemplateParmDecl *CreateDeserialized(ASTContext &C,
|
||||
unsigned ID);
|
||||
static NonTypeTemplateParmDecl *CreateDeserialized(ASTContext &C,
|
||||
static NonTypeTemplateParmDecl *CreateDeserialized(ASTContext &C,
|
||||
unsigned ID,
|
||||
unsigned NumExpandedTypes);
|
||||
|
||||
|
||||
using TemplateParmPosition::getDepth;
|
||||
using TemplateParmPosition::setDepth;
|
||||
using TemplateParmPosition::getPosition;
|
||||
@ -1495,7 +1495,7 @@ class TemplateTemplateParmDecl final
|
||||
static TemplateTemplateParmDecl *CreateDeserialized(ASTContext &C,
|
||||
unsigned ID,
|
||||
unsigned NumExpansions);
|
||||
|
||||
|
||||
using TemplateParmPosition::getDepth;
|
||||
using TemplateParmPosition::setDepth;
|
||||
using TemplateParmPosition::getPosition;
|
||||
@ -2442,7 +2442,7 @@ class ClassScopeFunctionSpecializationDecl : public Decl {
|
||||
|
||||
static ClassScopeFunctionSpecializationDecl *
|
||||
CreateDeserialized(ASTContext &Context, unsigned ID);
|
||||
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
|
||||
|
@ -211,14 +211,14 @@ class DeclarationName {
|
||||
/// getNameKind - Determine what kind of name this is.
|
||||
NameKind getNameKind() const;
|
||||
|
||||
/// Determines whether the name itself is dependent, e.g., because it
|
||||
/// Determines whether the name itself is dependent, e.g., because it
|
||||
/// involves a C++ type that is itself dependent.
|
||||
///
|
||||
/// Note that this does not capture all of the notions of "dependent name",
|
||||
/// because an identifier can be a dependent name if it is used as the
|
||||
/// because an identifier can be a dependent name if it is used as the
|
||||
/// callee in a call expression with dependent arguments.
|
||||
bool isDependentName() const;
|
||||
|
||||
|
||||
/// getNameAsString - Retrieve the human-readable string for this name.
|
||||
std::string getAsString() const;
|
||||
|
||||
@ -543,7 +543,7 @@ struct DeclarationNameInfo {
|
||||
|
||||
/// Determine whether this name involves a template parameter.
|
||||
bool isInstantiationDependent() const;
|
||||
|
||||
|
||||
/// Determine whether this name contains an unexpanded
|
||||
/// parameter pack.
|
||||
bool containsUnexpandedParameterPack() const;
|
||||
@ -558,7 +558,7 @@ struct DeclarationNameInfo {
|
||||
SourceLocation getBeginLoc() const { return NameLoc; }
|
||||
|
||||
/// getEndLoc - Retrieve the location of the last token.
|
||||
SourceLocation getEndLoc() const;
|
||||
SourceLocation getEndLoc() const { return getLocEnd(); }
|
||||
|
||||
/// getSourceRange - The range of the declaration name.
|
||||
SourceRange getSourceRange() const LLVM_READONLY {
|
||||
@ -570,9 +570,11 @@ struct DeclarationNameInfo {
|
||||
}
|
||||
|
||||
SourceLocation getLocEnd() const LLVM_READONLY {
|
||||
SourceLocation EndLoc = getEndLoc();
|
||||
SourceLocation EndLoc = getEndLocPrivate();
|
||||
return EndLoc.isValid() ? EndLoc : getLocStart();
|
||||
}
|
||||
private:
|
||||
SourceLocation getEndLocPrivate() const;
|
||||
};
|
||||
|
||||
/// Insertion operator for diagnostics. This allows sending DeclarationName's
|
||||
|
@ -101,9 +101,9 @@ class DependentDiagnostic {
|
||||
friend class DependentStoredDeclsMap;
|
||||
|
||||
DependentDiagnostic(const PartialDiagnostic &PDiag,
|
||||
PartialDiagnostic::Storage *Storage)
|
||||
PartialDiagnostic::Storage *Storage)
|
||||
: Diag(PDiag, Storage) {}
|
||||
|
||||
|
||||
static DependentDiagnostic *Create(ASTContext &Context,
|
||||
DeclContext *Parent,
|
||||
const PartialDiagnostic &PDiag);
|
||||
|
@ -21,9 +21,9 @@
|
||||
#include "clang/AST/StmtVisitor.h"
|
||||
|
||||
namespace clang {
|
||||
|
||||
|
||||
class ASTContext;
|
||||
|
||||
|
||||
/// Given a potentially-evaluated expression, this visitor visits all
|
||||
/// of its potentially-evaluated subexpressions, recursively.
|
||||
template<template <typename> class Ptr, typename ImplClass>
|
||||
|
@ -884,7 +884,7 @@ class OpaqueValueExpr : public Expr {
|
||||
: Expr(OpaqueValueExprClass, T, VK, OK,
|
||||
T->isDependentType() ||
|
||||
(SourceExpr && SourceExpr->isTypeDependent()),
|
||||
T->isDependentType() ||
|
||||
T->isDependentType() ||
|
||||
(SourceExpr && SourceExpr->isValueDependent()),
|
||||
T->isInstantiationDependentType() ||
|
||||
(SourceExpr && SourceExpr->isInstantiationDependent()),
|
||||
@ -2787,20 +2787,26 @@ class CompoundLiteralExpr : public Expr {
|
||||
/// representation in the source code (ExplicitCastExpr's derived
|
||||
/// classes).
|
||||
class CastExpr : public Expr {
|
||||
public:
|
||||
using BasePathSizeTy = unsigned int;
|
||||
static_assert(std::numeric_limits<BasePathSizeTy>::max() >= 16384,
|
||||
"[implimits] Direct and indirect base classes [16384].");
|
||||
|
||||
private:
|
||||
Stmt *Op;
|
||||
|
||||
bool CastConsistency() const;
|
||||
|
||||
BasePathSizeTy *BasePathSize();
|
||||
|
||||
const CXXBaseSpecifier * const *path_buffer() const {
|
||||
return const_cast<CastExpr*>(this)->path_buffer();
|
||||
}
|
||||
CXXBaseSpecifier **path_buffer();
|
||||
|
||||
void setBasePathSize(unsigned basePathSize) {
|
||||
CastExprBits.BasePathSize = basePathSize;
|
||||
assert(CastExprBits.BasePathSize == basePathSize &&
|
||||
"basePathSize doesn't fit in bits of CastExprBits.BasePathSize!");
|
||||
void setBasePathSize(BasePathSizeTy basePathSize) {
|
||||
assert(!path_empty() && basePathSize != 0);
|
||||
*(BasePathSize()) = basePathSize;
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -2823,7 +2829,9 @@ class CastExpr : public Expr {
|
||||
Op(op) {
|
||||
CastExprBits.Kind = kind;
|
||||
CastExprBits.PartOfExplicitCast = false;
|
||||
setBasePathSize(BasePathSize);
|
||||
CastExprBits.BasePathIsEmpty = BasePathSize == 0;
|
||||
if (!path_empty())
|
||||
setBasePathSize(BasePathSize);
|
||||
assert(CastConsistency());
|
||||
}
|
||||
|
||||
@ -2831,7 +2839,9 @@ class CastExpr : public Expr {
|
||||
CastExpr(StmtClass SC, EmptyShell Empty, unsigned BasePathSize)
|
||||
: Expr(SC, Empty) {
|
||||
CastExprBits.PartOfExplicitCast = false;
|
||||
setBasePathSize(BasePathSize);
|
||||
CastExprBits.BasePathIsEmpty = BasePathSize == 0;
|
||||
if (!path_empty())
|
||||
setBasePathSize(BasePathSize);
|
||||
}
|
||||
|
||||
public:
|
||||
@ -2859,8 +2869,12 @@ class CastExpr : public Expr {
|
||||
|
||||
typedef CXXBaseSpecifier **path_iterator;
|
||||
typedef const CXXBaseSpecifier * const *path_const_iterator;
|
||||
bool path_empty() const { return CastExprBits.BasePathSize == 0; }
|
||||
unsigned path_size() const { return CastExprBits.BasePathSize; }
|
||||
bool path_empty() const { return CastExprBits.BasePathIsEmpty; }
|
||||
unsigned path_size() const {
|
||||
if (path_empty())
|
||||
return 0U;
|
||||
return *(const_cast<CastExpr *>(this)->BasePathSize());
|
||||
}
|
||||
path_iterator path_begin() { return path_buffer(); }
|
||||
path_iterator path_end() { return path_buffer() + path_size(); }
|
||||
path_const_iterator path_begin() const { return path_buffer(); }
|
||||
@ -2908,7 +2922,12 @@ class CastExpr : public Expr {
|
||||
/// @endcode
|
||||
class ImplicitCastExpr final
|
||||
: public CastExpr,
|
||||
private llvm::TrailingObjects<ImplicitCastExpr, CXXBaseSpecifier *> {
|
||||
private llvm::TrailingObjects<ImplicitCastExpr, CastExpr::BasePathSizeTy,
|
||||
CXXBaseSpecifier *> {
|
||||
size_t numTrailingObjects(OverloadToken<CastExpr::BasePathSizeTy>) const {
|
||||
return path_empty() ? 0 : 1;
|
||||
}
|
||||
|
||||
private:
|
||||
ImplicitCastExpr(QualType ty, CastKind kind, Expr *op,
|
||||
unsigned BasePathLength, ExprValueKind VK)
|
||||
@ -3013,7 +3032,8 @@ class ExplicitCastExpr : public CastExpr {
|
||||
/// (Type)expr. For example: @c (int)f.
|
||||
class CStyleCastExpr final
|
||||
: public ExplicitCastExpr,
|
||||
private llvm::TrailingObjects<CStyleCastExpr, CXXBaseSpecifier *> {
|
||||
private llvm::TrailingObjects<CStyleCastExpr, CastExpr::BasePathSizeTy,
|
||||
CXXBaseSpecifier *> {
|
||||
SourceLocation LPLoc; // the location of the left paren
|
||||
SourceLocation RPLoc; // the location of the right paren
|
||||
|
||||
@ -3027,6 +3047,10 @@ class CStyleCastExpr final
|
||||
explicit CStyleCastExpr(EmptyShell Shell, unsigned PathSize)
|
||||
: ExplicitCastExpr(CStyleCastExprClass, Shell, PathSize) { }
|
||||
|
||||
size_t numTrailingObjects(OverloadToken<CastExpr::BasePathSizeTy>) const {
|
||||
return path_empty() ? 0 : 1;
|
||||
}
|
||||
|
||||
public:
|
||||
static CStyleCastExpr *Create(const ASTContext &Context, QualType T,
|
||||
ExprValueKind VK, CastKind K,
|
||||
@ -5341,7 +5365,7 @@ class TypoExpr : public Expr {
|
||||
|
||||
SourceLocation getLocStart() const LLVM_READONLY { return SourceLocation(); }
|
||||
SourceLocation getLocEnd() const LLVM_READONLY { return SourceLocation(); }
|
||||
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == TypoExprClass;
|
||||
}
|
||||
|
@ -301,7 +301,8 @@ class CXXNamedCastExpr : public ExplicitCastExpr {
|
||||
/// \c static_cast<int>(1.0).
|
||||
class CXXStaticCastExpr final
|
||||
: public CXXNamedCastExpr,
|
||||
private llvm::TrailingObjects<CXXStaticCastExpr, CXXBaseSpecifier *> {
|
||||
private llvm::TrailingObjects<CXXStaticCastExpr, CastExpr::BasePathSizeTy,
|
||||
CXXBaseSpecifier *> {
|
||||
CXXStaticCastExpr(QualType ty, ExprValueKind vk, CastKind kind, Expr *op,
|
||||
unsigned pathSize, TypeSourceInfo *writtenTy,
|
||||
SourceLocation l, SourceLocation RParenLoc,
|
||||
@ -312,6 +313,10 @@ class CXXStaticCastExpr final
|
||||
explicit CXXStaticCastExpr(EmptyShell Empty, unsigned PathSize)
|
||||
: CXXNamedCastExpr(CXXStaticCastExprClass, Empty, PathSize) {}
|
||||
|
||||
size_t numTrailingObjects(OverloadToken<CastExpr::BasePathSizeTy>) const {
|
||||
return path_empty() ? 0 : 1;
|
||||
}
|
||||
|
||||
public:
|
||||
friend class CastExpr;
|
||||
friend TrailingObjects;
|
||||
@ -337,7 +342,8 @@ class CXXStaticCastExpr final
|
||||
/// check to determine how to perform the type conversion.
|
||||
class CXXDynamicCastExpr final
|
||||
: public CXXNamedCastExpr,
|
||||
private llvm::TrailingObjects<CXXDynamicCastExpr, CXXBaseSpecifier *> {
|
||||
private llvm::TrailingObjects<
|
||||
CXXDynamicCastExpr, CastExpr::BasePathSizeTy, CXXBaseSpecifier *> {
|
||||
CXXDynamicCastExpr(QualType ty, ExprValueKind VK, CastKind kind,
|
||||
Expr *op, unsigned pathSize, TypeSourceInfo *writtenTy,
|
||||
SourceLocation l, SourceLocation RParenLoc,
|
||||
@ -348,6 +354,10 @@ class CXXDynamicCastExpr final
|
||||
explicit CXXDynamicCastExpr(EmptyShell Empty, unsigned pathSize)
|
||||
: CXXNamedCastExpr(CXXDynamicCastExprClass, Empty, pathSize) {}
|
||||
|
||||
size_t numTrailingObjects(OverloadToken<CastExpr::BasePathSizeTy>) const {
|
||||
return path_empty() ? 0 : 1;
|
||||
}
|
||||
|
||||
public:
|
||||
friend class CastExpr;
|
||||
friend TrailingObjects;
|
||||
@ -380,6 +390,7 @@ class CXXDynamicCastExpr final
|
||||
class CXXReinterpretCastExpr final
|
||||
: public CXXNamedCastExpr,
|
||||
private llvm::TrailingObjects<CXXReinterpretCastExpr,
|
||||
CastExpr::BasePathSizeTy,
|
||||
CXXBaseSpecifier *> {
|
||||
CXXReinterpretCastExpr(QualType ty, ExprValueKind vk, CastKind kind,
|
||||
Expr *op, unsigned pathSize,
|
||||
@ -392,6 +403,10 @@ class CXXReinterpretCastExpr final
|
||||
CXXReinterpretCastExpr(EmptyShell Empty, unsigned pathSize)
|
||||
: CXXNamedCastExpr(CXXReinterpretCastExprClass, Empty, pathSize) {}
|
||||
|
||||
size_t numTrailingObjects(OverloadToken<CastExpr::BasePathSizeTy>) const {
|
||||
return path_empty() ? 0 : 1;
|
||||
}
|
||||
|
||||
public:
|
||||
friend class CastExpr;
|
||||
friend TrailingObjects;
|
||||
@ -419,7 +434,8 @@ class CXXReinterpretCastExpr final
|
||||
/// value.
|
||||
class CXXConstCastExpr final
|
||||
: public CXXNamedCastExpr,
|
||||
private llvm::TrailingObjects<CXXConstCastExpr, CXXBaseSpecifier *> {
|
||||
private llvm::TrailingObjects<CXXConstCastExpr, CastExpr::BasePathSizeTy,
|
||||
CXXBaseSpecifier *> {
|
||||
CXXConstCastExpr(QualType ty, ExprValueKind VK, Expr *op,
|
||||
TypeSourceInfo *writtenTy, SourceLocation l,
|
||||
SourceLocation RParenLoc, SourceRange AngleBrackets)
|
||||
@ -429,6 +445,10 @@ class CXXConstCastExpr final
|
||||
explicit CXXConstCastExpr(EmptyShell Empty)
|
||||
: CXXNamedCastExpr(CXXConstCastExprClass, Empty, 0) {}
|
||||
|
||||
size_t numTrailingObjects(OverloadToken<CastExpr::BasePathSizeTy>) const {
|
||||
return path_empty() ? 0 : 1;
|
||||
}
|
||||
|
||||
public:
|
||||
friend class CastExpr;
|
||||
friend TrailingObjects;
|
||||
@ -721,7 +741,7 @@ class CXXTypeidExpr : public Expr {
|
||||
}
|
||||
};
|
||||
|
||||
/// A member reference to an MSPropertyDecl.
|
||||
/// A member reference to an MSPropertyDecl.
|
||||
///
|
||||
/// This expression always has pseudo-object type, and therefore it is
|
||||
/// typically not encountered in a fully-typechecked expression except
|
||||
@ -1471,7 +1491,8 @@ class CXXInheritedCtorInitExpr : public Expr {
|
||||
/// \endcode
|
||||
class CXXFunctionalCastExpr final
|
||||
: public ExplicitCastExpr,
|
||||
private llvm::TrailingObjects<CXXFunctionalCastExpr, CXXBaseSpecifier *> {
|
||||
private llvm::TrailingObjects<
|
||||
CXXFunctionalCastExpr, CastExpr::BasePathSizeTy, CXXBaseSpecifier *> {
|
||||
SourceLocation LParenLoc;
|
||||
SourceLocation RParenLoc;
|
||||
|
||||
@ -1486,6 +1507,10 @@ class CXXFunctionalCastExpr final
|
||||
explicit CXXFunctionalCastExpr(EmptyShell Shell, unsigned PathSize)
|
||||
: ExplicitCastExpr(CXXFunctionalCastExprClass, Shell, PathSize) {}
|
||||
|
||||
size_t numTrailingObjects(OverloadToken<CastExpr::BasePathSizeTy>) const {
|
||||
return path_empty() ? 0 : 1;
|
||||
}
|
||||
|
||||
public:
|
||||
friend class CastExpr;
|
||||
friend TrailingObjects;
|
||||
@ -1591,7 +1616,7 @@ class LambdaExpr final : public Expr,
|
||||
|
||||
/// The number of captures.
|
||||
unsigned NumCaptures : 16;
|
||||
|
||||
|
||||
/// The default capture kind, which is a value of type
|
||||
/// LambdaCaptureDefault.
|
||||
unsigned CaptureDefault : 2;
|
||||
@ -1602,10 +1627,10 @@ class LambdaExpr final : public Expr,
|
||||
|
||||
/// Whether this lambda had the result type explicitly specified.
|
||||
unsigned ExplicitResultType : 1;
|
||||
|
||||
|
||||
/// The location of the closing brace ('}') that completes
|
||||
/// the lambda.
|
||||
///
|
||||
///
|
||||
/// The location of the brace is also available by looking up the
|
||||
/// function call operator in the lambda class. However, it is
|
||||
/// stored here to improve the performance of getSourceRange(), and
|
||||
@ -1673,7 +1698,7 @@ class LambdaExpr final : public Expr,
|
||||
|
||||
/// Retrieve this lambda's captures.
|
||||
capture_range captures() const;
|
||||
|
||||
|
||||
/// Retrieve an iterator pointing to the first lambda capture.
|
||||
capture_iterator capture_begin() const;
|
||||
|
||||
@ -1686,7 +1711,7 @@ class LambdaExpr final : public Expr,
|
||||
|
||||
/// Retrieve this lambda's explicit captures.
|
||||
capture_range explicit_captures() const;
|
||||
|
||||
|
||||
/// Retrieve an iterator pointing to the first explicit
|
||||
/// lambda capture.
|
||||
capture_iterator explicit_capture_begin() const;
|
||||
@ -1754,18 +1779,18 @@ class LambdaExpr final : public Expr,
|
||||
SourceRange getIntroducerRange() const { return IntroducerRange; }
|
||||
|
||||
/// Retrieve the class that corresponds to the lambda.
|
||||
///
|
||||
///
|
||||
/// This is the "closure type" (C++1y [expr.prim.lambda]), and stores the
|
||||
/// captures in its fields and provides the various operations permitted
|
||||
/// on a lambda (copying, calling).
|
||||
CXXRecordDecl *getLambdaClass() const;
|
||||
|
||||
/// Retrieve the function call operator associated with this
|
||||
/// lambda expression.
|
||||
/// lambda expression.
|
||||
CXXMethodDecl *getCallOperator() const;
|
||||
|
||||
/// If this is a generic lambda expression, retrieve the template
|
||||
/// parameter list associated with it, or else return null.
|
||||
/// If this is a generic lambda expression, retrieve the template
|
||||
/// parameter list associated with it, or else return null.
|
||||
TemplateParameterList *getTemplateParameterList() const;
|
||||
|
||||
/// Whether this is a generic lambda.
|
||||
@ -1784,7 +1809,7 @@ class LambdaExpr final : public Expr,
|
||||
|
||||
/// Whether this lambda had its result type explicitly specified.
|
||||
bool hasExplicitResultType() const { return ExplicitResultType; }
|
||||
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == LambdaExprClass;
|
||||
}
|
||||
@ -2129,7 +2154,7 @@ class CXXDeleteExpr : public Expr {
|
||||
Expr *getArgument() { return cast<Expr>(Argument); }
|
||||
const Expr *getArgument() const { return cast<Expr>(Argument); }
|
||||
|
||||
/// Retrieve the type being destroyed.
|
||||
/// Retrieve the type being destroyed.
|
||||
///
|
||||
/// If the type being destroyed is a dependent type which may or may not
|
||||
/// be a pointer, return an invalid type.
|
||||
@ -2345,13 +2370,13 @@ class TypeTraitExpr final
|
||||
private llvm::TrailingObjects<TypeTraitExpr, TypeSourceInfo *> {
|
||||
/// The location of the type trait keyword.
|
||||
SourceLocation Loc;
|
||||
|
||||
|
||||
/// The location of the closing parenthesis.
|
||||
SourceLocation RParenLoc;
|
||||
|
||||
|
||||
// Note: The TypeSourceInfos for the arguments are allocated after the
|
||||
// TypeTraitExpr.
|
||||
|
||||
|
||||
TypeTraitExpr(QualType T, SourceLocation Loc, TypeTrait Kind,
|
||||
ArrayRef<TypeSourceInfo *> Args,
|
||||
SourceLocation RParenLoc,
|
||||
@ -2377,26 +2402,26 @@ class TypeTraitExpr final
|
||||
|
||||
static TypeTraitExpr *CreateDeserialized(const ASTContext &C,
|
||||
unsigned NumArgs);
|
||||
|
||||
|
||||
/// Determine which type trait this expression uses.
|
||||
TypeTrait getTrait() const {
|
||||
return static_cast<TypeTrait>(TypeTraitExprBits.Kind);
|
||||
}
|
||||
|
||||
bool getValue() const {
|
||||
assert(!isValueDependent());
|
||||
return TypeTraitExprBits.Value;
|
||||
bool getValue() const {
|
||||
assert(!isValueDependent());
|
||||
return TypeTraitExprBits.Value;
|
||||
}
|
||||
|
||||
|
||||
/// Determine the number of arguments to this type trait.
|
||||
unsigned getNumArgs() const { return TypeTraitExprBits.NumArgs; }
|
||||
|
||||
|
||||
/// Retrieve the Ith argument.
|
||||
TypeSourceInfo *getArg(unsigned I) const {
|
||||
assert(I < getNumArgs() && "Argument out-of-range");
|
||||
return getArgs()[I];
|
||||
}
|
||||
|
||||
|
||||
/// Retrieve the argument types.
|
||||
ArrayRef<TypeSourceInfo *> getArgs() const {
|
||||
return llvm::makeArrayRef(getTrailingObjects<TypeSourceInfo *>(),
|
||||
@ -2409,7 +2434,7 @@ class TypeTraitExpr final
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == TypeTraitExprClass;
|
||||
}
|
||||
|
||||
|
||||
// Iterators
|
||||
child_range children() {
|
||||
return child_range(child_iterator(), child_iterator());
|
||||
|
@ -90,16 +90,16 @@ class ObjCBoolLiteralExpr : public Expr {
|
||||
Value(val), Loc(l) {}
|
||||
explicit ObjCBoolLiteralExpr(EmptyShell Empty)
|
||||
: Expr(ObjCBoolLiteralExprClass, Empty) {}
|
||||
|
||||
|
||||
bool getValue() const { return Value; }
|
||||
void setValue(bool V) { Value = V; }
|
||||
|
||||
|
||||
SourceLocation getLocStart() const LLVM_READONLY { return Loc; }
|
||||
SourceLocation getLocEnd() const LLVM_READONLY { return Loc; }
|
||||
|
||||
SourceLocation getLocation() const { return Loc; }
|
||||
void setLocation(SourceLocation L) { Loc = L; }
|
||||
|
||||
|
||||
// Iterators
|
||||
child_range children() {
|
||||
return child_range(child_iterator(), child_iterator());
|
||||
@ -124,30 +124,30 @@ class ObjCBoxedExpr : public Expr {
|
||||
|
||||
ObjCBoxedExpr(Expr *E, QualType T, ObjCMethodDecl *method,
|
||||
SourceRange R)
|
||||
: Expr(ObjCBoxedExprClass, T, VK_RValue, OK_Ordinary,
|
||||
E->isTypeDependent(), E->isValueDependent(),
|
||||
: Expr(ObjCBoxedExprClass, T, VK_RValue, OK_Ordinary,
|
||||
E->isTypeDependent(), E->isValueDependent(),
|
||||
E->isInstantiationDependent(),
|
||||
E->containsUnexpandedParameterPack()),
|
||||
E->containsUnexpandedParameterPack()),
|
||||
SubExpr(E), BoxingMethod(method), Range(R) {}
|
||||
explicit ObjCBoxedExpr(EmptyShell Empty)
|
||||
: Expr(ObjCBoxedExprClass, Empty) {}
|
||||
|
||||
|
||||
Expr *getSubExpr() { return cast<Expr>(SubExpr); }
|
||||
const Expr *getSubExpr() const { return cast<Expr>(SubExpr); }
|
||||
|
||||
|
||||
ObjCMethodDecl *getBoxingMethod() const {
|
||||
return BoxingMethod;
|
||||
return BoxingMethod;
|
||||
}
|
||||
|
||||
|
||||
SourceLocation getAtLoc() const { return Range.getBegin(); }
|
||||
|
||||
|
||||
SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
|
||||
SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
|
||||
|
||||
SourceRange getSourceRange() const LLVM_READONLY {
|
||||
return Range;
|
||||
}
|
||||
|
||||
|
||||
// Iterators
|
||||
child_range children() { return child_range(&SubExpr, &SubExpr+1); }
|
||||
|
||||
@ -208,7 +208,7 @@ class ObjCArrayLiteral final
|
||||
|
||||
/// getNumElements - Return number of elements of objective-c array literal.
|
||||
unsigned getNumElements() const { return NumElements; }
|
||||
|
||||
|
||||
/// getElement - Return the Element at the specified index.
|
||||
Expr *getElement(unsigned Index) {
|
||||
assert((Index < NumElements) && "Arg access out of range!");
|
||||
@ -218,11 +218,11 @@ class ObjCArrayLiteral final
|
||||
assert((Index < NumElements) && "Arg access out of range!");
|
||||
return getElements()[Index];
|
||||
}
|
||||
|
||||
|
||||
ObjCMethodDecl *getArrayWithObjectsMethod() const {
|
||||
return ArrayWithObjectsMethod;
|
||||
return ArrayWithObjectsMethod;
|
||||
}
|
||||
|
||||
|
||||
// Iterators
|
||||
child_range children() {
|
||||
return child_range(reinterpret_cast<Stmt **>(getElements()),
|
||||
@ -239,13 +239,13 @@ class ObjCArrayLiteral final
|
||||
struct ObjCDictionaryElement {
|
||||
/// The key for the dictionary element.
|
||||
Expr *Key;
|
||||
|
||||
|
||||
/// The value of the dictionary element.
|
||||
Expr *Value;
|
||||
|
||||
|
||||
/// The location of the ellipsis, if this is a pack expansion.
|
||||
SourceLocation EllipsisLoc;
|
||||
|
||||
|
||||
/// The number of elements this pack expansion will expand to, if
|
||||
/// this is a pack expansion and is known.
|
||||
Optional<unsigned> NumExpansions;
|
||||
@ -308,7 +308,7 @@ class ObjCDictionaryLiteral final
|
||||
using KeyValuePair = ObjCDictionaryLiteral_KeyValuePair;
|
||||
using ExpansionData = ObjCDictionaryLiteral_ExpansionData;
|
||||
|
||||
ObjCDictionaryLiteral(ArrayRef<ObjCDictionaryElement> VK,
|
||||
ObjCDictionaryLiteral(ArrayRef<ObjCDictionaryElement> VK,
|
||||
bool HasPackExpansions,
|
||||
QualType T, ObjCMethodDecl *method,
|
||||
SourceRange SR);
|
||||
@ -328,16 +328,16 @@ class ObjCDictionaryLiteral final
|
||||
friend TrailingObjects;
|
||||
|
||||
static ObjCDictionaryLiteral *Create(const ASTContext &C,
|
||||
ArrayRef<ObjCDictionaryElement> VK,
|
||||
ArrayRef<ObjCDictionaryElement> VK,
|
||||
bool HasPackExpansions,
|
||||
QualType T, ObjCMethodDecl *method,
|
||||
SourceRange SR);
|
||||
|
||||
|
||||
static ObjCDictionaryLiteral *CreateEmpty(const ASTContext &C,
|
||||
unsigned NumElements,
|
||||
bool HasPackExpansions);
|
||||
|
||||
/// getNumElements - Return number of elements of objective-c dictionary
|
||||
|
||||
/// getNumElements - Return number of elements of objective-c dictionary
|
||||
/// literal.
|
||||
unsigned getNumElements() const { return NumElements; }
|
||||
|
||||
@ -354,7 +354,7 @@ class ObjCDictionaryLiteral final
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
ObjCMethodDecl *getDictWithObjectsMethod() const {
|
||||
return DictWithObjectsMethod;
|
||||
}
|
||||
@ -394,7 +394,7 @@ class ObjCEncodeExpr : public Expr {
|
||||
EncodedType->getType()->isDependentType(),
|
||||
EncodedType->getType()->isDependentType(),
|
||||
EncodedType->getType()->isInstantiationDependentType(),
|
||||
EncodedType->getType()->containsUnexpandedParameterPack()),
|
||||
EncodedType->getType()->containsUnexpandedParameterPack()),
|
||||
EncodedType(EncodedType), AtLoc(at), RParenLoc(rp) {}
|
||||
|
||||
explicit ObjCEncodeExpr(EmptyShell Empty) : Expr(ObjCEncodeExprClass, Empty){}
|
||||
@ -408,8 +408,8 @@ class ObjCEncodeExpr : public Expr {
|
||||
|
||||
TypeSourceInfo *getEncodedTypeSourceInfo() const { return EncodedType; }
|
||||
|
||||
void setEncodedTypeSourceInfo(TypeSourceInfo *EncType) {
|
||||
EncodedType = EncType;
|
||||
void setEncodedTypeSourceInfo(TypeSourceInfo *EncType) {
|
||||
EncodedType = EncType;
|
||||
}
|
||||
|
||||
SourceLocation getLocStart() const LLVM_READONLY { return AtLoc; }
|
||||
@ -531,9 +531,9 @@ class ObjCIvarRefExpr : public Expr {
|
||||
bool arrow = false, bool freeIvar = false)
|
||||
: Expr(ObjCIvarRefExprClass, t, VK_LValue,
|
||||
d->isBitField() ? OK_BitField : OK_Ordinary,
|
||||
/*TypeDependent=*/false, base->isValueDependent(),
|
||||
/*TypeDependent=*/false, base->isValueDependent(),
|
||||
base->isInstantiationDependent(),
|
||||
base->containsUnexpandedParameterPack()),
|
||||
base->containsUnexpandedParameterPack()),
|
||||
D(d), Base(base), Loc(l), OpLoc(oploc), IsArrow(arrow),
|
||||
IsFreeIvar(freeIvar) {}
|
||||
|
||||
@ -560,7 +560,7 @@ class ObjCIvarRefExpr : public Expr {
|
||||
return isFreeIvar() ? Loc : getBase()->getLocStart();
|
||||
}
|
||||
SourceLocation getLocEnd() const LLVM_READONLY { return Loc; }
|
||||
|
||||
|
||||
SourceLocation getOpLoc() const { return OpLoc; }
|
||||
void setOpLoc(SourceLocation L) { OpLoc = L; }
|
||||
|
||||
@ -600,13 +600,13 @@ class ObjCPropertyRefExpr : public Expr {
|
||||
// transformation is lossy on the first character).
|
||||
|
||||
SourceLocation IdLoc;
|
||||
|
||||
|
||||
/// When the receiver in property access is 'super', this is
|
||||
/// the location of the 'super' keyword. When it's an interface,
|
||||
/// this is that interface.
|
||||
SourceLocation ReceiverLoc;
|
||||
llvm::PointerUnion3<Stmt *, const Type *, ObjCInterfaceDecl *> Receiver;
|
||||
|
||||
|
||||
public:
|
||||
ObjCPropertyRefExpr(ObjCPropertyDecl *PD, QualType t,
|
||||
ExprValueKind VK, ExprObjectKind OK,
|
||||
@ -618,7 +618,7 @@ class ObjCPropertyRefExpr : public Expr {
|
||||
PropertyOrGetter(PD, false), IdLoc(l), Receiver(base) {
|
||||
assert(t->isSpecificPlaceholderType(BuiltinType::PseudoObject));
|
||||
}
|
||||
|
||||
|
||||
ObjCPropertyRefExpr(ObjCPropertyDecl *PD, QualType t,
|
||||
ExprValueKind VK, ExprObjectKind OK,
|
||||
SourceLocation l, SourceLocation sl, QualType st)
|
||||
@ -716,19 +716,19 @@ class ObjCPropertyRefExpr : public Expr {
|
||||
setMethodRefFlag(MethodRef_Setter, val);
|
||||
}
|
||||
|
||||
const Expr *getBase() const {
|
||||
return cast<Expr>(Receiver.get<Stmt*>());
|
||||
const Expr *getBase() const {
|
||||
return cast<Expr>(Receiver.get<Stmt*>());
|
||||
}
|
||||
Expr *getBase() {
|
||||
return cast<Expr>(Receiver.get<Stmt*>());
|
||||
Expr *getBase() {
|
||||
return cast<Expr>(Receiver.get<Stmt*>());
|
||||
}
|
||||
|
||||
SourceLocation getLocation() const { return IdLoc; }
|
||||
|
||||
|
||||
SourceLocation getReceiverLocation() const { return ReceiverLoc; }
|
||||
|
||||
QualType getSuperReceiverType() const {
|
||||
return QualType(Receiver.get<const Type*>(), 0);
|
||||
QualType getSuperReceiverType() const {
|
||||
return QualType(Receiver.get<const Type*>(), 0);
|
||||
}
|
||||
|
||||
ObjCInterfaceDecl *getClassReceiver() const {
|
||||
@ -796,7 +796,7 @@ class ObjCPropertyRefExpr : public Expr {
|
||||
SetterAndMethodRefFlags.setInt(f);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// ObjCSubscriptRefExpr - used for array and dictionary subscripting.
|
||||
/// array[4] = array[3]; dictionary[key] = dictionary[alt_key];
|
||||
class ObjCSubscriptRefExpr : public Expr {
|
||||
@ -808,20 +808,20 @@ class ObjCSubscriptRefExpr : public Expr {
|
||||
// an objective-c object pointer expression.
|
||||
enum { BASE, KEY, END_EXPR };
|
||||
Stmt* SubExprs[END_EXPR];
|
||||
|
||||
|
||||
ObjCMethodDecl *GetAtIndexMethodDecl;
|
||||
|
||||
|
||||
// For immutable objects this is null. When ObjCSubscriptRefExpr is to read
|
||||
// an indexed object this is null too.
|
||||
ObjCMethodDecl *SetAtIndexMethodDecl;
|
||||
|
||||
|
||||
public:
|
||||
ObjCSubscriptRefExpr(Expr *base, Expr *key, QualType T,
|
||||
ExprValueKind VK, ExprObjectKind OK,
|
||||
ObjCMethodDecl *getMethod,
|
||||
ObjCMethodDecl *setMethod, SourceLocation RB)
|
||||
: Expr(ObjCSubscriptRefExprClass, T, VK, OK,
|
||||
base->isTypeDependent() || key->isTypeDependent(),
|
||||
: Expr(ObjCSubscriptRefExprClass, T, VK, OK,
|
||||
base->isTypeDependent() || key->isTypeDependent(),
|
||||
base->isValueDependent() || key->isValueDependent(),
|
||||
(base->isInstantiationDependent() ||
|
||||
key->isInstantiationDependent()),
|
||||
@ -834,7 +834,7 @@ class ObjCSubscriptRefExpr : public Expr {
|
||||
|
||||
explicit ObjCSubscriptRefExpr(EmptyShell Empty)
|
||||
: Expr(ObjCSubscriptRefExprClass, Empty) {}
|
||||
|
||||
|
||||
SourceLocation getRBracket() const { return RBracket; }
|
||||
void setRBracket(SourceLocation RB) { RBracket = RB; }
|
||||
|
||||
@ -843,25 +843,25 @@ class ObjCSubscriptRefExpr : public Expr {
|
||||
}
|
||||
|
||||
SourceLocation getLocEnd() const LLVM_READONLY { return RBracket; }
|
||||
|
||||
|
||||
Expr *getBaseExpr() const { return cast<Expr>(SubExprs[BASE]); }
|
||||
void setBaseExpr(Stmt *S) { SubExprs[BASE] = S; }
|
||||
|
||||
|
||||
Expr *getKeyExpr() const { return cast<Expr>(SubExprs[KEY]); }
|
||||
void setKeyExpr(Stmt *S) { SubExprs[KEY] = S; }
|
||||
|
||||
|
||||
ObjCMethodDecl *getAtIndexMethodDecl() const {
|
||||
return GetAtIndexMethodDecl;
|
||||
}
|
||||
|
||||
|
||||
ObjCMethodDecl *setAtIndexMethodDecl() const {
|
||||
return SetAtIndexMethodDecl;
|
||||
}
|
||||
|
||||
|
||||
bool isArraySubscriptRefExpr() const {
|
||||
return getKeyExpr()->getType()->isIntegralOrEnumerationType();
|
||||
}
|
||||
|
||||
|
||||
child_range children() {
|
||||
return child_range(SubExprs, SubExprs+END_EXPR);
|
||||
}
|
||||
@ -913,7 +913,7 @@ class ObjCMessageExpr final
|
||||
/// The number of arguments in the message send, not
|
||||
/// including the receiver.
|
||||
unsigned NumArgs : NumArgsBitWidth;
|
||||
|
||||
|
||||
/// The kind of message send this is, which is one of the
|
||||
/// ReceiverKind values.
|
||||
///
|
||||
@ -958,7 +958,7 @@ class ObjCMessageExpr final
|
||||
SourceLocation SuperLoc,
|
||||
bool IsInstanceSuper,
|
||||
QualType SuperType,
|
||||
Selector Sel,
|
||||
Selector Sel,
|
||||
ArrayRef<SourceLocation> SelLocs,
|
||||
SelectorLocationsKind SelLocsK,
|
||||
ObjCMethodDecl *Method,
|
||||
@ -968,7 +968,7 @@ class ObjCMessageExpr final
|
||||
ObjCMessageExpr(QualType T, ExprValueKind VK,
|
||||
SourceLocation LBracLoc,
|
||||
TypeSourceInfo *Receiver,
|
||||
Selector Sel,
|
||||
Selector Sel,
|
||||
ArrayRef<SourceLocation> SelLocs,
|
||||
SelectorLocationsKind SelLocsK,
|
||||
ObjCMethodDecl *Method,
|
||||
@ -978,7 +978,7 @@ class ObjCMessageExpr final
|
||||
ObjCMessageExpr(QualType T, ExprValueKind VK,
|
||||
SourceLocation LBracLoc,
|
||||
Expr *Receiver,
|
||||
Selector Sel,
|
||||
Selector Sel,
|
||||
ArrayRef<SourceLocation> SelLocs,
|
||||
SelectorLocationsKind SelLocsK,
|
||||
ObjCMethodDecl *Method,
|
||||
@ -1091,7 +1091,7 @@ class ObjCMessageExpr final
|
||||
SourceLocation SuperLoc,
|
||||
bool IsInstanceSuper,
|
||||
QualType SuperType,
|
||||
Selector Sel,
|
||||
Selector Sel,
|
||||
ArrayRef<SourceLocation> SelLocs,
|
||||
ObjCMethodDecl *Method,
|
||||
ArrayRef<Expr *> Args,
|
||||
@ -1125,7 +1125,7 @@ class ObjCMessageExpr final
|
||||
ExprValueKind VK,
|
||||
SourceLocation LBracLoc,
|
||||
TypeSourceInfo *Receiver,
|
||||
Selector Sel,
|
||||
Selector Sel,
|
||||
ArrayRef<SourceLocation> SelLocs,
|
||||
ObjCMethodDecl *Method,
|
||||
ArrayRef<Expr *> Args,
|
||||
@ -1159,7 +1159,7 @@ class ObjCMessageExpr final
|
||||
ExprValueKind VK,
|
||||
SourceLocation LBracLoc,
|
||||
Expr *Receiver,
|
||||
Selector Sel,
|
||||
Selector Sel,
|
||||
ArrayRef<SourceLocation> SeLocs,
|
||||
ObjCMethodDecl *Method,
|
||||
ArrayRef<Expr *> Args,
|
||||
@ -1215,14 +1215,14 @@ class ObjCMessageExpr final
|
||||
|
||||
/// Turn this message send into an instance message that
|
||||
/// computes the receiver object with the given expression.
|
||||
void setInstanceReceiver(Expr *rec) {
|
||||
void setInstanceReceiver(Expr *rec) {
|
||||
Kind = Instance;
|
||||
setReceiverPointer(rec);
|
||||
}
|
||||
|
||||
|
||||
/// Returns the type of a class message send, or NULL if the
|
||||
/// message is not a class message.
|
||||
QualType getClassReceiver() const {
|
||||
QualType getClassReceiver() const {
|
||||
if (TypeSourceInfo *TSInfo = getClassReceiverTypeInfo())
|
||||
return TSInfo->getType();
|
||||
|
||||
@ -1244,7 +1244,7 @@ class ObjCMessageExpr final
|
||||
|
||||
/// Retrieve the location of the 'super' keyword for a class
|
||||
/// or instance message to 'super', otherwise an invalid source location.
|
||||
SourceLocation getSuperLoc() const {
|
||||
SourceLocation getSuperLoc() const {
|
||||
if (getReceiverKind() == SuperInstance || getReceiverKind() == SuperClass)
|
||||
return SuperLoc;
|
||||
|
||||
@ -1274,7 +1274,7 @@ class ObjCMessageExpr final
|
||||
/// \returns The Objective-C interface if known, otherwise nullptr.
|
||||
ObjCInterfaceDecl *getReceiverInterface() const;
|
||||
|
||||
/// Retrieve the type referred to by 'super'.
|
||||
/// Retrieve the type referred to by 'super'.
|
||||
///
|
||||
/// The returned type will either be an ObjCInterfaceType (for an
|
||||
/// class message to super) or an ObjCObjectPointerType that refers
|
||||
@ -1294,26 +1294,26 @@ class ObjCMessageExpr final
|
||||
|
||||
Selector getSelector() const;
|
||||
|
||||
void setSelector(Selector S) {
|
||||
void setSelector(Selector S) {
|
||||
HasMethod = false;
|
||||
SelectorOrMethod = reinterpret_cast<uintptr_t>(S.getAsOpaquePtr());
|
||||
}
|
||||
|
||||
const ObjCMethodDecl *getMethodDecl() const {
|
||||
const ObjCMethodDecl *getMethodDecl() const {
|
||||
if (HasMethod)
|
||||
return reinterpret_cast<const ObjCMethodDecl *>(SelectorOrMethod);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ObjCMethodDecl *getMethodDecl() {
|
||||
ObjCMethodDecl *getMethodDecl() {
|
||||
if (HasMethod)
|
||||
return reinterpret_cast<ObjCMethodDecl *>(SelectorOrMethod);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void setMethodDecl(ObjCMethodDecl *MD) {
|
||||
void setMethodDecl(ObjCMethodDecl *MD) {
|
||||
HasMethod = true;
|
||||
SelectorOrMethod = reinterpret_cast<uintptr_t>(MD);
|
||||
}
|
||||
@ -1414,16 +1414,16 @@ class ObjCMessageExpr final
|
||||
|
||||
arg_iterator arg_begin() { return reinterpret_cast<Stmt **>(getArgs()); }
|
||||
|
||||
arg_iterator arg_end() {
|
||||
return reinterpret_cast<Stmt **>(getArgs() + NumArgs);
|
||||
arg_iterator arg_end() {
|
||||
return reinterpret_cast<Stmt **>(getArgs() + NumArgs);
|
||||
}
|
||||
|
||||
const_arg_iterator arg_begin() const {
|
||||
return reinterpret_cast<Stmt const * const*>(getArgs());
|
||||
const_arg_iterator arg_begin() const {
|
||||
return reinterpret_cast<Stmt const * const*>(getArgs());
|
||||
}
|
||||
|
||||
const_arg_iterator arg_end() const {
|
||||
return reinterpret_cast<Stmt const * const*>(getArgs() + NumArgs);
|
||||
const_arg_iterator arg_end() const {
|
||||
return reinterpret_cast<Stmt const * const*>(getArgs() + NumArgs);
|
||||
}
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
@ -1439,7 +1439,7 @@ class ObjCIsaExpr : public Expr {
|
||||
|
||||
/// IsaMemberLoc - This is the location of the 'isa'.
|
||||
SourceLocation IsaMemberLoc;
|
||||
|
||||
|
||||
/// OpLoc - This is the location of '.' or '->'
|
||||
SourceLocation OpLoc;
|
||||
|
||||
@ -1468,18 +1468,18 @@ class ObjCIsaExpr : public Expr {
|
||||
/// location of 'F'.
|
||||
SourceLocation getIsaMemberLoc() const { return IsaMemberLoc; }
|
||||
void setIsaMemberLoc(SourceLocation L) { IsaMemberLoc = L; }
|
||||
|
||||
|
||||
SourceLocation getOpLoc() const { return OpLoc; }
|
||||
void setOpLoc(SourceLocation L) { OpLoc = L; }
|
||||
|
||||
SourceLocation getLocStart() const LLVM_READONLY {
|
||||
return getBase()->getLocStart();
|
||||
}
|
||||
|
||||
|
||||
SourceLocation getBaseLocEnd() const LLVM_READONLY {
|
||||
return getBase()->getLocEnd();
|
||||
}
|
||||
|
||||
|
||||
SourceLocation getLocEnd() const LLVM_READONLY { return IsaMemberLoc; }
|
||||
|
||||
SourceLocation getExprLoc() const LLVM_READONLY { return IsaMemberLoc; }
|
||||
@ -1546,7 +1546,7 @@ class ObjCIndirectCopyRestoreExpr : public Expr {
|
||||
/// copy-restore. If false, the temporary will be zero-initialized.
|
||||
bool shouldCopy() const { return ObjCIndirectCopyRestoreExprBits.ShouldCopy; }
|
||||
|
||||
child_range children() { return child_range(&Operand, &Operand+1); }
|
||||
child_range children() { return child_range(&Operand, &Operand+1); }
|
||||
|
||||
// Source locations are determined by the subexpression.
|
||||
SourceLocation getLocStart() const LLVM_READONLY {
|
||||
@ -1571,7 +1571,8 @@ class ObjCIndirectCopyRestoreExpr : public Expr {
|
||||
/// \endcode
|
||||
class ObjCBridgedCastExpr final
|
||||
: public ExplicitCastExpr,
|
||||
private llvm::TrailingObjects<ObjCBridgedCastExpr, CXXBaseSpecifier *> {
|
||||
private llvm::TrailingObjects<
|
||||
ObjCBridgedCastExpr, CastExpr::BasePathSizeTy, CXXBaseSpecifier *> {
|
||||
friend class ASTStmtReader;
|
||||
friend class ASTStmtWriter;
|
||||
friend class CastExpr;
|
||||
@ -1581,6 +1582,10 @@ class ObjCBridgedCastExpr final
|
||||
SourceLocation BridgeKeywordLoc;
|
||||
unsigned Kind : 2;
|
||||
|
||||
size_t numTrailingObjects(OverloadToken<CastExpr::BasePathSizeTy>) const {
|
||||
return path_empty() ? 0 : 1;
|
||||
}
|
||||
|
||||
public:
|
||||
ObjCBridgedCastExpr(SourceLocation LParenLoc, ObjCBridgeCastKind Kind,
|
||||
CastKind CK, SourceLocation BridgeKeywordLoc,
|
||||
@ -1588,7 +1593,7 @@ class ObjCBridgedCastExpr final
|
||||
: ExplicitCastExpr(ObjCBridgedCastExprClass, TSInfo->getType(), VK_RValue,
|
||||
CK, Operand, 0, TSInfo),
|
||||
LParenLoc(LParenLoc), BridgeKeywordLoc(BridgeKeywordLoc), Kind(Kind) {}
|
||||
|
||||
|
||||
/// Construct an empty Objective-C bridged cast.
|
||||
explicit ObjCBridgedCastExpr(EmptyShell Shell)
|
||||
: ExplicitCastExpr(ObjCBridgedCastExprClass, Shell, 0) {}
|
||||
@ -1596,22 +1601,22 @@ class ObjCBridgedCastExpr final
|
||||
SourceLocation getLParenLoc() const { return LParenLoc; }
|
||||
|
||||
/// Determine which kind of bridge is being performed via this cast.
|
||||
ObjCBridgeCastKind getBridgeKind() const {
|
||||
return static_cast<ObjCBridgeCastKind>(Kind);
|
||||
ObjCBridgeCastKind getBridgeKind() const {
|
||||
return static_cast<ObjCBridgeCastKind>(Kind);
|
||||
}
|
||||
|
||||
|
||||
/// Retrieve the kind of bridge being performed as a string.
|
||||
StringRef getBridgeKindName() const;
|
||||
|
||||
|
||||
/// The location of the bridge keyword.
|
||||
SourceLocation getBridgeKeywordLoc() const { return BridgeKeywordLoc; }
|
||||
|
||||
|
||||
SourceLocation getLocStart() const LLVM_READONLY { return LParenLoc; }
|
||||
|
||||
SourceLocation getLocEnd() const LLVM_READONLY {
|
||||
return getSubExpr()->getLocEnd();
|
||||
}
|
||||
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == ObjCBridgedCastExprClass;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace clang {
|
||||
/// lookup. In this case, Origins contains an entry overriding lookup and
|
||||
/// specifying the correct pair of DeclContext/ASTContext.
|
||||
///
|
||||
/// - The DeclContext of origin was determined by another ExterenalASTMerger.
|
||||
/// - The DeclContext of origin was determined by another ExterenalASTMerger.
|
||||
/// (This is possible when the source ASTContext for one of the Importers has
|
||||
/// its own ExternalASTMerger). The origin must be properly forwarded in this
|
||||
/// case.
|
||||
@ -57,7 +57,7 @@ class ExternalASTMerger : public ExternalASTSource {
|
||||
typedef std::map<const DeclContext *, DCOrigin> OriginMap;
|
||||
typedef std::vector<std::unique_ptr<ASTImporter>> ImporterVector;
|
||||
private:
|
||||
/// One importer exists for each source.
|
||||
/// One importer exists for each source.
|
||||
ImporterVector Importers;
|
||||
/// Overrides in case name lookup would return nothing or would return
|
||||
/// the wrong thing.
|
||||
@ -106,7 +106,7 @@ class ExternalASTMerger : public ExternalASTSource {
|
||||
/// Remove a set of ASTContexts as possible origins.
|
||||
///
|
||||
/// Sometimes an origin goes away (for example, if a source file gets
|
||||
/// superseded by a newer version).
|
||||
/// superseded by a newer version).
|
||||
///
|
||||
/// The caller is responsible for ensuring that this doesn't leave
|
||||
/// DeclContexts that can't be completed.
|
||||
@ -163,7 +163,7 @@ class ExternalASTMerger : public ExternalASTSource {
|
||||
template <typename CallbackType>
|
||||
void ForEachMatchingDC(const DeclContext *DC, CallbackType Callback);
|
||||
|
||||
public:
|
||||
public:
|
||||
/// Log something if there is a logging callback installed.
|
||||
llvm::raw_ostream &logs() { return *LogStream; }
|
||||
|
||||
|
@ -270,10 +270,10 @@ class ExternalASTSource : public RefCountedBase<ExternalASTSource> {
|
||||
///
|
||||
/// The default implementation of this method is a no-op.
|
||||
virtual void PrintStats();
|
||||
|
||||
|
||||
/// Perform layout on the given record.
|
||||
///
|
||||
/// This routine allows the external AST source to provide an specific
|
||||
/// This routine allows the external AST source to provide an specific
|
||||
/// layout for a record, overriding the layout that would normally be
|
||||
/// constructed. It is intended for clients who receive specific layout
|
||||
/// details rather than source code (such as LLDB). The client is expected
|
||||
@ -290,13 +290,13 @@ class ExternalASTSource : public RefCountedBase<ExternalASTSource> {
|
||||
/// expressed in bits. All of the fields must be provided with offsets.
|
||||
///
|
||||
/// \param BaseOffsets The offset of each of the direct, non-virtual base
|
||||
/// classes. If any bases are not given offsets, the bases will be laid
|
||||
/// classes. If any bases are not given offsets, the bases will be laid
|
||||
/// out according to the ABI.
|
||||
///
|
||||
/// \param VirtualBaseOffsets The offset of each of the virtual base classes
|
||||
/// (either direct or not). If any bases are not given offsets, the bases will be laid
|
||||
/// (either direct or not). If any bases are not given offsets, the bases will be laid
|
||||
/// out according to the ABI.
|
||||
///
|
||||
///
|
||||
/// \returns true if the record layout was provided, false otherwise.
|
||||
virtual bool layoutRecordType(
|
||||
const RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
|
||||
@ -307,15 +307,15 @@ class ExternalASTSource : public RefCountedBase<ExternalASTSource> {
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Queries for performance analysis.
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
|
||||
struct MemoryBufferSizes {
|
||||
size_t malloc_bytes;
|
||||
size_t mmap_bytes;
|
||||
|
||||
|
||||
MemoryBufferSizes(size_t malloc_bytes, size_t mmap_bytes)
|
||||
: malloc_bytes(malloc_bytes), mmap_bytes(mmap_bytes) {}
|
||||
};
|
||||
|
||||
|
||||
/// Return the amount of memory used by memory buffers, breaking down
|
||||
/// by heap-backed versus mmap'ed memory.
|
||||
MemoryBufferSizes getMemoryBufferSizes() const {
|
||||
@ -512,10 +512,10 @@ namespace clang {
|
||||
/// Represents a lazily-loaded vector of data.
|
||||
///
|
||||
/// The lazily-loaded vector of data contains data that is partially loaded
|
||||
/// from an external source and partially added by local translation. The
|
||||
/// from an external source and partially added by local translation. The
|
||||
/// items loaded from the external source are loaded lazily, when needed for
|
||||
/// iteration over the complete vector.
|
||||
template<typename T, typename Source,
|
||||
template<typename T, typename Source,
|
||||
void (Source::*Loader)(SmallVectorImpl<T>&),
|
||||
unsigned LoadedStorage = 2, unsigned LocalStorage = 4>
|
||||
class LazyVector {
|
||||
@ -564,20 +564,20 @@ class LazyVector {
|
||||
iterator begin(Source *source, bool LocalOnly = false) {
|
||||
if (LocalOnly)
|
||||
return iterator(this, 0);
|
||||
|
||||
|
||||
if (source)
|
||||
(source->*Loader)(Loaded);
|
||||
return iterator(this, -(int)Loaded.size());
|
||||
}
|
||||
|
||||
|
||||
iterator end() {
|
||||
return iterator(this, Local.size());
|
||||
}
|
||||
|
||||
|
||||
void push_back(const T& LocalValue) {
|
||||
Local.push_back(LocalValue);
|
||||
}
|
||||
|
||||
|
||||
void erase(iterator From, iterator To) {
|
||||
if (From.isLoaded() && To.isLoaded()) {
|
||||
Loaded.erase(&*From, &*To);
|
||||
|
@ -57,7 +57,7 @@ class GlobalDecl {
|
||||
GlobalDecl CanonGD;
|
||||
CanonGD.Value.setPointer(Value.getPointer()->getCanonicalDecl());
|
||||
CanonGD.Value.setInt(Value.getInt());
|
||||
|
||||
|
||||
return CanonGD;
|
||||
}
|
||||
|
||||
@ -72,11 +72,11 @@ class GlobalDecl {
|
||||
assert(isa<CXXDestructorDecl>(getDecl()) && "Decl is not a dtor!");
|
||||
return static_cast<CXXDtorType>(Value.getInt());
|
||||
}
|
||||
|
||||
|
||||
friend bool operator==(const GlobalDecl &LHS, const GlobalDecl &RHS) {
|
||||
return LHS.Value == RHS.Value;
|
||||
}
|
||||
|
||||
|
||||
void *getAsOpaquePtr() const { return Value.getOpaqueValue(); }
|
||||
|
||||
static GlobalDecl getFromOpaquePtr(void *P) {
|
||||
@ -84,7 +84,7 @@ class GlobalDecl {
|
||||
GD.Value.setFromOpaqueValue(P);
|
||||
return GD;
|
||||
}
|
||||
|
||||
|
||||
GlobalDecl getWithDecl(const Decl *D) {
|
||||
GlobalDecl Result(*this);
|
||||
Result.Value.setPointer(D);
|
||||
@ -100,7 +100,7 @@ namespace llvm {
|
||||
static inline clang::GlobalDecl getEmptyKey() {
|
||||
return clang::GlobalDecl();
|
||||
}
|
||||
|
||||
|
||||
static inline clang::GlobalDecl getTombstoneKey() {
|
||||
return clang::GlobalDecl::
|
||||
getFromOpaquePtr(reinterpret_cast<void*>(-1));
|
||||
@ -109,13 +109,13 @@ namespace llvm {
|
||||
static unsigned getHashValue(clang::GlobalDecl GD) {
|
||||
return DenseMapInfo<void*>::getHashValue(GD.getAsOpaquePtr());
|
||||
}
|
||||
|
||||
static bool isEqual(clang::GlobalDecl LHS,
|
||||
|
||||
static bool isEqual(clang::GlobalDecl LHS,
|
||||
clang::GlobalDecl RHS) {
|
||||
return LHS == RHS;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// GlobalDecl isn't *technically* a POD type. However, its copy constructor,
|
||||
// copy assignment operator, and destructor are all trivial.
|
||||
template <>
|
||||
|
@ -41,7 +41,7 @@ class LambdaCapture {
|
||||
};
|
||||
|
||||
// Decl could represent:
|
||||
// - a VarDecl* that represents the variable that was captured or the
|
||||
// - a VarDecl* that represents the variable that was captured or the
|
||||
// init-capture.
|
||||
// - or, is a nullptr and Capture_This is set in Bits if this represents a
|
||||
// capture of '*this' by value or reference.
|
||||
|
@ -73,7 +73,7 @@ class MangleContext {
|
||||
DiagnosticsEngine &getDiags() const { return Diags; }
|
||||
|
||||
virtual void startNewFunction() { LocalBlockIds.clear(); }
|
||||
|
||||
|
||||
unsigned getBlockId(const BlockDecl *BD, bool Local) {
|
||||
llvm::DenseMap<const BlockDecl *, unsigned> &BlockIds
|
||||
= Local? LocalBlockIds : GlobalBlockIds;
|
||||
|
@ -113,7 +113,7 @@ class NSAPI {
|
||||
NSMutableDict_setValueForKey
|
||||
};
|
||||
static const unsigned NumNSDictionaryMethods = 13;
|
||||
|
||||
|
||||
/// The Objective-C NSDictionary selectors.
|
||||
Selector getNSDictionarySelector(NSDictionaryMethodKind MK) const;
|
||||
|
||||
|
@ -44,7 +44,7 @@ class TypeLoc;
|
||||
/// specifier. Nested name specifiers are made up of a sequence of
|
||||
/// specifiers, each of which can be a namespace, type, identifier
|
||||
/// (for dependent names), decltype specifier, or the global specifier ('::').
|
||||
/// The last two specifiers can only appear at the start of a
|
||||
/// The last two specifiers can only appear at the start of a
|
||||
/// nested-namespace-specifier.
|
||||
class NestedNameSpecifier : public llvm::FoldingSetNode {
|
||||
/// Enumeration describing
|
||||
@ -438,7 +438,7 @@ class NestedNameSpecifierLocBuilder {
|
||||
/// Turn this (empty) nested-name-specifier into the global
|
||||
/// nested-name-specifier '::'.
|
||||
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc);
|
||||
|
||||
|
||||
/// Turns this (empty) nested-name-specifier into '__super'
|
||||
/// nested-name-specifier.
|
||||
///
|
||||
@ -452,7 +452,7 @@ class NestedNameSpecifierLocBuilder {
|
||||
/// name.
|
||||
///
|
||||
/// \param ColonColonLoc The location of the trailing '::'.
|
||||
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD,
|
||||
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD,
|
||||
SourceLocation SuperLoc, SourceLocation ColonColonLoc);
|
||||
|
||||
/// Make a new nested-name-specifier from incomplete source-location
|
||||
|
@ -307,7 +307,7 @@ CAST_OPERATION(AtomicToNonAtomic)
|
||||
/// Converts from T to _Atomic(T).
|
||||
CAST_OPERATION(NonAtomicToAtomic)
|
||||
|
||||
/// Causes a block literal to by copied to the heap and then
|
||||
/// Causes a block literal to by copied to the heap and then
|
||||
/// autoreleased.
|
||||
///
|
||||
/// This particular cast kind is used for the conversion from a C++11
|
||||
@ -391,13 +391,13 @@ BINARY_OPERATION(Comma, ",")
|
||||
// [C99 6.5.2.4] Postfix increment and decrement
|
||||
UNARY_OPERATION(PostInc, "++")
|
||||
UNARY_OPERATION(PostDec, "--")
|
||||
// [C99 6.5.3.1] Prefix increment and decrement
|
||||
// [C99 6.5.3.1] Prefix increment and decrement
|
||||
UNARY_OPERATION(PreInc, "++")
|
||||
UNARY_OPERATION(PreDec, "--")
|
||||
// [C99 6.5.3.2] Address and indirection
|
||||
UNARY_OPERATION(AddrOf, "&")
|
||||
UNARY_OPERATION(Deref, "*")
|
||||
// [C99 6.5.3.3] Unary arithmetic
|
||||
// [C99 6.5.3.3] Unary arithmetic
|
||||
UNARY_OPERATION(Plus, "+")
|
||||
UNARY_OPERATION(Minus, "-")
|
||||
UNARY_OPERATION(Not, "~")
|
||||
|
@ -16,7 +16,7 @@
|
||||
#define LLVM_CLANG_AST_OPERATIONKINDS_H
|
||||
|
||||
namespace clang {
|
||||
|
||||
|
||||
/// CastKind - The kind of operation required for a conversion.
|
||||
enum CastKind {
|
||||
#define CAST_OPERATION(Name) CK_##Name,
|
||||
|
@ -109,7 +109,7 @@ struct PrintingPolicy {
|
||||
/// Suppress printing parts of scope specifiers that don't need
|
||||
/// to be written, e.g., for inline or anonymous namespaces.
|
||||
bool SuppressUnwrittenScope : 1;
|
||||
|
||||
|
||||
/// Suppress printing of variable initializers.
|
||||
///
|
||||
/// This flag is used when printing the loop variable in a for-range
|
||||
@ -140,15 +140,15 @@ struct PrintingPolicy {
|
||||
/// char a[9] = "A string";
|
||||
/// \endcode
|
||||
bool ConstantArraySizeAsWritten : 1;
|
||||
|
||||
|
||||
/// When printing an anonymous tag name, also print the location of that
|
||||
/// entity (e.g., "enum <anonymous at t.h:10:5>"). Otherwise, just prints
|
||||
/// "(anonymous)" for the name.
|
||||
bool AnonymousTagLocations : 1;
|
||||
|
||||
|
||||
/// When true, suppress printing of the __strong lifetime qualifier in ARC.
|
||||
unsigned SuppressStrongLifetime : 1;
|
||||
|
||||
|
||||
/// When true, suppress printing of lifetime qualifier in ARC.
|
||||
unsigned SuppressLifetimeQualifiers : 1;
|
||||
|
||||
@ -179,7 +179,7 @@ struct PrintingPolicy {
|
||||
/// declarations inside namespaces etc. Effectively, this should print
|
||||
/// only the requested declaration.
|
||||
unsigned TerseOutput : 1;
|
||||
|
||||
|
||||
/// When true, do certain refinement needed for producing proper declaration
|
||||
/// tag; such as, do not print attributes attached to the declaration.
|
||||
///
|
||||
|
@ -71,6 +71,10 @@ class ASTRecordLayout {
|
||||
// Alignment - Alignment of record in characters.
|
||||
CharUnits Alignment;
|
||||
|
||||
// UnadjustedAlignment - Maximum of the alignments of the record members in
|
||||
// characters.
|
||||
CharUnits UnadjustedAlignment;
|
||||
|
||||
/// RequiredAlignment - The required alignment of the object. In the MS-ABI
|
||||
/// the __declspec(align()) trumps #pramga pack and must always be obeyed.
|
||||
CharUnits RequiredAlignment;
|
||||
@ -120,10 +124,10 @@ class ASTRecordLayout {
|
||||
|
||||
/// BaseSharingVBPtr - The base we share vbptr with.
|
||||
const CXXRecordDecl *BaseSharingVBPtr;
|
||||
|
||||
|
||||
/// FIXME: This should really use a SmallPtrMap, once we have one in LLVM :)
|
||||
using BaseOffsetsMapTy = llvm::DenseMap<const CXXRecordDecl *, CharUnits>;
|
||||
|
||||
|
||||
/// BaseOffsets - Contains a map from base classes to their offset.
|
||||
BaseOffsetsMapTy BaseOffsets;
|
||||
|
||||
@ -136,6 +140,7 @@ class ASTRecordLayout {
|
||||
CXXRecordLayoutInfo *CXXInfo = nullptr;
|
||||
|
||||
ASTRecordLayout(const ASTContext &Ctx, CharUnits size, CharUnits alignment,
|
||||
CharUnits unadjustedAlignment,
|
||||
CharUnits requiredAlignment, CharUnits datasize,
|
||||
ArrayRef<uint64_t> fieldoffsets);
|
||||
|
||||
@ -144,6 +149,7 @@ class ASTRecordLayout {
|
||||
// Constructor for C++ records.
|
||||
ASTRecordLayout(const ASTContext &Ctx,
|
||||
CharUnits size, CharUnits alignment,
|
||||
CharUnits unadjustedAlignment,
|
||||
CharUnits requiredAlignment,
|
||||
bool hasOwnVFPtr, bool hasExtendableVFPtr,
|
||||
CharUnits vbptroffset,
|
||||
@ -162,7 +168,7 @@ class ASTRecordLayout {
|
||||
~ASTRecordLayout() = default;
|
||||
|
||||
void Destroy(ASTContext &Ctx);
|
||||
|
||||
|
||||
public:
|
||||
ASTRecordLayout(const ASTRecordLayout &) = delete;
|
||||
ASTRecordLayout &operator=(const ASTRecordLayout &) = delete;
|
||||
@ -170,6 +176,10 @@ class ASTRecordLayout {
|
||||
/// getAlignment - Get the record alignment in characters.
|
||||
CharUnits getAlignment() const { return Alignment; }
|
||||
|
||||
/// getUnadjustedAlignment - Get the record alignment in characters, before
|
||||
/// alignment adjustement.
|
||||
CharUnits getUnadjustedAlignment() const { return UnadjustedAlignment; }
|
||||
|
||||
/// getSize - Get the record size in characters.
|
||||
CharUnits getSize() const { return Size; }
|
||||
|
||||
@ -259,7 +269,7 @@ class ASTRecordLayout {
|
||||
assert(CXXInfo && "Record layout does not have C++ specific info!");
|
||||
return CXXInfo->HasExtendableVFPtr;
|
||||
}
|
||||
|
||||
|
||||
/// hasOwnVBPtr - Does this class provide its own virtual-base
|
||||
/// table pointer, rather than inheriting one from a primary base
|
||||
/// class?
|
||||
|
@ -204,7 +204,7 @@ class alignas(void *) Stmt {
|
||||
|
||||
unsigned Kind : 6;
|
||||
unsigned PartOfExplicitCast : 1; // Only set for ImplicitCastExpr.
|
||||
unsigned BasePathSize : 32 - 6 - 1 - NumExprBits;
|
||||
unsigned BasePathIsEmpty : 1;
|
||||
};
|
||||
|
||||
class CallExprBitfields {
|
||||
@ -271,12 +271,12 @@ class alignas(void *) Stmt {
|
||||
friend class ASTStmtReader;
|
||||
friend class ASTStmtWriter;
|
||||
friend class TypeTraitExpr;
|
||||
|
||||
|
||||
unsigned : NumExprBits;
|
||||
|
||||
|
||||
/// The kind of type trait, which is a value of a TypeTrait enumerator.
|
||||
unsigned Kind : 8;
|
||||
|
||||
|
||||
/// If this expression is not value-dependent, this indicates whether
|
||||
/// the trait evaluated true or false.
|
||||
unsigned Value : 1;
|
||||
@ -1556,7 +1556,7 @@ class AsmStmt : public Stmt {
|
||||
/// getInputConstraint - Return the specified input constraint. Unlike output
|
||||
/// constraints, these can be empty.
|
||||
StringRef getInputConstraint(unsigned i) const;
|
||||
|
||||
|
||||
const Expr *getInputExpr(unsigned i) const;
|
||||
|
||||
//===--- Other ---===//
|
||||
@ -2133,7 +2133,7 @@ class CapturedStmt : public Stmt {
|
||||
/// The number of variable captured, including 'this'.
|
||||
unsigned NumCaptures;
|
||||
|
||||
/// The pointer part is the implicit the outlined function and the
|
||||
/// The pointer part is the implicit the outlined function and the
|
||||
/// int part is the captured region kind, 'CR_Default' etc.
|
||||
llvm::PointerIntPair<CapturedDecl *, 2, CapturedRegionKind> CapDeclAndKind;
|
||||
|
||||
|
@ -33,14 +33,14 @@ class StmtIteratorBase {
|
||||
DeclGroupMode = 0x2,
|
||||
Flags = 0x3
|
||||
};
|
||||
|
||||
|
||||
union {
|
||||
Stmt **stmt;
|
||||
Decl **DGI;
|
||||
};
|
||||
uintptr_t RawVAPtr = 0;
|
||||
Decl **DGE;
|
||||
|
||||
|
||||
StmtIteratorBase(Stmt **s) : stmt(s) {}
|
||||
StmtIteratorBase(const VariableArrayType *t);
|
||||
StmtIteratorBase(Decl **dgi, Decl **dge);
|
||||
|
@ -81,7 +81,7 @@ class ObjCAtCatchStmt : public Stmt {
|
||||
ObjCAtCatchStmt(SourceLocation atCatchLoc, SourceLocation rparenloc,
|
||||
VarDecl *catchVarDecl,
|
||||
Stmt *atCatchStmt)
|
||||
: Stmt(ObjCAtCatchStmtClass), ExceptionDecl(catchVarDecl),
|
||||
: Stmt(ObjCAtCatchStmtClass), ExceptionDecl(catchVarDecl),
|
||||
Body(atCatchStmt), AtCatchLoc(atCatchLoc), RParenLoc(rparenloc) { }
|
||||
|
||||
explicit ObjCAtCatchStmt(EmptyShell Empty) :
|
||||
@ -155,27 +155,27 @@ class ObjCAtTryStmt : public Stmt {
|
||||
private:
|
||||
// The location of the @ in the \@try.
|
||||
SourceLocation AtTryLoc;
|
||||
|
||||
|
||||
// The number of catch blocks in this statement.
|
||||
unsigned NumCatchStmts : 16;
|
||||
|
||||
|
||||
// Whether this statement has a \@finally statement.
|
||||
bool HasFinally : 1;
|
||||
|
||||
|
||||
/// Retrieve the statements that are stored after this \@try statement.
|
||||
///
|
||||
/// The order of the statements in memory follows the order in the source,
|
||||
/// with the \@try body first, followed by the \@catch statements (if any)
|
||||
/// and, finally, the \@finally (if it exists).
|
||||
Stmt **getStmts() { return reinterpret_cast<Stmt **> (this + 1); }
|
||||
const Stmt* const *getStmts() const {
|
||||
return reinterpret_cast<const Stmt * const*> (this + 1);
|
||||
const Stmt* const *getStmts() const {
|
||||
return reinterpret_cast<const Stmt * const*> (this + 1);
|
||||
}
|
||||
|
||||
|
||||
ObjCAtTryStmt(SourceLocation atTryLoc, Stmt *atTryStmt,
|
||||
Stmt **CatchStmts, unsigned NumCatchStmts,
|
||||
Stmt *atFinallyStmt);
|
||||
|
||||
|
||||
explicit ObjCAtTryStmt(EmptyShell Empty, unsigned NumCatchStmts,
|
||||
bool HasFinally)
|
||||
: Stmt(ObjCAtTryStmtClass, Empty), NumCatchStmts(NumCatchStmts),
|
||||
@ -188,7 +188,7 @@ class ObjCAtTryStmt : public Stmt {
|
||||
Stmt *atFinallyStmt);
|
||||
static ObjCAtTryStmt *CreateEmpty(const ASTContext &Context,
|
||||
unsigned NumCatchStmts, bool HasFinally);
|
||||
|
||||
|
||||
/// Retrieve the location of the @ in the \@try.
|
||||
SourceLocation getAtTryLoc() const { return AtTryLoc; }
|
||||
void setAtTryLoc(SourceLocation Loc) { AtTryLoc = Loc; }
|
||||
@ -201,41 +201,41 @@ class ObjCAtTryStmt : public Stmt {
|
||||
/// Retrieve the number of \@catch statements in this try-catch-finally
|
||||
/// block.
|
||||
unsigned getNumCatchStmts() const { return NumCatchStmts; }
|
||||
|
||||
|
||||
/// Retrieve a \@catch statement.
|
||||
const ObjCAtCatchStmt *getCatchStmt(unsigned I) const {
|
||||
assert(I < NumCatchStmts && "Out-of-bounds @catch index");
|
||||
return cast_or_null<ObjCAtCatchStmt>(getStmts()[I + 1]);
|
||||
}
|
||||
|
||||
|
||||
/// Retrieve a \@catch statement.
|
||||
ObjCAtCatchStmt *getCatchStmt(unsigned I) {
|
||||
assert(I < NumCatchStmts && "Out-of-bounds @catch index");
|
||||
return cast_or_null<ObjCAtCatchStmt>(getStmts()[I + 1]);
|
||||
}
|
||||
|
||||
|
||||
/// Set a particular catch statement.
|
||||
void setCatchStmt(unsigned I, ObjCAtCatchStmt *S) {
|
||||
assert(I < NumCatchStmts && "Out-of-bounds @catch index");
|
||||
getStmts()[I + 1] = S;
|
||||
}
|
||||
|
||||
|
||||
/// Retrieve the \@finally statement, if any.
|
||||
const ObjCAtFinallyStmt *getFinallyStmt() const {
|
||||
if (!HasFinally)
|
||||
return nullptr;
|
||||
|
||||
|
||||
return cast_or_null<ObjCAtFinallyStmt>(getStmts()[1 + NumCatchStmts]);
|
||||
}
|
||||
ObjCAtFinallyStmt *getFinallyStmt() {
|
||||
if (!HasFinally)
|
||||
return nullptr;
|
||||
|
||||
|
||||
return cast_or_null<ObjCAtFinallyStmt>(getStmts()[1 + NumCatchStmts]);
|
||||
}
|
||||
void setFinallyStmt(Stmt *S) {
|
||||
void setFinallyStmt(Stmt *S) {
|
||||
assert(HasFinally && "@try does not have a @finally slot!");
|
||||
getStmts()[1 + NumCatchStmts] = S;
|
||||
getStmts()[1 + NumCatchStmts] = S;
|
||||
}
|
||||
|
||||
SourceLocation getLocStart() const LLVM_READONLY { return AtTryLoc; }
|
||||
|
@ -2319,7 +2319,7 @@ class OMPTargetDataDirective : public OMPExecutableDirective {
|
||||
///
|
||||
OMPTargetDataDirective(SourceLocation StartLoc, SourceLocation EndLoc,
|
||||
unsigned NumClauses)
|
||||
: OMPExecutableDirective(this, OMPTargetDataDirectiveClass,
|
||||
: OMPExecutableDirective(this, OMPTargetDataDirectiveClass,
|
||||
OMPD_target_data, StartLoc, EndLoc, NumClauses,
|
||||
1) {}
|
||||
|
||||
@ -2328,7 +2328,7 @@ class OMPTargetDataDirective : public OMPExecutableDirective {
|
||||
/// \param NumClauses Number of clauses.
|
||||
///
|
||||
explicit OMPTargetDataDirective(unsigned NumClauses)
|
||||
: OMPExecutableDirective(this, OMPTargetDataDirectiveClass,
|
||||
: OMPExecutableDirective(this, OMPTargetDataDirectiveClass,
|
||||
OMPD_target_data, SourceLocation(),
|
||||
SourceLocation(), NumClauses, 1) {}
|
||||
|
||||
@ -3157,7 +3157,7 @@ class OMPDistributeParallelForSimdDirective final : public OMPLoopDirective {
|
||||
unsigned CollapsedNum,
|
||||
unsigned NumClauses)
|
||||
: OMPLoopDirective(this, OMPDistributeParallelForSimdDirectiveClass,
|
||||
OMPD_distribute_parallel_for_simd, StartLoc,
|
||||
OMPD_distribute_parallel_for_simd, StartLoc,
|
||||
EndLoc, CollapsedNum, NumClauses) {}
|
||||
|
||||
/// Build an empty directive.
|
||||
@ -3168,7 +3168,7 @@ class OMPDistributeParallelForSimdDirective final : public OMPLoopDirective {
|
||||
explicit OMPDistributeParallelForSimdDirective(unsigned CollapsedNum,
|
||||
unsigned NumClauses)
|
||||
: OMPLoopDirective(this, OMPDistributeParallelForSimdDirectiveClass,
|
||||
OMPD_distribute_parallel_for_simd,
|
||||
OMPD_distribute_parallel_for_simd,
|
||||
SourceLocation(), SourceLocation(), CollapsedNum,
|
||||
NumClauses) {}
|
||||
|
||||
@ -3232,7 +3232,7 @@ class OMPDistributeSimdDirective final : public OMPLoopDirective {
|
||||
/// \param CollapsedNum Number of collapsed nested loops.
|
||||
/// \param NumClauses Number of clauses.
|
||||
///
|
||||
explicit OMPDistributeSimdDirective(unsigned CollapsedNum,
|
||||
explicit OMPDistributeSimdDirective(unsigned CollapsedNum,
|
||||
unsigned NumClauses)
|
||||
: OMPLoopDirective(this, OMPDistributeSimdDirectiveClass,
|
||||
OMPD_distribute_simd, SourceLocation(),
|
||||
@ -3369,7 +3369,7 @@ class OMPTargetSimdDirective final : public OMPLoopDirective {
|
||||
/// \param NumClauses Number of clauses.
|
||||
///
|
||||
explicit OMPTargetSimdDirective(unsigned CollapsedNum, unsigned NumClauses)
|
||||
: OMPLoopDirective(this, OMPTargetSimdDirectiveClass, OMPD_target_simd,
|
||||
: OMPLoopDirective(this, OMPTargetSimdDirectiveClass, OMPD_target_simd,
|
||||
SourceLocation(),SourceLocation(), CollapsedNum,
|
||||
NumClauses) {}
|
||||
|
||||
@ -3425,8 +3425,8 @@ class OMPTeamsDistributeDirective final : public OMPLoopDirective {
|
||||
///
|
||||
OMPTeamsDistributeDirective(SourceLocation StartLoc, SourceLocation EndLoc,
|
||||
unsigned CollapsedNum, unsigned NumClauses)
|
||||
: OMPLoopDirective(this, OMPTeamsDistributeDirectiveClass,
|
||||
OMPD_teams_distribute, StartLoc, EndLoc,
|
||||
: OMPLoopDirective(this, OMPTeamsDistributeDirectiveClass,
|
||||
OMPD_teams_distribute, StartLoc, EndLoc,
|
||||
CollapsedNum, NumClauses) {}
|
||||
|
||||
/// Build an empty directive.
|
||||
@ -3567,7 +3567,7 @@ class OMPTeamsDistributeParallelForSimdDirective final
|
||||
unsigned CollapsedNum,
|
||||
unsigned NumClauses)
|
||||
: OMPLoopDirective(this, OMPTeamsDistributeParallelForSimdDirectiveClass,
|
||||
OMPD_teams_distribute_parallel_for_simd, StartLoc,
|
||||
OMPD_teams_distribute_parallel_for_simd, StartLoc,
|
||||
EndLoc, CollapsedNum, NumClauses) {}
|
||||
|
||||
/// Build an empty directive.
|
||||
@ -3578,7 +3578,7 @@ class OMPTeamsDistributeParallelForSimdDirective final
|
||||
explicit OMPTeamsDistributeParallelForSimdDirective(unsigned CollapsedNum,
|
||||
unsigned NumClauses)
|
||||
: OMPLoopDirective(this, OMPTeamsDistributeParallelForSimdDirectiveClass,
|
||||
OMPD_teams_distribute_parallel_for_simd,
|
||||
OMPD_teams_distribute_parallel_for_simd,
|
||||
SourceLocation(), SourceLocation(), CollapsedNum,
|
||||
NumClauses) {}
|
||||
|
||||
|
@ -252,7 +252,7 @@ class TemplateArgument {
|
||||
|
||||
/// Determine whether this template argument is a pack expansion.
|
||||
bool isPackExpansion() const;
|
||||
|
||||
|
||||
/// Retrieve the type for a type template argument.
|
||||
QualType getAsType() const {
|
||||
assert(getKind() == Type && "Unexpected kind");
|
||||
@ -288,14 +288,14 @@ class TemplateArgument {
|
||||
TemplateName getAsTemplateOrTemplatePattern() const {
|
||||
assert((getKind() == Template || getKind() == TemplateExpansion) &&
|
||||
"Unexpected kind");
|
||||
|
||||
|
||||
return TemplateName::getFromVoidPointer(TemplateArg.Name);
|
||||
}
|
||||
|
||||
/// Retrieve the number of expansions that a template template argument
|
||||
/// expansion will produce, if known.
|
||||
Optional<unsigned> getNumTemplateExpansions() const;
|
||||
|
||||
|
||||
/// Retrieve the template argument as an integral value.
|
||||
// FIXME: Provide a way to read the integral data without copying the value.
|
||||
llvm::APSInt getAsIntegral() const {
|
||||
@ -378,13 +378,13 @@ class TemplateArgument {
|
||||
|
||||
/// Print this template argument to the given output stream.
|
||||
void print(const PrintingPolicy &Policy, raw_ostream &Out) const;
|
||||
|
||||
|
||||
/// Debugging aid that dumps the template argument.
|
||||
void dump(raw_ostream &Out) const;
|
||||
|
||||
/// Debugging aid that dumps the template argument to standard error.
|
||||
void dump() const;
|
||||
|
||||
|
||||
/// Used to insert TemplateArguments into FoldingSets.
|
||||
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) const;
|
||||
};
|
||||
@ -411,9 +411,9 @@ struct TemplateArgumentLocInfo {
|
||||
constexpr TemplateArgumentLocInfo() : Template({nullptr, nullptr, 0, 0}) {}
|
||||
|
||||
TemplateArgumentLocInfo(TypeSourceInfo *TInfo) : Declarator(TInfo) {}
|
||||
|
||||
|
||||
TemplateArgumentLocInfo(Expr *E) : Expression(E) {}
|
||||
|
||||
|
||||
TemplateArgumentLocInfo(NestedNameSpecifierLoc QualifierLoc,
|
||||
SourceLocation TemplateNameLoc,
|
||||
SourceLocation EllipsisLoc) {
|
||||
@ -432,14 +432,14 @@ struct TemplateArgumentLocInfo {
|
||||
}
|
||||
|
||||
NestedNameSpecifierLoc getTemplateQualifierLoc() const {
|
||||
return NestedNameSpecifierLoc(Template.Qualifier,
|
||||
return NestedNameSpecifierLoc(Template.Qualifier,
|
||||
Template.QualifierLocData);
|
||||
}
|
||||
|
||||
|
||||
SourceLocation getTemplateNameLoc() const {
|
||||
return SourceLocation::getFromRawEncoding(Template.TemplateNameLoc);
|
||||
}
|
||||
|
||||
|
||||
SourceLocation getTemplateEllipsisLoc() const {
|
||||
return SourceLocation::getFromRawEncoding(Template.EllipsisLoc);
|
||||
}
|
||||
@ -465,10 +465,16 @@ class TemplateArgumentLoc {
|
||||
|
||||
TemplateArgumentLoc(const TemplateArgument &Argument, Expr *E)
|
||||
: Argument(Argument), LocInfo(E) {
|
||||
assert(Argument.getKind() == TemplateArgument::Expression);
|
||||
|
||||
// Permit any kind of template argument that can be represented with an
|
||||
// expression
|
||||
assert(Argument.getKind() == TemplateArgument::NullPtr ||
|
||||
Argument.getKind() == TemplateArgument::Integral ||
|
||||
Argument.getKind() == TemplateArgument::Declaration ||
|
||||
Argument.getKind() == TemplateArgument::Expression);
|
||||
}
|
||||
|
||||
TemplateArgumentLoc(const TemplateArgument &Argument,
|
||||
TemplateArgumentLoc(const TemplateArgument &Argument,
|
||||
NestedNameSpecifierLoc QualifierLoc,
|
||||
SourceLocation TemplateNameLoc,
|
||||
SourceLocation EllipsisLoc = SourceLocation())
|
||||
@ -477,13 +483,13 @@ class TemplateArgumentLoc {
|
||||
assert(Argument.getKind() == TemplateArgument::Template ||
|
||||
Argument.getKind() == TemplateArgument::TemplateExpansion);
|
||||
}
|
||||
|
||||
|
||||
/// - Fetches the primary location of the argument.
|
||||
SourceLocation getLocation() const {
|
||||
if (Argument.getKind() == TemplateArgument::Template ||
|
||||
Argument.getKind() == TemplateArgument::TemplateExpansion)
|
||||
return getTemplateNameLoc();
|
||||
|
||||
|
||||
return getSourceRange().getBegin();
|
||||
}
|
||||
|
||||
@ -528,13 +534,13 @@ class TemplateArgumentLoc {
|
||||
Argument.getKind() == TemplateArgument::TemplateExpansion);
|
||||
return LocInfo.getTemplateQualifierLoc();
|
||||
}
|
||||
|
||||
|
||||
SourceLocation getTemplateNameLoc() const {
|
||||
assert(Argument.getKind() == TemplateArgument::Template ||
|
||||
Argument.getKind() == TemplateArgument::TemplateExpansion);
|
||||
return LocInfo.getTemplateNameLoc();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SourceLocation getTemplateEllipsisLoc() const {
|
||||
assert(Argument.getKind() == TemplateArgument::TemplateExpansion);
|
||||
return LocInfo.getTemplateEllipsisLoc();
|
||||
@ -689,7 +695,7 @@ inline const TemplateArgument &
|
||||
assert(Idx < getNumArgs() && "Template argument out of range");
|
||||
return getArgs()[Idx];
|
||||
}
|
||||
|
||||
|
||||
} // namespace clang
|
||||
|
||||
#endif // LLVM_CLANG_AST_TEMPLATEBASE_H
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <cassert>
|
||||
|
||||
namespace clang {
|
||||
|
||||
|
||||
class ASTContext;
|
||||
class DependentTemplateName;
|
||||
class DiagnosticBuilder;
|
||||
@ -38,7 +38,7 @@ class SubstTemplateTemplateParmStorage;
|
||||
class TemplateArgument;
|
||||
class TemplateDecl;
|
||||
class TemplateTemplateParmDecl;
|
||||
|
||||
|
||||
/// Implementation class used to describe either a set of overloaded
|
||||
/// template names or an already-substituted template template parameter pack.
|
||||
class UncommonTemplateNameStorage {
|
||||
@ -52,7 +52,7 @@ class UncommonTemplateNameStorage {
|
||||
struct BitsTag {
|
||||
/// A Kind.
|
||||
unsigned Kind : 2;
|
||||
|
||||
|
||||
/// The number of stored templates or template arguments,
|
||||
/// depending on which subclass we have.
|
||||
unsigned Size : 30;
|
||||
@ -62,21 +62,21 @@ class UncommonTemplateNameStorage {
|
||||
struct BitsTag Bits;
|
||||
void *PointerAlignment;
|
||||
};
|
||||
|
||||
|
||||
UncommonTemplateNameStorage(Kind kind, unsigned size) {
|
||||
Bits.Kind = kind;
|
||||
Bits.Size = size;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
unsigned size() const { return Bits.Size; }
|
||||
|
||||
|
||||
OverloadedTemplateStorage *getAsOverloadedStorage() {
|
||||
return Bits.Kind == Overloaded
|
||||
? reinterpret_cast<OverloadedTemplateStorage *>(this)
|
||||
? reinterpret_cast<OverloadedTemplateStorage *>(this)
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
|
||||
SubstTemplateTemplateParmStorage *getAsSubstTemplateTemplateParm() {
|
||||
return Bits.Kind == SubstTemplateTemplateParm
|
||||
? reinterpret_cast<SubstTemplateTemplateParmStorage *>(this)
|
||||
@ -89,13 +89,13 @@ class UncommonTemplateNameStorage {
|
||||
: nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// A structure for storing the information associated with an
|
||||
/// overloaded template name.
|
||||
class OverloadedTemplateStorage : public UncommonTemplateNameStorage {
|
||||
friend class ASTContext;
|
||||
|
||||
OverloadedTemplateStorage(unsigned size)
|
||||
OverloadedTemplateStorage(unsigned size)
|
||||
: UncommonTemplateNameStorage(Overloaded, size) {}
|
||||
|
||||
NamedDecl **getStorage() {
|
||||
@ -115,7 +115,7 @@ class OverloadedTemplateStorage : public UncommonTemplateNameStorage {
|
||||
/// A structure for storing an already-substituted template template
|
||||
/// parameter pack.
|
||||
///
|
||||
/// This kind of template names occurs when the parameter pack has been
|
||||
/// This kind of template names occurs when the parameter pack has been
|
||||
/// provided with a template template argument pack in a context where its
|
||||
/// enclosing pack expansion could not be fully expanded.
|
||||
class SubstTemplateTemplateParmPackStorage
|
||||
@ -123,25 +123,25 @@ class SubstTemplateTemplateParmPackStorage
|
||||
{
|
||||
TemplateTemplateParmDecl *Parameter;
|
||||
const TemplateArgument *Arguments;
|
||||
|
||||
|
||||
public:
|
||||
SubstTemplateTemplateParmPackStorage(TemplateTemplateParmDecl *Parameter,
|
||||
unsigned Size,
|
||||
unsigned Size,
|
||||
const TemplateArgument *Arguments)
|
||||
: UncommonTemplateNameStorage(SubstTemplateTemplateParmPack, Size),
|
||||
Parameter(Parameter), Arguments(Arguments) {}
|
||||
|
||||
|
||||
/// Retrieve the template template parameter pack being substituted.
|
||||
TemplateTemplateParmDecl *getParameterPack() const {
|
||||
return Parameter;
|
||||
}
|
||||
|
||||
|
||||
/// Retrieve the template template argument pack with which this
|
||||
/// parameter was substituted.
|
||||
TemplateArgument getArgumentPack() const;
|
||||
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Context);
|
||||
|
||||
|
||||
static void Profile(llvm::FoldingSetNodeID &ID,
|
||||
ASTContext &Context,
|
||||
TemplateTemplateParmDecl *Parameter,
|
||||
@ -193,11 +193,11 @@ class TemplateName {
|
||||
/// A set of overloaded template declarations.
|
||||
OverloadedTemplate,
|
||||
|
||||
/// A qualified template name, where the qualification is kept
|
||||
/// A qualified template name, where the qualification is kept
|
||||
/// to describe the source code as written.
|
||||
QualifiedTemplate,
|
||||
|
||||
/// A dependent template name that has not been resolved to a
|
||||
/// A dependent template name that has not been resolved to a
|
||||
/// template (or set of templates).
|
||||
DependentTemplate,
|
||||
|
||||
@ -205,7 +205,7 @@ class TemplateName {
|
||||
/// for some other template name.
|
||||
SubstTemplateTemplateParm,
|
||||
|
||||
/// A template template parameter pack that has been substituted for
|
||||
/// A template template parameter pack that has been substituted for
|
||||
/// a template template argument pack, but has not yet been expanded into
|
||||
/// individual arguments.
|
||||
SubstTemplateTemplateParmPack
|
||||
@ -221,7 +221,7 @@ class TemplateName {
|
||||
|
||||
/// Determine whether this template name is NULL.
|
||||
bool isNull() const;
|
||||
|
||||
|
||||
// Get the kind of name that is actually stored.
|
||||
NameKind getKind() const;
|
||||
|
||||
@ -243,14 +243,14 @@ class TemplateName {
|
||||
/// refers to a single template, returns NULL.
|
||||
OverloadedTemplateStorage *getAsOverloadedTemplate() const;
|
||||
|
||||
/// Retrieve the substituted template template parameter, if
|
||||
/// Retrieve the substituted template template parameter, if
|
||||
/// known.
|
||||
///
|
||||
/// \returns The storage for the substituted template template parameter,
|
||||
/// if known. Otherwise, returns NULL.
|
||||
SubstTemplateTemplateParmStorage *getAsSubstTemplateTemplateParm() const;
|
||||
|
||||
/// Retrieve the substituted template template parameter pack, if
|
||||
/// Retrieve the substituted template template parameter pack, if
|
||||
/// known.
|
||||
///
|
||||
/// \returns The storage for the substituted template template parameter pack,
|
||||
@ -339,7 +339,7 @@ class SubstTemplateTemplateParmStorage
|
||||
TemplateName getReplacement() const { return Replacement; }
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID &ID);
|
||||
|
||||
|
||||
static void Profile(llvm::FoldingSetNodeID &ID,
|
||||
TemplateTemplateParmDecl *parameter,
|
||||
TemplateName replacement);
|
||||
@ -436,7 +436,7 @@ class DependentTemplateName : public llvm::FoldingSetNode {
|
||||
///
|
||||
/// Only valid when the bit on \c Qualifier is clear.
|
||||
const IdentifierInfo *Identifier;
|
||||
|
||||
|
||||
/// The overloaded operator name.
|
||||
///
|
||||
/// Only valid when the bit on \c Qualifier is set.
|
||||
@ -453,26 +453,26 @@ class DependentTemplateName : public llvm::FoldingSetNode {
|
||||
|
||||
DependentTemplateName(NestedNameSpecifier *Qualifier,
|
||||
const IdentifierInfo *Identifier)
|
||||
: Qualifier(Qualifier, false), Identifier(Identifier),
|
||||
: Qualifier(Qualifier, false), Identifier(Identifier),
|
||||
CanonicalTemplateName(this) {}
|
||||
|
||||
DependentTemplateName(NestedNameSpecifier *Qualifier,
|
||||
const IdentifierInfo *Identifier,
|
||||
TemplateName Canon)
|
||||
: Qualifier(Qualifier, false), Identifier(Identifier),
|
||||
: Qualifier(Qualifier, false), Identifier(Identifier),
|
||||
CanonicalTemplateName(Canon) {}
|
||||
|
||||
DependentTemplateName(NestedNameSpecifier *Qualifier,
|
||||
OverloadedOperatorKind Operator)
|
||||
: Qualifier(Qualifier, true), Operator(Operator),
|
||||
: Qualifier(Qualifier, true), Operator(Operator),
|
||||
CanonicalTemplateName(this) {}
|
||||
|
||||
|
||||
DependentTemplateName(NestedNameSpecifier *Qualifier,
|
||||
OverloadedOperatorKind Operator,
|
||||
TemplateName Canon)
|
||||
: Qualifier(Qualifier, true), Operator(Operator),
|
||||
: Qualifier(Qualifier, true), Operator(Operator),
|
||||
CanonicalTemplateName(Canon) {}
|
||||
|
||||
|
||||
public:
|
||||
/// Return the nested name specifier that qualifies this name.
|
||||
NestedNameSpecifier *getQualifier() const { return Qualifier.getPointer(); }
|
||||
@ -481,22 +481,22 @@ class DependentTemplateName : public llvm::FoldingSetNode {
|
||||
bool isIdentifier() const { return !Qualifier.getInt(); }
|
||||
|
||||
/// Returns the identifier to which this template name refers.
|
||||
const IdentifierInfo *getIdentifier() const {
|
||||
const IdentifierInfo *getIdentifier() const {
|
||||
assert(isIdentifier() && "Template name isn't an identifier?");
|
||||
return Identifier;
|
||||
}
|
||||
|
||||
|
||||
/// Determine whether this template name refers to an overloaded
|
||||
/// operator.
|
||||
bool isOverloadedOperator() const { return Qualifier.getInt(); }
|
||||
|
||||
|
||||
/// Return the overloaded operator to which this template name refers.
|
||||
OverloadedOperatorKind getOperator() const {
|
||||
OverloadedOperatorKind getOperator() const {
|
||||
assert(isOverloadedOperator() &&
|
||||
"Template name isn't an overloaded operator?");
|
||||
return Operator;
|
||||
return Operator;
|
||||
}
|
||||
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID &ID) {
|
||||
if (isIdentifier())
|
||||
Profile(ID, getQualifier(), getIdentifier());
|
||||
|
@ -992,7 +992,7 @@ class QualType {
|
||||
static std::string getAsString(const Type *ty, Qualifiers qs,
|
||||
const PrintingPolicy &Policy);
|
||||
|
||||
std::string getAsString() const;
|
||||
std::string getAsString() const;
|
||||
std::string getAsString(const PrintingPolicy &Policy) const;
|
||||
|
||||
void print(raw_ostream &OS, const PrintingPolicy &Policy,
|
||||
@ -2017,6 +2017,9 @@ class Type : public ExtQualsTypeCommonBase {
|
||||
/// type of a class template or class template partial specialization.
|
||||
CXXRecordDecl *getAsCXXRecordDecl() const;
|
||||
|
||||
/// Retrieves the RecordDecl this type refers to.
|
||||
RecordDecl *getAsRecordDecl() const;
|
||||
|
||||
/// Retrieves the TagDecl that this type refers to, either
|
||||
/// because the type is a TagType or because it is the injected-class-name
|
||||
/// type of a class template or class template partial specialization.
|
||||
@ -2926,7 +2929,7 @@ class DependentSizedArrayType : public ArrayType {
|
||||
};
|
||||
|
||||
/// Represents an extended address space qualifier where the input address space
|
||||
/// value is dependent. Non-dependent address spaces are not represented with a
|
||||
/// value is dependent. Non-dependent address spaces are not represented with a
|
||||
/// special Type subclass; they are stored on an ExtQuals node as part of a QualType.
|
||||
///
|
||||
/// For example:
|
||||
@ -2945,7 +2948,7 @@ class DependentAddressSpaceType : public Type, public llvm::FoldingSetNode {
|
||||
SourceLocation loc;
|
||||
|
||||
DependentAddressSpaceType(const ASTContext &Context, QualType PointeeType,
|
||||
QualType can, Expr *AddrSpaceExpr,
|
||||
QualType can, Expr *AddrSpaceExpr,
|
||||
SourceLocation loc);
|
||||
|
||||
public:
|
||||
@ -3264,7 +3267,7 @@ class FunctionType : public Type {
|
||||
Bits = ((unsigned)cc) | (noReturn ? NoReturnMask : 0) |
|
||||
(producesResult ? ProducesResultMask : 0) |
|
||||
(noCallerSavedRegs ? NoCallerSavedRegsMask : 0) |
|
||||
(hasRegParm ? ((regParm + 1) << RegParmOffset) : 0) |
|
||||
(hasRegParm ? ((regParm + 1) << RegParmOffset) : 0) |
|
||||
(NoCfCheck ? NoCfCheckMask : 0);
|
||||
}
|
||||
|
||||
@ -4234,6 +4237,7 @@ class AttributedType : public Type, public llvm::FoldingSetNode {
|
||||
attr_null_unspecified,
|
||||
attr_objc_kindof,
|
||||
attr_objc_inert_unsafe_unretained,
|
||||
attr_lifetimebound,
|
||||
};
|
||||
|
||||
private:
|
||||
@ -5336,7 +5340,7 @@ class ObjCTypeParamType : public Type,
|
||||
/// with base C and no protocols.
|
||||
///
|
||||
/// 'C<P>' is an unspecialized ObjCObjectType with base C and protocol list [P].
|
||||
/// 'C<C*>' is a specialized ObjCObjectType with type arguments 'C*' and no
|
||||
/// 'C<C*>' is a specialized ObjCObjectType with type arguments 'C*' and no
|
||||
/// protocol list.
|
||||
/// 'C<C*><P>' is a specialized ObjCObjectType with base C, type arguments 'C*',
|
||||
/// and protocol list [P].
|
||||
@ -5968,7 +5972,7 @@ inline QualType QualType::getUnqualifiedType() const {
|
||||
|
||||
return QualType(getSplitUnqualifiedTypeImpl(*this).Ty, 0);
|
||||
}
|
||||
|
||||
|
||||
inline SplitQualType QualType::getSplitUnqualifiedType() const {
|
||||
if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
|
||||
return split();
|
||||
@ -6443,7 +6447,7 @@ inline bool Type::isIntegralOrEnumerationType() const {
|
||||
if (const auto *ET = dyn_cast<EnumType>(CanonicalType))
|
||||
return IsEnumDeclComplete(ET->getDecl());
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool Type::isBooleanType() const {
|
||||
|
@ -992,7 +992,7 @@ class ObjCObjectTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
|
||||
return (TypeSourceInfo**)this->getExtraLocalData();
|
||||
}
|
||||
|
||||
// SourceLocations are stored after the type argument information, one for
|
||||
// SourceLocations are stored after the type argument information, one for
|
||||
// each Protocol.
|
||||
SourceLocation *getProtocolLocArray() const {
|
||||
return (SourceLocation*)(getTypeArgLocArray() + getNumTypeArgs());
|
||||
@ -1131,11 +1131,11 @@ class ObjCInterfaceTypeLoc : public ConcreteTypeLoc<ObjCObjectTypeLoc,
|
||||
void setNameLoc(SourceLocation Loc) {
|
||||
getLocalData()->NameLoc = Loc;
|
||||
}
|
||||
|
||||
|
||||
SourceRange getLocalSourceRange() const {
|
||||
return SourceRange(getNameLoc(), getNameEndLoc());
|
||||
}
|
||||
|
||||
|
||||
SourceLocation getNameEndLoc() const {
|
||||
return getLocalData()->NameEndLoc;
|
||||
}
|
||||
@ -1766,10 +1766,10 @@ class DependentAddressSpaceTypeLoc
|
||||
return range;
|
||||
}
|
||||
|
||||
/// Returns the type before the address space attribute application
|
||||
/// area.
|
||||
/// Returns the type before the address space attribute application
|
||||
/// area.
|
||||
/// int * __attribute__((address_space(11))) *
|
||||
/// ^ ^
|
||||
/// ^ ^
|
||||
QualType getInnerType() const {
|
||||
return this->getTypePtr()->getPointeeType();
|
||||
}
|
||||
|
@ -56,20 +56,20 @@ namespace llvm {
|
||||
};
|
||||
|
||||
template<> struct DenseMapInfo<clang::CanQualType> {
|
||||
static inline clang::CanQualType getEmptyKey() {
|
||||
return clang::CanQualType();
|
||||
static inline clang::CanQualType getEmptyKey() {
|
||||
return clang::CanQualType();
|
||||
}
|
||||
|
||||
|
||||
static inline clang::CanQualType getTombstoneKey() {
|
||||
using clang::CanQualType;
|
||||
return CanQualType::getFromOpaquePtr(reinterpret_cast<clang::Type *>(-1));
|
||||
}
|
||||
|
||||
|
||||
static unsigned getHashValue(clang::CanQualType Val) {
|
||||
return (unsigned)((uintptr_t)Val.getAsOpaquePtr()) ^
|
||||
((unsigned)((uintptr_t)Val.getAsOpaquePtr() >> 9));
|
||||
}
|
||||
|
||||
|
||||
static bool isEqual(clang::CanQualType LHS, clang::CanQualType RHS) {
|
||||
return LHS == RHS;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ template <unsigned InlineCapacity> class UnresolvedSet :
|
||||
SmallVector<DeclAccessPair, InlineCapacity> Decls;
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace clang
|
||||
|
||||
#endif // LLVM_CLANG_AST_UNRESOLVEDSET_H
|
||||
|
@ -76,15 +76,15 @@ class VTTBuilder {
|
||||
const CXXRecordDecl *MostDerivedClass;
|
||||
|
||||
using VTTVTablesVectorTy = SmallVector<VTTVTable, 64>;
|
||||
|
||||
|
||||
/// The VTT vtables.
|
||||
VTTVTablesVectorTy VTTVTables;
|
||||
|
||||
|
||||
using VTTComponentsVectorTy = SmallVector<VTTComponent, 64>;
|
||||
|
||||
|
||||
/// The VTT components.
|
||||
VTTComponentsVectorTy VTTComponents;
|
||||
|
||||
|
||||
/// The AST record layout of the most derived class.
|
||||
const ASTRecordLayout &MostDerivedClassLayout;
|
||||
|
||||
@ -105,35 +105,35 @@ class VTTBuilder {
|
||||
/// Add a vtable pointer to the VTT currently being built.
|
||||
void AddVTablePointer(BaseSubobject Base, uint64_t VTableIndex,
|
||||
const CXXRecordDecl *VTableClass);
|
||||
|
||||
|
||||
/// Lay out the secondary VTTs of the given base subobject.
|
||||
void LayoutSecondaryVTTs(BaseSubobject Base);
|
||||
|
||||
|
||||
/// Lay out the secondary virtual pointers for the given base
|
||||
/// subobject.
|
||||
///
|
||||
/// \param BaseIsMorallyVirtual whether the base subobject is a virtual base
|
||||
/// or a direct or indirect base of a virtual base.
|
||||
void LayoutSecondaryVirtualPointers(BaseSubobject Base,
|
||||
void LayoutSecondaryVirtualPointers(BaseSubobject Base,
|
||||
bool BaseIsMorallyVirtual,
|
||||
uint64_t VTableIndex,
|
||||
const CXXRecordDecl *VTableClass,
|
||||
VisitedVirtualBasesSetTy &VBases);
|
||||
|
||||
|
||||
/// Lay out the secondary virtual pointers for the given base
|
||||
/// subobject.
|
||||
void LayoutSecondaryVirtualPointers(BaseSubobject Base,
|
||||
void LayoutSecondaryVirtualPointers(BaseSubobject Base,
|
||||
uint64_t VTableIndex);
|
||||
|
||||
/// Lay out the VTTs for the virtual base classes of the given
|
||||
/// record declaration.
|
||||
void LayoutVirtualVTTs(const CXXRecordDecl *RD,
|
||||
VisitedVirtualBasesSetTy &VBases);
|
||||
|
||||
|
||||
/// Lay out the VTT for the given subobject, including any
|
||||
/// secondary VTTs, secondary virtual pointers and virtual VTTs.
|
||||
void LayoutVTT(BaseSubobject Base, bool BaseIsVirtual);
|
||||
|
||||
|
||||
public:
|
||||
VTTBuilder(ASTContext &Ctx, const CXXRecordDecl *MostDerivedClass,
|
||||
bool GenerateDefinition);
|
||||
@ -142,17 +142,17 @@ class VTTBuilder {
|
||||
const VTTComponentsVectorTy &getVTTComponents() const {
|
||||
return VTTComponents;
|
||||
}
|
||||
|
||||
|
||||
// Returns a reference to the VTT vtables.
|
||||
const VTTVTablesVectorTy &getVTTVTables() const {
|
||||
return VTTVTables;
|
||||
}
|
||||
|
||||
|
||||
/// Returns a reference to the sub-VTT indices.
|
||||
const llvm::DenseMap<BaseSubobject, uint64_t> &getSubVTTIndicies() const {
|
||||
return SubVTTIndicies;
|
||||
}
|
||||
|
||||
|
||||
/// Returns a reference to the secondary virtual pointer indices.
|
||||
const llvm::DenseMap<BaseSubobject, uint64_t> &
|
||||
getSecondaryVirtualPointerIndices() const {
|
||||
|
@ -394,7 +394,7 @@ class ItaniumVTableContext : public VTableContextBase {
|
||||
|
||||
/// Return the offset in chars (relative to the vtable address point) where
|
||||
/// the offset of the virtual base that contains the given base is stored,
|
||||
/// otherwise, if no virtual base contains the given class, return 0.
|
||||
/// otherwise, if no virtual base contains the given class, return 0.
|
||||
///
|
||||
/// Base must be a virtual base class or an unambiguous base.
|
||||
CharUnits getVirtualBaseOffsetOffset(const CXXRecordDecl *RD,
|
||||
|
@ -1247,7 +1247,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCMethodDecl>
|
||||
objcMethodDecl;
|
||||
|
||||
/// Matches block declarations.
|
||||
///
|
||||
///
|
||||
/// Example matches the declaration of the nameless block printing an input
|
||||
/// integer.
|
||||
///
|
||||
@ -1654,7 +1654,6 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, DeclRefExpr>
|
||||
/// - (void) init {
|
||||
/// a = @"hello";
|
||||
/// }
|
||||
//}
|
||||
/// \endcode
|
||||
extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCIvarRefExpr>
|
||||
objcIvarRefExpr;
|
||||
@ -2886,7 +2885,7 @@ AST_MATCHER(ObjCMessageExpr, hasKeywordSelector) {
|
||||
AST_MATCHER_P(ObjCMessageExpr, numSelectorArgs, unsigned, N) {
|
||||
return Node.getSelector().getNumArgs() == N;
|
||||
}
|
||||
|
||||
|
||||
/// Matches if the call expression's callee expression matches.
|
||||
///
|
||||
/// Given
|
||||
@ -3679,7 +3678,7 @@ AST_POLYMORPHIC_MATCHER_P2(forEachArgumentWithParam,
|
||||
/// \code
|
||||
/// b = ^(int y) { printf("%d", y) };
|
||||
/// \endcode
|
||||
///
|
||||
///
|
||||
/// the matcher blockDecl(hasAnyParameter(hasName("y")))
|
||||
/// matches the declaration of the block b with hasParameter
|
||||
/// matching y.
|
||||
@ -5141,7 +5140,7 @@ extern const AstTypeMatcher<AutoType> autoType;
|
||||
/// int j = 42;
|
||||
/// decltype(i + j) result = i + j;
|
||||
/// \endcode
|
||||
/// decltypeType()
|
||||
/// decltypeType()
|
||||
/// matches "decltype(i + j)"
|
||||
extern const AstTypeMatcher<DecltypeType> decltypeType;
|
||||
|
||||
@ -6048,8 +6047,8 @@ AST_MATCHER(NamedDecl, hasExternalFormalLinkage) {
|
||||
/// void x(int val) {}
|
||||
/// void y(int val = 0) {}
|
||||
/// \endcode
|
||||
AST_MATCHER(ParmVarDecl, hasDefaultArgument) {
|
||||
return Node.hasDefaultArg();
|
||||
AST_MATCHER(ParmVarDecl, hasDefaultArgument) {
|
||||
return Node.hasDefaultArg();
|
||||
}
|
||||
|
||||
/// Matches array new expressions.
|
||||
|
@ -23,7 +23,7 @@ namespace clang {
|
||||
|
||||
class CFG;
|
||||
class CFGBlock;
|
||||
|
||||
|
||||
// A class that performs reachability queries for CFGBlocks. Several internal
|
||||
// checks in this checker require reachability information. The requests all
|
||||
// tend to have a common destination, so we lazily do a predecessor search
|
||||
@ -45,7 +45,7 @@ class CFGReverseBlockReachabilityAnalysis {
|
||||
private:
|
||||
void mapReachability(const CFGBlock *Dst);
|
||||
};
|
||||
|
||||
|
||||
} // namespace clang
|
||||
|
||||
#endif // LLVM_CLANG_ANALYSIS_ANALYSES_CFGREACHABILITYANALYSIS_H
|
||||
|
@ -38,18 +38,18 @@ class Stmt;
|
||||
class VarDecl;
|
||||
|
||||
namespace consumed {
|
||||
|
||||
|
||||
class ConsumedStmtVisitor;
|
||||
|
||||
enum ConsumedState {
|
||||
// No state information for the given variable.
|
||||
CS_None,
|
||||
|
||||
|
||||
CS_Unknown,
|
||||
CS_Unconsumed,
|
||||
CS_Consumed
|
||||
};
|
||||
|
||||
|
||||
using OptionalNotes = SmallVector<PartialDiagnosticAt, 1>;
|
||||
using DelayedDiag = std::pair<PartialDiagnosticAt, OptionalNotes>;
|
||||
using DiagList = std::list<DelayedDiag>;
|
||||
@ -60,7 +60,7 @@ namespace consumed {
|
||||
|
||||
/// Emit the warnings and notes left by the analysis.
|
||||
virtual void emitDiagnostics() {}
|
||||
|
||||
|
||||
/// Warn that a variable's state doesn't match at the entry and exit
|
||||
/// of a loop.
|
||||
///
|
||||
@ -70,7 +70,7 @@ namespace consumed {
|
||||
/// state.
|
||||
virtual void warnLoopStateMismatch(SourceLocation Loc,
|
||||
StringRef VariableName) {}
|
||||
|
||||
|
||||
/// Warn about parameter typestate mismatches upon return.
|
||||
///
|
||||
/// \param Loc -- The SourceLocation of the return statement.
|
||||
@ -84,22 +84,22 @@ namespace consumed {
|
||||
StringRef VariableName,
|
||||
StringRef ExpectedState,
|
||||
StringRef ObservedState) {}
|
||||
|
||||
|
||||
// FIXME: Add documentation.
|
||||
virtual void warnParamTypestateMismatch(SourceLocation LOC,
|
||||
StringRef ExpectedState,
|
||||
StringRef ObservedState) {}
|
||||
|
||||
|
||||
// FIXME: This can be removed when the attr propagation fix for templated
|
||||
// classes lands.
|
||||
/// Warn about return typestates set for unconsumable types.
|
||||
///
|
||||
///
|
||||
/// \param Loc -- The location of the attributes.
|
||||
///
|
||||
/// \param TypeName -- The name of the unconsumable type.
|
||||
virtual void warnReturnTypestateForUnconsumableType(SourceLocation Loc,
|
||||
StringRef TypeName) {}
|
||||
|
||||
|
||||
/// Warn about return typestate mismatches.
|
||||
///
|
||||
/// \param Loc -- The SourceLocation of the return statement.
|
||||
@ -144,71 +144,71 @@ namespace consumed {
|
||||
using VarMapType = llvm::DenseMap<const VarDecl *, ConsumedState>;
|
||||
using TmpMapType =
|
||||
llvm::DenseMap<const CXXBindTemporaryExpr *, ConsumedState>;
|
||||
|
||||
|
||||
protected:
|
||||
bool Reachable = true;
|
||||
const Stmt *From = nullptr;
|
||||
VarMapType VarMap;
|
||||
TmpMapType TmpMap;
|
||||
|
||||
|
||||
public:
|
||||
ConsumedStateMap() = default;
|
||||
ConsumedStateMap(const ConsumedStateMap &Other)
|
||||
: Reachable(Other.Reachable), From(Other.From), VarMap(Other.VarMap),
|
||||
TmpMap() {}
|
||||
|
||||
|
||||
/// Warn if any of the parameters being tracked are not in the state
|
||||
/// they were declared to be in upon return from a function.
|
||||
void checkParamsForReturnTypestate(SourceLocation BlameLoc,
|
||||
ConsumedWarningsHandlerBase &WarningsHandler) const;
|
||||
|
||||
|
||||
/// Clear the TmpMap.
|
||||
void clearTemporaries();
|
||||
|
||||
|
||||
/// Get the consumed state of a given variable.
|
||||
ConsumedState getState(const VarDecl *Var) const;
|
||||
|
||||
|
||||
/// Get the consumed state of a given temporary value.
|
||||
ConsumedState getState(const CXXBindTemporaryExpr *Tmp) const;
|
||||
|
||||
|
||||
/// Merge this state map with another map.
|
||||
void intersect(const ConsumedStateMap &Other);
|
||||
|
||||
void intersectAtLoopHead(const CFGBlock *LoopHead, const CFGBlock *LoopBack,
|
||||
const ConsumedStateMap *LoopBackStates,
|
||||
ConsumedWarningsHandlerBase &WarningsHandler);
|
||||
|
||||
|
||||
/// Return true if this block is reachable.
|
||||
bool isReachable() const { return Reachable; }
|
||||
|
||||
|
||||
/// Mark the block as unreachable.
|
||||
void markUnreachable();
|
||||
|
||||
|
||||
/// Set the source for a decision about the branching of states.
|
||||
/// \param Source -- The statement that was the origin of a branching
|
||||
/// decision.
|
||||
void setSource(const Stmt *Source) { this->From = Source; }
|
||||
|
||||
|
||||
/// Set the consumed state of a given variable.
|
||||
void setState(const VarDecl *Var, ConsumedState State);
|
||||
|
||||
|
||||
/// Set the consumed state of a given temporary value.
|
||||
void setState(const CXXBindTemporaryExpr *Tmp, ConsumedState State);
|
||||
|
||||
|
||||
/// Remove the temporary value from our state map.
|
||||
void remove(const CXXBindTemporaryExpr *Tmp);
|
||||
|
||||
|
||||
/// Tests to see if there is a mismatch in the states stored in two
|
||||
/// maps.
|
||||
///
|
||||
/// \param Other -- The second map to compare against.
|
||||
bool operator!=(const ConsumedStateMap *Other) const;
|
||||
};
|
||||
|
||||
|
||||
class ConsumedBlockInfo {
|
||||
std::vector<std::unique_ptr<ConsumedStateMap>> StateMapsArray;
|
||||
std::vector<unsigned int> VisitOrder;
|
||||
|
||||
|
||||
public:
|
||||
ConsumedBlockInfo() = default;
|
||||
|
||||
@ -218,7 +218,7 @@ namespace consumed {
|
||||
for (const auto BI : *SortedGraph)
|
||||
VisitOrder[BI->getBlockID()] = VisitOrderCounter++;
|
||||
}
|
||||
|
||||
|
||||
bool allBackEdgesVisited(const CFGBlock *CurrBlock,
|
||||
const CFGBlock *TargetBlock);
|
||||
|
||||
@ -228,7 +228,7 @@ namespace consumed {
|
||||
std::unique_ptr<ConsumedStateMap> StateMap);
|
||||
|
||||
ConsumedStateMap* borrowInfo(const CFGBlock *Block);
|
||||
|
||||
|
||||
void discardInfo(const CFGBlock *Block);
|
||||
|
||||
std::unique_ptr<ConsumedStateMap> getInfo(const CFGBlock *Block);
|
||||
@ -243,12 +243,12 @@ namespace consumed {
|
||||
std::unique_ptr<ConsumedStateMap> CurrStates;
|
||||
|
||||
ConsumedState ExpectedReturnState;
|
||||
|
||||
|
||||
void determineExpectedReturnState(AnalysisDeclContext &AC,
|
||||
const FunctionDecl *D);
|
||||
bool splitState(const CFGBlock *CurrBlock,
|
||||
const ConsumedStmtVisitor &Visitor);
|
||||
|
||||
|
||||
public:
|
||||
ConsumedWarningsHandlerBase &WarningsHandler;
|
||||
|
||||
@ -256,7 +256,7 @@ namespace consumed {
|
||||
: WarningsHandler(WarningsHandler) {}
|
||||
|
||||
ConsumedState getExpectedReturnState() const { return ExpectedReturnState; }
|
||||
|
||||
|
||||
/// Check a function's CFG for consumed violations.
|
||||
///
|
||||
/// We traverse the blocks in the CFG, keeping track of the state of each
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "llvm/ADT/GraphTraits.h"
|
||||
#include "llvm/ADT/iterator.h"
|
||||
#include "llvm/Support/GenericDomTree.h"
|
||||
#include "llvm/Support/GenericDomTreeConstruction.h"
|
||||
#include "llvm/Support/GenericDomTreeConstruction.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
||||
// FIXME: There is no good reason for the domtree to require a print method
|
||||
|
@ -236,7 +236,7 @@ class ConversionSpecifier {
|
||||
const char *toString() const;
|
||||
|
||||
bool isPrintfKind() const { return IsPrintf; }
|
||||
|
||||
|
||||
Optional<ConversionSpecifier> getStandardSpecifier() const;
|
||||
|
||||
protected:
|
||||
|
@ -25,7 +25,7 @@ class CFGBlock;
|
||||
class Stmt;
|
||||
class DeclRefExpr;
|
||||
class SourceManager;
|
||||
|
||||
|
||||
class LiveVariables : public ManagedAnalysis {
|
||||
public:
|
||||
class LivenessValues {
|
||||
@ -34,7 +34,7 @@ class LiveVariables : public ManagedAnalysis {
|
||||
llvm::ImmutableSet<const Stmt *> liveStmts;
|
||||
llvm::ImmutableSet<const VarDecl *> liveDecls;
|
||||
llvm::ImmutableSet<const BindingDecl *> liveBindings;
|
||||
|
||||
|
||||
bool equals(const LivenessValues &V) const;
|
||||
|
||||
LivenessValues()
|
||||
@ -48,21 +48,21 @@ class LiveVariables : public ManagedAnalysis {
|
||||
|
||||
bool isLive(const Stmt *S) const;
|
||||
bool isLive(const VarDecl *D) const;
|
||||
|
||||
friend class LiveVariables;
|
||||
|
||||
friend class LiveVariables;
|
||||
};
|
||||
|
||||
|
||||
class Observer {
|
||||
virtual void anchor();
|
||||
public:
|
||||
virtual ~Observer() {}
|
||||
|
||||
|
||||
/// A callback invoked right before invoking the
|
||||
/// liveness transfer function on the given statement.
|
||||
virtual void observeStmt(const Stmt *S,
|
||||
const CFGBlock *currentBlock,
|
||||
const LivenessValues& V) {}
|
||||
|
||||
|
||||
/// Called when the live variables analysis registers
|
||||
/// that a variable is killed.
|
||||
virtual void observerKill(const DeclRefExpr *DR) {}
|
||||
@ -73,47 +73,47 @@ class LiveVariables : public ManagedAnalysis {
|
||||
/// Compute the liveness information for a given CFG.
|
||||
static LiveVariables *computeLiveness(AnalysisDeclContext &analysisContext,
|
||||
bool killAtAssign);
|
||||
|
||||
|
||||
/// Return true if a variable is live at the end of a
|
||||
/// specified block.
|
||||
bool isLive(const CFGBlock *B, const VarDecl *D);
|
||||
|
||||
|
||||
/// Returns true if a variable is live at the beginning of the
|
||||
/// the statement. This query only works if liveness information
|
||||
/// has been recorded at the statement level (see runOnAllBlocks), and
|
||||
/// only returns liveness information for block-level expressions.
|
||||
bool isLive(const Stmt *S, const VarDecl *D);
|
||||
|
||||
|
||||
/// Returns true the block-level expression "value" is live
|
||||
/// before the given block-level expression (see runOnAllBlocks).
|
||||
bool isLive(const Stmt *Loc, const Stmt *StmtVal);
|
||||
|
||||
|
||||
/// Print to stderr the liveness information associated with
|
||||
/// each basic block.
|
||||
void dumpBlockLiveness(const SourceManager& M);
|
||||
|
||||
void runOnAllBlocks(Observer &obs);
|
||||
|
||||
|
||||
static LiveVariables *create(AnalysisDeclContext &analysisContext) {
|
||||
return computeLiveness(analysisContext, true);
|
||||
}
|
||||
|
||||
|
||||
static const void *getTag();
|
||||
|
||||
|
||||
private:
|
||||
LiveVariables(void *impl);
|
||||
void *impl;
|
||||
};
|
||||
|
||||
|
||||
class RelaxedLiveVariables : public LiveVariables {
|
||||
public:
|
||||
static LiveVariables *create(AnalysisDeclContext &analysisContext) {
|
||||
return computeLiveness(analysisContext, false);
|
||||
}
|
||||
|
||||
|
||||
static const void *getTag();
|
||||
};
|
||||
|
||||
|
||||
} // end namespace clang
|
||||
|
||||
#endif
|
||||
|
@ -57,7 +57,7 @@ class Callback {
|
||||
};
|
||||
|
||||
/// ScanReachableFromBlock - Mark all blocks reachable from Start.
|
||||
/// Returns the total number of blocks that were marked reachable.
|
||||
/// Returns the total number of blocks that were marked reachable.
|
||||
unsigned ScanReachableFromBlock(const CFGBlock *Start,
|
||||
llvm::BitVector &Reachable);
|
||||
|
||||
|
@ -500,7 +500,7 @@ class SExprBuilder {
|
||||
std::vector<til::BasicBlock *> BlockMap;
|
||||
|
||||
// Extra information per BB. Indexed by clang BlockID.
|
||||
std::vector<BlockInfo> BBInfo;
|
||||
std::vector<BlockInfo> BBInfo;
|
||||
|
||||
LVarDefinitionMap CurrentLVarMap;
|
||||
std::vector<til::Phi *> CurrentArguments;
|
||||
|
@ -111,7 +111,7 @@ class AnalysisDeclContext {
|
||||
AnalysisDeclContextManager *getManager() const {
|
||||
return Manager;
|
||||
}
|
||||
|
||||
|
||||
/// Return the build options used to construct the CFG.
|
||||
CFG::BuildOptions &getCFGBuildOptions() {
|
||||
return cfgBuildOptions;
|
||||
@ -190,7 +190,7 @@ class AnalysisDeclContext {
|
||||
const Stmt *S,
|
||||
const CFGBlock *Blk,
|
||||
unsigned Idx);
|
||||
|
||||
|
||||
const BlockInvocationContext *
|
||||
getBlockInvocationContext(const LocationContext *parent,
|
||||
const BlockDecl *BD,
|
||||
@ -359,7 +359,7 @@ class BlockInvocationContext : public LocationContext {
|
||||
friend class LocationContextManager;
|
||||
|
||||
const BlockDecl *BD;
|
||||
|
||||
|
||||
// FIXME: Come up with a more type-safe way to model context-sensitivity.
|
||||
const void *ContextData;
|
||||
|
||||
@ -372,7 +372,7 @@ class BlockInvocationContext : public LocationContext {
|
||||
~BlockInvocationContext() override = default;
|
||||
|
||||
const BlockDecl *getBlockDecl() const { return BD; }
|
||||
|
||||
|
||||
const void *getContextData() const { return ContextData; }
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID &ID) override;
|
||||
@ -403,7 +403,7 @@ class LocationContextManager {
|
||||
const ScopeContext *getScope(AnalysisDeclContext *ctx,
|
||||
const LocationContext *parent,
|
||||
const Stmt *s);
|
||||
|
||||
|
||||
const BlockInvocationContext *
|
||||
getBlockInvocationContext(AnalysisDeclContext *ctx,
|
||||
const LocationContext *parent,
|
||||
@ -463,7 +463,7 @@ class AnalysisDeclContextManager {
|
||||
CFG::BuildOptions &getCFGBuildOptions() {
|
||||
return cfgBuildOptions;
|
||||
}
|
||||
|
||||
|
||||
/// Return true if faux bodies should be synthesized for well-known
|
||||
/// functions.
|
||||
bool synthesizeBodies() const { return SynthesizeBodies; }
|
||||
|
@ -15,9 +15,10 @@
|
||||
#ifndef LLVM_CLANG_ANALYSIS_CFG_H
|
||||
#define LLVM_CLANG_ANALYSIS_CFG_H
|
||||
|
||||
#include "clang/AST/ExprCXX.h"
|
||||
#include "clang/Analysis/Support/BumpVector.h"
|
||||
#include "clang/Analysis/ConstructionContext.h"
|
||||
#include "clang/AST/ExprCXX.h"
|
||||
#include "clang/AST/ExprObjC.h"
|
||||
#include "clang/Basic/LLVM.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/GraphTraits.h"
|
||||
@ -51,7 +52,7 @@ class FieldDecl;
|
||||
class LangOptions;
|
||||
class VarDecl;
|
||||
|
||||
/// CFGElement - Represents a top-level expression in a basic block.
|
||||
/// Represents a top-level expression in a basic block.
|
||||
class CFGElement {
|
||||
public:
|
||||
enum Kind {
|
||||
@ -144,9 +145,9 @@ class CFGStmt : public CFGElement {
|
||||
CFGStmt() = default;
|
||||
};
|
||||
|
||||
/// CFGConstructor - Represents C++ constructor call. Maintains information
|
||||
/// necessary to figure out what memory is being initialized by the
|
||||
/// constructor expression. For now this is only used by the analyzer's CFG.
|
||||
/// Represents C++ constructor call. Maintains information necessary to figure
|
||||
/// out what memory is being initialized by the constructor expression. For now
|
||||
/// this is only used by the analyzer's CFG.
|
||||
class CFGConstructor : public CFGStmt {
|
||||
public:
|
||||
explicit CFGConstructor(CXXConstructExpr *CE, const ConstructionContext *C)
|
||||
@ -169,30 +170,34 @@ class CFGConstructor : public CFGStmt {
|
||||
}
|
||||
};
|
||||
|
||||
/// CFGCXXRecordTypedCall - Represents a function call that returns a C++ object
|
||||
/// by value. This, like constructor, requires a construction context in order
|
||||
/// to understand the storage of the returned object . In C such tracking is not
|
||||
/// necessary because no additional effort is required for destroying the object
|
||||
/// or modeling copy elision. Like CFGConstructor, this element is for now only
|
||||
/// used by the analyzer's CFG.
|
||||
/// Represents a function call that returns a C++ object by value. This, like
|
||||
/// constructor, requires a construction context in order to understand the
|
||||
/// storage of the returned object . In C such tracking is not necessary because
|
||||
/// no additional effort is required for destroying the object or modeling copy
|
||||
/// elision. Like CFGConstructor, this element is for now only used by the
|
||||
/// analyzer's CFG.
|
||||
class CFGCXXRecordTypedCall : public CFGStmt {
|
||||
public:
|
||||
/// Returns true when call expression \p CE needs to be represented
|
||||
/// by CFGCXXRecordTypedCall, as opposed to a regular CFGStmt.
|
||||
static bool isCXXRecordTypedCall(CallExpr *CE, const ASTContext &ACtx) {
|
||||
return CE->getCallReturnType(ACtx).getCanonicalType()->getAsCXXRecordDecl();
|
||||
static bool isCXXRecordTypedCall(Expr *E) {
|
||||
assert(isa<CallExpr>(E) || isa<ObjCMessageExpr>(E));
|
||||
// There is no such thing as reference-type expression. If the function
|
||||
// returns a reference, it'll return the respective lvalue or xvalue
|
||||
// instead, and we're only interested in objects.
|
||||
return !E->isGLValue() &&
|
||||
E->getType().getCanonicalType()->getAsCXXRecordDecl();
|
||||
}
|
||||
|
||||
explicit CFGCXXRecordTypedCall(CallExpr *CE, const ConstructionContext *C)
|
||||
: CFGStmt(CE, CXXRecordTypedCall) {
|
||||
// FIXME: This is not protected against squeezing a non-record-typed-call
|
||||
// into the constructor. An assertion would require passing an ASTContext
|
||||
// which would mean paying for something we don't use.
|
||||
explicit CFGCXXRecordTypedCall(Expr *E, const ConstructionContext *C)
|
||||
: CFGStmt(E, CXXRecordTypedCall) {
|
||||
assert(isCXXRecordTypedCall(E));
|
||||
assert(C && (isa<TemporaryObjectConstructionContext>(C) ||
|
||||
// These are possible in C++17 due to mandatory copy elision.
|
||||
isa<ReturnedValueConstructionContext>(C) ||
|
||||
isa<VariableConstructionContext>(C) ||
|
||||
isa<ConstructorInitializerConstructionContext>(C)));
|
||||
isa<ConstructorInitializerConstructionContext>(C) ||
|
||||
isa<ArgumentConstructionContext>(C)));
|
||||
Data2.setPointer(const_cast<ConstructionContext *>(C));
|
||||
}
|
||||
|
||||
@ -210,8 +215,8 @@ class CFGCXXRecordTypedCall : public CFGStmt {
|
||||
}
|
||||
};
|
||||
|
||||
/// CFGInitializer - Represents C++ base or member initializer from
|
||||
/// constructor's initialization list.
|
||||
/// Represents C++ base or member initializer from constructor's initialization
|
||||
/// list.
|
||||
class CFGInitializer : public CFGElement {
|
||||
public:
|
||||
explicit CFGInitializer(CXXCtorInitializer *initializer)
|
||||
@ -231,7 +236,7 @@ class CFGInitializer : public CFGElement {
|
||||
}
|
||||
};
|
||||
|
||||
/// CFGNewAllocator - Represents C++ allocator call.
|
||||
/// Represents C++ allocator call.
|
||||
class CFGNewAllocator : public CFGElement {
|
||||
public:
|
||||
explicit CFGNewAllocator(const CXXNewExpr *S)
|
||||
@ -349,8 +354,8 @@ class CFGScopeEnd : public CFGElement {
|
||||
}
|
||||
};
|
||||
|
||||
/// CFGImplicitDtor - Represents C++ object destructor implicitly generated
|
||||
/// by compiler on various occasions.
|
||||
/// Represents C++ object destructor implicitly generated by compiler on various
|
||||
/// occasions.
|
||||
class CFGImplicitDtor : public CFGElement {
|
||||
protected:
|
||||
CFGImplicitDtor() = default;
|
||||
@ -373,9 +378,9 @@ class CFGImplicitDtor : public CFGElement {
|
||||
}
|
||||
};
|
||||
|
||||
/// CFGAutomaticObjDtor - Represents C++ object destructor implicitly generated
|
||||
/// for automatic object or temporary bound to const reference at the point
|
||||
/// of leaving its local scope.
|
||||
/// Represents C++ object destructor implicitly generated for automatic object
|
||||
/// or temporary bound to const reference at the point of leaving its local
|
||||
/// scope.
|
||||
class CFGAutomaticObjDtor: public CFGImplicitDtor {
|
||||
public:
|
||||
CFGAutomaticObjDtor(const VarDecl *var, const Stmt *stmt)
|
||||
@ -400,8 +405,7 @@ class CFGAutomaticObjDtor: public CFGImplicitDtor {
|
||||
}
|
||||
};
|
||||
|
||||
/// CFGDeleteDtor - Represents C++ object destructor generated
|
||||
/// from a call to delete.
|
||||
/// Represents C++ object destructor generated from a call to delete.
|
||||
class CFGDeleteDtor : public CFGImplicitDtor {
|
||||
public:
|
||||
CFGDeleteDtor(const CXXRecordDecl *RD, const CXXDeleteExpr *DE)
|
||||
@ -426,8 +430,8 @@ class CFGDeleteDtor : public CFGImplicitDtor {
|
||||
}
|
||||
};
|
||||
|
||||
/// CFGBaseDtor - Represents C++ object destructor implicitly generated for
|
||||
/// base object in destructor.
|
||||
/// Represents C++ object destructor implicitly generated for base object in
|
||||
/// destructor.
|
||||
class CFGBaseDtor : public CFGImplicitDtor {
|
||||
public:
|
||||
CFGBaseDtor(const CXXBaseSpecifier *base)
|
||||
@ -447,8 +451,8 @@ class CFGBaseDtor : public CFGImplicitDtor {
|
||||
}
|
||||
};
|
||||
|
||||
/// CFGMemberDtor - Represents C++ object destructor implicitly generated for
|
||||
/// member object in destructor.
|
||||
/// Represents C++ object destructor implicitly generated for member object in
|
||||
/// destructor.
|
||||
class CFGMemberDtor : public CFGImplicitDtor {
|
||||
public:
|
||||
CFGMemberDtor(const FieldDecl *field)
|
||||
@ -468,8 +472,8 @@ class CFGMemberDtor : public CFGImplicitDtor {
|
||||
}
|
||||
};
|
||||
|
||||
/// CFGTemporaryDtor - Represents C++ object destructor implicitly generated
|
||||
/// at the end of full expression for temporary object.
|
||||
/// Represents C++ object destructor implicitly generated at the end of full
|
||||
/// expression for temporary object.
|
||||
class CFGTemporaryDtor : public CFGImplicitDtor {
|
||||
public:
|
||||
CFGTemporaryDtor(CXXBindTemporaryExpr *expr)
|
||||
@ -489,7 +493,7 @@ class CFGTemporaryDtor : public CFGImplicitDtor {
|
||||
}
|
||||
};
|
||||
|
||||
/// CFGTerminator - Represents CFGBlock terminator statement.
|
||||
/// Represents CFGBlock terminator statement.
|
||||
///
|
||||
/// TemporaryDtorsBranch bit is set to true if the terminator marks a branch
|
||||
/// in control flow of destructors of temporaries. In this case terminator
|
||||
@ -520,7 +524,7 @@ class CFGTerminator {
|
||||
explicit operator bool() const { return getStmt(); }
|
||||
};
|
||||
|
||||
/// CFGBlock - Represents a single basic block in a source-level CFG.
|
||||
/// Represents a single basic block in a source-level CFG.
|
||||
/// It consists of:
|
||||
///
|
||||
/// (1) A set of statements/expressions (which may contain subexpressions).
|
||||
@ -588,26 +592,24 @@ class CFGBlock {
|
||||
bool empty() const { return Impl.empty(); }
|
||||
};
|
||||
|
||||
/// Stmts - The set of statements in the basic block.
|
||||
/// The set of statements in the basic block.
|
||||
ElementList Elements;
|
||||
|
||||
/// Label - An (optional) label that prefixes the executable
|
||||
/// statements in the block. When this variable is non-NULL, it is
|
||||
/// either an instance of LabelStmt, SwitchCase or CXXCatchStmt.
|
||||
/// An (optional) label that prefixes the executable statements in the block.
|
||||
/// When this variable is non-NULL, it is either an instance of LabelStmt,
|
||||
/// SwitchCase or CXXCatchStmt.
|
||||
Stmt *Label = nullptr;
|
||||
|
||||
/// Terminator - The terminator for a basic block that
|
||||
/// indicates the type of control-flow that occurs between a block
|
||||
/// and its successors.
|
||||
/// The terminator for a basic block that indicates the type of control-flow
|
||||
/// that occurs between a block and its successors.
|
||||
CFGTerminator Terminator;
|
||||
|
||||
/// LoopTarget - Some blocks are used to represent the "loop edge" to
|
||||
/// the start of a loop from within the loop body. This Stmt* will be
|
||||
/// refer to the loop statement for such blocks (and be null otherwise).
|
||||
/// Some blocks are used to represent the "loop edge" to the start of a loop
|
||||
/// from within the loop body. This Stmt* will be refer to the loop statement
|
||||
/// for such blocks (and be null otherwise).
|
||||
const Stmt *LoopTarget = nullptr;
|
||||
|
||||
/// BlockID - A numerical ID assigned to a CFGBlock during construction
|
||||
/// of the CFG.
|
||||
/// A numerical ID assigned to a CFGBlock during construction of the CFG.
|
||||
unsigned BlockID;
|
||||
|
||||
public:
|
||||
@ -629,7 +631,7 @@ class CFGBlock {
|
||||
public:
|
||||
/// Construct an AdjacentBlock with a possibly unreachable block.
|
||||
AdjacentBlock(CFGBlock *B, bool IsReachable);
|
||||
|
||||
|
||||
/// Construct an AdjacentBlock with a reachable block and an alternate
|
||||
/// unreachable block.
|
||||
AdjacentBlock(CFGBlock *B, CFGBlock *AlternateBlock);
|
||||
@ -665,13 +667,12 @@ class CFGBlock {
|
||||
};
|
||||
|
||||
private:
|
||||
/// Predecessors/Successors - Keep track of the predecessor / successor
|
||||
/// CFG blocks.
|
||||
/// Keep track of the predecessor / successor CFG blocks.
|
||||
using AdjacentBlocks = BumpVector<AdjacentBlock>;
|
||||
AdjacentBlocks Preds;
|
||||
AdjacentBlocks Succs;
|
||||
|
||||
/// NoReturn - This bit is set when the basic block contains a function call
|
||||
/// This bit is set when the basic block contains a function call
|
||||
/// or implicit destructor that is attributed as 'noreturn'. In that case,
|
||||
/// control cannot technically ever proceed past this block. All such blocks
|
||||
/// will have a single immediate successor: the exit block. This allows them
|
||||
@ -682,7 +683,7 @@ class CFGBlock {
|
||||
/// storage if the memory usage of CFGBlock becomes an issue.
|
||||
unsigned HasNoReturnElement : 1;
|
||||
|
||||
/// Parent - The parent CFG that owns this CFGBlock.
|
||||
/// The parent CFG that owns this CFGBlock.
|
||||
CFG *Parent;
|
||||
|
||||
public:
|
||||
@ -878,10 +879,10 @@ class CFGBlock {
|
||||
Elements.push_back(CFGConstructor(CE, CC), C);
|
||||
}
|
||||
|
||||
void appendCXXRecordTypedCall(CallExpr *CE,
|
||||
void appendCXXRecordTypedCall(Expr *E,
|
||||
const ConstructionContext *CC,
|
||||
BumpVectorContext &C) {
|
||||
Elements.push_back(CFGCXXRecordTypedCall(CE, CC), C);
|
||||
Elements.push_back(CFGCXXRecordTypedCall(E, CC), C);
|
||||
}
|
||||
|
||||
void appendInitializer(CXXCtorInitializer *initializer,
|
||||
@ -992,7 +993,7 @@ class CFGCallback {
|
||||
bool isAlwaysTrue) {}
|
||||
};
|
||||
|
||||
/// CFG - Represents a source-level, intra-procedural CFG that represents the
|
||||
/// Represents a source-level, intra-procedural CFG that represents the
|
||||
/// control-flow of a Stmt. The Stmt can represent an entire function body,
|
||||
/// or a single expression. A CFG will always contain one empty block that
|
||||
/// represents the Exit point of the CFG. A CFG will also contain a designated
|
||||
@ -1044,21 +1045,21 @@ class CFG {
|
||||
}
|
||||
};
|
||||
|
||||
/// buildCFG - Builds a CFG from an AST.
|
||||
/// Builds a CFG from an AST.
|
||||
static std::unique_ptr<CFG> buildCFG(const Decl *D, Stmt *AST, ASTContext *C,
|
||||
const BuildOptions &BO);
|
||||
|
||||
/// createBlock - Create a new block in the CFG. The CFG owns the block;
|
||||
/// the caller should not directly free it.
|
||||
/// Create a new block in the CFG. The CFG owns the block; the caller should
|
||||
/// not directly free it.
|
||||
CFGBlock *createBlock();
|
||||
|
||||
/// setEntry - Set the entry block of the CFG. This is typically used
|
||||
/// only during CFG construction. Most CFG clients expect that the
|
||||
/// entry block has no predecessors and contains no statements.
|
||||
/// Set the entry block of the CFG. This is typically used only during CFG
|
||||
/// construction. Most CFG clients expect that the entry block has no
|
||||
/// predecessors and contains no statements.
|
||||
void setEntry(CFGBlock *B) { Entry = B; }
|
||||
|
||||
/// setIndirectGotoBlock - Set the block used for indirect goto jumps.
|
||||
/// This is typically used only during CFG construction.
|
||||
/// Set the block used for indirect goto jumps. This is typically used only
|
||||
/// during CFG construction.
|
||||
void setIndirectGotoBlock(CFGBlock *B) { IndirectGotoBlock = B; }
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
@ -1152,8 +1153,8 @@ class CFG {
|
||||
|
||||
template <typename CALLBACK>
|
||||
void VisitBlockStmts(CALLBACK& O) const {
|
||||
for (const_iterator I=begin(), E=end(); I != E; ++I)
|
||||
for (CFGBlock::const_iterator BI=(*I)->begin(), BE=(*I)->end();
|
||||
for (const_iterator I = begin(), E = end(); I != E; ++I)
|
||||
for (CFGBlock::const_iterator BI = (*I)->begin(), BE = (*I)->end();
|
||||
BI != BE; ++BI) {
|
||||
if (Optional<CFGStmt> stmt = BI->getAs<CFGStmt>())
|
||||
O(const_cast<Stmt*>(stmt->getStmt()));
|
||||
@ -1164,13 +1165,12 @@ class CFG {
|
||||
// CFG Introspection.
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
/// getNumBlockIDs - Returns the total number of BlockIDs allocated (which
|
||||
/// start at 0).
|
||||
/// Returns the total number of BlockIDs allocated (which start at 0).
|
||||
unsigned getNumBlockIDs() const { return NumBlockIDs; }
|
||||
|
||||
/// size - Return the total number of CFGBlocks within the CFG
|
||||
/// This is simply a renaming of the getNumBlockIDs(). This is necessary
|
||||
/// because the dominator implementation needs such an interface.
|
||||
/// Return the total number of CFGBlocks within the CFG This is simply a
|
||||
/// renaming of the getNumBlockIDs(). This is necessary because the dominator
|
||||
/// implementation needs such an interface.
|
||||
unsigned size() const { return NumBlockIDs; }
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
@ -19,20 +19,18 @@
|
||||
|
||||
namespace clang {
|
||||
|
||||
class CFG;
|
||||
class CFGBlock;
|
||||
class ParentMap;
|
||||
class Stmt;
|
||||
|
||||
class CFGStmtMap {
|
||||
ParentMap *PM;
|
||||
void *M;
|
||||
|
||||
|
||||
CFGStmtMap(ParentMap *pm, void *m) : PM(pm), M(m) {}
|
||||
|
||||
|
||||
public:
|
||||
~CFGStmtMap();
|
||||
|
||||
|
||||
/// Returns a new CFGMap for the given CFG. It is the caller's
|
||||
/// responsibility to 'delete' this object when done using it.
|
||||
static CFGStmtMap *Build(CFG* C, ParentMap *PM);
|
||||
|
@ -332,7 +332,7 @@ struct FilenamePatternConstraint {
|
||||
StringRef IgnoredFilesPattern;
|
||||
std::shared_ptr<llvm::Regex> IgnoredFilesRegex;
|
||||
|
||||
FilenamePatternConstraint(StringRef IgnoredFilesPattern)
|
||||
FilenamePatternConstraint(StringRef IgnoredFilesPattern)
|
||||
: IgnoredFilesPattern(IgnoredFilesPattern) {
|
||||
IgnoredFilesRegex = std::make_shared<llvm::Regex>("^(" +
|
||||
IgnoredFilesPattern.str() + "$)");
|
||||
|
@ -22,66 +22,201 @@
|
||||
|
||||
namespace clang {
|
||||
|
||||
/// Construction context is a linked list of multiple layers. Layers are
|
||||
/// created gradually while traversing the AST, and layers that represent
|
||||
/// the outmost AST nodes are built first, while the node that immediately
|
||||
/// contains the constructor would be built last and capture the previous
|
||||
/// layers as its parents. Construction context captures the last layer
|
||||
/// (which has links to the previous layers) and classifies the seemingly
|
||||
/// arbitrary chain of layers into one of the possible ways of constructing
|
||||
/// an object in C++ for user-friendly experience.
|
||||
class ConstructionContextLayer {
|
||||
/// Represents a single point (AST node) in the program that requires attention
|
||||
/// during construction of an object. ConstructionContext would be represented
|
||||
/// as a list of such items.
|
||||
class ConstructionContextItem {
|
||||
public:
|
||||
typedef llvm::PointerUnion<Stmt *, CXXCtorInitializer *> TriggerTy;
|
||||
enum ItemKind {
|
||||
VariableKind,
|
||||
NewAllocatorKind,
|
||||
ReturnKind,
|
||||
MaterializationKind,
|
||||
TemporaryDestructorKind,
|
||||
ElidedDestructorKind,
|
||||
ElidableConstructorKind,
|
||||
ArgumentKind,
|
||||
STATEMENT_WITH_INDEX_KIND_BEGIN=ArgumentKind,
|
||||
STATEMENT_WITH_INDEX_KIND_END=ArgumentKind,
|
||||
STATEMENT_KIND_BEGIN = VariableKind,
|
||||
STATEMENT_KIND_END = ArgumentKind,
|
||||
InitializerKind,
|
||||
INITIALIZER_KIND_BEGIN=InitializerKind,
|
||||
INITIALIZER_KIND_END=InitializerKind
|
||||
};
|
||||
|
||||
LLVM_DUMP_METHOD static StringRef getKindAsString(ItemKind K) {
|
||||
switch (K) {
|
||||
case VariableKind: return "construct into local variable";
|
||||
case NewAllocatorKind: return "construct into new-allocator";
|
||||
case ReturnKind: return "construct into return address";
|
||||
case MaterializationKind: return "materialize temporary";
|
||||
case TemporaryDestructorKind: return "destroy temporary";
|
||||
case ElidedDestructorKind: return "elide destructor";
|
||||
case ElidableConstructorKind: return "elide constructor";
|
||||
case ArgumentKind: return "construct into argument";
|
||||
case InitializerKind: return "construct into member variable";
|
||||
};
|
||||
llvm_unreachable("Unknown ItemKind");
|
||||
}
|
||||
|
||||
private:
|
||||
const void *const Data;
|
||||
const ItemKind Kind;
|
||||
const unsigned Index = 0;
|
||||
|
||||
bool hasStatement() const {
|
||||
return Kind >= STATEMENT_KIND_BEGIN &&
|
||||
Kind <= STATEMENT_KIND_END;
|
||||
}
|
||||
|
||||
bool hasIndex() const {
|
||||
return Kind >= STATEMENT_WITH_INDEX_KIND_BEGIN &&
|
||||
Kind >= STATEMENT_WITH_INDEX_KIND_END;
|
||||
}
|
||||
|
||||
bool hasInitializer() const {
|
||||
return Kind >= INITIALIZER_KIND_BEGIN &&
|
||||
Kind <= INITIALIZER_KIND_END;
|
||||
}
|
||||
|
||||
public:
|
||||
// ConstructionContextItem should be simple enough so that it was easy to
|
||||
// re-construct it from the AST node it captures. For that reason we provide
|
||||
// simple implicit conversions from all sorts of supported AST nodes.
|
||||
ConstructionContextItem(const DeclStmt *DS)
|
||||
: Data(DS), Kind(VariableKind) {}
|
||||
|
||||
ConstructionContextItem(const CXXNewExpr *NE)
|
||||
: Data(NE), Kind(NewAllocatorKind) {}
|
||||
|
||||
ConstructionContextItem(const ReturnStmt *RS)
|
||||
: Data(RS), Kind(ReturnKind) {}
|
||||
|
||||
ConstructionContextItem(const MaterializeTemporaryExpr *MTE)
|
||||
: Data(MTE), Kind(MaterializationKind) {}
|
||||
|
||||
ConstructionContextItem(const CXXBindTemporaryExpr *BTE,
|
||||
bool IsElided = false)
|
||||
: Data(BTE),
|
||||
Kind(IsElided ? ElidedDestructorKind : TemporaryDestructorKind) {}
|
||||
|
||||
ConstructionContextItem(const CXXConstructExpr *CE)
|
||||
: Data(CE), Kind(ElidableConstructorKind) {}
|
||||
|
||||
ConstructionContextItem(const CallExpr *CE, unsigned Index)
|
||||
: Data(CE), Kind(ArgumentKind), Index(Index) {}
|
||||
|
||||
ConstructionContextItem(const CXXConstructExpr *CE, unsigned Index)
|
||||
: Data(CE), Kind(ArgumentKind), Index(Index) {}
|
||||
|
||||
ConstructionContextItem(const ObjCMessageExpr *ME, unsigned Index)
|
||||
: Data(ME), Kind(ArgumentKind), Index(Index) {}
|
||||
|
||||
// A polymorphic version of the previous calls with dynamic type check.
|
||||
ConstructionContextItem(const Expr *E, unsigned Index)
|
||||
: Data(E), Kind(ArgumentKind), Index(Index) {
|
||||
assert(isa<CallExpr>(E) || isa<CXXConstructExpr>(E) ||
|
||||
isa<ObjCMessageExpr>(E));
|
||||
}
|
||||
|
||||
ConstructionContextItem(const CXXCtorInitializer *Init)
|
||||
: Data(Init), Kind(InitializerKind), Index(0) {}
|
||||
|
||||
ItemKind getKind() const { return Kind; }
|
||||
|
||||
LLVM_DUMP_METHOD StringRef getKindAsString() const {
|
||||
return getKindAsString(getKind());
|
||||
}
|
||||
|
||||
/// The construction site - the statement that triggered the construction
|
||||
/// for one of its parts. For instance, stack variable declaration statement
|
||||
/// triggers construction of itself or its elements if it's an array,
|
||||
/// new-expression triggers construction of the newly allocated object(s).
|
||||
TriggerTy Trigger;
|
||||
const Stmt *getStmt() const {
|
||||
assert(hasStatement());
|
||||
return static_cast<const Stmt *>(Data);
|
||||
}
|
||||
|
||||
/// Sometimes a single trigger is not enough to describe the construction
|
||||
/// site. In this case we'd have a chain of "partial" construction context
|
||||
/// layers.
|
||||
/// Some examples:
|
||||
/// - A constructor within in an aggregate initializer list within a variable
|
||||
/// would have a construction context of the initializer list with
|
||||
/// the parent construction context of a variable.
|
||||
/// - A constructor for a temporary that needs to be both destroyed
|
||||
/// and materialized into an elidable copy constructor would have a
|
||||
/// construction context of a CXXBindTemporaryExpr with the parent
|
||||
/// construction context of a MaterializeTemproraryExpr.
|
||||
/// Not all of these are currently supported.
|
||||
const Stmt *getStmtOrNull() const {
|
||||
return hasStatement() ? getStmt() : nullptr;
|
||||
}
|
||||
|
||||
/// The construction site is not necessarily a statement. It may also be a
|
||||
/// CXXCtorInitializer, which means that a member variable is being
|
||||
/// constructed during initialization of the object that contains it.
|
||||
const CXXCtorInitializer *getCXXCtorInitializer() const {
|
||||
assert(hasInitializer());
|
||||
return static_cast<const CXXCtorInitializer *>(Data);
|
||||
}
|
||||
|
||||
/// If a single trigger statement triggers multiple constructors, they are
|
||||
/// usually being enumerated. This covers function argument constructors
|
||||
/// triggered by a call-expression and items in an initializer list triggered
|
||||
/// by an init-list-expression.
|
||||
unsigned getIndex() const {
|
||||
// This is a fairly specific request. Let's make sure the user knows
|
||||
// what he's doing.
|
||||
assert(hasIndex());
|
||||
return Index;
|
||||
}
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID &ID) const {
|
||||
ID.AddPointer(Data);
|
||||
ID.AddInteger(Kind);
|
||||
ID.AddInteger(Index);
|
||||
}
|
||||
|
||||
bool operator==(const ConstructionContextItem &Other) const {
|
||||
// For most kinds the Index comparison is trivially true, but
|
||||
// checking kind separately doesn't seem to be less expensive
|
||||
// than checking Index. Same in operator<().
|
||||
return std::make_tuple(Data, Kind, Index) ==
|
||||
std::make_tuple(Other.Data, Other.Kind, Other.Index);
|
||||
}
|
||||
|
||||
bool operator<(const ConstructionContextItem &Other) const {
|
||||
return std::make_tuple(Data, Kind, Index) <
|
||||
std::make_tuple(Other.Data, Other.Kind, Other.Index);
|
||||
}
|
||||
};
|
||||
|
||||
/// Construction context can be seen as a linked list of multiple layers.
|
||||
/// Sometimes a single trigger is not enough to describe the construction
|
||||
/// site. That's what causing us to have a chain of "partial" construction
|
||||
/// context layers. Some examples:
|
||||
/// - A constructor within in an aggregate initializer list within a variable
|
||||
/// would have a construction context of the initializer list with
|
||||
/// the parent construction context of a variable.
|
||||
/// - A constructor for a temporary that needs to be both destroyed
|
||||
/// and materialized into an elidable copy constructor would have a
|
||||
/// construction context of a CXXBindTemporaryExpr with the parent
|
||||
/// construction context of a MaterializeTemproraryExpr.
|
||||
/// Not all of these are currently supported.
|
||||
/// Layers are created gradually while traversing the AST, and layers that
|
||||
/// represent the outmost AST nodes are built first, while the node that
|
||||
/// immediately contains the constructor would be built last and capture the
|
||||
/// previous layers as its parents. Construction context captures the last layer
|
||||
/// (which has links to the previous layers) and classifies the seemingly
|
||||
/// arbitrary chain of layers into one of the possible ways of constructing
|
||||
/// an object in C++ for user-friendly experience.
|
||||
class ConstructionContextLayer {
|
||||
const ConstructionContextLayer *Parent = nullptr;
|
||||
ConstructionContextItem Item;
|
||||
|
||||
ConstructionContextLayer(TriggerTy Trigger,
|
||||
const ConstructionContextLayer *Parent)
|
||||
: Trigger(Trigger), Parent(Parent) {}
|
||||
ConstructionContextLayer(ConstructionContextItem Item,
|
||||
const ConstructionContextLayer *Parent)
|
||||
: Parent(Parent), Item(Item) {}
|
||||
|
||||
public:
|
||||
static const ConstructionContextLayer *
|
||||
create(BumpVectorContext &C, TriggerTy Trigger,
|
||||
create(BumpVectorContext &C, const ConstructionContextItem &Item,
|
||||
const ConstructionContextLayer *Parent = nullptr);
|
||||
|
||||
const ConstructionContextItem &getItem() const { return Item; }
|
||||
const ConstructionContextLayer *getParent() const { return Parent; }
|
||||
bool isLast() const { return !Parent; }
|
||||
|
||||
const Stmt *getTriggerStmt() const {
|
||||
return Trigger.dyn_cast<Stmt *>();
|
||||
}
|
||||
|
||||
const CXXCtorInitializer *getTriggerInit() const {
|
||||
return Trigger.dyn_cast<CXXCtorInitializer *>();
|
||||
}
|
||||
|
||||
/// Returns true if these layers are equal as individual layers, even if
|
||||
/// their parents are different.
|
||||
bool isSameLayer(const ConstructionContextLayer *Other) const {
|
||||
assert(Other);
|
||||
return (Trigger == Other->Trigger);
|
||||
}
|
||||
|
||||
/// See if Other is a proper initial segment of this construction context
|
||||
/// in terms of the parent chain - i.e. a few first parents coincide and
|
||||
/// then the other context terminates but our context goes further - i.e.,
|
||||
@ -114,7 +249,8 @@ class ConstructionContext {
|
||||
SimpleReturnedValueKind,
|
||||
CXX17ElidedCopyReturnedValueKind,
|
||||
RETURNED_VALUE_BEGIN = SimpleReturnedValueKind,
|
||||
RETURNED_VALUE_END = CXX17ElidedCopyReturnedValueKind
|
||||
RETURNED_VALUE_END = CXX17ElidedCopyReturnedValueKind,
|
||||
ArgumentKind
|
||||
};
|
||||
|
||||
protected:
|
||||
@ -132,6 +268,23 @@ class ConstructionContext {
|
||||
return new (CC) T(Args...);
|
||||
}
|
||||
|
||||
// A sub-routine of createFromLayers() that deals with temporary objects
|
||||
// that need to be materialized. The BTE argument is for the situation when
|
||||
// the object also needs to be bound for destruction.
|
||||
static const ConstructionContext *createMaterializedTemporaryFromLayers(
|
||||
BumpVectorContext &C, const MaterializeTemporaryExpr *MTE,
|
||||
const CXXBindTemporaryExpr *BTE,
|
||||
const ConstructionContextLayer *ParentLayer);
|
||||
|
||||
// A sub-routine of createFromLayers() that deals with temporary objects
|
||||
// that need to be bound for destruction. Automatically finds out if the
|
||||
// object also needs to be materialized and delegates to
|
||||
// createMaterializedTemporaryFromLayers() if necessary.
|
||||
static const ConstructionContext *
|
||||
createBoundTemporaryFromLayers(
|
||||
BumpVectorContext &C, const CXXBindTemporaryExpr *BTE,
|
||||
const ConstructionContextLayer *ParentLayer);
|
||||
|
||||
public:
|
||||
/// Consume the construction context layer, together with its parent layers,
|
||||
/// and wrap it up into a complete construction context. May return null
|
||||
@ -469,6 +622,32 @@ class CXX17ElidedCopyReturnedValueConstructionContext
|
||||
}
|
||||
};
|
||||
|
||||
class ArgumentConstructionContext : public ConstructionContext {
|
||||
const Expr *CE; // The call of which the context is an argument.
|
||||
unsigned Index; // Which argument we're constructing.
|
||||
const CXXBindTemporaryExpr *BTE; // Whether the object needs to be destroyed.
|
||||
|
||||
friend class ConstructionContext; // Allows to create<>() itself.
|
||||
|
||||
explicit ArgumentConstructionContext(const Expr *CE, unsigned Index,
|
||||
const CXXBindTemporaryExpr *BTE)
|
||||
: ConstructionContext(ArgumentKind), CE(CE),
|
||||
Index(Index), BTE(BTE) {
|
||||
assert(isa<CallExpr>(CE) || isa<CXXConstructExpr>(CE) ||
|
||||
isa<ObjCMessageExpr>(CE));
|
||||
// BTE is optional.
|
||||
}
|
||||
|
||||
public:
|
||||
const Expr *getCallLikeExpr() const { return CE; }
|
||||
unsigned getIndex() const { return Index; }
|
||||
const CXXBindTemporaryExpr *getCXXBindTemporaryExpr() const { return BTE; }
|
||||
|
||||
static bool classof(const ConstructionContext *CC) {
|
||||
return CC->getKind() == ArgumentKind;
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
|
||||
#endif // LLVM_CLANG_ANALYSIS_CONSTRUCTIONCONTEXT_H
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements cocoa naming convention analysis.
|
||||
// This file implements cocoa naming convention analysis.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@ -20,20 +20,20 @@
|
||||
namespace clang {
|
||||
class FunctionDecl;
|
||||
class QualType;
|
||||
|
||||
|
||||
namespace ento {
|
||||
namespace cocoa {
|
||||
|
||||
|
||||
bool isRefType(QualType RetTy, StringRef Prefix,
|
||||
StringRef Name = StringRef());
|
||||
|
||||
|
||||
bool isCocoaObjectRef(QualType T);
|
||||
|
||||
}
|
||||
|
||||
namespace coreFoundation {
|
||||
bool isCFObjectRef(QualType T);
|
||||
|
||||
|
||||
bool followsCreateRule(const FunctionDecl *FD);
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ namespace clang {
|
||||
|
||||
class ASTContext;
|
||||
class ObjCMessageExpr;
|
||||
|
||||
|
||||
class ObjCNoReturn {
|
||||
/// Cached "raise" selector.
|
||||
Selector RaiseSel;
|
||||
@ -36,7 +36,7 @@ class ObjCNoReturn {
|
||||
|
||||
public:
|
||||
ObjCNoReturn(ASTContext &C);
|
||||
|
||||
|
||||
/// Return true if the given message expression is known to never
|
||||
/// return.
|
||||
bool isImplicitNoReturn(const ObjCMessageExpr *ME);
|
||||
|
@ -33,7 +33,7 @@ namespace clang {
|
||||
class AnalysisDeclContext;
|
||||
class FunctionDecl;
|
||||
class LocationContext;
|
||||
|
||||
|
||||
/// ProgramPoints can be "tagged" as representing points specific to a given
|
||||
/// analysis entity. Tags are abstract annotations, with an associated
|
||||
/// description and potentially other information.
|
||||
@ -41,12 +41,12 @@ class ProgramPointTag {
|
||||
public:
|
||||
ProgramPointTag(void *tagKind = nullptr) : TagKind(tagKind) {}
|
||||
virtual ~ProgramPointTag();
|
||||
virtual StringRef getTagDescription() const = 0;
|
||||
virtual StringRef getTagDescription() const = 0;
|
||||
|
||||
protected:
|
||||
/// Used to implement 'isKind' in subclasses.
|
||||
const void *getTagKind() { return TagKind; }
|
||||
|
||||
|
||||
private:
|
||||
const void *TagKind;
|
||||
};
|
||||
@ -111,7 +111,7 @@ class ProgramPoint {
|
||||
assert(getLocationContext() == l);
|
||||
assert(getData1() == P);
|
||||
}
|
||||
|
||||
|
||||
ProgramPoint(const void *P1,
|
||||
const void *P2,
|
||||
Kind k,
|
||||
@ -223,7 +223,7 @@ class BlockEntrance : public ProgramPoint {
|
||||
public:
|
||||
BlockEntrance(const CFGBlock *B, const LocationContext *L,
|
||||
const ProgramPointTag *tag = nullptr)
|
||||
: ProgramPoint(B, BlockEntranceKind, L, tag) {
|
||||
: ProgramPoint(B, BlockEntranceKind, L, tag) {
|
||||
assert(B && "BlockEntrance requires non-null block");
|
||||
}
|
||||
|
||||
@ -235,7 +235,7 @@ class BlockEntrance : public ProgramPoint {
|
||||
const CFGBlock *B = getBlock();
|
||||
return B->empty() ? Optional<CFGElement>() : B->front();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
friend class ProgramPoint;
|
||||
BlockEntrance() = default;
|
||||
@ -350,7 +350,7 @@ class LocationCheck : public StmtPoint {
|
||||
LocationCheck(const Stmt *S, const LocationContext *L,
|
||||
ProgramPoint::Kind K, const ProgramPointTag *tag)
|
||||
: StmtPoint(S, nullptr, K, L, tag) {}
|
||||
|
||||
|
||||
private:
|
||||
friend class ProgramPoint;
|
||||
static bool isKind(const ProgramPoint &location) {
|
||||
@ -358,13 +358,13 @@ class LocationCheck : public StmtPoint {
|
||||
return k == PreLoadKind || k == PreStoreKind;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class PreLoad : public LocationCheck {
|
||||
public:
|
||||
PreLoad(const Stmt *S, const LocationContext *L,
|
||||
const ProgramPointTag *tag = nullptr)
|
||||
: LocationCheck(S, L, PreLoadKind, tag) {}
|
||||
|
||||
|
||||
private:
|
||||
friend class ProgramPoint;
|
||||
PreLoad() = default;
|
||||
@ -378,7 +378,7 @@ class PreStore : public LocationCheck {
|
||||
PreStore(const Stmt *S, const LocationContext *L,
|
||||
const ProgramPointTag *tag = nullptr)
|
||||
: LocationCheck(S, L, PreStoreKind, tag) {}
|
||||
|
||||
|
||||
private:
|
||||
friend class ProgramPoint;
|
||||
PreStore() = default;
|
||||
@ -405,7 +405,7 @@ class PostLoad : public PostStmt {
|
||||
class PostStore : public PostStmt {
|
||||
public:
|
||||
/// Construct the post store point.
|
||||
/// \param Loc can be used to store the information about the location
|
||||
/// \param Loc can be used to store the information about the location
|
||||
/// used in the form it was uttered in the code.
|
||||
PostStore(const Stmt *S, const LocationContext *L, const void *Loc,
|
||||
const ProgramPointTag *tag = nullptr)
|
||||
@ -479,7 +479,7 @@ class BlockEdge : public ProgramPoint {
|
||||
BlockEdge(const CFGBlock *B1, const CFGBlock *B2, const LocationContext *L)
|
||||
: ProgramPoint(B1, B2, BlockEdgeKind, L) {
|
||||
assert(B1 && "BlockEdge: source block must be non-null");
|
||||
assert(B2 && "BlockEdge: destination block must be non-null");
|
||||
assert(B2 && "BlockEdge: destination block must be non-null");
|
||||
}
|
||||
|
||||
const CFGBlock *getSrc() const {
|
||||
@ -603,7 +603,7 @@ class PostAllocatorCall : public StmtPoint {
|
||||
/// CallEnter uses the caller's location context.
|
||||
class CallEnter : public ProgramPoint {
|
||||
public:
|
||||
CallEnter(const Stmt *stmt, const StackFrameContext *calleeCtx,
|
||||
CallEnter(const Stmt *stmt, const StackFrameContext *calleeCtx,
|
||||
const LocationContext *callerCtx)
|
||||
: ProgramPoint(stmt, calleeCtx, CallEnterKind, callerCtx, nullptr) {}
|
||||
|
||||
@ -749,7 +749,7 @@ static bool isEqual(const clang::ProgramPoint &L,
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
template <>
|
||||
struct isPodLike<clang::ProgramPoint> { static const bool value = true; };
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <type_traits>
|
||||
|
||||
namespace clang {
|
||||
|
||||
|
||||
class BumpVectorContext {
|
||||
llvm::PointerIntPair<llvm::BumpPtrAllocator*, 1> Alloc;
|
||||
|
||||
@ -47,15 +47,15 @@ class BumpVectorContext {
|
||||
/// BumpPtrAllocator. This BumpPtrAllocator is not destroyed when the
|
||||
/// BumpVectorContext object is destroyed.
|
||||
BumpVectorContext(llvm::BumpPtrAllocator &A) : Alloc(&A, 0) {}
|
||||
|
||||
|
||||
~BumpVectorContext() {
|
||||
if (Alloc.getInt())
|
||||
delete Alloc.getPointer();
|
||||
}
|
||||
|
||||
|
||||
llvm::BumpPtrAllocator &getAllocator() { return *Alloc.getPointer(); }
|
||||
};
|
||||
|
||||
|
||||
template<typename T>
|
||||
class BumpVector {
|
||||
T *Begin = nullptr;
|
||||
@ -67,34 +67,34 @@ class BumpVector {
|
||||
explicit BumpVector(BumpVectorContext &C, unsigned N) {
|
||||
reserve(C, N);
|
||||
}
|
||||
|
||||
|
||||
~BumpVector() {
|
||||
if (std::is_class<T>::value) {
|
||||
// Destroy the constructed elements in the vector.
|
||||
destroy_range(Begin, End);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
using size_type = size_t;
|
||||
using difference_type = ptrdiff_t;
|
||||
using value_type = T;
|
||||
using iterator = T *;
|
||||
using const_iterator = const T *;
|
||||
|
||||
|
||||
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
||||
using reverse_iterator = std::reverse_iterator<iterator>;
|
||||
|
||||
|
||||
using reference = T &;
|
||||
using const_reference = const T &;
|
||||
using pointer = T *;
|
||||
using const_pointer = const T *;
|
||||
|
||||
|
||||
// forward iterator creation methods.
|
||||
iterator begin() { return Begin; }
|
||||
const_iterator begin() const { return Begin; }
|
||||
iterator end() { return End; }
|
||||
const_iterator end() const { return End; }
|
||||
|
||||
|
||||
// reverse iterator creation methods.
|
||||
reverse_iterator rbegin() { return reverse_iterator(end()); }
|
||||
const_reverse_iterator rbegin() const{ return const_reverse_iterator(end()); }
|
||||
@ -102,7 +102,7 @@ class BumpVector {
|
||||
const_reverse_iterator rend() const {
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
|
||||
|
||||
bool empty() const { return Begin == End; }
|
||||
size_type size() const { return End-Begin; }
|
||||
|
||||
@ -114,49 +114,49 @@ class BumpVector {
|
||||
assert(Begin + idx < End);
|
||||
return Begin[idx];
|
||||
}
|
||||
|
||||
|
||||
reference front() {
|
||||
return begin()[0];
|
||||
}
|
||||
const_reference front() const {
|
||||
return begin()[0];
|
||||
}
|
||||
|
||||
|
||||
reference back() {
|
||||
return end()[-1];
|
||||
}
|
||||
const_reference back() const {
|
||||
return end()[-1];
|
||||
}
|
||||
|
||||
|
||||
void pop_back() {
|
||||
--End;
|
||||
End->~T();
|
||||
}
|
||||
|
||||
|
||||
T pop_back_val() {
|
||||
T Result = back();
|
||||
pop_back();
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
void clear() {
|
||||
if (std::is_class<T>::value) {
|
||||
destroy_range(Begin, End);
|
||||
}
|
||||
End = Begin;
|
||||
}
|
||||
|
||||
|
||||
/// data - Return a pointer to the vector's buffer, even if empty().
|
||||
pointer data() {
|
||||
return pointer(Begin);
|
||||
}
|
||||
|
||||
|
||||
/// data - Return a pointer to the vector's buffer, even if empty().
|
||||
const_pointer data() const {
|
||||
return const_pointer(Begin);
|
||||
}
|
||||
|
||||
|
||||
void push_back(const_reference Elt, BumpVectorContext &C) {
|
||||
if (End < Capacity) {
|
||||
Retry:
|
||||
@ -165,7 +165,7 @@ class BumpVector {
|
||||
return;
|
||||
}
|
||||
grow(C);
|
||||
goto Retry;
|
||||
goto Retry;
|
||||
}
|
||||
|
||||
/// insert - Insert some number of copies of element into a position. Return
|
||||
@ -193,18 +193,18 @@ class BumpVector {
|
||||
|
||||
/// capacity - Return the total number of elements in the currently allocated
|
||||
/// buffer.
|
||||
size_t capacity() const { return Capacity - Begin; }
|
||||
|
||||
size_t capacity() const { return Capacity - Begin; }
|
||||
|
||||
private:
|
||||
/// grow - double the size of the allocated memory, guaranteeing space for at
|
||||
/// least one more element or MinSize if specified.
|
||||
void grow(BumpVectorContext &C, size_type MinSize = 1);
|
||||
|
||||
|
||||
void construct_range(T *S, T *E, const T &Elt) {
|
||||
for (; S != E; ++S)
|
||||
new (S) T(Elt);
|
||||
}
|
||||
|
||||
|
||||
void destroy_range(T *S, T *E) {
|
||||
while (S != E) {
|
||||
--E;
|
||||
@ -220,7 +220,7 @@ class BumpVector {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Define this out-of-line to dissuade the C++ compiler from inlining it.
|
||||
template <typename T>
|
||||
void BumpVector<T>::grow(BumpVectorContext &C, size_t MinSize) {
|
||||
@ -232,7 +232,7 @@ void BumpVector<T>::grow(BumpVectorContext &C, size_t MinSize) {
|
||||
|
||||
// Allocate the memory from the BumpPtrAllocator.
|
||||
T *NewElts = C.getAllocator().template Allocate<T>(NewCapacity);
|
||||
|
||||
|
||||
// Copy the elements over.
|
||||
if (Begin != End) {
|
||||
if (std::is_class<T>::value) {
|
||||
|
@ -81,12 +81,12 @@ struct ReturnAdjustment {
|
||||
return memcmp(this, &RHS, sizeof(RHS)) < 0;
|
||||
}
|
||||
} Virtual;
|
||||
|
||||
|
||||
ReturnAdjustment() : NonVirtual(0) {}
|
||||
|
||||
|
||||
bool isEmpty() const { return !NonVirtual && Virtual.isEmpty(); }
|
||||
|
||||
friend bool operator==(const ReturnAdjustment &LHS,
|
||||
friend bool operator==(const ReturnAdjustment &LHS,
|
||||
const ReturnAdjustment &RHS) {
|
||||
return LHS.NonVirtual == RHS.NonVirtual && LHS.Virtual.Equals(RHS.Virtual);
|
||||
}
|
||||
@ -103,7 +103,7 @@ struct ReturnAdjustment {
|
||||
return LHS.NonVirtual == RHS.NonVirtual && LHS.Virtual.Less(RHS.Virtual);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// A \c this pointer adjustment.
|
||||
struct ThisAdjustment {
|
||||
/// The non-virtual adjustment from the derived object to its
|
||||
@ -149,12 +149,12 @@ struct ThisAdjustment {
|
||||
return memcmp(this, &RHS, sizeof(RHS)) < 0;
|
||||
}
|
||||
} Virtual;
|
||||
|
||||
|
||||
ThisAdjustment() : NonVirtual(0) { }
|
||||
|
||||
bool isEmpty() const { return !NonVirtual && Virtual.isEmpty(); }
|
||||
|
||||
friend bool operator==(const ThisAdjustment &LHS,
|
||||
friend bool operator==(const ThisAdjustment &LHS,
|
||||
const ThisAdjustment &RHS) {
|
||||
return LHS.NonVirtual == RHS.NonVirtual && LHS.Virtual.Equals(RHS.Virtual);
|
||||
}
|
||||
@ -162,12 +162,12 @@ struct ThisAdjustment {
|
||||
friend bool operator!=(const ThisAdjustment &LHS, const ThisAdjustment &RHS) {
|
||||
return !(LHS == RHS);
|
||||
}
|
||||
|
||||
|
||||
friend bool operator<(const ThisAdjustment &LHS,
|
||||
const ThisAdjustment &RHS) {
|
||||
if (LHS.NonVirtual < RHS.NonVirtual)
|
||||
return true;
|
||||
|
||||
|
||||
return LHS.NonVirtual == RHS.NonVirtual && LHS.Virtual.Less(RHS.Virtual);
|
||||
}
|
||||
};
|
||||
@ -179,7 +179,7 @@ class CXXMethodDecl;
|
||||
struct ThunkInfo {
|
||||
/// The \c this pointer adjustment.
|
||||
ThisAdjustment This;
|
||||
|
||||
|
||||
/// The return adjustment.
|
||||
ReturnAdjustment Return;
|
||||
|
||||
@ -204,7 +204,7 @@ struct ThunkInfo {
|
||||
bool isEmpty() const {
|
||||
return This.isEmpty() && Return.isEmpty() && Method == nullptr;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
|
||||
|
@ -34,9 +34,9 @@ class StringSizerHelper {
|
||||
public:
|
||||
enum { Size = SizeOfStr };
|
||||
};
|
||||
} // end namespace clang
|
||||
} // end namespace clang
|
||||
|
||||
#define STR_SIZE(str, fieldTy) clang::StringSizerHelper<sizeof(str)-1, \
|
||||
fieldTy>::Size
|
||||
fieldTy>::Size
|
||||
|
||||
#endif
|
||||
|
@ -141,6 +141,13 @@ def HasFunctionProto : SubsetSubject<DeclBase,
|
||||
isa<BlockDecl>(S)}],
|
||||
"non-K&R-style functions">;
|
||||
|
||||
// A subject that matches the implicit object parameter of a non-static member
|
||||
// function. Accepted as a function type attribute on the type of such a
|
||||
// member function.
|
||||
// FIXME: This does not actually ever match currently.
|
||||
def ImplicitObjectParameter : SubsetSubject<Function, [{false}],
|
||||
"implicit object parameters">;
|
||||
|
||||
// A single argument to an attribute
|
||||
class Argument<string name, bit optional, bit fake = 0> {
|
||||
string Name = name;
|
||||
@ -456,7 +463,7 @@ class Attr {
|
||||
// Set to true if all of the attribute's arguments should be parsed in an
|
||||
// unevaluated context.
|
||||
bit ParseArgumentsAsUnevaluated = 0;
|
||||
// Set to true if this attribute meaningful when applied to or inherited
|
||||
// Set to true if this attribute meaningful when applied to or inherited
|
||||
// in a class template definition.
|
||||
bit MeaningfulToClassTemplateDefinition = 0;
|
||||
// Set to true if this attribute can be used with '#pragma clang attribute'.
|
||||
@ -583,7 +590,7 @@ def AlignValue : Attr {
|
||||
// the future (and a corresponding C++ attribute), but this can be done
|
||||
// later once we decide if we also want them to have slightly-different
|
||||
// semantics than Intel's align_value.
|
||||
//
|
||||
//
|
||||
// Does not get a [[]] spelling because the attribute is not exposed as such
|
||||
// by Intel.
|
||||
GNU<"align_value">
|
||||
@ -1211,6 +1218,13 @@ def LayoutVersion : InheritableAttr, TargetSpecificAttr<TargetMicrosoftCXXABI> {
|
||||
let Documentation = [LayoutVersionDocs];
|
||||
}
|
||||
|
||||
def LifetimeBound : InheritableAttr {
|
||||
let Spellings = [Clang<"lifetimebound", 0>];
|
||||
let Subjects = SubjectList<[ParmVar, ImplicitObjectParameter], ErrorDiag>;
|
||||
let Documentation = [LifetimeBoundDocs];
|
||||
let LangOpts = [CPlusPlus];
|
||||
}
|
||||
|
||||
def TrivialABI : InheritableAttr {
|
||||
// This attribute does not have a C [[]] spelling because it requires the
|
||||
// CPlusPlus language option.
|
||||
@ -1703,7 +1717,7 @@ def Overloadable : Attr {
|
||||
let Documentation = [OverloadableDocs];
|
||||
}
|
||||
|
||||
def Override : InheritableAttr {
|
||||
def Override : InheritableAttr {
|
||||
let Spellings = [Keyword<"override">];
|
||||
let SemaHandler = 0;
|
||||
let Documentation = [Undocumented];
|
||||
@ -1782,7 +1796,7 @@ def RequireConstantInit : InheritableAttr {
|
||||
def WorkGroupSizeHint : InheritableAttr {
|
||||
// Does not have a [[]] spelling because it is an OpenCL-related attribute.
|
||||
let Spellings = [GNU<"work_group_size_hint">];
|
||||
let Args = [UnsignedArgument<"XDim">,
|
||||
let Args = [UnsignedArgument<"XDim">,
|
||||
UnsignedArgument<"YDim">,
|
||||
UnsignedArgument<"ZDim">];
|
||||
let Subjects = SubjectList<[Function], ErrorDiag>;
|
||||
|
@ -2362,6 +2362,22 @@ It is only supported when using the Microsoft C++ ABI.
|
||||
}];
|
||||
}
|
||||
|
||||
def LifetimeBoundDocs : Documentation {
|
||||
let Category = DocCatFunction;
|
||||
let Content = [{
|
||||
The ``lifetimebound`` attribute indicates that a resource owned by
|
||||
a function parameter or implicit object parameter
|
||||
is retained by the return value of the annotated function
|
||||
(or, for a parameter of a constructor, in the value of the constructed object).
|
||||
It is only supported in C++.
|
||||
|
||||
This attribute provides an experimental implementation of the facility
|
||||
described in the C++ committee paper [http://wg21.link/p0936r0](P0936R0),
|
||||
and is subject to change as the design of the corresponding functionality
|
||||
changes.
|
||||
}];
|
||||
}
|
||||
|
||||
def TrivialABIDocs : Documentation {
|
||||
let Category = DocCatVariable;
|
||||
let Content = [{
|
||||
|
@ -471,6 +471,8 @@ BUILTIN(__builtin_wcslen, "zwC*", "nF")
|
||||
BUILTIN(__builtin_wcsncmp, "iwC*wC*z", "nF")
|
||||
BUILTIN(__builtin_wmemchr, "w*wC*wz", "nF")
|
||||
BUILTIN(__builtin_wmemcmp, "iwC*wC*z", "nF")
|
||||
BUILTIN(__builtin_wmemcpy, "w*w*wC*z", "nF")
|
||||
BUILTIN(__builtin_wmemmove, "w*w*wC*z", "nF")
|
||||
BUILTIN(__builtin_return_address, "v*IUi", "n")
|
||||
BUILTIN(__builtin_extract_return_addr, "v*v*", "n")
|
||||
BUILTIN(__builtin_frame_address, "v*IUi", "n")
|
||||
@ -908,6 +910,8 @@ LIBBUILTIN(wcslen, "zwC*", "f", "wchar.h", ALL_LANGUAGES)
|
||||
LIBBUILTIN(wcsncmp, "iwC*wC*z", "f", "wchar.h", ALL_LANGUAGES)
|
||||
LIBBUILTIN(wmemchr, "w*wC*wz", "f", "wchar.h", ALL_LANGUAGES)
|
||||
LIBBUILTIN(wmemcmp, "iwC*wC*z", "f", "wchar.h", ALL_LANGUAGES)
|
||||
LIBBUILTIN(wmemcpy, "w*w*wC*z", "f", "wchar.h", ALL_LANGUAGES)
|
||||
LIBBUILTIN(wmemmove,"w*w*wC*z", "f", "wchar.h", ALL_LANGUAGES)
|
||||
|
||||
// C99
|
||||
// In some systems setjmp is a macro that expands to _setjmp. We undefine
|
||||
@ -956,7 +960,7 @@ LIBBUILTIN(strlcpy, "zc*cC*z", "f", "string.h", ALL_GNU_LANGUAGES)
|
||||
LIBBUILTIN(strlcat, "zc*cC*z", "f", "string.h", ALL_GNU_LANGUAGES)
|
||||
// id objc_msgSend(id, SEL, ...)
|
||||
LIBBUILTIN(objc_msgSend, "GGH.", "f", "objc/message.h", OBJC_LANG)
|
||||
// long double objc_msgSend_fpret(id self, SEL op, ...)
|
||||
// long double objc_msgSend_fpret(id self, SEL op, ...)
|
||||
LIBBUILTIN(objc_msgSend_fpret, "LdGH.", "f", "objc/message.h", OBJC_LANG)
|
||||
// _Complex long double objc_msgSend_fp2ret(id self, SEL op, ...)
|
||||
LIBBUILTIN(objc_msgSend_fp2ret, "XLdGH.", "f", "objc/message.h", OBJC_LANG)
|
||||
|
@ -124,13 +124,13 @@ TARGET_BUILTIN(__builtin_amdgcn_fmed3h, "hhhh", "nc", "gfx9-insts")
|
||||
// Deep learning builtins.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
TARGET_BUILTIN(__builtin_amdgcn_fdot2, "fV2hV2hf", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_sdot2, "SiV2SsV2SsSi", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_udot2, "UiV2UsV2UsUi", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_sdot4, "SiSiSiSi", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_udot4, "UiUiUiUi", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_sdot8, "SiSiSiSi", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_udot8, "UiUiUiUi", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_fdot2, "fV2hV2hfIb", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_sdot2, "SiV2SsV2SsSiIb", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_udot2, "UiV2UsV2UsUiIb", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_sdot4, "SiSiSiSiIb", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_udot4, "UiUiUiUiIb", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_sdot8, "SiSiSiSiIb", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_udot8, "UiUiUiUiIb", "nc", "dl-insts")
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Special builtins.
|
||||
|
@ -58,7 +58,7 @@ BUILTIN(__builtin_altivec_vctuxs, "V4UiV4fIi", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_dss, "vUi", "")
|
||||
BUILTIN(__builtin_altivec_dssall, "v", "")
|
||||
BUILTIN(__builtin_altivec_dst, "vvC*iUi", "")
|
||||
BUILTIN(__builtin_altivec_dst, "vvC*iUi", "")
|
||||
BUILTIN(__builtin_altivec_dstt, "vvC*iUi", "")
|
||||
BUILTIN(__builtin_altivec_dstst, "vvC*iUi", "")
|
||||
BUILTIN(__builtin_altivec_dststt, "vvC*iUi", "")
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
@ -86,7 +86,7 @@ class FixItHint {
|
||||
bool isNull() const {
|
||||
return !RemoveRange.isValid();
|
||||
}
|
||||
|
||||
|
||||
/// Create a code modification hint that inserts the given
|
||||
/// code string at a specific location.
|
||||
static FixItHint CreateInsertion(SourceLocation InsertionLoc,
|
||||
@ -99,7 +99,7 @@ class FixItHint {
|
||||
Hint.BeforePreviousInsertions = BeforePreviousInsertions;
|
||||
return Hint;
|
||||
}
|
||||
|
||||
|
||||
/// Create a code modification hint that inserts the given
|
||||
/// code from \p FromRange at a specific location.
|
||||
static FixItHint CreateInsertionFromRange(SourceLocation InsertionLoc,
|
||||
@ -123,7 +123,7 @@ class FixItHint {
|
||||
static FixItHint CreateRemoval(SourceRange RemoveRange) {
|
||||
return CreateRemoval(CharSourceRange::getTokenRange(RemoveRange));
|
||||
}
|
||||
|
||||
|
||||
/// Create a code modification hint that replaces the given
|
||||
/// source range with the given code string.
|
||||
static FixItHint CreateReplacement(CharSourceRange RemoveRange,
|
||||
@ -133,7 +133,7 @@ class FixItHint {
|
||||
Hint.CodeToInsert = Code;
|
||||
return Hint;
|
||||
}
|
||||
|
||||
|
||||
static FixItHint CreateReplacement(SourceRange RemoveRange,
|
||||
StringRef Code) {
|
||||
return CreateReplacement(CharSourceRange::getTokenRange(RemoveRange), Code);
|
||||
@ -348,7 +348,7 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
|
||||
unsigned Offset;
|
||||
|
||||
DiagStatePoint(DiagState *State, unsigned Offset)
|
||||
: State(State), Offset(Offset) {}
|
||||
: State(State), Offset(Offset) {}
|
||||
};
|
||||
|
||||
/// Description of the diagnostic states and state transitions for a
|
||||
@ -420,7 +420,7 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
|
||||
|
||||
/// Indicates that an unrecoverable error has occurred.
|
||||
bool UnrecoverableErrorOccurred;
|
||||
|
||||
|
||||
/// Counts for DiagnosticErrorTrap to check whether an error occurred
|
||||
/// during a parsing section, e.g. during parsing a function.
|
||||
unsigned TrapNumErrorsOccurred;
|
||||
@ -556,7 +556,7 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
|
||||
///
|
||||
/// Zero disables the limit.
|
||||
void setErrorLimit(unsigned Limit) { ErrorLimit = Limit; }
|
||||
|
||||
|
||||
/// Specify the maximum number of template instantiation
|
||||
/// notes to emit along with a given diagnostic.
|
||||
void setTemplateBacktraceLimit(unsigned Limit) {
|
||||
@ -626,11 +626,11 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
|
||||
return GetCurDiagState()->SuppressSystemWarnings;
|
||||
}
|
||||
|
||||
/// Suppress all diagnostics, to silence the front end when we
|
||||
/// Suppress all diagnostics, to silence the front end when we
|
||||
/// know that we don't want any more diagnostics to be passed along to the
|
||||
/// client
|
||||
void setSuppressAllDiagnostics(bool Val = true) {
|
||||
SuppressAllDiagnostics = Val;
|
||||
void setSuppressAllDiagnostics(bool Val = true) {
|
||||
SuppressAllDiagnostics = Val;
|
||||
}
|
||||
bool getSuppressAllDiagnostics() const { return SuppressAllDiagnostics; }
|
||||
|
||||
@ -638,12 +638,12 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
|
||||
/// template types.
|
||||
void setElideType(bool Val = true) { ElideType = Val; }
|
||||
bool getElideType() { return ElideType; }
|
||||
|
||||
|
||||
/// Set tree printing, to outputting the template difference in a
|
||||
/// tree format.
|
||||
void setPrintTemplateTree(bool Val = false) { PrintTemplateTree = Val; }
|
||||
bool getPrintTemplateTree() { return PrintTemplateTree; }
|
||||
|
||||
|
||||
/// Set color printing, so the type diffing will inject color markers
|
||||
/// into the output.
|
||||
void setShowColors(bool Val = false) { ShowColors = Val; }
|
||||
@ -657,7 +657,7 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
|
||||
ShowOverloads = Val;
|
||||
}
|
||||
OverloadsShown getShowOverloads() const { return ShowOverloads; }
|
||||
|
||||
|
||||
/// Pretend that the last diagnostic issued was ignored, so any
|
||||
/// subsequent notes will be suppressed, or restore a prior ignoring
|
||||
/// state after ignoring some diagnostics and their notes, possibly in
|
||||
@ -751,12 +751,12 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
|
||||
return UncompilableErrorOccurred;
|
||||
}
|
||||
bool hasFatalErrorOccurred() const { return FatalErrorOccurred; }
|
||||
|
||||
|
||||
/// Determine whether any kind of unrecoverable error has occurred.
|
||||
bool hasUnrecoverableErrorOccurred() const {
|
||||
return FatalErrorOccurred || UnrecoverableErrorOccurred;
|
||||
}
|
||||
|
||||
|
||||
unsigned getNumWarnings() const { return NumWarnings; }
|
||||
|
||||
void setNumWarnings(unsigned NumWarnings) {
|
||||
@ -799,10 +799,10 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
|
||||
LastDiagLevel = Other.LastDiagLevel;
|
||||
}
|
||||
|
||||
/// Reset the state of the diagnostic object to its initial
|
||||
/// Reset the state of the diagnostic object to its initial
|
||||
/// configuration.
|
||||
void Reset();
|
||||
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// DiagnosticsEngine classification and reporting interfaces.
|
||||
//
|
||||
@ -875,7 +875,7 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
|
||||
/// DiagnosticsEngine object itself.
|
||||
void SetDelayedDiagnostic(unsigned DiagID, StringRef Arg1 = "",
|
||||
StringRef Arg2 = "");
|
||||
|
||||
|
||||
/// Clear out the current diagnostic.
|
||||
void Clear() { CurDiagID = std::numeric_limits<unsigned>::max(); }
|
||||
|
||||
@ -894,7 +894,7 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
|
||||
friend class DiagnosticErrorTrap;
|
||||
friend class DiagnosticIDs;
|
||||
friend class PartialDiagnostic;
|
||||
|
||||
|
||||
/// Report the delayed diagnostic.
|
||||
void ReportDelayed();
|
||||
|
||||
@ -1042,7 +1042,7 @@ class DiagnosticErrorTrap {
|
||||
class DiagnosticBuilder {
|
||||
friend class DiagnosticsEngine;
|
||||
friend class PartialDiagnostic;
|
||||
|
||||
|
||||
mutable DiagnosticsEngine *DiagObj = nullptr;
|
||||
mutable unsigned NumArgs = 0;
|
||||
|
||||
@ -1105,7 +1105,7 @@ class DiagnosticBuilder {
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
/// Copy constructor. When copied, this "takes" the diagnostic info from the
|
||||
/// input and neuters it.
|
||||
@ -1430,8 +1430,8 @@ class Diagnostic {
|
||||
};
|
||||
|
||||
/**
|
||||
* Represents a diagnostic in a form that can be retained until its
|
||||
* corresponding source manager is destroyed.
|
||||
* Represents a diagnostic in a form that can be retained until its
|
||||
* corresponding source manager is destroyed.
|
||||
*/
|
||||
class StoredDiagnostic {
|
||||
unsigned ID;
|
||||
@ -1444,9 +1444,9 @@ class StoredDiagnostic {
|
||||
public:
|
||||
StoredDiagnostic() = default;
|
||||
StoredDiagnostic(DiagnosticsEngine::Level Level, const Diagnostic &Info);
|
||||
StoredDiagnostic(DiagnosticsEngine::Level Level, unsigned ID,
|
||||
StoredDiagnostic(DiagnosticsEngine::Level Level, unsigned ID,
|
||||
StringRef Message);
|
||||
StoredDiagnostic(DiagnosticsEngine::Level Level, unsigned ID,
|
||||
StoredDiagnostic(DiagnosticsEngine::Level Level, unsigned ID,
|
||||
StringRef Message, FullSourceLoc Loc,
|
||||
ArrayRef<CharSourceRange> Ranges,
|
||||
ArrayRef<FixItHint> Fixits);
|
||||
@ -1466,7 +1466,7 @@ class StoredDiagnostic {
|
||||
range_iterator range_begin() const { return Ranges.begin(); }
|
||||
range_iterator range_end() const { return Ranges.end(); }
|
||||
unsigned range_size() const { return Ranges.size(); }
|
||||
|
||||
|
||||
ArrayRef<CharSourceRange> getRanges() const {
|
||||
return llvm::makeArrayRef(Ranges);
|
||||
}
|
||||
@ -1476,7 +1476,7 @@ class StoredDiagnostic {
|
||||
fixit_iterator fixit_begin() const { return FixIts.begin(); }
|
||||
fixit_iterator fixit_end() const { return FixIts.end(); }
|
||||
unsigned fixit_size() const { return FixIts.size(); }
|
||||
|
||||
|
||||
ArrayRef<FixItHint> getFixIts() const {
|
||||
return llvm::makeArrayRef(FixIts);
|
||||
}
|
||||
@ -1488,7 +1488,7 @@ class DiagnosticConsumer {
|
||||
protected:
|
||||
unsigned NumWarnings = 0; ///< Number of warnings reported
|
||||
unsigned NumErrors = 0; ///< Number of errors reported
|
||||
|
||||
|
||||
public:
|
||||
DiagnosticConsumer() = default;
|
||||
virtual ~DiagnosticConsumer();
|
||||
@ -1506,7 +1506,7 @@ class DiagnosticConsumer {
|
||||
/// in between BeginSourceFile() and EndSourceFile().
|
||||
///
|
||||
/// \param LangOpts The language options for the source file being processed.
|
||||
/// \param PP The preprocessor object being used for the source; this is
|
||||
/// \param PP The preprocessor object being used for the source; this is
|
||||
/// optional, e.g., it may not be present when processing AST source files.
|
||||
virtual void BeginSourceFile(const LangOptions &LangOpts,
|
||||
const Preprocessor *PP = nullptr) {}
|
||||
|
@ -163,12 +163,26 @@ def note_constexpr_unsupported_unsized_array : Note<
|
||||
def note_constexpr_unsized_array_indexed : Note<
|
||||
"indexing of array without known bound is not allowed "
|
||||
"in a constant expression">;
|
||||
def note_constexpr_memcpy_type_pun : Note<
|
||||
"cannot constant evaluate '%select{memcpy|memmove}0' from object of "
|
||||
"type %1 to object of type %2">;
|
||||
def note_constexpr_memcpy_nontrivial : Note<
|
||||
"cannot constant evaluate '%select{memcpy|memmove}0' between objects of "
|
||||
"non-trivially-copyable type %1">;
|
||||
def note_constexpr_memcpy_overlap : Note<
|
||||
"'%select{memcpy|wmemcpy}0' between overlapping memory regions">;
|
||||
def note_constexpr_memcpy_unsupported : Note<
|
||||
"'%select{%select{memcpy|wmemcpy}1|%select{memmove|wmemmove}1}0' "
|
||||
"not supported: %select{"
|
||||
"size to copy (%4) is not a multiple of size of element type %3 (%5)|"
|
||||
"source is not a contiguous array of at least %4 elements of type %3|"
|
||||
"destination is not a contiguous array of at least %4 elements of type %3}2">;
|
||||
|
||||
def warn_integer_constant_overflow : Warning<
|
||||
"overflow in expression; result is %0 with type %1">,
|
||||
InGroup<DiagGroup<"integer-overflow">>;
|
||||
|
||||
// This is a temporary diagnostic, and shall be removed once our
|
||||
// This is a temporary diagnostic, and shall be removed once our
|
||||
// implementation is complete, and like the preceding constexpr notes belongs
|
||||
// in Sema.
|
||||
def note_unimplemented_constexpr_lambda_feature_ast : Note<
|
||||
|
@ -83,19 +83,19 @@ def warn_doc_function_method_decl_mismatch : Warning<
|
||||
"%select{a function|a function|an Objective-C method|an Objective-C method|"
|
||||
"a pointer to function}2 declaration">,
|
||||
InGroup<Documentation>, DefaultIgnore;
|
||||
|
||||
|
||||
def warn_doc_api_container_decl_mismatch : Warning<
|
||||
"'%select{\\|@}0%select{class|interface|protocol|struct|union}1' "
|
||||
"command should not be used in a comment attached to a "
|
||||
"non-%select{class|interface|protocol|struct|union}2 declaration">,
|
||||
InGroup<Documentation>, DefaultIgnore;
|
||||
|
||||
|
||||
def warn_doc_container_decl_mismatch : Warning<
|
||||
"'%select{\\|@}0%select{classdesign|coclass|dependency|helper"
|
||||
"|helperclass|helps|instancesize|ownership|performance|security|superclass}1' "
|
||||
"command should not be used in a comment attached to a non-container declaration">,
|
||||
InGroup<Documentation>, DefaultIgnore;
|
||||
|
||||
|
||||
def warn_doc_param_duplicate : Warning<
|
||||
"parameter '%0' is already documented">,
|
||||
InGroup<Documentation>, DefaultIgnore;
|
||||
|
@ -16,7 +16,7 @@ let Component = "Common" in {
|
||||
// Basic.
|
||||
|
||||
def fatal_too_many_errors
|
||||
: Error<"too many errors emitted, stopping now">, DefaultFatal;
|
||||
: Error<"too many errors emitted, stopping now">, DefaultFatal;
|
||||
|
||||
def note_declared_at : Note<"declared here">;
|
||||
def note_previous_definition : Note<"previous definition is here">;
|
||||
@ -97,11 +97,11 @@ def remark_module_lock_timeout : Remark<
|
||||
def err_module_shadowed : Error<"import of shadowed module '%0'">, DefaultFatal;
|
||||
def err_module_build_shadowed_submodule : Error<
|
||||
"build a shadowed submodule '%0'">, DefaultFatal;
|
||||
def err_module_cycle : Error<"cyclic dependency in module '%0': %1">,
|
||||
def err_module_cycle : Error<"cyclic dependency in module '%0': %1">,
|
||||
DefaultFatal;
|
||||
def err_module_prebuilt : Error<
|
||||
"error in loading module '%0' from prebuilt module path">, DefaultFatal;
|
||||
def note_pragma_entered_here : Note<"#pragma entered here">;
|
||||
def note_pragma_entered_here : Note<"#pragma entered here">;
|
||||
def note_decl_hiding_tag_type : Note<
|
||||
"%1 %0 is hidden by a non-type declaration of %0 here">;
|
||||
def err_attribute_not_type_attr : Error<
|
||||
@ -115,7 +115,7 @@ let CategoryName = "Nullability Issue" in {
|
||||
def warn_nullability_duplicate : Warning<
|
||||
"duplicate nullability specifier %0">,
|
||||
InGroup<Nullability>;
|
||||
|
||||
|
||||
def warn_conflicting_nullability_attr_overriding_ret_types : Warning<
|
||||
"conflicting nullability specifier on return types, %0 "
|
||||
"conflicts with existing specifier %1">,
|
||||
@ -223,7 +223,7 @@ def err_unable_to_rename_temp : Error<
|
||||
"unable to rename temporary '%0' to output file '%1': '%2'">;
|
||||
def err_unable_to_make_temp : Error<
|
||||
"unable to make temporary file: %0">;
|
||||
|
||||
|
||||
// Modules
|
||||
def err_module_format_unhandled : Error<
|
||||
"no handler registered for module format '%0'">, DefaultFatal;
|
||||
|
@ -208,7 +208,7 @@ def err_drv_omp_host_target_not_supported : Error<
|
||||
def err_drv_expecting_fopenmp_with_fopenmp_targets : Error<
|
||||
"The option -fopenmp-targets must be used in conjunction with a -fopenmp option compatible with offloading, please use -fopenmp=libomp or -fopenmp=libiomp5.">;
|
||||
def warn_drv_omp_offload_target_duplicate : Warning<
|
||||
"The OpenMP offloading target '%0' is similar to target '%1' already specified - will be ignored.">,
|
||||
"The OpenMP offloading target '%0' is similar to target '%1' already specified - will be ignored.">,
|
||||
InGroup<OpenMPTarget>;
|
||||
def warn_drv_omp_offload_target_missingbcruntime : Warning<
|
||||
"No library '%0' found in the default clang lib directory or in LIBRARY_PATH. Expect degraded performance due to no inlining of runtime functions on target devices.">,
|
||||
@ -226,6 +226,9 @@ def warn_ignored_clang_option : Warning<"the flag '%0' has been deprecated and w
|
||||
def warn_drv_unsupported_opt_for_target : Warning<
|
||||
"optimization flag '%0' is not supported for target '%1'">,
|
||||
InGroup<IgnoredOptimizationArgument>;
|
||||
def warn_drv_unsupported_debug_info_opt_for_target : Warning<
|
||||
"debug information option '%0' is not supported for target '%1'">,
|
||||
InGroup<UnsupportedTargetOpt>;
|
||||
def warn_c_kext : Warning<
|
||||
"ignoring -fapple-kext which is valid for C++ and Objective-C++ only">;
|
||||
def warn_drv_input_file_unused : Warning<
|
||||
|
@ -36,7 +36,7 @@ def remark_fe_backend_plugin: Remark<"%0">, BackendInfo, InGroup<RemarkBackendPl
|
||||
def note_fe_backend_plugin: Note<"%0">, BackendInfo;
|
||||
|
||||
def warn_fe_override_module : Warning<
|
||||
"overriding the module target triple with %0">,
|
||||
"overriding the module target triple with %0">,
|
||||
InGroup<DiagGroup<"override-module">>;
|
||||
|
||||
def remark_fe_backend_optimization_remark : Remark<"%0">, BackendInfo,
|
||||
@ -190,10 +190,10 @@ def err_module_interface_requires_modules_ts : Error<
|
||||
def warn_module_config_mismatch : Warning<
|
||||
"module file %0 cannot be loaded due to a configuration mismatch with the current "
|
||||
"compilation">, InGroup<DiagGroup<"module-file-config-mismatch">>, DefaultError;
|
||||
def err_module_map_not_found : Error<"module map file '%0' not found">,
|
||||
def err_module_map_not_found : Error<"module map file '%0' not found">,
|
||||
DefaultFatal;
|
||||
def err_missing_module_name : Error<
|
||||
"no module name provided; specify one with -fmodule-name=">,
|
||||
"no module name provided; specify one with -fmodule-name=">,
|
||||
DefaultFatal;
|
||||
def err_missing_module : Error<
|
||||
"no module named '%0' declared in module map file '%1'">, DefaultFatal;
|
||||
|
@ -72,6 +72,7 @@ def UnsupportedNan : DiagGroup<"unsupported-nan">;
|
||||
def UnsupportedAbs : DiagGroup<"unsupported-abs">;
|
||||
def UnsupportedCB : DiagGroup<"unsupported-cb">;
|
||||
def UnsupportedGPOpt : DiagGroup<"unsupported-gpopt">;
|
||||
def UnsupportedTargetOpt : DiagGroup<"unsupported-target-opt">;
|
||||
def NonLiteralNullConversion : DiagGroup<"non-literal-null-conversion">;
|
||||
def NullConversion : DiagGroup<"null-conversion">;
|
||||
def ImplicitConversionFloatingPointToBool :
|
||||
@ -287,7 +288,7 @@ def IgnoredQualifiers : DiagGroup<"ignored-qualifiers">;
|
||||
def : DiagGroup<"import">;
|
||||
def GNUIncludeNext : DiagGroup<"gnu-include-next">;
|
||||
def IncompatibleMSStruct : DiagGroup<"incompatible-ms-struct">;
|
||||
def IncompatiblePointerTypesDiscardsQualifiers
|
||||
def IncompatiblePointerTypesDiscardsQualifiers
|
||||
: DiagGroup<"incompatible-pointer-types-discards-qualifiers">;
|
||||
def IncompatibleFunctionPointerTypes
|
||||
: DiagGroup<"incompatible-function-pointer-types">;
|
||||
@ -799,14 +800,14 @@ def Most : DiagGroup<"most", [
|
||||
UserDefinedWarnings
|
||||
]>;
|
||||
|
||||
// Thread Safety warnings
|
||||
// Thread Safety warnings
|
||||
def ThreadSafetyAttributes : DiagGroup<"thread-safety-attributes">;
|
||||
def ThreadSafetyAnalysis : DiagGroup<"thread-safety-analysis">;
|
||||
def ThreadSafetyPrecise : DiagGroup<"thread-safety-precise">;
|
||||
def ThreadSafetyReference : DiagGroup<"thread-safety-reference">;
|
||||
def ThreadSafetyNegative : DiagGroup<"thread-safety-negative">;
|
||||
def ThreadSafety : DiagGroup<"thread-safety",
|
||||
[ThreadSafetyAttributes,
|
||||
[ThreadSafetyAttributes,
|
||||
ThreadSafetyAnalysis,
|
||||
ThreadSafetyPrecise,
|
||||
ThreadSafetyReference]>;
|
||||
|
@ -214,7 +214,7 @@ class DiagnosticIDs : public RefCountedBase<DiagnosticIDs> {
|
||||
bool ignored;
|
||||
return isBuiltinExtensionDiag(DiagID, ignored);
|
||||
}
|
||||
|
||||
|
||||
/// Determine whether the given built-in diagnostic ID is for an
|
||||
/// extension of some sort, and whether it is enabled by default.
|
||||
///
|
||||
@ -223,14 +223,14 @@ class DiagnosticIDs : public RefCountedBase<DiagnosticIDs> {
|
||||
/// treated as a warning/error by default.
|
||||
///
|
||||
static bool isBuiltinExtensionDiag(unsigned DiagID, bool &EnabledByDefault);
|
||||
|
||||
|
||||
|
||||
/// Return the lowest-level warning option that enables the specified
|
||||
/// diagnostic.
|
||||
///
|
||||
/// If there is no -Wfoo flag that controls the diagnostic, this returns null.
|
||||
static StringRef getWarningOptionForDiag(unsigned DiagID);
|
||||
|
||||
|
||||
/// Return the category number that a specified \p DiagID belongs to,
|
||||
/// or 0 if no category.
|
||||
static unsigned getCategoryNumberForDiag(unsigned DiagID);
|
||||
@ -240,7 +240,7 @@ class DiagnosticIDs : public RefCountedBase<DiagnosticIDs> {
|
||||
|
||||
/// Given a category ID, return the name of the category.
|
||||
static StringRef getCategoryNameFromID(unsigned CategoryID);
|
||||
|
||||
|
||||
/// Return true if a given diagnostic falls into an ARC diagnostic
|
||||
/// category.
|
||||
static bool isARCDiagnostic(unsigned DiagID);
|
||||
@ -251,26 +251,26 @@ class DiagnosticIDs : public RefCountedBase<DiagnosticIDs> {
|
||||
/// The diagnostic should not be reported, but it should cause
|
||||
/// template argument deduction to fail.
|
||||
///
|
||||
/// The vast majority of errors that occur during template argument
|
||||
/// The vast majority of errors that occur during template argument
|
||||
/// deduction fall into this category.
|
||||
SFINAE_SubstitutionFailure,
|
||||
|
||||
|
||||
/// The diagnostic should be suppressed entirely.
|
||||
///
|
||||
/// Warnings generally fall into this category.
|
||||
SFINAE_Suppress,
|
||||
|
||||
|
||||
/// The diagnostic should be reported.
|
||||
///
|
||||
/// The diagnostic should be reported. Various fatal errors (e.g.,
|
||||
/// The diagnostic should be reported. Various fatal errors (e.g.,
|
||||
/// template instantiation depth exceeded) fall into this category.
|
||||
SFINAE_Report,
|
||||
|
||||
|
||||
/// The diagnostic is an access-control diagnostic, which will be
|
||||
/// substitution failures in some contexts and reported in others.
|
||||
SFINAE_AccessControl
|
||||
};
|
||||
|
||||
|
||||
/// Determines whether the given built-in diagnostic ID is
|
||||
/// for an error that is suppressed if it occurs during C++ template
|
||||
/// argument deduction.
|
||||
@ -306,7 +306,7 @@ class DiagnosticIDs : public RefCountedBase<DiagnosticIDs> {
|
||||
private:
|
||||
/// Classify the specified diagnostic ID into a Level, consumable by
|
||||
/// the DiagnosticClient.
|
||||
///
|
||||
///
|
||||
/// The classification is based on the way the client configured the
|
||||
/// DiagnosticsEngine object.
|
||||
///
|
||||
|
@ -53,7 +53,7 @@ def ext_multi_line_line_comment : Extension<"multi-line // comment">,
|
||||
def ext_line_comment : Extension<
|
||||
"// comments are not allowed in this language">,
|
||||
InGroup<Comment>;
|
||||
def ext_no_newline_eof : Extension<"no newline at end of file">,
|
||||
def ext_no_newline_eof : Extension<"no newline at end of file">,
|
||||
InGroup<NewlineEOF>;
|
||||
def warn_no_newline_eof : Warning<"no newline at end of file">,
|
||||
InGroup<NewlineEOF>, DefaultIgnore;
|
||||
@ -294,7 +294,7 @@ def pp_nonportable_path : NonportablePath,
|
||||
InGroup<DiagGroup<"nonportable-include-path">>;
|
||||
def pp_nonportable_system_path : NonportablePath, DefaultIgnore,
|
||||
InGroup<DiagGroup<"nonportable-system-include-path">>;
|
||||
|
||||
|
||||
def pp_pragma_once_in_main_file : Warning<"#pragma once in main file">,
|
||||
InGroup<DiagGroup<"pragma-once-outside-header">>;
|
||||
def pp_pragma_sysheader_in_main_file : Warning<
|
||||
@ -353,7 +353,7 @@ def ext_pp_warning_directive : Extension<"#warning is a language extension">;
|
||||
|
||||
def ext_pp_extra_tokens_at_eol : ExtWarn<
|
||||
"extra tokens at end of #%0 directive">, InGroup<ExtraTokens>;
|
||||
|
||||
|
||||
def ext_pp_comma_expr : Extension<"comma operator in operand of #if">;
|
||||
def ext_pp_bad_vaargs_use : Extension<
|
||||
"__VA_ARGS__ can only appear in the expansion of a C99 variadic macro">;
|
||||
@ -594,7 +594,7 @@ def err_pp_illegal_floating_literal : Error<
|
||||
def err_pp_line_requires_integer : Error<
|
||||
"#line directive requires a positive integer argument">;
|
||||
def ext_pp_line_zero : Extension<
|
||||
"#line directive with zero argument is a GNU extension">,
|
||||
"#line directive with zero argument is a GNU extension">,
|
||||
InGroup<GNUZeroLineDirective>;
|
||||
def err_pp_line_invalid_filename : Error<
|
||||
"invalid filename for #line directive">;
|
||||
@ -736,7 +736,7 @@ def warn_auto_module_import : Warning<
|
||||
def note_implicit_top_level_module_import_here : Note<
|
||||
"submodule of top-level module '%0' implicitly imported here">;
|
||||
def warn_uncovered_module_header : Warning<
|
||||
"umbrella header for module '%0' does not include header '%1'">,
|
||||
"umbrella header for module '%0' does not include header '%1'">,
|
||||
InGroup<IncompleteUmbrella>;
|
||||
def warn_mmap_umbrella_dir_not_found : Warning<
|
||||
"umbrella directory '%0' not found">,
|
||||
@ -755,7 +755,7 @@ def warn_non_modular_include_in_module : Warning<
|
||||
"include of non-modular header inside module '%0': '%1'">,
|
||||
InGroup<NonModularIncludeInModule>, DefaultIgnore;
|
||||
def warn_module_conflict : Warning<
|
||||
"module '%0' conflicts with already-imported module '%1': %2">,
|
||||
"module '%0' conflicts with already-imported module '%1': %2">,
|
||||
InGroup<ModuleConflict>;
|
||||
|
||||
def warn_header_guard : Warning<
|
||||
|
@ -61,9 +61,9 @@ DIAGOPT(ShowOptionNames, 1, 0) /// Show the option name for mappable
|
||||
DIAGOPT(ShowNoteIncludeStack, 1, 0) /// Show include stacks for notes.
|
||||
VALUE_DIAGOPT(ShowCategories, 2, 0) /// Show categories: 0 -> none, 1 -> Number,
|
||||
/// 2 -> Full Name.
|
||||
|
||||
ENUM_DIAGOPT(Format, TextDiagnosticFormat, 2, Clang) /// Format for diagnostics:
|
||||
|
||||
|
||||
ENUM_DIAGOPT(Format, TextDiagnosticFormat, 2, Clang) /// Format for diagnostics:
|
||||
|
||||
DIAGOPT(ShowColors, 1, 0) /// Show diagnostics with ANSI color sequences.
|
||||
ENUM_DIAGOPT(ShowOverloads, OverloadsShown, 1,
|
||||
Ovl_All) /// Overload candidates to show.
|
||||
|
@ -91,7 +91,7 @@ class DiagnosticOptions : public RefCountedBase<DiagnosticOptions>{
|
||||
public:
|
||||
/// The file to log diagnostic output to.
|
||||
std::string DiagnosticLogFile;
|
||||
|
||||
|
||||
/// The file to serialize diagnostics to (non-appending).
|
||||
std::string DiagnosticSerializationFile;
|
||||
|
||||
|
@ -86,7 +86,7 @@ def err_enumerator_list_missing_comma : Error<
|
||||
def err_enumerator_unnamed_no_def : Error<
|
||||
"unnamed enumeration must be a definition">;
|
||||
def ext_cxx11_enum_fixed_underlying_type : Extension<
|
||||
"enumeration types with a fixed underlying type are a C++11 extension">,
|
||||
"enumeration types with a fixed underlying type are a C++11 extension">,
|
||||
InGroup<CXX11>;
|
||||
def ext_c_enum_fixed_underlying_type : Extension<
|
||||
"enumeration types with a fixed underlying type are a Microsoft extension">,
|
||||
@ -101,7 +101,7 @@ def ext_alignof_expr : ExtWarn<
|
||||
"%0 applied to an expression is a GNU extension">, InGroup<GNUAlignofExpression>;
|
||||
|
||||
def warn_microsoft_dependent_exists : Warning<
|
||||
"dependent %select{__if_not_exists|__if_exists}0 declarations are ignored">,
|
||||
"dependent %select{__if_not_exists|__if_exists}0 declarations are ignored">,
|
||||
InGroup<DiagGroup<"microsoft-exists">>;
|
||||
def warn_microsoft_qualifiers_ignored : Warning<
|
||||
"qualifiers after comma in declarator list are ignored">,
|
||||
@ -134,14 +134,14 @@ def ext_gnu_conditional_expr : Extension<
|
||||
"use of GNU ?: conditional expression extension, omitting middle operand">, InGroup<GNUConditionalOmittedOperand>;
|
||||
def ext_gnu_empty_initializer : Extension<
|
||||
"use of GNU empty initializer extension">, InGroup<GNUEmptyInitializer>;
|
||||
def ext_gnu_array_range : Extension<"use of GNU array range extension">,
|
||||
def ext_gnu_array_range : Extension<"use of GNU array range extension">,
|
||||
InGroup<GNUDesignator>;
|
||||
def ext_gnu_missing_equal_designator : ExtWarn<
|
||||
"use of GNU 'missing =' extension in designator">,
|
||||
"use of GNU 'missing =' extension in designator">,
|
||||
InGroup<GNUDesignator>;
|
||||
def err_expected_equal_designator : Error<"expected '=' or another designator">;
|
||||
def ext_gnu_old_style_field_designator : ExtWarn<
|
||||
"use of GNU old-style field designator extension">,
|
||||
"use of GNU old-style field designator extension">,
|
||||
InGroup<GNUDesignator>;
|
||||
def ext_gnu_case_range : Extension<"use of GNU case range extension">,
|
||||
InGroup<GNUCaseRange>;
|
||||
@ -168,16 +168,16 @@ def err_unexpected_semi : Error<"unexpected ';' before %0">;
|
||||
def err_expected_fn_body : Error<
|
||||
"expected function body after function declarator">;
|
||||
def warn_attribute_on_function_definition : Warning<
|
||||
"GCC does not allow %0 attribute in this position on a function definition">,
|
||||
"GCC does not allow %0 attribute in this position on a function definition">,
|
||||
InGroup<GccCompat>;
|
||||
def warn_gcc_attribute_location : Warning<
|
||||
"GCC does not allow an attribute in this position on a function declaration">,
|
||||
"GCC does not allow an attribute in this position on a function declaration">,
|
||||
InGroup<GccCompat>;
|
||||
def warn_gcc_variable_decl_in_for_loop : Warning<
|
||||
"GCC does not allow variable declarations in for loop initializers before "
|
||||
"C99">, InGroup<GccCompat>;
|
||||
def warn_attribute_no_decl : Warning<
|
||||
"attribute %0 ignored, because it is not attached to a declaration">,
|
||||
"attribute %0 ignored, because it is not attached to a declaration">,
|
||||
InGroup<IgnoredAttributes>;
|
||||
def err_ms_attributes_not_enabled : Error<
|
||||
"'__declspec' attributes are not enabled; use '-fdeclspec' or "
|
||||
@ -319,7 +319,7 @@ def warn_cxx98_compat_decltype : Warning<
|
||||
def err_unexpected_scope_on_base_decltype : Error<
|
||||
"unexpected namespace scope prior to decltype">;
|
||||
def err_expected_class_name : Error<"expected class name">;
|
||||
def err_expected_class_name_not_template :
|
||||
def err_expected_class_name_not_template :
|
||||
Error<"'typename' is redundant; base classes are implicitly types">;
|
||||
def err_unspecified_vla_size_with_static : Error<
|
||||
"'static' may not be used with an unspecified variable length array size">;
|
||||
@ -395,7 +395,7 @@ def warn_arc_bridge_cast_nonarc : Warning<
|
||||
"'%0' casts have no effect when not using ARC">,
|
||||
InGroup<DiagGroup<"arc-bridge-casts-disallowed-in-nonarc">>;
|
||||
}
|
||||
|
||||
|
||||
def err_objc_illegal_visibility_spec : Error<
|
||||
"illegal visibility specification">;
|
||||
def err_objc_illegal_interface_qual : Error<"illegal interface qualifier">;
|
||||
@ -687,7 +687,7 @@ def warn_cxx98_compat_extern_template : Warning<
|
||||
def warn_static_inline_explicit_inst_ignored : Warning<
|
||||
"ignoring '%select{static|inline}0' keyword on explicit template "
|
||||
"instantiation">, InGroup<DiagGroup<"static-inline-explicit-instantiation">>;
|
||||
|
||||
|
||||
// Constructor template diagnostics.
|
||||
def err_out_of_line_constructor_template_id : Error<
|
||||
"out-of-line constructor for %0 cannot have template arguments">;
|
||||
@ -703,7 +703,7 @@ def err_expected_type_name_after_typename : Error<
|
||||
"expected an identifier or template-id after '::'">;
|
||||
def err_explicit_spec_non_template : Error<
|
||||
"explicit %select{specialization|instantiation}0 of non-template %1 %2">;
|
||||
|
||||
|
||||
def err_default_template_template_parameter_not_template : Error<
|
||||
"default template argument for a template template parameter must be a class "
|
||||
"template">;
|
||||
@ -850,7 +850,7 @@ def err_zero_version : Error<
|
||||
"version number must have non-zero major, minor, or sub-minor version">;
|
||||
def err_availability_expected_platform : Error<
|
||||
"expected a platform name, e.g., 'macos'">;
|
||||
|
||||
|
||||
// objc_bridge_related attribute
|
||||
def err_objcbridge_related_expected_related_class : Error<
|
||||
"expected a related ObjectiveC class name, e.g., 'NSColor'">;
|
||||
@ -994,7 +994,7 @@ def warn_pragma_init_seg_unsupported_target : Warning<
|
||||
// - #pragma fp_contract
|
||||
def err_pragma_fp_contract_scope : Error<
|
||||
"'#pragma fp_contract' can only appear at file scope or at the start of a "
|
||||
"compound statement">;
|
||||
"compound statement">;
|
||||
// - #pragma stdc unknown
|
||||
def ext_stdc_pragma_ignored : ExtWarn<"unknown pragma in STDC namespace">,
|
||||
InGroup<UnknownPragmas>;
|
||||
|
@ -243,7 +243,7 @@ def err_invalid_vector_double_decl_spec : Error <
|
||||
"(available on POWER7 or later)">;
|
||||
def err_invalid_vector_long_long_decl_spec : Error <
|
||||
"use of 'long long' with '__vector bool' requires VSX support (available on "
|
||||
"POWER7 or later) or extended Altivec support (available on POWER8 or later) "
|
||||
"POWER7 or later) or extended Altivec support (available on POWER8 or later) "
|
||||
"to be enabled">;
|
||||
def err_invalid_vector_long_double_decl_spec : Error<
|
||||
"cannot use 'long double' with '__vector'">;
|
||||
@ -388,7 +388,7 @@ def err_inline_non_function : Error<
|
||||
"'inline' can only appear on functions%select{| and non-local variables}0">;
|
||||
def err_noreturn_non_function : Error<
|
||||
"'_Noreturn' can only appear on functions">;
|
||||
def warn_qual_return_type : Warning<
|
||||
def warn_qual_return_type : Warning<
|
||||
"'%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect">,
|
||||
InGroup<IgnoredQualifiers>, DefaultIgnore;
|
||||
def warn_deprecated_redundant_constexpr_static_def : Warning<
|
||||
@ -640,8 +640,8 @@ def warn_dyn_class_memaccess : Warning<
|
||||
def note_bad_memaccess_silence : Note<
|
||||
"explicitly cast the pointer to silence this warning">;
|
||||
def warn_sizeof_pointer_expr_memaccess : Warning<
|
||||
"'%0' call operates on objects of type %1 while the size is based on a "
|
||||
"different type %2">,
|
||||
"'%0' call operates on objects of type %1 while the size is based on a "
|
||||
"different type %2">,
|
||||
InGroup<SizeofPointerMemaccess>;
|
||||
def warn_sizeof_pointer_expr_memaccess_note : Note<
|
||||
"did you mean to %select{dereference the argument to 'sizeof' (and multiply "
|
||||
@ -679,14 +679,14 @@ def note_suspicious_bzero_size_silence : Note<
|
||||
"parenthesize the second argument to silence">;
|
||||
|
||||
def warn_strncat_large_size : Warning<
|
||||
"the value of the size argument in 'strncat' is too large, might lead to a "
|
||||
"the value of the size argument in 'strncat' is too large, might lead to a "
|
||||
"buffer overflow">, InGroup<StrncatSize>;
|
||||
def warn_strncat_src_size : Warning<"size argument in 'strncat' call appears "
|
||||
def warn_strncat_src_size : Warning<"size argument in 'strncat' call appears "
|
||||
"to be size of the source">, InGroup<StrncatSize>;
|
||||
def warn_strncat_wrong_size : Warning<
|
||||
"the value of the size argument to 'strncat' is wrong">, InGroup<StrncatSize>;
|
||||
def note_strncat_wrong_size : Note<
|
||||
"change the argument to be the free space in the destination buffer minus "
|
||||
"change the argument to be the free space in the destination buffer minus "
|
||||
"the terminating null byte">;
|
||||
|
||||
def warn_assume_side_effects : Warning<
|
||||
@ -1030,15 +1030,15 @@ def note_property_attribute : Note<"property %0 is declared "
|
||||
"%select{deprecated|unavailable|partial}1 here">;
|
||||
def err_setter_type_void : Error<"type of setter must be void">;
|
||||
def err_duplicate_method_decl : Error<"duplicate declaration of method %0">;
|
||||
def warn_duplicate_method_decl :
|
||||
Warning<"multiple declarations of method %0 found and ignored">,
|
||||
def warn_duplicate_method_decl :
|
||||
Warning<"multiple declarations of method %0 found and ignored">,
|
||||
InGroup<MethodDuplicate>, DefaultIgnore;
|
||||
def warn_objc_cdirective_format_string :
|
||||
Warning<"using %0 directive in %select{NSString|CFString}1 "
|
||||
"which is being passed as a formatting argument to the formatting "
|
||||
"%select{method|CFfunction}2">,
|
||||
InGroup<ObjCCStringFormat>, DefaultIgnore;
|
||||
def err_objc_var_decl_inclass :
|
||||
def err_objc_var_decl_inclass :
|
||||
Error<"cannot declare variable inside @interface or @protocol">;
|
||||
def err_missing_method_context : Error<
|
||||
"missing context for method declaration">;
|
||||
@ -1250,7 +1250,7 @@ def warn_auto_implicit_atomic_property : Warning<
|
||||
"property is assumed atomic when auto-synthesizing the property">,
|
||||
InGroup<ImplicitAtomic>, DefaultIgnore;
|
||||
def warn_unimplemented_selector: Warning<
|
||||
"no method with selector %0 is implemented in this translation unit">,
|
||||
"no method with selector %0 is implemented in this translation unit">,
|
||||
InGroup<Selector>, DefaultIgnore;
|
||||
def warn_unimplemented_protocol_method : Warning<
|
||||
"method %0 in protocol %1 not implemented">, InGroup<Protocol>;
|
||||
@ -1379,7 +1379,7 @@ def err_capture_default_non_local : Error<
|
||||
"non-local lambda expression cannot have a capture-default">;
|
||||
|
||||
def err_multiple_final_overriders : Error<
|
||||
"virtual function %q0 has more than one final overrider in %1">;
|
||||
"virtual function %q0 has more than one final overrider in %1">;
|
||||
def note_final_overrider : Note<"final overrider of %q0 in %1">;
|
||||
|
||||
def err_type_defined_in_type_specifier : Error<
|
||||
@ -1421,7 +1421,7 @@ def warn_weak_template_vtable : Warning<
|
||||
|
||||
def ext_using_undefined_std : ExtWarn<
|
||||
"using directive refers to implicitly-defined namespace 'std'">;
|
||||
|
||||
|
||||
// C++ exception specifications
|
||||
def err_exception_spec_in_typedef : Error<
|
||||
"exception specifications are not allowed in %select{typedefs|type aliases}0">;
|
||||
@ -1475,7 +1475,7 @@ def ext_ms_using_declaration_inaccessible : ExtWarn<
|
||||
"to accessible member '%1') is a Microsoft compatibility extension">,
|
||||
AccessControl, InGroup<MicrosoftUsingDecl>;
|
||||
def err_access_ctor : Error<
|
||||
"calling a %select{private|protected}0 constructor of class %2">,
|
||||
"calling a %select{private|protected}0 constructor of class %2">,
|
||||
AccessControl;
|
||||
def ext_rvalue_to_reference_access_ctor : Extension<
|
||||
"C++98 requires an accessible copy constructor for class %2 when binding "
|
||||
@ -1498,7 +1498,7 @@ def err_access_friend_function : Error<
|
||||
AccessControl;
|
||||
|
||||
def err_access_dtor : Error<
|
||||
"calling a %select{private|protected}1 destructor of class %0">,
|
||||
"calling a %select{private|protected}1 destructor of class %0">,
|
||||
AccessControl;
|
||||
def err_access_dtor_base :
|
||||
Error<"base class %0 has %select{private|protected}1 destructor">,
|
||||
@ -1540,7 +1540,7 @@ def note_access_protected_restricted_object : Note<
|
||||
def warn_cxx98_compat_sfinae_access_control : Warning<
|
||||
"substitution failure due to access control is incompatible with C++98">,
|
||||
InGroup<CXX98Compat>, DefaultIgnore, NoSFINAE;
|
||||
|
||||
|
||||
// C++ name lookup
|
||||
def err_incomplete_nested_name_spec : Error<
|
||||
"incomplete type %0 named in nested name specifier">;
|
||||
@ -1733,6 +1733,8 @@ def warn_overriding_method_missing_noescape : Warning<
|
||||
"__attribute__((noescape))">, InGroup<MissingNoEscape>;
|
||||
def note_overridden_marked_noescape : Note<
|
||||
"parameter of overridden method is annotated with __attribute__((noescape))">;
|
||||
def note_cat_conform_to_noescape_prot : Note<
|
||||
"%select{category|class extension}0 conforms to protocol %1 which defines method %2">;
|
||||
|
||||
def err_covariant_return_inaccessible_base : Error<
|
||||
"invalid covariant return for virtual function: %1 is a "
|
||||
@ -1979,7 +1981,7 @@ def note_explicit_ctor_deduction_guide_here : Note<
|
||||
// C++11 decltype
|
||||
def err_decltype_in_declarator : Error<
|
||||
"'decltype' cannot be used to name a declaration">;
|
||||
|
||||
|
||||
// C++11 auto
|
||||
def warn_cxx98_compat_auto_type_specifier : Warning<
|
||||
"'auto' type specifier is incompatible with C++98">,
|
||||
@ -2632,7 +2634,7 @@ def warn_objc_literal_comparison : Warning<
|
||||
def err_missing_atsign_prefix : Error<
|
||||
"string literal must be prefixed by '@' ">;
|
||||
def warn_objc_string_literal_comparison : Warning<
|
||||
"direct comparison of a string literal has undefined behavior">,
|
||||
"direct comparison of a string literal has undefined behavior">,
|
||||
InGroup<ObjCStringComparison>;
|
||||
def warn_concatenated_nsarray_literal : Warning<
|
||||
"concatenated NSString literal for an NSArray expression - "
|
||||
@ -2746,7 +2748,7 @@ def warn_cxx11_gnu_attribute_on_type : Warning<
|
||||
"attribute %0 ignored, because it cannot be applied to a type">,
|
||||
InGroup<IgnoredAttributes>;
|
||||
def warn_unhandled_ms_attribute_ignored : Warning<
|
||||
"__declspec attribute %0 is not supported">,
|
||||
"__declspec attribute %0 is not supported">,
|
||||
InGroup<IgnoredAttributes>;
|
||||
def err_decl_attribute_invalid_on_stmt : Error<
|
||||
"%0 attribute cannot be applied to a statement">;
|
||||
@ -3001,7 +3003,7 @@ def err_attribute_argument_out_of_range : Error<
|
||||
"1:can only be 1, since there is one parameter|"
|
||||
":must be between 1 and %2}2">;
|
||||
|
||||
// Thread Safety Analysis
|
||||
// Thread Safety Analysis
|
||||
def warn_unlock_but_no_lock : Warning<"releasing %0 '%1' that was not held">,
|
||||
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
|
||||
def warn_unlock_kind_mismatch : Warning<
|
||||
@ -3015,7 +3017,7 @@ def warn_no_unlock : Warning<
|
||||
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
|
||||
def warn_expecting_locked : Warning<
|
||||
"expecting %0 '%1' to be held at the end of function">,
|
||||
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
|
||||
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
|
||||
// FIXME: improve the error message about locks not in scope
|
||||
def warn_lock_some_predecessors : Warning<
|
||||
"%0 '%1' is not held on every path through here">,
|
||||
@ -3092,13 +3094,13 @@ def warn_fun_requires_lock_precise :
|
||||
def note_found_mutex_near_match : Note<"found near match '%0'">;
|
||||
|
||||
// Verbose thread safety warnings
|
||||
def warn_thread_safety_verbose : Warning<"Thread safety verbose warning.">,
|
||||
def warn_thread_safety_verbose : Warning<"Thread safety verbose warning.">,
|
||||
InGroup<ThreadSafetyVerbose>, DefaultIgnore;
|
||||
def note_thread_warning_in_fun : Note<"Thread warning in function %0">;
|
||||
def note_guarded_by_declared_here : Note<"Guarded_by declared here.">;
|
||||
|
||||
// Dummy warning that will trigger "beta" warnings from the analysis if enabled.
|
||||
def warn_thread_safety_beta : Warning<"Thread safety beta warning.">,
|
||||
// Dummy warning that will trigger "beta" warnings from the analysis if enabled.
|
||||
def warn_thread_safety_beta : Warning<"Thread safety beta warning.">,
|
||||
InGroup<ThreadSafetyBeta>, DefaultIgnore;
|
||||
|
||||
// Consumed warnings
|
||||
@ -3354,7 +3356,7 @@ def err_attribute_sentinel_not_zero_or_one : Error<
|
||||
"'sentinel' parameter 2 not 0 or 1">;
|
||||
def warn_cleanup_ext : Warning<
|
||||
"GCC does not allow the 'cleanup' attribute argument to be anything other "
|
||||
"than a simple identifier">,
|
||||
"than a simple identifier">,
|
||||
InGroup<GccCompat>;
|
||||
def err_attribute_cleanup_arg_not_function : Error<
|
||||
"'cleanup' argument %select{|%1 |%1 }0is not a %select{||single }0function">;
|
||||
@ -3389,7 +3391,7 @@ def warn_iboutlet_object_type : Warning<
|
||||
def warn_iboutletcollection_property_assign : Warning<
|
||||
"IBOutletCollection properties should be copy/strong and not assign">,
|
||||
InGroup<ObjCInvalidIBOutletProperty>;
|
||||
|
||||
|
||||
def err_attribute_overloadable_mismatch : Error<
|
||||
"redeclaration of %0 must %select{not |}1have the 'overloadable' attribute">;
|
||||
def note_attribute_overloadable_prev_overload : Note<
|
||||
@ -3854,7 +3856,7 @@ def note_template_param_different_kind : Note<
|
||||
|
||||
def err_invalid_decl_specifier_in_nontype_parm : Error<
|
||||
"invalid declaration specifier in template non-type parameter">;
|
||||
|
||||
|
||||
def err_template_nontype_parm_different_type : Error<
|
||||
"template non-type parameter has a different type %0 in template "
|
||||
"%select{|template parameter }1redeclaration">;
|
||||
@ -4156,7 +4158,7 @@ def err_dependent_typed_non_type_arg_in_partial_spec : Error<
|
||||
def err_partial_spec_args_match_primary_template : Error<
|
||||
"%select{class|variable}0 template partial specialization does not "
|
||||
"specialize any template argument; to %select{declare|define}1 the "
|
||||
"primary template, remove the template argument list">;
|
||||
"primary template, remove the template argument list">;
|
||||
def ext_partial_spec_not_more_specialized_than_primary : ExtWarn<
|
||||
"%select{class|variable}0 template partial specialization is not "
|
||||
"more specialized than the primary template">, DefaultError,
|
||||
@ -4191,7 +4193,7 @@ def err_var_spec_no_template : Error<
|
||||
def err_var_spec_no_template_but_method : Error<
|
||||
"no variable template matches specialization; "
|
||||
"did you mean to use %0 as function template instead?">;
|
||||
|
||||
|
||||
// C++ Function template specializations
|
||||
def err_function_template_spec_no_match : Error<
|
||||
"no function template matches function template specialization %0">;
|
||||
@ -4312,12 +4314,12 @@ def err_explicit_instantiation_out_of_scope : Error<
|
||||
def err_explicit_instantiation_must_be_global : Error<
|
||||
"explicit instantiation of %0 must occur at global scope">;
|
||||
def warn_explicit_instantiation_out_of_scope_0x : Warning<
|
||||
"explicit instantiation of %0 not in a namespace enclosing %1">,
|
||||
"explicit instantiation of %0 not in a namespace enclosing %1">,
|
||||
InGroup<CXX11Compat>, DefaultIgnore;
|
||||
def warn_explicit_instantiation_must_be_global_0x : Warning<
|
||||
"explicit instantiation of %0 must occur at global scope">,
|
||||
"explicit instantiation of %0 must occur at global scope">,
|
||||
InGroup<CXX11Compat>, DefaultIgnore;
|
||||
|
||||
|
||||
def err_explicit_instantiation_requires_name : Error<
|
||||
"explicit instantiation declaration requires a name">;
|
||||
def err_explicit_instantiation_of_typedef : Error<
|
||||
@ -4378,7 +4380,7 @@ def err_mismatched_exception_spec_explicit_instantiation : Error<
|
||||
def ext_mismatched_exception_spec_explicit_instantiation : ExtWarn<
|
||||
err_mismatched_exception_spec_explicit_instantiation.Text>,
|
||||
InGroup<MicrosoftExceptionSpec>;
|
||||
|
||||
|
||||
// C++ typename-specifiers
|
||||
def err_typename_nested_not_found : Error<"no type named %0 in %1">;
|
||||
def err_typename_nested_not_found_enable_if : Error<
|
||||
@ -4456,7 +4458,7 @@ def note_template_parameter_pack_non_pack : Note<
|
||||
def note_template_parameter_pack_here : Note<
|
||||
"previous %select{template type|non-type template|template template}0 "
|
||||
"parameter%select{| pack}1 declared here">;
|
||||
|
||||
|
||||
def err_unexpanded_parameter_pack : Error<
|
||||
"%select{expression|base type|declaration type|data member type|bit-field "
|
||||
"size|static assertion|fixed underlying type|enumerator value|"
|
||||
@ -4560,7 +4562,7 @@ def warn_missing_prototype : Warning<
|
||||
"no previous prototype for function %0">,
|
||||
InGroup<DiagGroup<"missing-prototypes">>, DefaultIgnore;
|
||||
def note_declaration_not_a_prototype : Note<
|
||||
"this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function">;
|
||||
"this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function">;
|
||||
def warn_strict_prototypes : Warning<
|
||||
"this %select{function declaration is not|block declaration is not|"
|
||||
"old-style function definition is not preceded by}0 a prototype">,
|
||||
@ -4768,7 +4770,7 @@ def ext_ms_forward_ref_enum : ExtWarn<
|
||||
def ext_forward_ref_enum_def : Extension<
|
||||
"redeclaration of already-defined enum %0 is a GNU extension">,
|
||||
InGroup<GNURedeclaredEnum>;
|
||||
|
||||
|
||||
def err_redefinition_of_enumerator : Error<"redefinition of enumerator %0">;
|
||||
def err_duplicate_member : Error<"duplicate member %0">;
|
||||
def err_misplaced_ivar : Error<
|
||||
@ -4787,7 +4789,7 @@ def ext_enumerator_increment_too_large : ExtWarn<
|
||||
def warn_flag_enum_constant_out_of_range : Warning<
|
||||
"enumeration value %0 is out of range of flags in enumeration type %1">,
|
||||
InGroup<FlagEnum>;
|
||||
|
||||
|
||||
def warn_illegal_constant_array_size : Extension<
|
||||
"size of static array must be an integer constant expression">;
|
||||
def err_vm_decl_in_file_scope : Error<
|
||||
@ -4892,7 +4894,7 @@ def err_illegal_initializer : Error<
|
||||
"illegal initializer (only variables can be initialized)">;
|
||||
def err_illegal_initializer_type : Error<"illegal initializer type %0">;
|
||||
def ext_init_list_type_narrowing : ExtWarn<
|
||||
"type %0 cannot be narrowed to %1 in initializer list">,
|
||||
"type %0 cannot be narrowed to %1 in initializer list">,
|
||||
InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
|
||||
def ext_init_list_variable_narrowing : ExtWarn<
|
||||
"non-constant-expression cannot be narrowed from type %0 to %1 in "
|
||||
@ -5230,9 +5232,9 @@ def err_arc_illegal_method_def : Error<
|
||||
def warn_arc_strong_pointer_objc_pointer : Warning<
|
||||
"method parameter of type %0 with no explicit ownership">,
|
||||
InGroup<DiagGroup<"explicit-ownership-type">>, DefaultIgnore;
|
||||
|
||||
|
||||
} // end "ARC Restrictions" category
|
||||
|
||||
|
||||
def err_arc_lost_method_convention : Error<
|
||||
"method was declared as %select{an 'alloc'|a 'copy'|an 'init'|a 'new'}0 "
|
||||
"method, but its implementation doesn't match because %select{"
|
||||
@ -5301,7 +5303,7 @@ def warn_receiver_forward_instance : Warning<
|
||||
InGroup<ForwardClassReceiver>, DefaultIgnore;
|
||||
def err_arc_collection_forward : Error<
|
||||
"collection expression type %0 is a forward declaration">;
|
||||
def err_arc_multiple_method_decl : Error<
|
||||
def err_arc_multiple_method_decl : Error<
|
||||
"multiple methods named %0 found with mismatched result, "
|
||||
"parameter type or attributes">;
|
||||
def warn_arc_lifetime_result_type : Warning<
|
||||
@ -5694,7 +5696,7 @@ def warn_namespace_member_extra_qualification : Warning<
|
||||
"extra qualification on member %0">,
|
||||
InGroup<DiagGroup<"extra-qualification">>;
|
||||
def err_member_qualification : Error<
|
||||
"non-friend class member %0 cannot have a qualified name">;
|
||||
"non-friend class member %0 cannot have a qualified name">;
|
||||
def note_member_def_close_match : Note<"member declaration nearly matches">;
|
||||
def note_member_def_close_const_match : Note<
|
||||
"member declaration does not match because "
|
||||
@ -5800,7 +5802,7 @@ def err_typecheck_invalid_lvalue_addrof_addrof_function : Error<
|
||||
def err_typecheck_invalid_lvalue_addrof : Error<
|
||||
"cannot take the address of an rvalue of type %0">;
|
||||
def ext_typecheck_addrof_temporary : ExtWarn<
|
||||
"taking the address of a temporary object of type %0">,
|
||||
"taking the address of a temporary object of type %0">,
|
||||
InGroup<AddressOfTemporary>, DefaultError;
|
||||
def err_typecheck_addrof_temporary : Error<
|
||||
"taking the address of a temporary object of type %0">;
|
||||
@ -5911,7 +5913,7 @@ def warn_mixed_sign_comparison : Warning<
|
||||
"comparison of integers of different signs: %0 and %1">,
|
||||
InGroup<SignCompare>, DefaultIgnore;
|
||||
def warn_out_of_range_compare : Warning<
|
||||
"result of comparison of %select{constant %0|true|false}1 with "
|
||||
"result of comparison of %select{constant %0|true|false}1 with "
|
||||
"%select{expression of type %2|boolean expression}3 is always %4">,
|
||||
InGroup<TautologicalOutOfRangeCompare>;
|
||||
def warn_tautological_bool_compare : Warning<warn_out_of_range_compare.Text>,
|
||||
@ -6069,7 +6071,7 @@ def err_no_subobject_property_setting : Error<
|
||||
"expression is not assignable">;
|
||||
def err_qualified_objc_access : Error<
|
||||
"%select{property|instance variable}0 access cannot be qualified with '%1'">;
|
||||
|
||||
|
||||
def ext_freestanding_complex : Extension<
|
||||
"complex numbers are an extension in a freestanding C99 implementation">;
|
||||
|
||||
@ -6235,13 +6237,13 @@ def warn_cxx98_compat_cast_fn_obj : Warning<
|
||||
def err_bad_reinterpret_cast_small_int : Error<
|
||||
"cast from pointer to smaller type %2 loses information">;
|
||||
def err_bad_cxx_cast_vector_to_scalar_different_size : Error<
|
||||
"%select{||reinterpret_cast||C-style cast|}0 from vector %1 "
|
||||
"%select{||reinterpret_cast||C-style cast|}0 from vector %1 "
|
||||
"to scalar %2 of different size">;
|
||||
def err_bad_cxx_cast_scalar_to_vector_different_size : Error<
|
||||
"%select{||reinterpret_cast||C-style cast|}0 from scalar %1 "
|
||||
"%select{||reinterpret_cast||C-style cast|}0 from scalar %1 "
|
||||
"to vector %2 of different size">;
|
||||
def err_bad_cxx_cast_vector_to_vector_different_size : Error<
|
||||
"%select{||reinterpret_cast||C-style cast|}0 from vector %1 "
|
||||
"%select{||reinterpret_cast||C-style cast|}0 from vector %1 "
|
||||
"to vector %2 of different size">;
|
||||
def err_bad_lvalue_to_rvalue_cast : Error<
|
||||
"cannot cast from lvalue of type %1 to rvalue reference type %2; types are "
|
||||
@ -6643,7 +6645,7 @@ def err_typecheck_nonviable_condition_incomplete : Error<
|
||||
def err_typecheck_deleted_function : Error<
|
||||
"conversion function %diff{from $ to $|between types}0,1 "
|
||||
"invokes a deleted function">;
|
||||
|
||||
|
||||
def err_expected_class_or_namespace : Error<"%0 is not a class"
|
||||
"%select{ or namespace|, namespace, or enumeration}1">;
|
||||
def err_invalid_declarator_scope : Error<"cannot define or redeclare %0 here "
|
||||
@ -7011,11 +7013,11 @@ def err_typecheck_call_too_many_args_at_most_suggest : Error<
|
||||
"too many %select{|||execution configuration }0arguments to "
|
||||
"%select{function|block|method|kernel function}0 call, "
|
||||
"expected at most %1, have %2; did you mean %3?">;
|
||||
|
||||
|
||||
def err_arc_typecheck_convert_incompatible_pointer : Error<
|
||||
"incompatible pointer types passing retainable parameter of type %0"
|
||||
"to a CF function expecting %1 type">;
|
||||
|
||||
|
||||
def err_builtin_fn_use : Error<"builtin functions must be directly called">;
|
||||
|
||||
def warn_call_wrong_number_of_arguments : Warning<
|
||||
@ -7129,7 +7131,8 @@ def err_shared_var_init : Error<
|
||||
"initialization is not supported for __shared__ variables.">;
|
||||
def err_device_static_local_var : Error<
|
||||
"within a %select{__device__|__global__|__host__|__host__ __device__}0 "
|
||||
"function, only __shared__ variables may be marked 'static'">;
|
||||
"function, only __shared__ variables or const variables without device "
|
||||
"memory qualifier may be marked 'static'">;
|
||||
def err_cuda_vla : Error<
|
||||
"cannot use variable-length arrays in "
|
||||
"%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
|
||||
@ -7505,8 +7508,8 @@ def err_reference_to_local_in_enclosing_context : Error<
|
||||
"%select{%3|block literal|lambda expression|context}2">;
|
||||
|
||||
def err_static_data_member_not_allowed_in_local_class : Error<
|
||||
"static data member %0 not allowed in local class %1">;
|
||||
|
||||
"static data member %0 not allowed in local class %1">;
|
||||
|
||||
// C++ derived classes
|
||||
def err_base_clause_on_union : Error<"unions cannot have base classes">;
|
||||
def err_base_must_be_class : Error<"base specifier must name a class">;
|
||||
@ -7851,6 +7854,13 @@ def warn_null_ret : Warning<
|
||||
"null returned from %select{function|method}0 that requires a non-null return value">,
|
||||
InGroup<NonNull>;
|
||||
|
||||
def err_lifetimebound_no_object_param : Error<
|
||||
"'lifetimebound' attribute cannot be applied; %select{static |non-}0member "
|
||||
"function has no implicit object parameter">;
|
||||
def err_lifetimebound_ctor_dtor : Error<
|
||||
"'lifetimebound' attribute cannot be applied to a "
|
||||
"%select{constructor|destructor}0">;
|
||||
|
||||
// CHECK: returning address/reference of stack memory
|
||||
def warn_ret_stack_addr_ref : Warning<
|
||||
"%select{address of|reference to}0 stack memory associated with "
|
||||
@ -7865,7 +7875,8 @@ def warn_ret_addr_label : Warning<
|
||||
def err_ret_local_block : Error<
|
||||
"returning block that lives on the local stack">;
|
||||
def note_local_var_initializer : Note<
|
||||
"%select{via initialization of|binding reference}0 variable %1 here">;
|
||||
"%select{via initialization of|binding reference}0 variable "
|
||||
"%select{%2 |}1here">;
|
||||
def note_init_with_default_member_initalizer : Note<
|
||||
"initializing field %0 with default member initializer">;
|
||||
|
||||
@ -7897,13 +7908,14 @@ def note_lifetime_extending_member_declared_here : Note<
|
||||
"member with %select{reference|'std::initializer_list'}0 subobject}1 "
|
||||
"declared here">;
|
||||
def warn_dangling_variable : Warning<
|
||||
"%select{temporary %select{whose address is used as value of|bound to}3 "
|
||||
"%select{%select{|reference }3member of local variable|"
|
||||
"local %select{variable|reference}3}1|"
|
||||
"%select{temporary %select{whose address is used as value of|"
|
||||
"%select{|implicitly }2bound to}4 "
|
||||
"%select{%select{|reference }4member of local variable|"
|
||||
"local %select{variable|reference}4}1|"
|
||||
"array backing "
|
||||
"%select{initializer list subobject of local variable|"
|
||||
"local initializer list}1}0 "
|
||||
"%2 will be destroyed at the end of the full-expression">,
|
||||
"%select{%3 |}2will be destroyed at the end of the full-expression">,
|
||||
InGroup<Dangling>;
|
||||
def warn_new_dangling_reference : Warning<
|
||||
"temporary bound to reference member of allocated object "
|
||||
@ -8219,7 +8231,7 @@ def err_vector_incorrect_num_initializers : Error<
|
||||
def err_altivec_empty_initializer : Error<"expected initializer">;
|
||||
|
||||
def err_invalid_neon_type_code : Error<
|
||||
"incompatible constant for this __builtin_neon function">;
|
||||
"incompatible constant for this __builtin_neon function">;
|
||||
def err_argument_invalid_range : Error<
|
||||
"argument value %0 is outside the valid range [%1, %2]">;
|
||||
def warn_argument_invalid_range : Warning<
|
||||
@ -8275,7 +8287,7 @@ def err_constant_integer_arg_type : Error<
|
||||
def ext_mixed_decls_code : Extension<
|
||||
"ISO C90 forbids mixing declarations and code">,
|
||||
InGroup<DiagGroup<"declaration-after-statement">>;
|
||||
|
||||
|
||||
def err_non_local_variable_decl_in_for : Error<
|
||||
"declaration of non-local variable in 'for' loop">;
|
||||
def err_non_variable_decl_in_for : Error<
|
||||
@ -8343,7 +8355,7 @@ def warn_nsconsumed_attribute_mismatch : Warning<
|
||||
err_nsconsumed_attribute_mismatch.Text>, InGroup<NSConsumedMismatch>;
|
||||
def warn_nsreturns_retained_attribute_mismatch : Warning<
|
||||
err_nsreturns_retained_attribute_mismatch.Text>, InGroup<NSReturnsMismatch>;
|
||||
|
||||
|
||||
def note_getter_unavailable : Note<
|
||||
"or because setter is declared here, but no getter method %0 is found">;
|
||||
def err_invalid_protocol_qualifiers : Error<
|
||||
@ -8599,7 +8611,7 @@ def err_opencl_extern_block_declaration : Error<
|
||||
def err_opencl_block_ref_block : Error<
|
||||
"cannot refer to a block inside block">;
|
||||
|
||||
// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
|
||||
// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
|
||||
def err_opencl_builtin_to_addr_arg_num : Error<
|
||||
"invalid number of arguments to function: %0">;
|
||||
def err_opencl_builtin_to_addr_invalid_arg : Error<
|
||||
|
@ -49,7 +49,7 @@ def err_pch_diagopt_mismatch : Error<"%0 is currently enabled, but was not in "
|
||||
"the PCH file">;
|
||||
def err_pch_modulecache_mismatch : Error<"PCH was compiled with module cache "
|
||||
"path '%0', but the path is currently '%1'">;
|
||||
|
||||
|
||||
def err_pch_version_too_old : Error<
|
||||
"PCH file uses an older PCH format that is no longer supported">;
|
||||
def err_pch_version_too_new : Error<
|
||||
|
@ -62,7 +62,7 @@ class FileSystemStatCache {
|
||||
|
||||
public:
|
||||
virtual ~FileSystemStatCache() = default;
|
||||
|
||||
|
||||
enum LookupResult {
|
||||
/// We know the file exists and its cached stat data.
|
||||
CacheExists,
|
||||
@ -90,10 +90,10 @@ class FileSystemStatCache {
|
||||
void setNextStatCache(std::unique_ptr<FileSystemStatCache> Cache) {
|
||||
NextStatCache = std::move(Cache);
|
||||
}
|
||||
|
||||
|
||||
/// Retrieve the next stat call cache in the chain.
|
||||
FileSystemStatCache *getNextStatCache() { return NextStatCache.get(); }
|
||||
|
||||
|
||||
/// Retrieve the next stat call cache in the chain, transferring
|
||||
/// ownership of this cache (and, transitively, all of the remaining caches)
|
||||
/// to the caller.
|
||||
|
@ -63,7 +63,7 @@ class IdentifierInfo {
|
||||
bool IsPoisoned : 1; // True if identifier is poisoned.
|
||||
bool IsCPPOperatorKeyword : 1; // True if ident is a C++ operator keyword.
|
||||
bool NeedsHandleIdentifier : 1; // See "RecomputeNeedsHandleIdentifier".
|
||||
bool IsFromAST : 1; // True if identifier was loaded (at least
|
||||
bool IsFromAST : 1; // True if identifier was loaded (at least
|
||||
// partially) from an AST file.
|
||||
bool ChangedAfterLoad : 1; // True if identifier has changed from the
|
||||
// definition loaded from an AST file.
|
||||
@ -308,7 +308,7 @@ class IdentifierInfo {
|
||||
bool hasChangedSinceDeserialization() const {
|
||||
return ChangedAfterLoad;
|
||||
}
|
||||
|
||||
|
||||
/// Note that this identifier has changed since it was loaded from
|
||||
/// an AST file.
|
||||
void setChangedSinceDeserialization() {
|
||||
@ -320,7 +320,7 @@ class IdentifierInfo {
|
||||
bool hasFETokenInfoChangedSinceDeserialization() const {
|
||||
return FEChangedAfterLoad;
|
||||
}
|
||||
|
||||
|
||||
/// Note that the frontend token information for this identifier has
|
||||
/// changed since it was loaded from an AST file.
|
||||
void setFETokenInfoChangedSinceDeserialization() {
|
||||
@ -330,7 +330,7 @@ class IdentifierInfo {
|
||||
/// Determine whether the information for this identifier is out of
|
||||
/// date with respect to the external source.
|
||||
bool isOutOfDate() const { return OutOfDate; }
|
||||
|
||||
|
||||
/// Set whether the information for this identifier is out of
|
||||
/// date with respect to the external source.
|
||||
void setOutOfDate(bool OOD) {
|
||||
@ -340,10 +340,10 @@ class IdentifierInfo {
|
||||
else
|
||||
RecomputeNeedsHandleIdentifier();
|
||||
}
|
||||
|
||||
|
||||
/// Determine whether this is the contextual keyword \c import.
|
||||
bool isModulesImport() const { return IsModulesImport; }
|
||||
|
||||
|
||||
/// Set whether this identifier is the contextual keyword \c import.
|
||||
void setModulesImport(bool I) {
|
||||
IsModulesImport = I;
|
||||
@ -419,7 +419,7 @@ class PoisonIdentifierRAIIObject {
|
||||
class IdentifierIterator {
|
||||
protected:
|
||||
IdentifierIterator() = default;
|
||||
|
||||
|
||||
public:
|
||||
IdentifierIterator(const IdentifierIterator &) = delete;
|
||||
IdentifierIterator &operator=(const IdentifierIterator &) = delete;
|
||||
@ -490,7 +490,7 @@ class IdentifierTable {
|
||||
IdentifierInfoLookup *getExternalIdentifierLookup() const {
|
||||
return ExternalLookup;
|
||||
}
|
||||
|
||||
|
||||
llvm::BumpPtrAllocator& getAllocator() {
|
||||
return HashTable.getAllocator();
|
||||
}
|
||||
@ -572,7 +572,7 @@ class IdentifierTable {
|
||||
void AddKeywords(const LangOptions &LangOpts);
|
||||
};
|
||||
|
||||
/// A family of Objective-C methods.
|
||||
/// A family of Objective-C methods.
|
||||
///
|
||||
/// These families have no inherent meaning in the language, but are
|
||||
/// nonetheless central enough in the existing implementations to
|
||||
@ -687,13 +687,13 @@ class Selector {
|
||||
MultiKeywordSelector *getMultiKeywordSelector() const {
|
||||
return reinterpret_cast<MultiKeywordSelector *>(InfoPtr & ~ArgFlags);
|
||||
}
|
||||
|
||||
|
||||
unsigned getIdentifierInfoFlag() const {
|
||||
return InfoPtr & ArgFlags;
|
||||
}
|
||||
|
||||
static ObjCMethodFamily getMethodFamilyImpl(Selector sel);
|
||||
|
||||
|
||||
static ObjCStringFormatFamily getStringFormatFamilyImpl(Selector sel);
|
||||
|
||||
public:
|
||||
@ -730,11 +730,11 @@ class Selector {
|
||||
}
|
||||
|
||||
unsigned getNumArgs() const;
|
||||
|
||||
|
||||
/// Retrieve the identifier at a given position in the selector.
|
||||
///
|
||||
/// Note that the identifier pointer returned may be NULL. Clients that only
|
||||
/// care about the text of the identifier string, and not the specific,
|
||||
/// care about the text of the identifier string, and not the specific,
|
||||
/// uniqued identifier pointer, should use \c getNameForSlot(), which returns
|
||||
/// an empty string when the identifier pointer would be NULL.
|
||||
///
|
||||
@ -745,7 +745,7 @@ class Selector {
|
||||
/// \returns the uniqued identifier for this slot, or NULL if this slot has
|
||||
/// no corresponding identifier.
|
||||
IdentifierInfo *getIdentifierInfoForSlot(unsigned argIndex) const;
|
||||
|
||||
|
||||
/// Retrieve the name at a given position in the selector.
|
||||
///
|
||||
/// \param argIndex The index for which we want to retrieve the name.
|
||||
@ -755,7 +755,7 @@ class Selector {
|
||||
/// \returns the name for this slot, which may be the empty string if no
|
||||
/// name was supplied.
|
||||
StringRef getNameForSlot(unsigned argIndex) const;
|
||||
|
||||
|
||||
/// Derive the full selector name (e.g. "foo:bar:") and return
|
||||
/// it as an std::string.
|
||||
std::string getAsString() const;
|
||||
@ -769,11 +769,11 @@ class Selector {
|
||||
ObjCMethodFamily getMethodFamily() const {
|
||||
return getMethodFamilyImpl(*this);
|
||||
}
|
||||
|
||||
|
||||
ObjCStringFormatFamily getStringFormatFamily() const {
|
||||
return getStringFormatFamilyImpl(*this);
|
||||
}
|
||||
|
||||
|
||||
static Selector getEmptyMarker() {
|
||||
return Selector(uintptr_t(-1));
|
||||
}
|
||||
@ -781,7 +781,7 @@ class Selector {
|
||||
static Selector getTombstoneMarker() {
|
||||
return Selector(uintptr_t(-2));
|
||||
}
|
||||
|
||||
|
||||
static ObjCInstanceTypeFamily getInstTypeMethodFamily(Selector sel);
|
||||
};
|
||||
|
||||
@ -901,7 +901,7 @@ struct PointerLikeTypeTraits<clang::Selector> {
|
||||
return clang::Selector(reinterpret_cast<uintptr_t>(P));
|
||||
}
|
||||
|
||||
enum { NumLowBitsAvailable = 0 };
|
||||
enum { NumLowBitsAvailable = 0 };
|
||||
};
|
||||
|
||||
// Provide PointerLikeTypeTraits for IdentifierInfo pointers, which
|
||||
|
@ -59,7 +59,7 @@ namespace clang {
|
||||
using llvm::dyn_cast;
|
||||
using llvm::dyn_cast_or_null;
|
||||
using llvm::cast_or_null;
|
||||
|
||||
|
||||
// ADT's.
|
||||
using llvm::ArrayRef;
|
||||
using llvm::MutableArrayRef;
|
||||
|
@ -50,10 +50,10 @@ class LangOptionsBase {
|
||||
class LangOptions : public LangOptionsBase {
|
||||
public:
|
||||
using Visibility = clang::Visibility;
|
||||
|
||||
|
||||
enum GCMode { NonGC, GCOnly, HybridGC };
|
||||
enum StackProtectorMode { SSPOff, SSPOn, SSPStrong, SSPReq };
|
||||
|
||||
|
||||
enum SignedOverflowBehaviorTy {
|
||||
// Default C standard behavior.
|
||||
SOB_Undefined,
|
||||
@ -165,7 +165,7 @@ class LangOptions : public LangOptionsBase {
|
||||
clang::ObjCRuntime ObjCRuntime;
|
||||
|
||||
std::string ObjCConstantStringClass;
|
||||
|
||||
|
||||
/// The name of the handler function to be called when -ftrapv is
|
||||
/// specified.
|
||||
///
|
||||
@ -209,10 +209,10 @@ class LangOptions : public LangOptionsBase {
|
||||
LangOptions();
|
||||
|
||||
// Define accessors/mutators for language options of enumeration type.
|
||||
#define LANGOPT(Name, Bits, Default, Description)
|
||||
#define LANGOPT(Name, Bits, Default, Description)
|
||||
#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
|
||||
Type get##Name() const { return static_cast<Type>(Name); } \
|
||||
void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
|
||||
void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
|
||||
#include "clang/Basic/LangOptions.def"
|
||||
|
||||
/// Are we compiling a module interface (.cppm or module map)?
|
||||
@ -228,7 +228,7 @@ class LangOptions : public LangOptionsBase {
|
||||
bool isSignedOverflowDefined() const {
|
||||
return getSignedOverflowBehavior() == SOB_Defined;
|
||||
}
|
||||
|
||||
|
||||
bool isSubscriptPointerArithmetic() const {
|
||||
return ObjCRuntime.isSubscriptPointerArithmetic() &&
|
||||
!ObjCSubscriptingLegacyRuntime;
|
||||
@ -309,7 +309,7 @@ enum TranslationUnitKind {
|
||||
/// The translation unit is a module.
|
||||
TU_Module
|
||||
};
|
||||
|
||||
|
||||
} // namespace clang
|
||||
|
||||
#endif // LLVM_CLANG_BASIC_LANGOPTIONS_H
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
namespace clang {
|
||||
|
||||
/// Describes the different kinds of linkage
|
||||
/// Describes the different kinds of linkage
|
||||
/// (C++ [basic.link], C99 6.2.2) that an entity may have.
|
||||
enum Linkage : unsigned char {
|
||||
/// No linkage, which means that the entity is unique and
|
||||
@ -31,7 +31,7 @@ enum Linkage : unsigned char {
|
||||
/// translation units).
|
||||
InternalLinkage,
|
||||
|
||||
/// External linkage within a unique namespace.
|
||||
/// External linkage within a unique namespace.
|
||||
///
|
||||
/// From the language perspective, these entities have external
|
||||
/// linkage. However, since they reside in an anonymous namespace,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user