summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/undefined-internal.cpp
Commit message (Collapse)AuthorAgeFilesLines
* DR1113: anonymous namespaces formally give their contents internal linkage.Richard Smith2017-09-221-0/+8
| | | | | | | | | | | | | | | | | | | | 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
* Revisit PR10177: don't instantiate a variable if it's only referenced in aRichard Smith2017-01-061-3/+8
| | | | | | | | | | | | | | dependent context and can't be used in a constant expression. Per C++ [temp.inst]p2, "the instantiation of a static data member does not occur unless the static data member is used in a way that requires the definition to exist". This doesn't /quite/ match that, as we still instantiate static data members that are usable in constant expressions even if the use doesn't require a definition. A followup patch will fix that for both variables and functions. llvm-svn: 291295
* Warn if function or variable cannot be implicitly instantiatedSerge Pavlov2016-04-191-0/+1
| | | | | | | | | | | | With this patch compiler emits warning if it tries to make implicit instantiation of a template but cannot find the template definition. The warning can be suppressed by explicit instantiation declaration or by command line options -Wundefined-var-template and -Wundefined-func-template. The implementation follows the discussion of http://reviews.llvm.org/D12326. Differential Revision: http://reviews.llvm.org/D16396 llvm-svn: 266719
* [Lit Test] Updated 26 Lit tests to be C++11 compatible.Charles Li2015-11-111-1/+10
| | | | | | | Expected diagnostics have been expanded to vary by C++ dialect. RUN line has also been expanded to: default, C++98/03 and C++11. llvm-svn: 252785
* Adding a -Wunused-value warning for expressions with side effects used in an ↵Aaron Ballman2014-12-171-1/+1
| | | | | | unevaluated expression context, such as sizeof(), or decltype(). Also adds a similar warning when the expression passed to typeid() *is* evaluated, since it is equally likely that the user would expect the expression operand to be unevaluated in that case. llvm-svn: 224465
* Change -Wbind-to-temporary-copy from an ExtWarn to an Extension.Nico Weber2014-09-181-1/+1
| | | | | | | | | | | | | | | | | The reasoning is that this construct is accepted by all compilers and valid in C++11, so it doesn't seem like a useful warning to have enabled by default. Building with -pedantic, -Wbind-to-temporary-copy, or -Wc++98-compat still shows the warning. The motivation is that I built re2, and this was the only warning that was emitted during the build. Both changing re2 to fix the warning and detecting clang and suppressing the warning in re2's build seem inferior than just giving the compiler a good default for this warning. Also move the cxx98compat version of this warning to CXX98CompatPedantic, and update tests accordingly. llvm-svn: 218008
* test/SemaCXX/undefined-internal.cpp: Remove target triple.Hans Wennborg2014-06-061-4/+1
| | | | | | This test seems to run fine in both MS and Itanium C++ ABI mode these days. llvm-svn: 210357
* Revert "Fix the undefined-but-used odr-use marker (DR48)"Alp Toker2014-06-011-4/+7
| | | | | | | | Wrong patch got committed (this one isn't ready for prime time). This reverts commit r209996. llvm-svn: 209997
* Fix the undefined-but-used odr-use marker (DR48)Alp Toker2014-06-011-7/+4
| | | | | | | | | | | | | We should treat tentative definitions as undefined for the purpose of ODR-use linkage checking. This broke somewhere around r149731 when tests were disabled. Note that test coverage for these diagnostics is generally lacking due to a separate issue (PR19910: Don't suppress unused/undefined warnings when there are errors). llvm-svn: 209996
* Render anonymous entities as '(anonymous <thing>)' (and lambdas as '(lambda ↵David Blaikie2014-04-021-23/+23
| | | | | | | | | | | | at ... )') For namespaces, this is consistent with mangling and GCC's debug info behavior. For structs, GCC uses <anonymous struct> but we prefer consistency between all anonymous entities but don't want to confuse them with template arguments, etc, so we'll just go with parens in all cases. llvm-svn: 205398
* Consistently print anonymous namespace names as "<anonymous namespace>"David Blaikie2014-02-141-2/+2
| | | | | | | | | | | For some reason we have two bits of code handling this printing: lib/AST/Decl.cpp: OS << "<anonymous namespace>"; lib/AST/TypePrinter.cpp: OS << "<anonymous namespace>::"; it would be nice if we only had one... llvm-svn: 201437
* When formatting a C++-only declaration name, enable C++ mode in the formatter'sRichard Smith2014-01-221-1/+1
| | | | | | | | | language options. This is not really ideal -- we should require the right language options to be passed in, or not require language options to format a name -- but it fixes a number of *obviously* wrong formattings. Patch by Olivier Goffart! llvm-svn: 199778
* Remove the -cxx-abi command-line flag.Hans Wennborg2014-01-141-2/+2
| | | | | | | | | | | | | | | This makes the C++ ABI depend entirely on the target: MS ABI for -win32 triples, Itanium otherwise. It's no longer possible to do weird combinations. To be able to run a test with a specific ABI without constraining it to a specific triple, new substitutions are added to lit: %itanium_abi_triple and %ms_abi_triple can be used to get the current target triple adjusted to the desired ABI. For example, if the test suite is running with the i686-pc-win32 target, %itanium_abi_triple will expand to i686-pc-mingw32. Differential Revision: http://llvm-reviews.chandlerc.com/D2545 llvm-svn: 199250
* Update tests in preparation for using the MS ABI for Win32 targetsHans Wennborg2014-01-131-1/+4
| | | | | | | | | | In preparation for making the Win32 triple imply MS ABI mode, make all tests pass in this mode, or make them use the Itanium mode explicitly. Differential Revision: http://llvm-reviews.chandlerc.com/D2401 llvm-svn: 199130
* Add r180263 back, but fix hasBraces() to be correct during parsing.Rafael Espindola2013-04-261-0/+7
| | | | | | | | Original commit message: Fix a case in linkage computation that should check for single line extern "C". llvm-svn: 180591
* Revert r180263. It's causing failures.Bill Wendling2013-04-251-7/+0
| | | | llvm-svn: 180583
* Fix a case in linkage computation that should check for single line extern "C".Rafael Espindola2013-04-251-0/+7
| | | | llvm-svn: 180263
* When marking derived classes' virtual methods ODR-used in order to triggerNick Lewycky2013-02-141-0/+17
| | | | | | | instantiation in order to permit devirtualization later in codegen, skip over pure functions since those can't be devirtualization targets. llvm-svn: 175116
* The meat of this patch is in BuildCXXMemberCalLExpr where we make it useNick Lewycky2013-02-121-0/+37
| | | | | | | | | | | | MarkMemberReferenced instead of marking functions referenced directly. An audit of callers to MarkFunctionReferenced and DiagnoseUseOfDecl also caused a few other changes: * don't mark functions odr-used when considering them for an initialization sequence. Do mark them referenced though. * the function nominated by the cleanup attribute should be diagnosed. * operator new/delete should be diagnosed when building a 'new' expression. llvm-svn: 174951
* Apply the pure-virtual odr rule to other constructs which can call overloadedNick Lewycky2013-02-071-0/+38
| | | | | | operators. llvm-svn: 174584
* This patch makes "&Cls::purevfn" not an odr use. This isn't what the standardNick Lewycky2013-02-021-0/+19
| | | | | | | | | says, but that's a defect (to be filed). "Cls::purevfn()" is still an odr use. Also fixes a bug that caused us to not mark the function referenced just because we didn't want to mark it odr used. llvm-svn: 174242
* Fix ODR-use of a MemberExpr to check before marking a pure function used. RemoveNick Lewycky2013-01-311-0/+13
| | | | | | a workaround for this bug from the -Wundefined-internals warning. llvm-svn: 174020
* Don't warn for undefined but used decls that are external because of a typedef.Rafael Espindola2012-12-291-0/+18
| | | | | | | | This fixes pr14736. It is fairly ugly, but I don't think we can do much better as we have to wait at least until the end of the typedef to know if the function will have external linkage or not. llvm-svn: 171240
* Make sure template argument deduction is consistently performed in an ↵Eli Friedman2012-02-081-0/+11
| | | | | | unevaluated context. llvm-svn: 150049
* Suppress the used-but-not-defined warning for static data members while I ↵Eli Friedman2012-02-041-4/+7
| | | | | | look into a rather nasty bug in the new odr-use marking code. llvm-svn: 149731
* Add some code to accurately perform odr-used marking for variables per the ↵Eli Friedman2012-02-021-0/+45
| | | | | | C++11 rules. llvm-svn: 149641
* Rough fix for PR9323 that prevents Clang from marking copy constructorChandler Carruth2011-02-251-0/+17
| | | | | | | | | | | | | | | | declarations as referenced when in fact we're not going to even form a call in the AST. This is significant because we attempt to allow as an extension classes with intentionally private and undefined copy constructors to have temporaries bound to references, and so shouldn't warn about the lack of definition for that copy constructor when the class is internal. Doug, John wasn't really satisfied with the presence of overloading at all. This is a stop-gap and there may be a better solution. If you can give me some hints for how you'd prefer to see this solved, I'll happily switch things over. llvm-svn: 126480
* Don't warn about static const integral data members with in-line constantJohn McCall2011-02-211-0/+21
| | | | | | | | initializers just because they don't have a proper out-of-line definition. Such code is technically ill-formed but is too common and too unlikely to be a problem to be seriously worth worrying about. llvm-svn: 126137
* Warn about code that uses variables and functions with internal linkageJohn McCall2011-02-191-0/+86
without defining them. This should be an error, but I'm paranoid about "uses" that end up not actually requiring a definition. I'll revisit later. Also, teach IR generation to not set internal linkage on variable declarations, just for safety's sake. Doing so produces an invalid module if the variable is not ultimately defined. Also, fix several places in the test suite where we were using internal functions without definitions. llvm-svn: 126016
OpenPOWER on IntegriCloud