aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Parse/ParseDecl.cpp
AgeCommit message (Collapse)AuthorFilesLines
2023-05-08[clang-repl] Consider the scope spec in template lookups for deduction guides.Vassil Vassilev1-1/+2
isDeductionGuideName looks up the underlying template and if the template name is qualified we miss that qualification resulting in an error. This issue resurfaced in clang-repl where we call isDeductionGuideName more often to distinguish between if we had a statement or declaration. This patch passes the CXXScopeSpec information down to LookupTemplateName to make the lookup more precise. Differential revision: https://reviews.llvm.org/D147319
2023-05-04[clang][Sema][NFC] Move `EnterExpressionEvaluationContext` to its own fileDavid Stone1-0/+1
Sema.h is huge. This makes a small reduction to it by moving EnterExpressionEvaluationContext into a new header, since it is an independent component. Differential Revision: https://reviews.llvm.org/D149796
2023-04-25[clang] add diagnose when member function contains invalid default argumentCongcong Cai1-7/+3
Fixed: https://github.com/llvm/llvm-project/issues/62122 This change pointer to add diagnose message for this code. ``` struct S { static int F(int n = 0 ? 0) { return 0; } }; ``` For default parameter, we should set it as unparsed even if meeting syntax error because it should be issued in real parser time instead of set is as invalid directly without diagnose. Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D148372
2023-04-13[clang] Type safety tweak for AttributeCommonInfo::FormRichard Sandiford1-5/+5
This patch adds static functions for constructing most AttributeCommonInfo::Forms. Direct construction is only retained where all fields (currently the syntax and spelling) are specified explicitly. This is a wash on its own. The purpose is to allow extra fields to be added to Form without disrupting all callers. In particular, it allows extra information to be stored about keywords without affecting non-keyword uses. No functional change intended. Differential Revision: https://reviews.llvm.org/D148104
2023-04-13[clang] Allow attributes to be constructed from keyword tokensRichard Sandiford1-16/+19
This patch adds an extra AttributeCommonInfo::Form constructor for keywords, represented by their TokenKind. This isn't a win on its own, but it helps with later patches. No functional change intended. Differential Revision: https://reviews.llvm.org/D148103
2023-04-13[clang] Specify attribute syntax & spelling with a single argumentRichard Sandiford1-53/+43
When constructing an attribute, the syntactic form was specified using two arguments: an attribute-independent syntax type and an attribute-specific spelling index. This patch replaces them with a single argument. In most cases, that's done using a new Form class that combines the syntax and spelling into a single object. This has the minor benefit of removing a couple of constructors. But the main purpose is to allow additional information to be stored as well, beyond just the syntax and spelling enums. In the case of the attribute-specific Create and CreateImplicit functions, the patch instead uses the attribute-specific spelling enum. This helps to ensure that the syntax and spelling are consistent with each other and with the Attr.td definition. If a Create or CreateImplicit caller specified a syntax and a spelling, the patch drops the syntax argument and keeps the spelling. If the caller instead specified only a syntax (so that the spelling was SpellingNotCalculated), the patch simply drops the syntax argument. There were two cases of the latter: TargetVersion and Weak. TargetVersionAttrs were created with GNU syntax, which matches their definition in Attr.td, but which is also the default. WeakAttrs were created with Pragma syntax, which does not match their definition in Attr.td. Dropping the argument switches them to AS_GNU too (to match [GCC<"weak">]). Differential Revision: https://reviews.llvm.org/D148102
2023-04-10[Clang] Check type-constraints applied to placeholder typesCorentin Jabot1-0/+4
(and deduced return types) Previously, only type constraints applied to type parameter were semantically checked. A diagnostic would still be emitted on instantiation, but it was too late, lacked clarity, and was inconsistent with type parameters. Reviewed By: erichkeane Differential Revision: https://reviews.llvm.org/D147925
2023-03-30[Clang] Improve diagnostics when using a concept as template argumentCorentin Jabot1-5/+5
When using the name of a template variable or concept in places where an expression was expected, Clang would drop the cxxscope token preceeding it, if any. This leads to subpar diagnostics - complaining about the identifier being undeclared as clang would not know to look into a non-global scope. We make sure the scope is preserved. When encountering `ns::Concept foo x;`, Clang would also fail to provide the same quality as it does at global scope. Reviewed By: aaron.ballman, erichkeane Differential Revision: https://reviews.llvm.org/D146719
2023-03-17[clang][WebAssembly] Initial support for reference type funcref in clangPaulo Matos1-1/+28
This is the funcref counterpart to 890146b. We introduce a new attribute that marks a function pointer as a funcref. It also implements builtin __builtin_wasm_ref_null_func(), that returns a null funcref value. Differential Revision: https://reviews.llvm.org/D128440
2023-03-10[Clang][Sema] Start fixing handling of out-of-line definitions of ↵Alexander Shaposhnikov1-2/+11
constrained templates This diff starts fixing our handling of out-of-line definitions of constrained templates. Initially it was motivated by https://github.com/llvm/llvm-project/issues/49620 and https://github.com/llvm/llvm-project/issues/60231. In particular, this diff adjusts Sema::computeDeclContext to work properly in the case of constrained template parameters. Test plan: 1/ ninja check-all 2/ Bootstrapped Clang passes all the tests 3/ Internal testing Differential revision: https://reviews.llvm.org/D145034
2023-02-25[C2x] Implement support for revised spelling of keywordsAaron Ballman1-3/+7
This implements WG14 N2934 (https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2934.pdf), which adds keywords for alignas, alignof, bool, static_assert, and thread_local in C, as aliases for _Alignas, _Alignof, _Bool, _Static_assert, and _Thread_local. We already supported the keywords in C2x mode, but this completes support by adding pre-C2x compat warnings and updates the stdalign.h header in freestanding mode.
2023-02-23[clang] extend external_source_symbol attribute with USR clauseAlex Lorenz1-5/+24
Allow the user to specify a concrete USR in the external_source_symbol attribute. That will let Clang's indexer to use Swift USRs for Swift declarations that are represented with C++ declarations. This new clause is used by Swift when generating a C++ header representation of a Swift module: https://github.com/apple/swift/pull/63002 Differential Revision: https://reviews.llvm.org/D141324
2023-02-17[clang-repl] Support compound statement as a top-level statement.Vassil Vassilev1-0/+2
This patch teaches our incremental compilation infrastructure to push and pop a fake function scope making the Parser happy when parsing compound statements as part of a top-leve statement declaration. Differential revision: https://reviews.llvm.org/D139798
2023-02-13[clang] Handle __declspec() attributes in usingTobias Hieta1-0/+12
This patch fixes so that declspec attributes are forwarded to the alias declaration. Before this patch this would assert: class Test { int a; }; using AlignedTest = __declspec(align(16)) const Test; static_assert(alignof(AlignedTest) == 16, "error"); But afterwards it behaves the same as MSVC does and doesn't assert. Fixes: llvm/llvm-project#60513 Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D143632
2023-02-02[DeclContext] Sort the Decls before adding into DeclContextSteven Wu1-0/+9
Fix a non-deterministic issue in clang module generation, which the anonymous declaration number from a function context is not deterministic. This is due to the unstable iteration order for decls in scope so the order after moving the decls into function decl context is not deterministic. From https://reviews.llvm.org/D135118, we can't use a set that preserves the order without the performance penalty. Fix the issue by sorting the decls based on raw encoding of their source location. rdar://104097976 Reviewed By: akyrtzi, vsapsai Differential Revision: https://reviews.llvm.org/D141625
2023-01-26Revert "[clang] Build UsingType for elaborated type specifiers."Haojian Wu1-6/+5
This reverts commit e70ca7b35319a3621f9d9c6475926428f8c5c000 and the followup patch "[clang] Fix the location of UsingTypeLoc" (ebbeb164c25a40cb6ba9c6b18dce5dcd06c0bb07). The patch causes an incorrect lookup result: ``` namespace ns { struct Foo { };} using ns::Foo; void test() { struct Foo { } k; // the type of k refers to ns::Foo, rather than the local Foo! } ```
2023-01-19[clang] Build UsingType for elaborated type specifiers.Haojian Wu1-5/+6
Support building UsingType for elaborated type specifiers: ``` namespace ns { class Foo {}; } using ns::Foo; // The TypeLoc of `Foo` below should be a ElaboratedTypeLoc with an // inner UsingTypeLoc rather than the underlying `CXXRecordTypeLoc` class Foo foo; ``` Differential Revision: https://reviews.llvm.org/D141280
2023-01-18Diagnose extensions in 'offsetof'Aaron Ballman1-8/+9
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm made very clear that it is an UB having type definitions with in offsetof. Clang supports defining a type as the first argument as a conforming extension due to how many projects use the construct in C99 and earlier to calculate the alignment of a type. GCC also supports defining a type as the first argument. This adds extension warnings and documentation for the functionality Clang explicitly supports. Fixes #57065 Reverts the revert of 39da55e8f548a11f7dadefa73ea73d809a5f1729 Co-authored-by: Yingchi Long <i@lyc.dev> Co-authored-by: Aaron Ballman <aaron@aaronballman.com> Differential Revision: https://reviews.llvm.org/D133574
2023-01-18Reland "nullptr returned from ActOnTag() is not a valid result"Haojian Wu1-1/+1
The commit was reverted in 346e1c43a11b8af5a818dac321f83f043862c1ec as part of the f1f0a0d8e8fdd2e534d9423b2e64c6b8aaa53aee revert.
2023-01-17Revert "Diagnose extensions in 'offsetof'"Arthur Eubanks1-1/+1
This reverts commit f1f0a0d8e8fdd2e534d9423b2e64c6b8aaa53aee. Causes crashes on $ echo 'typedef int a; void c() { __builtin_offsetof(struct {a b}, b); }' | bin/clang -cc1 -emit-llvm -o /dev/null - -x c
2023-01-17Revert "nullptr returned from ActOnTag() is not a valid result"Arthur Eubanks1-1/+1
This reverts commit 3925fbc80019f72bf3f5174736f348acfb5768b0. Dependent commit to be reverted.
2023-01-17nullptr returned from ActOnTag() is not a valid resultAaron Ballman1-1/+1
DeclResult tracks two states: valid/invalid and usable/unusable. Passing a null pointer to the constructor creates a valid but unusable result and we wanted an invalid result instead. This changes some functions to return a DeclResult rather than a Decl * to make it harder to get this incorrect in callers. Discovered when working on https://reviews.llvm.org/D141280. Co-authored-by: Haojian Wu <hokein@google.com> Co-authored-by: Aaron Ballman <aaron@aaronballman.com> Differential Revision: https://reviews.llvm.org/D141580
2023-01-17Diagnose extensions in 'offsetof'Aaron Ballman1-1/+1
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm made very clear that it is an UB having type definitions with in offsetof. Clang supports defining a type as the first argument as a conforming extension due to how many projects use the construct in C99 and earlier to calculate the alignment of a type. GCC also supports defining a type as the first argument. This adds extension warnings and documentation for the functionality Clang explicitly supports. Fixes #57065 Co-authored-by: Yingchi Long <i@lyc.dev> Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
2023-01-16Revert "[C2x] reject type definitions in offsetof"Yingchi Long1-1/+1
This reverts commit e327b52766ed497e4779f4e652b9ad237dfda8e6.
2023-01-14[clang] Remove remaining uses of llvm::Optional (NFC)Kazu Hirata1-1/+0
This patch removes several "using" declarations and #include "llvm/ADT/Optional.h". This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-01-14[clang] Use std::optional instead of llvm::Optional (NFC)Kazu Hirata1-5/+5
This patch replaces (llvm::|)Optional< with std::optional<. I'll post a separate patch to remove #include "llvm/ADT/Optional.h". This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-01-14[clang] Add #include <optional> (NFC)Kazu Hirata1-0/+1
This patch adds #include <optional> to those files containing llvm::Optional<...> or Optional<...>. I'll post a separate patch to actually replace llvm::Optional with std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-01-13[C2x] reject type definitions in offsetofYingchi Long1-1/+1
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm made very clear that it is an UB having type definitions with in offsetof. After this patch clang will reject any type definitions in __builtin_offsetof. Fixes https://github.com/llvm/llvm-project/issues/57065 ``` local/offsetof.c:10:38: error: 'struct S' cannot be defined in '__builtin_offsetof' return __builtin_offsetof(struct S{ int a, b;}, a); ^ ``` Reviewed By: aaron.ballman, #clang-language-wg Differential Revision: https://reviews.llvm.org/D133574
2022-12-03[clang] Use std::nullopt instead of None (NFC)Kazu Hirata1-2/+2
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-03[clang-repl] Support statements on global scope in incremental mode.Vassil Vassilev1-0/+19
This patch teaches clang to parse statements on the global scope to allow: ``` ./bin/clang-repl clang-repl> int i = 12; clang-repl> ++i; clang-repl> extern "C" int printf(const char*,...); clang-repl> printf("%d\n", i); 13 clang-repl> %quit ``` Generally, disambiguating between statements and declarations is a non-trivial task for a C++ parser. The challenge is to allow both standard C++ to be translated as if this patch does not exist and in the cases where the user typed a statement to be executed as if it were in a function body. Clang's Parser does pretty well in disambiguating between declarations and expressions. We have added DisambiguatingWithExpression flag which allows us to preserve the existing and optimized behavior where needed and implement the extra rules for disambiguating. Only few cases require additional attention: * Constructors/destructors -- Parser::isConstructorDeclarator was used in to disambiguate between ctor-looking declarations and statements on the global scope(eg. `Ns::f()`). * The template keyword -- the template keyword can appear in both declarations and statements. This patch considers the template keyword to be a declaration starter which breaks a few cases in incremental mode which will be tackled later. * The inline (and similar) keyword -- looking at the first token in many cases allows us to classify what is a declaration. * Other language keywords and specifiers -- ObjC/ObjC++/OpenCL/OpenMP rely on pragmas or special tokens which will be handled in subsequent patches. The patch conceptually models a "top-level" statement into a TopLevelStmtDecl. The TopLevelStmtDecl is lowered into a void function with no arguments. We attach this function to the global initializer list to execute the statement blocks in the correct order. Differential revision: https://reviews.llvm.org/D127284
2022-11-18[clang][Parse][NFC] Remove unused CommaLocs parametersTimm Bäder1-9/+2
2022-11-01[Concepts] Improve diagnostics on a missing 'auto' keyword.Erich Keane1-2/+9
As reported in https://github.com/llvm/llvm-project/issues/49192, we did a pretty poor job diagnosing cases where someone forgot 'auto', a nd is probably in the middle of a variable declaration. This patch makes us properly diagnose in cases where the next token is a reference, or CVR qualifier.
2022-10-20[HLSL] Add groupshare address space.Xiang Li1-0/+24
Added keyword, LangAS and TypeAttrbute for groupshared. Tanslate it to LangAS with asHLSLLangAS. Make sure it translated into address space 3 for DirectX target. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D135060
2022-10-18[clang] Fix crash upon stray coloncolon token in C2x modeJialun Hu1-0/+2
The parser assumes that the lexer never emits coloncolon token for C code, but this assumption no longer holds in C2x attribute namespaces. As a result, stray coloncolon tokens out of attributes cause assertion failures and hangs in release build, which this patch tries to handle. Crash input minimal example: `T n::v` Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D133248
2022-10-05[HLSL] Support register binding attribute on global variableXiang Li1-1/+9
Allow register binding attribute on variables. Report warning when register binding attribute applies to local variable or static variable. It will be ignored in this case. Type check for register binding is tracked with https://github.com/llvm/llvm-project/issues/57886. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D134617
2022-09-28[C2x] implement typeof and typeof_unqualAaron Ballman1-9/+30
This implements WG14 N2927 and WG14 N2930, which together define the feature for typeof and typeof_unqual, which get the type of their argument as either fully qualified or fully unqualified. The argument to either operator is either a type name or an expression. If given a type name, the type information is pulled directly from the given name. If given an expression, the type information is pulled from the expression. Recursive use of these operators is allowed and has the expected behavior (the innermost operator is resolved to a type, and that's used to resolve the next layer of typeof specifier, until a fully resolved type is determined. Note, we already supported typeof in GNU mode as a non-conforming extension and we are *not* exposing typeof_unqual as a non-conforming extension in that mode, nor are we exposing typeof or typeof_unqual as a nonconforming extension in other language modes. The GNU variant of typeof supports a form where the parentheses are elided from the operator when given an expression (e.g., typeof 0 i = 12;). When in C2x mode, we do not support this extension. Differential Revision: https://reviews.llvm.org/D134286
2022-09-28[C++2a] P0634r3: Down with typename!Nicolas Lesser1-48/+148
This patch implements P0634r3 that removes the need for 'typename' in certain contexts. For example, ``` template <typename T> using foo = T::type; // ok ``` This is also allowed in previous language versions as an extension, because I think it's pretty useful. :) Reviewed By: #clang-language-wg, erichkeane Differential Revision: https://reviews.llvm.org/D53847
2022-09-26Don't crash when code completing `using enum ^Foo`.Sam McCall1-0/+1
Fixes https://github.com/clangd/clangd/issues/1281 Differential Revision: https://reviews.llvm.org/D134243
2022-09-21[HLSL] Support cbuffer/tbuffer for hlsl.Xiang Li1-0/+5
This is first part for support cbuffer/tbuffer. The format for cbuffer/tbuffer is BufferType [Name] [: register(b#)] { VariableDeclaration [: packoffset(c#.xyzw)]; ... }; More details at https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-constants New keyword 'cbuffer' and 'tbuffer' are added. New AST node HLSLBufferDecl is added. Build AST for simple cbuffer/tbuffer without attribute support. The special thing is variables declared inside cbuffer is exposed into global scope. So isTransparentContext should return true for HLSLBuffer. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D129883
2022-09-08[clang] Use std::size instead of llvm::array_lengthofJoe Loser1-2/+2
LLVM contains a helpful function for getting the size of a C-style array: `llvm::array_lengthof`. This is useful prior to C++17, but not as helpful for C++17 or later: `std::size` already has support for C-style arrays. Change call sites to use `std::size` instead. Leave the few call sites that use a locally defined `array_lengthof` that are meant to test previous bugs with NTTPs in clang analyzer and SemaTemplate. Differential Revision: https://reviews.llvm.org/D133520
2022-08-27[Clang] Avoid crashes when parsing using enum declarationsShafik Yaghmour1-0/+3
In Parser::ParseUsingDeclaration(...) when we call ParseEnumSpecifier(...) it is not calling SetTypeSpecError() on DS when it detects an error. That means that DS is left set to TST_unspecified. When we then pass DS into Sema::ActOnUsingEnumDeclaration(...) we hit an llvm_unreachable(...) since it expects it to be one of three states TST_error, TST_enum or TST_typename. This fixes https://github.com/llvm/llvm-project/issues/57347 Differential Revision: https://reviews.llvm.org/D132695
2022-08-22[clang] adds unary type transformations as compiler built-insChristopher Di Bella1-6/+12
Adds * `__add_lvalue_reference` * `__add_pointer` * `__add_rvalue_reference` * `__decay` * `__make_signed` * `__make_unsigned` * `__remove_all_extents` * `__remove_extent` * `__remove_const` * `__remove_volatile` * `__remove_cv` * `__remove_pointer` * `__remove_reference` * `__remove_cvref` These are all compiler built-in equivalents of the unary type traits found in [[meta.trans]][1]. The compiler already has all of the information it needs to answer these transformations, so we can skip needing to make partial specialisations in standard library implementations (we already do this for a lot of the query traits). This will hopefully improve compile times, as we won't need use as much memory in such a base part of the standard library. [1]: http://wg21.link/meta.trans Co-authored-by: zoecarver Reviewed By: aaron.ballman, rsmith Differential Revision: https://reviews.llvm.org/D116203
2022-08-17[clang] Give priority to Class context while parsing declarationsFurkan Usta1-3/+4
Fixes https://github.com/clangd/clangd/issues/290. Reviewed By: kadircet Differential Revision: https://reviews.llvm.org/D130363
2022-08-14Revert "[clang] adds unary type transformations as compiler built-ins"Nico Weber1-12/+6
This reverts commit bc60cf2368de90918719dc7e3d7c63a72cc007ad. Doesn't build on Windows and breaks gcc 9 build, see https://reviews.llvm.org/D116203#3722094 and https://reviews.llvm.org/D116203#3722128 Also revert two follow-ups. One fixed a warning added in bc60cf2368de90918719dc7e3d7c63a72cc007ad, the other makes use of the feature added in bc60cf2368de90918719dc7e3d7c63a72cc007ad in libc++: Revert "[libcxx][NFC] utilises compiler builtins for unary transform type-traits" This reverts commit 06a1d917ef1f507aaa2f6891bb654696c866ea3a. Revert "[Sema] Fix a warning" This reverts commit c85abbe879ef3257de4db862ce249b060cc3d2a4.
2022-08-14[clang] adds unary type transformations as compiler built-insChristopher Di Bella1-6/+12
Adds * `__add_lvalue_reference` * `__add_pointer` * `__add_rvalue_reference` * `__decay` * `__make_signed` * `__make_unsigned` * `__remove_all_extents` * `__remove_extent` * `__remove_const` * `__remove_volatile` * `__remove_cv` * `__remove_pointer` * `__remove_reference` * `__remove_cvref` These are all compiler built-in equivalents of the unary type traits found in [[meta.trans]][1]. The compiler already has all of the information it needs to answer these transformations, so we can skip needing to make partial specialisations in standard library implementations (we already do this for a lot of the query traits). This will hopefully improve compile times, as we won't need use as much memory in such a base part of the standard library. [1]: http://wg21.link/meta.trans Co-authored-by: zoecarver Reviewed By: aaron.ballman, rsmith Differential Revision: https://reviews.llvm.org/D116203
2022-08-11Remove redundant condition check, NFCJun Zhang1-3/+1
Signed-off-by: Jun Zhang <jun@junz.org>
2022-08-08[clang] LLVM_FALLTHROUGH => [[fallthrough]]. NFCFangrui Song1-8/+8
With C++17 there is no Clang pedantic warning or MSVC C5051. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D131346
2022-07-29Diagnose use of _Noreturn on a struct/union fieldAaron Ballman1-0/+2
C99 6.7.4p2 clarifies that a function specifier can only be used in the declaration of a function. _Noreturn is a function specifier, so it is a constraint violation to write it on a structure or union field, but we missed that case. Fixes #56800
2022-07-25[clang] better error message for while loops outside of control flowinclyc1-16/+20
report an error when encountering 'while' token parsing declarator ``` clang/test/Parser/while-loop-outside-function.c:3:1: error: while loop outside of a function while // expected-error {{while loop outside of a function}} ^ clang/test/Parser/while-loop-outside-function.c:7:1: error: while loop outside of a function while // expected-error {{while loop outside of a function}} ^ ``` Fixes: https://github.com/llvm/llvm-project/issues/34462 Differential Revision: https://reviews.llvm.org/D129573
2022-06-29[Clang] Rename StringLiteral::isAscii() => isOrdinary() [NFC]Corentin Jabot1-1/+1
"Ascii" StringLiteral instances are actually narrow strings that are UTF-8 encoded and do not have an encoding prefix. (UTF8 StringLiteral are also UTF-8 encoded strings, but with the u8 prefix. To avoid possible confusion both with actuall ASCII strings, and with future works extending the set of literal encodings supported by clang, this rename StringLiteral::isAscii() to isOrdinary(), matching C++ standard terminology. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D128762