summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/basic/basic.link
Commit message (Collapse)AuthorAgeFilesLines
* [c++2a] Add semantic support for private module fragments.Richard Smith2019-04-182-10/+46
| | | | llvm-svn: 358713
* [c++20] Parsing support for module-declarations, import-declarations,Richard Smith2019-04-142-0/+90
| | | | | | | | | and the global and private module fragment. For now, the private module fragment introducer is ignored, but use of the global module fragment introducer should be properly enforced. llvm-svn: 358353
* Correctly compute linkage for members of internal linkage classes.Richard Smith2017-09-231-0/+9
| | | | | | | We used to give such members no linkage instead of giving them the linkage of the class. llvm-svn: 314054
* DR1113: anonymous namespaces formally give their contents internal linkage.Richard Smith2017-09-221-0/+7
| | | | | | | | | | | | | | | | | | | | This doesn't affect our code generation in any material way -- we already give such declarations internal linkage from a codegen perspective -- but it has some subtle effects on code validity. We suppress the 'L' (internal linkage) marker for mangled names in anonymous namespaces, because it is redundant (the information is already carried by the namespace); this deviates from GCC's behavior if a variable or function in an anonymous namespace is redundantly declared 'static' (where GCC does include the 'L'), but GCC's behavior is incoherent because such a declaration can be validly declared with or without the 'static'. We still deviate from the standard in one regard here: extern "C" declarations in anonymous namespaces are still granted external linkage. Changing those does not appear to have been an intentional consequence of the standard change in DR1113. llvm-svn: 314037
* Closure types have no name (and can't have a typedef name for linkageRichard Smith2017-09-221-11/+4
| | | | | | purposes), so they never formally have linkage. llvm-svn: 313957
* Implement C++ [basic.link]p8.Richard Smith2017-09-201-0/+69
| | | | | | | | | | | | | | If a function or variable has a type with no linkage (and is not extern "C"), any use of it requires a definition within the same translation unit; the idea is that it is not possible to define the entity elsewhere, so any such use is necessarily an error. There is an exception, though: some types formally have no linkage but nonetheless can be referenced from other translation units (for example, this happens to anonymous structures defined within inline functions). For entities with those types, we suppress the diagnostic except under -pedantic. llvm-svn: 313729
* Switch the semantic DeclContext for a block-scope declaration of a function orRichard Smith2013-09-201-0/+73
| | | | | | | | | | | | | | variable from being the function to being the enclosing namespace scope (in C++) or the TU (in C). This allows us to fix a selection of related issues where we would build incorrect redeclaration chains for such declarations, and fail to notice type mismatches. Such declarations are put into a new IdentifierNamespace, IDNS_LocalExtern, which is only found when searching scopes, and not found when searching DeclContexts. Such a declaration is only made visible in its DeclContext if there are no non-LocalExtern declarations. llvm-svn: 191064
* Fix implementation of C11 6.2.7/4 and C++11 [dcl.array]p3:Richard Smith2013-08-131-26/+27
| | | | | | | | | | | | | When a local extern declaration redeclares some other entity, the type of that entity is merged with the prior type if the prior declaration is visible (in C) or is declared in the same scope (in C++). - Make LookupRedeclarationWithLinkage actually work in C++, use it in the right set of cases, and make it track whether it found a shadowed declaration. - Track whether we found a declaration in the same scope (for C++) including across serialization and template instantiation. llvm-svn: 188307
* Only merge down a variable type if the previous declaration wasJohn McCall2013-04-011-0/+43
| | | | | | | | | visible. There's a lot of potential badness in how we're modelling these things, but getting this much correct is reasonably easy. rdar://13535367 llvm-svn: 178488
* Improve 0-argument -Wvexing-parse diagnostic by adding notes with fix-its:Richard Smith2012-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | - If the declarator is at the start of a line, and the previous line contained another declarator and ended with a comma, then that comma was probably a typo for a semicolon: int n = 0, m = 1, l = 2, // k = 5; myImportantFunctionCall(); // oops! - If removing the parentheses would correctly initialize the object, then produce a note suggesting that fix. - Otherwise, if there is a simple initializer we can suggest which performs value-initialization, then provide a note suggesting a correction to that initializer. Sema::Declarator now tracks the location of the comma prior to the declarator in the declaration, if there is one, to facilitate providing the note. The code to determine an appropriate initializer from the -Wuninitialized warning has been factored out to allow use in both that and -Wvexing-parse. llvm-svn: 148072
* David Blaikie and Chandler would like us to diagnoseRichard Smith2012-01-061-1/+1
| | | | | | | | int f(); in function scopes under -Wvexing-parse, so now we do. llvm-svn: 147649
* Tweak to r147599 for PR10828: Move the check from the parser into sema, and useRichard Smith2012-01-061-1/+1
| | | | | | | the Semantic Powers to only warn on class types (or dependent types), where the constructor or destructor could do something interesting. llvm-svn: 147642
* PR10828: Produce a warning when a no-arguments function is declared in blockRichard Smith2012-01-051-2/+1
| | | | | | | | | | | | | | | | | scope, when no other indication is provided that the user intended to declare a function rather than a variable. Remove some false positives from the existing 'parentheses disambiguated as a function' warning by suppressing it when the declaration is marked as 'typedef' or 'extern'. Add a new warning group -Wvexing-parse containing both of these warnings. The new warning is enabled by default; despite a number of false positives (and one bug) in clang's test-suite, I have only found genuine bugs with it when running it over a significant quantity of real C++ code. llvm-svn: 147599
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Implement the rules in C++ [basic.link] and C99 6.2.2 for computingDouglas Gregor2009-11-251-0/+11
the linkage of a declaration. Switch the lame (and completely wrong) NamedDecl::hasLinkage() over to using the new NamedDecl::getLinkage(), along with the "can this declaration be a template argument?" check that started all of this. Fixes -fsyntax-only for PR5597. llvm-svn: 89891
OpenPOWER on IntegriCloud