Sebastian Redl [Sun, 4 Sep 2011 18:14:28 +0000 (18:14 +0000)]
Add test case for defaulted copy and move structure validation.
Fix bug this uncovered.
Address minor comments from Doug.
Enable cxx_implicit_moves feature.
Support code-completion for C++ inline methods and ObjC buffering methods.
Previously we would cut off the source file buffer at the code-completion
point; this impeded code-completion inside C++ inline methods and,
recently, with buffering ObjC methods.
Have the code-completion inserted into the source buffer so that it can
be buffered along with a method body. When we actually hit the code-completion
point the cut-off lexing or parsing.
Fix Lexer::ComputePreamble when MaxLines parameter is non-zero.
The function was only counting lines that included tokens and not empty lines,
but MaxLines (mainly initiated to the line where the code-completion point resides)
is a count of overall lines (even empty ones).
Add a simple new warning to catch blatantly dangling pointer and
reference members of classes. We've had several bugs reported because of
this, and there's no reason not to flag it right away in the compiler.
Comments especially welcome on the strategy for implementing this
warning (IE, what should trigger this?) and on the text of the warning
itself.
I'm going to extend this to cover obvious cases with temporaries and
beef up the test cases some in subsequent patches. I'll then run it over
a large codebase and make sure its not misbehaving before I add it to
-Wall or turn it on by default. I think this one might be a good
candidate for on by default.
Eli Friedman [Fri, 2 Sep 2011 17:38:59 +0000 (17:38 +0000)]
Make StmtDumper::VisitCXXFunctionalCastExpr dump the attached cast kind. Fix the cast kind for a cast from floating-point to enum type. (The difference isn't actually visible, but that's just because IRGen is overly forgiving.) Per report by Enea Zaffanella on cfe-dev.
Jordy Rose [Fri, 2 Sep 2011 05:55:19 +0000 (05:55 +0000)]
[analyzer] Move the knowledge of whether or not GC is enabled for the current analysis from CFRefCount to ExprEngine.
Remove TransferFuncs from ExprEngine and AnalysisConsumer.
Demote RetainReleaseChecker to a regular checker, and give it the name osx.cocoa.RetainCount (class name change coming shortly). Update tests accordingly.
Douglas Gregor [Fri, 2 Sep 2011 00:26:20 +0000 (00:26 +0000)]
Always construct an ASTReader with a non-NULL ASTContext and
Preprocessor, eliminating the constructor that was used by ASTUnit
(which didn't provide an ASTContext or Prepreprocessor). Ensuring that
both objects are non-NULL will simplify module loading (but none of
that is done yet).
Douglas Gregor [Fri, 2 Sep 2011 00:18:52 +0000 (00:18 +0000)]
Extend the ASTContext constructor to delay the initialization of
builtin types (When requested). This is another step toward making
ASTUnit build the ASTContext as needed when loading an AST file,
rather than doing so after the fact. No actual functionality change (yet).
Douglas Gregor [Thu, 1 Sep 2011 23:39:15 +0000 (23:39 +0000)]
Allow the preprocessor to be constructed without performing target-
and language-specific initialization. Use this to allow ASTUnit to
create a preprocessor object *before* loading the AST file. No actual
functionality change.
Richard Trieu [Thu, 1 Sep 2011 22:53:23 +0000 (22:53 +0000)]
Refactor CheckAdditionOperands(), CheckSubtractionOperands(), and CheckIncrementDecrementOperand() in SemaExpr.cpp to move reused code to separate functions.
Nick Lewycky [Thu, 1 Sep 2011 21:49:51 +0000 (21:49 +0000)]
Don't try to emit unsupported templated friend declarations. They're unsupported
and may very well be dependent-types, triggering an assertion in debug info
codegen.
Richard Trieu [Thu, 1 Sep 2011 21:44:13 +0000 (21:44 +0000)]
Extend the self-reference warning to catch when a constructor references itself upon initialization, such as using itself within its own copy constructor.
Douglas Gregor [Thu, 1 Sep 2011 20:23:19 +0000 (20:23 +0000)]
Teach ASTContext and Preprocessor to hold on to references to the same
LangOptions, rather than making distinct copies of
LangOptions. Granted, LangOptions doesn't actually get modified, but
this will eventually make it easier to construct ASTContext and
Preprocessor before we know all of the LangOptions.
Douglas Gregor [Thu, 1 Sep 2011 17:04:32 +0000 (17:04 +0000)]
Modules hide macro definitions by default, so that silly things like
include guards don't show up as macro definitions in every translation
unit that imports a module. Macro definitions can, however, be
exported with the intentionally-ugly #__export_macro__
directive. Implement this feature by not even bothering to serialize
non-exported macros to a module, because clients of that module need
not (should not) know that these macros even exist.
Enable -fdelayed-template-parsing by default on Win32.
I had to force -fno-delayed-template-parsing on some Index tests because delayed template parsing will change the output of some tests.
Fix PR10744 by adding the toolchain path to the regular program path
and doing a simple search. Before we would manually check for the linker
before the -B options were searched.
Douglas Gregor [Thu, 1 Sep 2011 02:09:07 +0000 (02:09 +0000)]
When defining the implicit move assignment operator, don't perform
semantic analysis when taking the address of an xvalue. Instead, just
build the unary operator directly, since it's safe to do so (from the
IRgen and AST perspectives) for any glvalue. Fixes PR10822.
Support importing of ObjC categories from modules.
The initial incentive was to fix a crash when PCH chaining categories
to an interface, but the fix was done in the "modules way" that I hear
is popular with the kids these days.
Each module stores the local chain of categories and we combine them
when the interface is loaded. We also warn if non-dependent modules
introduce duplicate named categories.
Chandler Carruth [Wed, 31 Aug 2011 23:59:23 +0000 (23:59 +0000)]
Create a CaretDiagnostic class to hold the logic for emitting
(unsurprisingly) caret diagnostics. This is designed to bring some
organization to the monstrous EmitCaretDiagnostic function, and allow
factoring it more easily and with less mindless parameter passing.
Currently this just lifts the existing function into a method, and
splits off the obviously invariant arguments to be class members. No
functionality is changed, and there are still lots of warts to let
existing code continue functioning as-is. Definitely WIP, more cleanups
to follow.
objective-c: this patch (re)introduces objective-c's default property
synthesis. This new feature is currently placed under
-fobjc-default-synthesize-properties option
and is off by default pending further testing.
It will become the default feature soon.
// rdar://8843851
Chad Rosier [Wed, 31 Aug 2011 20:56:25 +0000 (20:56 +0000)]
[driver] If no -miphoneos-version-min is specified on the command line *and*
IPHONEOS_DEPLOYMENT_TARGET if undefined, set -miphoneos-version-min based on
isysroot.
Chandler Carruth [Wed, 31 Aug 2011 18:39:20 +0000 (18:39 +0000)]
Don't verify the name of the driver executable. It's not really relevent
to this test, and doesn't always start with 'clang' when fully resolved
on some build systems.
Douglas Gregor [Wed, 31 Aug 2011 18:19:09 +0000 (18:19 +0000)]
Switch __import__ over to __import_module__, so we don't conflict with
existing practice with Python extension modules. Not that Python
extension modules should be using a double-underscored identifier
anyway, but...
objective-c - This patch buffers method implementations
and does the Sema on their body after the entire
class/category @implementation is seen. This change allows messaging
of forward private methods, as well as, access to
synthesized ivars of properties with foward synthesize
declarations; among others. In effect, this patch removes
several restrictions placed on objective-c due to in-place
semantics processing of methods.
This is part of // rdar://8843851.
Chandler Carruth [Wed, 31 Aug 2011 16:53:37 +0000 (16:53 +0000)]
Update libclang to have APIs corresponding to the new 'expansion' naming
system for macro-backed source locations. The old APIs are preserved for
legacy users.
This was intended to land with the main work of instantiation ->
expansion, but despite running it by Doug over a month ago, I forgot to
commit it. Very sorry for that...
Chandler Carruth [Wed, 31 Aug 2011 09:01:53 +0000 (09:01 +0000)]
Improve the diagnostic text for -Wmissing-noreturn to include the name
of the function in question when applicable (that is, not for blocks).
Patch by Joerg Sonnenberger with some stylistic tweaks by me.
When discussing this weth Joerg, streaming the decl directly into the
diagnostic didn't work because we have a pointer-to-const, and the
overload doesn't accept such. In order to make my style tweaks to the
patch, I first changed the overload to accept a pointer-to-const, and
then changed the diagnostic printing layer to also use
a pointer-to-const, cleaning up a gross line of code along the way.
Eli Friedman [Tue, 30 Aug 2011 23:07:51 +0000 (23:07 +0000)]
Change err_pp_file_not_found back to an Error; when it's a Warning, we suppress it in system headers. And it is not a good idea to suppress it in system headers. (This was originally changed in r134996 to implement -MG.)
Fixes <rdar://10041960>. And also brings down the number of warnings without a flag by one :)
Douglas Gregor [Tue, 30 Aug 2011 22:40:35 +0000 (22:40 +0000)]
Allow C99 hexfloats in C++0x mode. This change resolves the standards
collision between C99 hexfloats and C++0x user-defined literals by
giving C99 hexfloats precedence. Also, warning about user-defined
literals that conflict with hexfloats and those that have names that
are reserved by the implementation. Fixes <rdar://problem/9940194>.
Douglas Gregor [Tue, 30 Aug 2011 20:49:19 +0000 (20:49 +0000)]
When writing out the entries in a lookup table for a DeclContext, make
sure that all of the CXXConversionDecls go into the same
bucket. Otherwise, name lookup might not find them all. Fixes
<rdar://problem/10041960>.
Sebastian Redl [Tue, 30 Aug 2011 19:58:05 +0000 (19:58 +0000)]
Declare and define implicit move constructor and assignment operator.
This makes the code duplication of implicit special member handling even worse,
but the cleanup will have to come later. For now, this works.
Follow-up with tests for explicit defaulting and enabling the __has_feature
flag to come.
In ASTWriter::WriteDeclContextVisibleBlock, don't write empty lookups.
Empty lookups can occur in the DeclContext map when we are chaining PCHs, where
the empty lookup indicates that we already looked in ExternalASTSource.
John McCall [Tue, 30 Aug 2011 00:57:29 +0000 (00:57 +0000)]
Be sure to emit lvalue-to-rvalue casts for loads from x-values.
Doing this happens to disrupt the pattern that ARC was looking for
for move optimizations, so we need to fix that simultaneously.
Ivan Krasin [Mon, 29 Aug 2011 22:39:12 +0000 (22:39 +0000)]
Clang/PNaCl: Improve test coverage for PNaClTargetInfo (type aligns), fixes nits:
- wrong alignment for double (it was 4, but 8 is desired),
- added checks for _REENTRANT define,
- fixed the issue that defines were not tested (because the check for inside #ifdef).
Caitlin Sadowski [Mon, 29 Aug 2011 22:27:51 +0000 (22:27 +0000)]
Thread safety: added basic handling for pt_guarded_by/var and guarded_by/var annotations. We identify situations where we are accessing (reading or writing) guarded variables, and report an error if the appropriate locks are not held.
Douglas Gregor [Mon, 29 Aug 2011 17:28:38 +0000 (17:28 +0000)]
Add and document __has_feature values for the remaining C++0x
features, so clients can check for the availability of these features
even before we get around to implementing them.
Jeffrey Yasskin [Mon, 29 Aug 2011 15:59:37 +0000 (15:59 +0000)]
Print 'int' instead of 'const int' in the narrowing conversion error, since the
qualification of a type doesn't affect whether a conversion is a narrowing
conversion.
This doesn't work in template cases because SubstTemplateTypeParmType gets in
the way.