Eli Friedman [Sat, 16 Jun 2012 02:19:17 +0000 (02:19 +0000)]
Fix Sema and IRGen for atomic compound assignment so it has the right semantics when promotions are involved.
(As far as I can tell, this only affects some edge cases.)
Jordan Rose [Sat, 16 Jun 2012 01:28:00 +0000 (01:28 +0000)]
[analyzer] Return an UnknownVal when we try to get the binding for a VLA.
This happens in C++ mode right at the declaration of a struct VLA;
MallocChecker sees a bind and tries to get see if it's an escaping bind.
It's likely that our handling of this is still incomplete, but it fixes a
crash on valid without disturbing anything else for now.
[AST/libclang] Fix the selector locations that are reported for a
method definition that has its '{' attached to the method name without
a space.
With a method like:
-(id)meth{
.....
}
the logic in ObjCMethodDecl that determined the selector locations got
confused because it was initialized based on an end location for '{' but
that end location changed to '}' after the method was finished.
Fix this by having an immutable end location for the declarator and
for getLocEnd() get the end location from the body itself.
Jordan Rose [Sat, 16 Jun 2012 00:09:20 +0000 (00:09 +0000)]
[analyzer] Buffers passed to CGBitmapContextCreate can escape.
Specifically, although the bitmap context does not take ownership of the
buffer (unlike CGBitmapContextCreateWithData), the data buffer can be extracted
out of the created CGContextRef. Thus the buffer is not leaked even if its
original pointer goes out of scope, as long as
- the context escapes, or
- it is retrieved via CGBitmapContextGetData and freed.
Actually implementing that logic is beyond the current scope of MallocChecker,
so for now CGBitmapContextCreate goes on our system function exception list.
Jordan Rose [Fri, 15 Jun 2012 23:33:51 +0000 (23:33 +0000)]
[-E] Emit a rewritten _Pragma on its own line.
1. Teach Lexer that pragma lexers are like macro expansions at EOF.
2. Treat pragmas like #define/#undef when printing.
3. If we just printed a directive, add a newline before any more tokens.
(4. Miscellaneous cleanup in PrintPreprocessedOutput.cpp)
PR10594 and <rdar://problem/11562490> (two separate related problems)
James Dennett [Fri, 15 Jun 2012 22:23:43 +0000 (22:23 +0000)]
Documentation cleanup:
* Escaped "::" and "<" as needed in Doxygen comments;
* Marked up code examples with \code...\endcode;
* Documented a \param that is current, instead of a few that aren't;
* Fixed up some \file and \brief comments.
James Dennett [Fri, 15 Jun 2012 22:10:14 +0000 (22:10 +0000)]
Documentation cleanup:
* Escaped Objective-C @keywords in Doxygen comments;
* Documented more accurate \params;
* Exposed some more summaries using \brief.
James Dennett [Fri, 15 Jun 2012 21:43:55 +0000 (21:43 +0000)]
Documentation cleanup:
* Escaped the # of #define in Doxygen comments;
* Formatting: Annotated __VA_ARGS__ with \c;
* Converted docs to use \brief to provide summaries;
* Fixed a typo: disbles -> disables.
Jordan Rose [Fri, 15 Jun 2012 18:19:56 +0000 (18:19 +0000)]
[completion] Add completions for @"..." and @(...), and tidy up @[] and @{}.
Specifically, @[] and @{} didn't have a type associated with them; we now
use "NSArray *" and "NSDictionary *", respectively. @"" has the type
"NSString *". @(), unfortunately, has type "id", since it (currently) may
be either an NSNumber or an NSString.
Add a test for all the Objective-C at-expression completions.
Jordan Rose [Fri, 15 Jun 2012 18:19:52 +0000 (18:19 +0000)]
[analyzer] RetainCount: don't track objects init'd with a delegate
We already didn't track objects that have delegates or callbacks or
objects that are passed through void * "context pointers". It's a
not-uncommon pattern to release the object in its callback, and so
the leak message we give is not very helpful.
Jordan Rose [Fri, 15 Jun 2012 18:19:48 +0000 (18:19 +0000)]
Warn when a static variable is referenced in a non-static inline function.
This is explicitly forbidden in C99 6.7.4p3. This is /not/ forbidden in C++,
probably because by default file-scope const/constexpr variables have internal
linkage, while functions have external linkage. There's also the issue of
anonymous namespaces to consider. Nevertheless, there should probably be a
similar warning, since the semantics of inlining a function that references
a variable with internal linkage do not seem well-defined.
James Dennett [Fri, 15 Jun 2012 08:55:05 +0000 (08:55 +0000)]
Documentation cleanup:
* Converted comments to use \brief to provide summaries;
* Fixed uses of \arg that should be \p;
* Fixed \param [in] [out] to \param [in,out];
* Made minor formatting fixes.
James Dennett [Fri, 15 Jun 2012 08:49:07 +0000 (08:49 +0000)]
Documentation cleanup: use \p ParameterName when referring to a parameter,
not \arg ParameterName (which should be used only when documenting that
parameter, not when referring to it from elsewhere).
James Dennett [Fri, 15 Jun 2012 08:32:48 +0000 (08:32 +0000)]
Documentation cleanup:
* Escaped @ symbols that shouldn't be interpreted by Doxygen;
* Deleted \param documentation for function parameters that no longer exist;
* Fixed parameter names in \param Doxygen commands;
* Fixed some broken formatting.
James Dennett [Fri, 15 Jun 2012 08:02:32 +0000 (08:02 +0000)]
Documentation cleanup: eliminated Doxygen warnings by deleting a doc comment
on ASTContext::CreateTypeSourceInfo that duplicated information from the
(more complete) version in ASTContext.h.
James Dennett [Fri, 15 Jun 2012 07:41:35 +0000 (07:41 +0000)]
Documentation cleanup:
* Add \brief to produce a summary in the Doxygen output;
* Add missing parameter names to \param commands;
* Fix mismatched parameter names for \param commands;
* Add a parameter name so that the \param has a target.
James Dennett [Fri, 15 Jun 2012 07:13:21 +0000 (07:13 +0000)]
Documentation cleanup:
* Removed \param comments for parameters that no longer exist;
* Fixed a "\para" typo to "\param";
* Escaped @, # and \ symbols as needed in Doxygen comments;
* Added use of \brief to output short summaries.
James Dennett [Fri, 15 Jun 2012 05:41:51 +0000 (05:41 +0000)]
Documentation cleanup for clang-c:
* Add parameter names to various \param commands;
* Ensure that \brief summaries are followed by blank lines where needed to
prevent subsequent text being merged into the summary;
* Mark code examples with \code...\endcode so that they're appropriately
formatted by Doxygen.
* Add qualification for links to field of structs (specifically callbacks);
* Escape #, @ and < as needed to avoid them being interpreted by Doxygen;
* Remove incorrect uses of "\see name", preferring #name;
* Fix a glitchy "\param Returns..." to be "\returns";
* Fix parameter names given to \param, typos and otherwise.
John McCall [Fri, 15 Jun 2012 05:27:05 +0000 (05:27 +0000)]
It turns out that implementing the rethrow-on-fallthrough
semantics of a ctor/dtor function-try-block catch handler
by pushing a normal cleanup is not just overkill but actually
actively wrong when the handler contains an explicit return
(which is only legal in a dtor). Just emit the rethrow as
ordinary code at the fallthrough point. Fixes PR13102.
Richard Smith [Fri, 15 Jun 2012 05:07:49 +0000 (05:07 +0000)]
PR12717: Clang supports hexadecimal floating-point literals in all language
modes. For languages other than C99/C11, this isn't quite a conforming
extension, and for C++11, it breaks some reasonable code containing
user-defined literals.
In languages which don't officially have hexfloats, pare back this extension
to only apply in cases where the token starts 0x and does not contain an
underscore. The extension is still not quite conforming, but it's a lot closer
now.
James Dennett [Fri, 15 Jun 2012 04:35:30 +0000 (04:35 +0000)]
Ongoing documentation cleanup: fixed Doxygen markup errors, added \brief
annotations in many places where it involved little change, fixed some
examples and marked code examples with \code...\endcode, and changed a few
nearby mentions of C++0x to refer to C++11.
James Dennett [Thu, 14 Jun 2012 21:40:34 +0000 (21:40 +0000)]
Still more Doxygen documentation fixes:
* Escape #, < and @ symbols where Doxygen would try to interpret them;
* Fix several function param documentation where names had got out of sync;
* Delete param documentation referring to parameters that no longer exist.
James Dennett [Thu, 14 Jun 2012 03:11:41 +0000 (03:11 +0000)]
This makes SemaCodeComplete.cpp more Doxygen-friendly by changing the
OBJC_AT_KEYWORD_NAME take a string literal argument where previously
its second argument was an unquoted token; macro invocations such as
OBJC_AT_KEYWORD_NAME(NeedAt,{) confuse Doxygen's parser.
While I'm wary of changing code (rather than just comments) to work
around Doxygen's limitations, in this case the change makes the code
more readable for human beings as well, and the macro derived no
benefit from using the preprocessor's stringification operator, as
it never has need of the unquoted token.
I've also included a couple of trivial drive-by fixes to doc comments.
James Dennett [Wed, 13 Jun 2012 22:07:09 +0000 (22:07 +0000)]
More doxygen/documentation cleanups.
This reduces the number of warnings generated by Doxygen by about 100
(roughly 10%). Issues addressed:
(1) Primarily, backslash-escaped "@foo" and "#bah" in Doxygen comments
when they're not supposed to be Doxygen commands or links, and
similarly for "<baz>" when it's not intended as as HTML tag;
(2) Changed some \t commands (which don't exist) to \c ("to refer to a
word of code", as the Doxygen manual says);
(3) \precondition becomes \pre;
(4) When touching comments, deleted a couple of spurious spaces in them;
(5) Changed some \n and \r to \\n and \\r;
(6) Fixed one tiny typo: #pragms -> #pragma.
Richard Smith [Wed, 13 Jun 2012 20:27:03 +0000 (20:27 +0000)]
Add -isystem-prefix and -ino-system-prefix arguments, which can be used to
override whether headers are system headers by checking for prefixes of the
header name specified in the #include directive.
This allows warnings to be disabled for third-party code which is found in
specific subdirectories of include paths.
Richard Trieu [Wed, 13 Jun 2012 20:25:24 +0000 (20:25 +0000)]
Moved the StringLiteral printing code from StmtPrinter into the StringLiteral
class and have StmtPrinter and StmtDumper refer to it. This fixes an
assertion failure when dumping wchar string literals.
Daniel Jasper [Wed, 13 Jun 2012 07:12:33 +0000 (07:12 +0000)]
Rename shouldVisitImplicitDeclarations to shouldVisitImplicitCode.
Fix RecursiveASTVisitor to visit CXXForRangeStmts accordingly to visit
implicit or explicit code.
The key bug that inspired this was the Visitor not visiting the range
initializer of such a loop, which is explicit code.
Charles Davis [Wed, 13 Jun 2012 00:18:14 +0000 (00:18 +0000)]
Grab bag of Microsoft Mangler fixes:
- Support mangling virtual function tables (base tables need work on the
ManglerContext interface).
- Correct mangling of local scopes (i.e. functions and C++ methods).
- Replace every llvm_unreachable() for actually-reachable code with a
diagnostic.
Chad Rosier [Tue, 12 Jun 2012 19:03:42 +0000 (19:03 +0000)]
[ms-inline-asm] Cleanup MS style inline assembly parsing.
Specifically, improve the handling of whitespace, stop saving tokens that are
in comments and fix the case where we have a comment followed by a closing brace
on the next line.
Unfortunately, there's no easy way of testing this code.