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.
Jordan Rose [Mon, 11 Jun 2012 23:20:52 +0000 (23:20 +0000)]
[analyzer] Treat LValueBitCasts like regular pointer bit casts.
These casts only appear in very well-defined circumstances, in which the
target of a reinterpret_cast or a function formal parameter is an lvalue
reference. According to the C++ standard, the following are equivalent:
Hal Finkel [Mon, 11 Jun 2012 22:35:19 +0000 (22:35 +0000)]
Add PPC support for translating gcc-style -mcpu options into LLVM -target-cpu options.
This functionality is based on what is done on ARM, and enables selecting PPC CPUs
in a way compatible with gcc's driver. Also, mirroring gcc (and what is done on x86),
-mcpu=native support was added. This uses the host cpu detection from LLVM
(which will also soon be updated by refactoring code currently in backend).
In order for this to work, the target needs a list of valid CPUs -- we now accept all CPUs accepted by LLVM.
A few preprocessor defines for common CPU types have been added.
Jordan Rose [Mon, 11 Jun 2012 16:40:41 +0000 (16:40 +0000)]
[analyzer] Add ObjCLoopChecker: objects from NSArray et al are non-nil.
While collections containing nil elements can still be iterated over in an
Objective-C for-in loop, the most common Cocoa collections -- NSArray,
NSDictionary, and NSSet -- cannot contain nil elements. This checker adds
that assumption to the analyzer state.
This was the cause of some minor false positives concerning CFRelease calls
on objects in an NSArray.
Jordan Rose [Mon, 11 Jun 2012 16:40:37 +0000 (16:40 +0000)]
[analyzer] When looking for a known class, only traverse the hierarchy once.
This has a small hit in the case where only one class is interesting
(NilArgChecker) but is a big improvement when looking for one of several
interesting classes (VariadicMethodTypeChecker), in which the most common
case is that there is no match.