Commit Graph

39290 Commits

Author SHA1 Message Date
Dylan Noblesmith eaea2a884b test/Preprocessor: add NVPTX predefine tests
llvm-svn: 160866
2012-07-27 16:37:53 +00:00
Peter Collingbourne 6b4fdc25d3 Fix an assertion failure when code completing an auto variable's initialiser.
llvm-svn: 160857
2012-07-27 12:56:09 +00:00
Benjamin Kramer a2dcac1095 Fix PR13394: Erasing from a vector changes the end of the vector, so make sure we always have the right end.
llvm-svn: 160855
2012-07-27 10:21:08 +00:00
NAKAMURA Takumi 836926dbdf clang/lib: [CMake] Update tblgen'd dependencies.
llvm-svn: 160851
2012-07-27 06:18:33 +00:00
NAKAMURA Takumi 075c89bc06 clang/lib: [CMake] Reformat, alphabetize lists.
llvm-svn: 160850
2012-07-27 06:18:12 +00:00
NAKAMURA Takumi a9a35c67e1 libclang, examples: [CMake] Add dependencies to tblgen'd headers.
llvm-svn: 160849
2012-07-27 06:17:56 +00:00
NAKAMURA Takumi d3f78a1458 clang/CMakeLists.txt: Move "examples" after building lib and tools.
llvm-svn: 160848
2012-07-27 06:17:48 +00:00
Richard Smith d3b5c90865 Final piece of core issue 1330: delay computing the exception specification of
a defaulted special member function until the exception specification is needed
(using the same criteria used for the delayed instantiation of exception
specifications for function temploids).

EST_Delayed is now EST_Unevaluated (using 1330's terminology), and, like
EST_Uninstantiated, carries a pointer to the FunctionDecl which will be used to
resolve the exception specification.

This is enabled for all C++ modes: it's a little faster in the case where the
exception specification isn't used, allows our C++11-in-C++98 extensions to
work, and is still correct for C++98, since in that mode the computation of the
exception specification can't fail.

The diagnostics here aren't great (in particular, we should include implicit
evaluation of exception specifications for defaulted special members in the
template instantiation backtraces), but they're not much worse than before.

Our approach to the problem of cycles between in-class initializers and the
exception specification for a defaulted default constructor is modified a
little by this change -- we now reject any odr-use of a defaulted default
constructor if that constructor uses an in-class initializer and the use is in
an in-class initialzer which is declared lexically earlier. This is a closer
approximation to the current draft solution in core issue 1351, but isn't an
exact match (but the current draft wording isn't reasonable, so that's to be
expected).

llvm-svn: 160847
2012-07-27 04:22:15 +00:00
Jordan Rose 41c98d9dc3 [analyzer] Look through SubstNonTypeTemplateParmExprs.
We were treating this like a CXXDefaultArgExpr, but
SubstNonTypeTemplateParmExpr actually appears when a template is
instantiated, i.e. we have all the information necessary to evaluate it.
This allows us to inline functions like llvm::array_lengthof.

<rdar://problem/11949235>

llvm-svn: 160846
2012-07-27 01:15:02 +00:00
Jordan Rose de76c92b15 [analyzer] Use a stack-based local AGAIN to fix the build for real.
It's a good thing CallEvents aren't created all over the place yet.
I checked all the uses this time and the private copy constructor
/really/ shouldn't cause any more problems.

llvm-svn: 160845
2012-07-27 00:47:52 +00:00
Jordan Rose 7aab2295be [analyzer] Use a stack-based local instead of a temporary to fix build.
Passing a temporary via reference parameter still requires a visible
copy constructor.

llvm-svn: 160840
2012-07-26 23:24:15 +00:00
Fariborz Jahanian 226459efff objc-arc: When objects with known CF semantics are assigned to
retainable types in arc, only suggest CFBridgingRelease/
CFBridgingRetain and not the confusing __bridge casts.
// rdar://11923822

llvm-svn: 160839
2012-07-26 23:17:04 +00:00
Ted Kremenek ecc928c89b Tweak test case to not emit warning.
llvm-svn: 160822
2012-07-26 22:32:35 +00:00
Jordan Rose c2a3223da9 SATestBuild should not ask for non-existent checkers.
- "cocoa" was moved to "osx.cocoa" a long time ago.
- "cplusplus" would be a valid package except we don't have any C++ checkers.

llvm-svn: 160821
2012-07-26 22:31:59 +00:00
Ted Kremenek 313c2ff375 Look at the preceding CFGBlock for the expression to load from in ExprEngine::VisitGuardedExpr
instead of walking to the preceding PostStmt node.  There are cases where the last evaluated
expression does not appear in the ExplodedGraph.

Fixes PR 13466.

llvm-svn: 160819
2012-07-26 22:23:41 +00:00
Jordan Rose 72ce8e2d42 [analyzer] CallEvent is no longer a value object.
After discussion, the type-based dispatch was decided to be bad for
maintenance and made it very easy for subtle bugs to creep in. Instead,
we'll just be very careful when we do have to allocate these on the heap.

llvm-svn: 160817
2012-07-26 21:41:15 +00:00
Jordan Rose 4f7df9be69 [analyzer] Rename Calls.{h,cpp} to CallEvent.{h,cpp}. No functionality change.
llvm-svn: 160815
2012-07-26 21:39:41 +00:00
Jordan Rose 25bc20f846 [analyzer] Don't crash on implicit statements inside initializers.
Our BugReporter knows how to deal with implicit statements: it looks in
the ParentMap until it finds a parent with a valid location. However, since
initializers are not in the body of a constructor, their sub-expressions are
not in the ParentMap. That was easy enough to fix in AnalysisDeclContext.

...and then even once THAT was fixed, there's still an extra funny case
of Objective-C object pointer fields under ARC, which are initialized with
a top-level ImplicitValueInitExpr. To catch these cases,
PathDiagnosticLocation will now fall back to the start of the current
function if it can't find any other valid SourceLocations. This isn't great,
but it's miles better than a crash.

(All of this is only relevant when constructors and destructors are being
inlined, i.e. under -cfg-add-initializers and -cfg-add-implicit-dtors.)

llvm-svn: 160810
2012-07-26 20:04:30 +00:00
Jordan Rose 20edae8749 [analyzer] Don't crash on array constructors and destructors.
This workaround is fairly lame: we simulate the first element's constructor
and destructor and rely on the region invalidation to "initialize" the rest
of the elements.

llvm-svn: 160809
2012-07-26 20:04:25 +00:00
Jordan Rose 54529a347e [analyzer] Handle C++ member initializers and destructors.
This uses CFG to tell if a constructor call is for a member, and uses
the member's region appropriately.

llvm-svn: 160808
2012-07-26 20:04:21 +00:00
Jordan Rose 05375eb4ec [analyzer] Use the CFG to see if a constructor is for a local variable.
Previously we were using ParentMap and crawling through the parent DeclStmt.
This should be at least slightly cheaper (and is also more flexible).

No (intended) functionality change.

llvm-svn: 160807
2012-07-26 20:04:16 +00:00
Jordan Rose b970505d0d [analyzer] Handle base class initializers and destructors.
Most of the logic here is fairly simple; the interesting thing is that
we now distinguish complete constructors from base or delegate constructors.
We also make sure to cast to the base class before evaluating a constructor
or destructor, since non-virtual base classes may behave differently.

This includes some refactoring of VisitCXXConstructExpr and VisitCXXDestructor
in order to keep ExprEngine.cpp as clean as possible (leaving the details for
ExprEngineCXX.cpp).

llvm-svn: 160806
2012-07-26 20:04:13 +00:00
Jordan Rose b3244566f0 [analyzer] Variables with destructors are live until the destructor is run.
Test case in the next commit, which enables destructors under certain
circumstances.

llvm-svn: 160805
2012-07-26 20:04:08 +00:00
Jordan Rose a4c0d21f42 [analyzer] Show paths for destructor calls.
This modifies BugReporter and friends to handle CallEnter and CallExitEnd
program points that came from implicit call CFG nodes (read: destructors).

This required some extra handling for nested implicit calls. For example,
the added multiple-inheritance test case has a call graph that looks like this:

testMultipleInheritance3
  ~MultipleInheritance
    ~SmartPointer
    ~Subclass
      ~SmartPointer
        ***bug here***

In this case we correctly notice that we started in an inlined function
when we reach the CallEnter program point for the second ~SmartPointer.
However, when we reach the next CallEnter (for ~Subclass), we were
accidentally re-using the inner ~SmartPointer call in the diagnostics.

Rather than guess if we saw the corresponding CallExitEnd based on the
contents of the active path, we now just ask the PathDiagnostic if there's
any known stack before popping off the top path.

(A similar issue could have occured without multiple inheritance, but there
wasn't a test case for it.)

llvm-svn: 160804
2012-07-26 20:04:05 +00:00
Jordan Rose c5d852447b [analyzer] Inline ctors + dtors when the CFG is built for them.
At the very least this means initializer nodes for constructors and
automatic object destructors are present in the CFG.

llvm-svn: 160803
2012-07-26 20:04:00 +00:00
Jordan Rose 443ec10e2d [analyzer] PostImplicitCall can also occur between CFGElements.
This avoids an assertion crash when we invalidate on a destructor call
instead of inlining it.

llvm-svn: 160802
2012-07-26 20:03:56 +00:00
Jordan Rose 77c28aaa5c Add a const version of Expr::IgnoreImplicit. No functionality change.
llvm-svn: 160801
2012-07-26 20:03:54 +00:00
Jordan Rose 5920a1bdd1 Un-break standalone invocations of CmpRuns.py.
Fallout from CmpRuns.py API changes in r160314.

llvm-svn: 160800
2012-07-26 20:03:51 +00:00
Fariborz Jahanian a5fc75f4f5 objective-c parsing. Don't crash when selector name
is missing in method prototype. // rdar://11939584

llvm-svn: 160789
2012-07-26 17:32:28 +00:00
Alexander Kornienko 49b5f89105 Put back dump() without a default argument, "because debuggers don't usually respect default arguments".
llvm-svn: 160788
2012-07-26 17:11:45 +00:00
Alexander Kornienko 3db68ee109 Added -ast-dump-filter option to clang -cc1.
llvm-svn: 160784
2012-07-26 16:01:23 +00:00
Timur Iskhodzhanov 3c80d5aa15 Remove an outdated comment; add one test to compare function pointer and block mangling
llvm-svn: 160783
2012-07-26 13:41:30 +00:00
Timur Iskhodzhanov a703956422 Add more tests for PR13207 (Mangling of template back references with -cxx-abi microsoft) now that PR13389 is fixed (mangling of return types)
llvm-svn: 160782
2012-07-26 11:01:05 +00:00
Timur Iskhodzhanov 25fabdbace Fix PR13389 (Wrong mangling of return type qualifiers with -cxx-abi microsoft)
llvm-svn: 160780
2012-07-26 10:41:15 +00:00
Alexander Kornienko cdc3987ca8 Removed standalone clang-ast-dump tool.
llvm-svn: 160772
2012-07-26 01:44:18 +00:00
Anna Zaks 83f1495fcb [analyzer] Inline ObjC class methods.
- Some cleanup(the TODOs) will be done after ObjC method inlining is
complete.
- Simplified CallEvent::getDefinition not to require ISDynamicDispatch
parameter.
- Also addressed Jordan's comments from r160530.

llvm-svn: 160768
2012-07-26 00:27:51 +00:00
Ted Kremenek faef9cb694 Add static analyzer check for calling a C++ instance method with a null/uninitialized pointer.
llvm-svn: 160767
2012-07-26 00:22:32 +00:00
Tanya Lattner 4bfc355094 Disable the warning for missing prototypes for OpenCL kernels. Includes testcase.
llvm-svn: 160766
2012-07-26 00:08:28 +00:00
Ted Kremenek 80b4ac76c5 Remove the ability to stash arbitrary pointers into UndefinedVal (no longer needed).
llvm-svn: 160764
2012-07-25 22:09:19 +00:00
Sylvestre Ledru 2aa45cf43e Fix two typos in the doc
llvm-svn: 160763
2012-07-25 22:02:37 +00:00
Ted Kremenek b5a18d5881 Remove ExprEngine::MarkBranch(), as it is no longer needed.
llvm-svn: 160761
2012-07-25 21:58:29 +00:00
Ted Kremenek bb81ffb342 Update ExprEngine's handling of ternary operators to find the ternary expression
value by scanning the path, rather than assuming we have visited the '?:' operator
as a terminator (which sets a value indicating which expression to grab the
final ternary expression value from).

llvm-svn: 160760
2012-07-25 21:58:25 +00:00
Fariborz Jahanian 1a11252f60 objective-c modern translator. Provide declaration of
"memset' lazily when is needed in translation of
struct-valued methods which require checkinf of nil receivers
outside their bodies. // rdar://11847319

llvm-svn: 160759
2012-07-25 21:48:36 +00:00
Ted Kremenek b1fcddfc6a Remove experimental invalid iterators checker from the codebase until we have the time
to fix all the issues.  Currently the code is essentially unmaintained and buggy, and
needs major revision (with coupled enhancements to the analyzer core).

llvm-svn: 160754
2012-07-25 20:02:05 +00:00
Chad Rosier ae7581dfd6 [driver crash diagnostics] Strip -internal-isystem and -internal-externc-isystem.
rdar://11949066

llvm-svn: 160752
2012-07-25 18:55:43 +00:00
Chad Rosier 7a42ff546a [driver crash diagnostics] Strip -idirafter, -iprefix, -iwithprefix,
-iwithprefixbefore, and -isystem options, per Matt's suggestion.
rdar://11949066

llvm-svn: 160750
2012-07-25 18:38:57 +00:00
Chad Rosier 959f0b3a07 [driver crash diagnostics] A few enhancements:
-Strip -iquote and -M options.
 -Quote -D options to avoid problems with command line macros that include
  parens.
rdar://11949066

llvm-svn: 160743
2012-07-25 17:52:16 +00:00
Dmitri Gribenko 6b375193a2 libclang comment to HTML rendering: \result is the same as \returns
llvm-svn: 160738
2012-07-25 17:14:58 +00:00
NAKAMURA Takumi 2538bf111e test/PCH/objc_stmts.m: Suppress stderr to be fed to FileCheck.
llvm-svn: 160720
2012-07-25 11:14:11 +00:00
Manuel Klimek e923569b1b Introduces the 'decl' matcher which was missing for a while
and became necessary with the change to require BindableMatchers
for binding.

Also fixes PR 13445: "hasSourceExpression only works for implicit casts".

llvm-svn: 160716
2012-07-25 10:02:02 +00:00
NAKAMURA Takumi e1efe31948 test/Analysis/iterators.cpp: Mark as REQUIRES:asserts. It crashes due to assertion failure.
I saw the case it XPASSes.

llvm-svn: 160715
2012-07-25 09:47:24 +00:00
Timur Iskhodzhanov ff7ff3f30b Add a FIXME to revisit the performance of BackRefMap later
llvm-svn: 160709
2012-07-25 08:16:41 +00:00
Manuel Klimek 587bcca66d Adds a introductionary document to the Clang AST.
Next steps are adding information about types & source location handling.

llvm-svn: 160708
2012-07-25 07:28:11 +00:00
Ted Kremenek 875a402dc3 Turn -Wobjc-root-class on by default. <rdar://problem/11203649>.
llvm-svn: 160707
2012-07-25 07:26:32 +00:00
Ted Kremenek 2b619662ee Promote warn_unknown_analyzer_checker to an error. Addresses <rdar://problem/10987863>.
llvm-svn: 160706
2012-07-25 07:12:13 +00:00
Richard Smith 2589b9808e PR12057: Allow variadic template pack expansions to cross lambda boundaries.
Rather than adding a ContainsUnexpandedParameterPack bit to essentially every
AST node, we tunnel the bit directly up to the surrounding lambda expression
when we reach a context where an unexpanded pack can not normally appear.
Thus any statement or declaration within a lambda can now potentially contain
an unexpanded parameter pack.

llvm-svn: 160705
2012-07-25 03:56:55 +00:00
Dmitri Gribenko e6af54af9b Make comments::Parser and comments::Sema noncopyable.
llvm-svn: 160702
2012-07-25 00:02:45 +00:00
Dmitri Gribenko 3c54128715 Comment parsing tests: fix test
llvm-svn: 160700
2012-07-24 21:56:59 +00:00
Jordan Rose 68449acea4 Add __has_feature(attribute_availability_with_message).
This tests for the ability to include a "message" field in availability
attributes, like so:

  extern void ATSFontGetName(const char *oName)
    __attribute__((availability(macosx,introduced=8.0,deprecated=9.0,
                                message="use CTFontCopyFullName")));

This was actually supported in Clang 3.1, but we got a request for a
__has_feature so that header files can use this more safely. It's
unfortunate that the 3.1 release doesn't include this, however.

<rdar://problem/11886458>

llvm-svn: 160699
2012-07-24 21:55:34 +00:00
Dmitri Gribenko 5b8a1d4854 Comment diagnostics tests: add a function with zero arguments, for completeness.
llvm-svn: 160697
2012-07-24 21:46:24 +00:00
Dmitri Gribenko 8f0f1b0c41 Comment diagnostics: add warning for multiple \param commands with duplicate
parameter names.

llvm-svn: 160696
2012-07-24 21:44:16 +00:00
Richard Smith f676e45e5f When a && or || appears as the condition of a ?:, perform appropriate
short-circuiting when building the CFG. Also be sure to skip parens before
checking for the && / || special cases. Finally, fix some crashes in CFG
printing in the presence of calls to destructors for array of array of class
type.

llvm-svn: 160691
2012-07-24 21:02:14 +00:00
Dmitri Gribenko 52cb218149 CommentSema: simplify functions, per Jordan's comment.
llvm-svn: 160689
2012-07-24 20:58:46 +00:00
Richard Smith 7ac3c6af87 Pedantic -pedantic correction. Duplicate cv-qualifiers are permitted in C++11
unless they appear in a decl-specifier-seq.

llvm-svn: 160688
2012-07-24 20:24:58 +00:00
Rafael Espindola a8842b4884 Don't use a temporary file.
llvm-svn: 160686
2012-07-24 20:00:35 +00:00
Rafael Espindola 4d3487b44b ABIArgInfo's constructor is private and only used by the static get* methods.
No need to abuse default arguments.

llvm-svn: 160684
2012-07-24 19:30:23 +00:00
Dmitri Gribenko 35b0c09b6c Comment parsing: allow newlines between \param, direction specification (e.g.,
[in]), parameter name and description paragraph.

llvm-svn: 160682
2012-07-24 18:23:31 +00:00
Hans Wennborg 84ce606b91 Tweak warning text for returning incomplete type from extern "C" functions.
A warning was added in r150128 for returning non-C compatible
user-defined types from functions with C linkage.

This makes the text more clear for the case when the type isn't
decidedly non-C compatible, but incomplete.

llvm-svn: 160681
2012-07-24 17:59:41 +00:00
Dmitri Gribenko 0a36302ae0 Comment parsing: couple TextTokenRetokenizer and comment parser together to
remove one of the two variable-length lookahead buffers.  Now retokenizer will
ask for more tokens when it needs them.

llvm-svn: 160680
2012-07-24 17:52:18 +00:00
Dmitri Gribenko 1bfd9dadda Move TextTokenRetokenizer from CommentLexer.h to CommentParser.cpp since it is
an implementation detail of the parser.

llvm-svn: 160679
2012-07-24 17:43:18 +00:00
Dmitri Gribenko 1c85d5b17d Comment parsing: retokenized text tokens are now pushed back in correct (not
reverse) order

llvm-svn: 160675
2012-07-24 16:10:47 +00:00
Manuel Klimek 86f8bbced4 Introduces a new concept for binding results to matchers
as per Chandler's request:
- introduces a new matcher base type BindableMatcher that
  provides the bind() call
- makes all dynamic-cast matcher creation functions return
  BindableMatchers; the special case about dynamic-cast
  matchers is that the node they match on and the node
  their child matchers match on are the same node, just
  casted to a different type; thus, there is no ambiguity
  on what bind() matches on; additionally, those are the
  matchers that we name with nouns in the matcher language,
  so it's easy for users to intuitively know which matchers
  are bindable

To make this change possible, we got rid of a non-orthogonal
implementation of thisPointerType, which had an implicit
dynamic-cast matcher from CallExpr to CXXMemberCallExpr; as
alternative, we now provide a memberCall dynamic-cast matcher
and thisPointerType is a predicate on CXXMemberCallExpr.

Last, the ArgumentAdaptingMatcher is actually not required
for the implementation of makeDynCastAllOfComposite - this
simplification makes it more obvious where the bind() call
can be used based on the matcher creation function types.

llvm-svn: 160673
2012-07-24 13:37:29 +00:00
Timur Iskhodzhanov bf0f663bca Fix PR13207 (Mangling of templates with back references when using -cxx-abi microsoft)
llvm-svn: 160667
2012-07-24 09:37:54 +00:00
Francois Pichet 1c7207c886 Change the way KEYNOMS is defined to be more comprehensible.
llvm-svn: 160663
2012-07-24 06:17:24 +00:00
NAKAMURA Takumi 3c72621570 clang/test/CodeGenCXX/debug-info-globalinit.cpp: Fix for -Asserts.
llvm-svn: 160660
2012-07-24 02:03:39 +00:00
Nick Lewycky 085970736f Emit debug info for dynamic initializers. Permit __attribute__((nodebug)) on
variables that have static storage duration, it removes debug info on the
emitted initializer function but not all debug info about this variable.

llvm-svn: 160659
2012-07-24 01:40:49 +00:00
Nick Lewycky cfb4517cc0 Fix whitespace, whoops missed a spot!
llvm-svn: 160658
2012-07-24 01:37:23 +00:00
Nick Lewycky b9e4a3a756 Fix whitespace, tabs to spaces. No functionality change.
llvm-svn: 160657
2012-07-24 01:31:55 +00:00
Rafael Espindola a647296b7c move X86_32ABIInfo::computeInfo out of line.
llvm-svn: 160652
2012-07-24 00:01:07 +00:00
Dmitri Gribenko 47f622d414 Comment parser unit tests: split a huge test case
llvm-svn: 160649
2012-07-23 23:37:11 +00:00
Rafael Espindola 75419dc151 Make classifyReturnType and classifyArgumentType private.
llvm-svn: 160648
2012-07-23 23:30:29 +00:00
Dmitri Gribenko 89630bce27 Comment parser unit tests: reduce code duplication
llvm-svn: 160647
2012-07-23 23:09:32 +00:00
Richard Smith 45fbfc7f11 Do not warn about a function decl / direct init ambiguity if the function has a trailing return type.
llvm-svn: 160646
2012-07-23 21:41:30 +00:00
Richard Trieu c320c745cc Change APInt to APSInt in one instance. Also change a call to operator==() to
APSInt::isSameValue() when comparing different sized APSInt's.

llvm-svn: 160641
2012-07-23 20:21:35 +00:00
Dmitri Gribenko e3942ef9a4 add AST unittests to CMake build system
llvm-svn: 160640
2012-07-23 20:11:34 +00:00
Dmitri Gribenko 378458d597 libclang comments AST: clang_ParamCommandComment_getParamName: don't assert
when a \param command does not have a parameter name, just return an empty
string instead.

llvm-svn: 160638
2012-07-23 19:41:49 +00:00
Michael Han 3be3b44cdb Refactor handler functions for thread safety attributes.
Make handler functions for thread safety attributes consistent with other attributes handler functions
by removing the bool parameter from some of the thread safety attributes handler functions and extracting
common checks out of different handler functions.

llvm-svn: 160635
2012-07-23 18:48:41 +00:00
Dmitri Gribenko 4b7f5fe572 Comment Sema: refactor handling of 'ParmVarDecl's and save them in Sema members.
llvm-svn: 160634
2012-07-23 17:40:30 +00:00
Dmitri Gribenko d73e4ce992 Comment AST: add InlineContentComment::RenderKind to specify a default
rendering mode for clients that don't want to interpret Doxygen commands.

Also add a libclang API to query this information.

llvm-svn: 160633
2012-07-23 16:43:01 +00:00
Timur Iskhodzhanov 49b52efab1 Follow-up: fix the quotes
llvm-svn: 160626
2012-07-23 09:43:03 +00:00
Timur Iskhodzhanov 284f98414b Replace wrong CHECK array mangling expectations with correct CHECK-NOT+FIXME (PR13182)
llvm-svn: 160625
2012-07-23 09:32:54 +00:00
Sylvestre Ledru 830885ca64 Fix a typo (the the => the)
llvm-svn: 160622
2012-07-23 08:59:39 +00:00
Richard Smith 87f5dc53b2 Add diagnostics for comma at end of enum and for extra semicolon at namespace
scope to -Wc++11-extensions. Move extra semicolon after member function
definition diagnostic out of -pedantic, since C++ allows a single semicolon
there. Keep it in -Wextra-semi, though, since it's still questionable.

llvm-svn: 160618
2012-07-23 05:45:25 +00:00
Douglas Gregor 6fa6942dda When we have an Objective-C object with non-trivial lifetime in a
structor class under ARC, that struct/class does not have a trivial
move constructor or move assignment operator. Fixes the rest of
<rdar://problem/11738725>.

llvm-svn: 160615
2012-07-23 04:23:39 +00:00
Richard Smith 505df2340a PR12917: Remove incorrect assumption that lambda mangling information cannot
change once it's been assigned. It can change in two ways:
 1) In a template instantiation, the context declaration should be the
    instantiated declaration, not the declaration in the template.
 2) If a lambda appears in the pattern of a variadic pack expansion, the
    mangling number will depend on the pack length.

llvm-svn: 160614
2012-07-22 23:45:10 +00:00
Francois Pichet f5b24e0136 Allow the parser to recover gracefully if a typename is used to introduce a decltype type.
In Microsoft mode, we emit a warning instead of an error.

This fixes a couple of errors when parsing the MSVC 11 RC headers with clang.

llvm-svn: 160613
2012-07-22 15:10:57 +00:00
Francois Pichet 0e2b84312f char16_t and char32_t are defined via typedef in MSVC 11 RC. So introduce a way to disable keywords under Microsoft mode.
llvm-svn: 160612
2012-07-22 11:32:41 +00:00
Dmitri Gribenko 565a680963 Comment AST nodes: add NumHTMLStartTagCommentBits member.
llvm-svn: 160600
2012-07-21 03:10:43 +00:00
Dmitri Gribenko 4c6d7a2ed2 Comment to HTML conversion: add more CSS classes to identify function arguments
by index.  This is useful if the user does not document all arguments, and we
can't find a particular argument by index via :nth-of-type() CSS selector.

llvm-svn: 160595
2012-07-21 01:47:43 +00:00
Chad Rosier d3957e57f6 Rename -fms-inline-asm to -fenable-experimental-ms-inline-asm.
llvm-svn: 160590
2012-07-20 23:12:26 +00:00
Tim Northover eb752d43c9 Add "long double" to permitted list of ARM complex homogeneous aggregates.
Under AAPCS, long double is the same as double, which means it should be
allowed as part of a homogeneous aggregate.

llvm-svn: 160586
2012-07-20 22:29:29 +00:00
Benjamin Kramer f473cd4b6a Remove unused private member variable uncovered by the recent changes to clang's -Wunused-private-field.
llvm-svn: 160584
2012-07-20 22:06:30 +00:00
Dmitri Gribenko f267c87e31 Fix c-index-test to compile as C89.
llvm-svn: 160582
2012-07-20 22:00:35 +00:00
Chad Rosier 3034ba167b Tidy up.
llvm-svn: 160581
2012-07-20 21:49:05 +00:00
Chad Rosier 7a96c77824 Add the mechanics for -fms-inline-asm. No easy way to test at this time.
llvm-svn: 160580
2012-07-20 21:44:43 +00:00
Dmitri Gribenko 5e4fe00e64 Add libclang APIs to walk comments ASTs and an API to convert a comment to an
HTML fragment.

For testing, c-index-test now has even more output:
* HTML rendering of a comment
* comment AST tree dump in S-expressions like Comment::dump(), but implemented
* with libclang APIs.

llvm-svn: 160577
2012-07-20 21:34:34 +00:00
Chad Rosier 8c9496a03c Revert accidental commit.
llvm-svn: 160574
2012-07-20 21:22:24 +00:00
Chad Rosier ed94324e70 Add a new flag, -fms-inline-asm, that enables the output of MS-style inline
assembly.  

By default, we don't emit IR for MS-style inline assembly (see r158833 as to 
why).  This is strictly for testing purposes and should not be enabled with the
expectation that things will work.  This is a temporary flag and will be removed
once MS-style inline assembly is fully supported.

llvm-svn: 160573
2012-07-20 21:20:33 +00:00
Aaron Ballman 9bca21ed25 No longer assuming the number of prototype arguments is always less than the number of formal parameters for a variadic function call.
llvm-svn: 160570
2012-07-20 20:40:35 +00:00
Dmitri Gribenko 66a00c765f Fix PR13411: Comment parsing: failed assertion on unterminated verbatim block.
The assertion was wrong in case we have a verbatim block without a closing
command.

Also add tests for closing command name in a verbatim block, since now it can
be empty in such cases.

llvm-svn: 160568
2012-07-20 20:18:53 +00:00
Jordan Rose 9dd82c1d94 Re-apply r160319 "Don't crash when emitting fixits following Unicode chars"
This time, make sure we don't try to print fixits with newline characters,
since they don't have a valid column width, and they don't look good anyway.

PR13417 (and originally <rdar://problem/11877454>)

llvm-svn: 160561
2012-07-20 18:50:51 +00:00
Jordan Rose 8c6c8a98b6 Add a reverse iterator to DeclStmt, and use it when building a CFG.
The CFG creates dummy DeclStmts with one Decl per statement, and it has
to do so from last to first in order to build the graph correctly.

llvm-svn: 160560
2012-07-20 18:50:48 +00:00
Eric Christopher ec21f68740 Don't need to specify the abi as it's the default.
rdar://11842763

llvm-svn: 160554
2012-07-20 17:42:31 +00:00
Fariborz Jahanian deb144ab51 Fixes an ObjC++ parse crash caused by delayed parsing
of c-functions nested in namespace in method implementations
by turning off its delayed parsing until a proper solution is 
figured out. pr13418

llvm-svn: 160552
2012-07-20 17:19:54 +00:00
Dmitri Gribenko af03ef7cce CommentBriefParser: coding style fix
llvm-svn: 160551
2012-07-20 17:02:25 +00:00
Dmitri Gribenko 77369eead6 CommentBriefParser: use \returns if we can't find the \brief or just a plain
paragraph.

llvm-svn: 160550
2012-07-20 17:01:34 +00:00
NAKAMURA Takumi e6c562c051 CMake: clang should depend on clang-headers, or bin/clang would not work better.
llvm-svn: 160549
2012-07-20 16:40:09 +00:00
Nico Weber cd8a546b6c Revert r160319, it caused PR13417. Add a test for PR13417.
llvm-svn: 160542
2012-07-20 06:44:52 +00:00
Nico Weber 9035951409 Let Expr::HasSideEffects() return false for NULL, bool literals, this, and nullptr.
Fixes PR13413, -Wunused-private-field now warns on unused fields initialized to NULL.

llvm-svn: 160541
2012-07-20 03:39:05 +00:00
Nico Weber 55a952bfcf Rename warn-unused-member.cpp to warn-unused-private-field.cpp to
make it match the flag it tests.

llvm-svn: 160536
2012-07-20 01:42:44 +00:00
Chandler Carruth 1649088ba1 Switch to the canonical pipe-based testing of clang output using
FileCheck.

This avoids copying files around needlessly during test runs.

llvm-svn: 160535
2012-07-20 00:49:53 +00:00
Chandler Carruth 1687e0ed35 Remove dos line endings. Please remember to configure your windows SVN
clients to default text files to 'eol-native'.

llvm-svn: 160534
2012-07-20 00:49:51 +00:00
Anna Zaks 3136cf9d5b [analyzer] Refactor VisitObjCMessage and VisitCallExpr to rely on the
same implementation for call evaluation.

llvm-svn: 160530
2012-07-19 23:38:13 +00:00
Eric Christopher 4bbb3c459e FileCheck-ize.
llvm-svn: 160528
2012-07-19 22:22:58 +00:00
Eric Christopher f8378ca2b1 Remove HasSynthBitfield and all callers/writers/etc. Also remove
previous ResetObjCLayout calls since this is now handled in Sema.

Part of rdar://11842763

llvm-svn: 160527
2012-07-19 22:22:55 +00:00
Eric Christopher 7457aaf8c9 Reset the layout of an ObjC class if we see an ivar in a category
or implementation since we've now got a different layout.

Fixes rdar://11842763

llvm-svn: 160526
2012-07-19 22:22:51 +00:00
Aaron Ballman 44475e2771 Removing a spurious comment, no functionality changes.
llvm-svn: 160522
2012-07-19 21:00:48 +00:00
Dmitri Gribenko a309c95d41 CommentDumper: print word-like arguments for block commands.
llvm-svn: 160519
2012-07-19 18:43:24 +00:00
Jordan Rose 3e0ec58c09 For varargs, diagnose passing ObjC objects by value like other non-POD types.
While we still want to consider this a hard error (non-POD variadic args are
normally a DefaultError warning), delaying the diagnostic allows us to give
better error messages, which also match the usual non-POD errors more closely.

In addition, this change improves the diagnostic messages for format string
argument type mismatches by passing down the type of the callee, so we can
say "variadic method" or "variadic function" appropriately.

<rdar://problem/11825593>

llvm-svn: 160517
2012-07-19 18:10:23 +00:00
Jordan Rose 96c49686b9 Capitalize "Objective-C" and "C++" in user-facing contexts.
No functionality change.

llvm-svn: 160516
2012-07-19 18:10:18 +00:00
Jordan Rose 58bbe4206f Don't crash checking a format string if one of the arguments is invalid.
Previously, we would ask for the SourceLocation of an argument even if
it were NULL (i.e. if Sema resulted in an ExprError trying to build it).

<rdar://problem/11890818>

llvm-svn: 160515
2012-07-19 18:10:08 +00:00
Argyrios Kyrtzidis ac4cdc8ef4 Add a test case for rdar://11806334.
Makes sure we don't overflow the stack.

llvm-svn: 160511
2012-07-19 16:08:28 +00:00
Ted Kremenek 6080d32194 Simplify UninitializedValues.cpp by removing logic to handle the previous (imprecise) representation
of '&&' and '||' in the CFG.  This is no longer needed, and greatly simplifies the code.

llvm-svn: 160494
2012-07-19 04:59:05 +00:00
Michael Han 7973250e33 Remove an unused header
llvm-svn: 160492
2012-07-19 04:10:19 +00:00
Bob Wilson 6a039161d7 Define __FINITE_MATH_ONLY__ based on -ffast-math and -ffinite-math-only.
This macro was being unconditionally set to zero, preceded by a FIXME comment.
This fixes <rdar://problem/11845441>.  Patch by Michael Gottesman!

llvm-svn: 160491
2012-07-19 03:52:53 +00:00
Aaron Ballman 24a1047c8c Relaxed enumeration constant naming rules for scoped enumerators so they no longer emit a diagnostic when the enumeration's name matches that of the class. Fixes PR13128.
llvm-svn: 160490
2012-07-19 03:12:23 +00:00
Richard Smith 18eff57031 Silence another GCC warning.
llvm-svn: 160488
2012-07-19 03:08:07 +00:00
NAKAMURA Takumi 9efaf227d1 Revert r160404, "Eliminating the GCC_CAST hack, take two.", for now.
It crashes mingw32-gcc-4.4.

llvm-svn: 160486
2012-07-19 02:27:55 +00:00
Richard Smith b1680655a6 Silence GCC warnings.
llvm-svn: 160485
2012-07-19 01:53:26 +00:00
Bob Wilson 25d3bfd895 Force the OS X version to 10.6 for old-style simulator builds.
The hack of recognizing a -D__IPHONE_OS_VERSION_MIN_REQUIRED option
in place of -mios-simulator-version-min leaves the Darwin version
unspecified.  It can be set separately with -mmacosx-version-min (which
makes no sense) or inferred to match the host version (which is unpredictable
and usually wrong).  This really needs to get cleaned up, but in the
meantime, force the OS X version to 10.6 so that the behavior is sane for
the iOS simulator.  Thanks for Argyrios for the patch.
<rdar://problem/11858187>

llvm-svn: 160484
2012-07-19 01:35:55 +00:00
Dmitri Gribenko e82ae819d3 CommentSema: add more inline commands to tables
llvm-svn: 160481
2012-07-19 00:21:03 +00:00
Dmitri Gribenko 7b2ca3e80b Fix ParagraphComment::isWhitespace(): a paragraph without a non-whitespace
TextComment node was considered whitespace even if it contained other child
nodes.

llvm-svn: 160474
2012-07-19 00:01:56 +00:00
Richard Smith 0bf93aa6b1 Fix OverloadCandidateSet::clear to not leak PartialDiagnostics, found by Samuel
Panzer. I've not been able to trigger a failure caused by this, so no test yet.
Also included is a small change from Paul Robinson to only consider the
FailureKind if the overload candidate did actually fail.

llvm-svn: 160470
2012-07-18 23:52:59 +00:00
Dmitri Gribenko c16cd2a67b Comment::dump(): show name of inline command
llvm-svn: 160467
2012-07-18 23:20:23 +00:00
Dmitri Gribenko e4a3997d70 Comment parsing: don't parse whitespace before \endverbatim as a separate line of whitespace.
llvm-svn: 160464
2012-07-18 23:01:58 +00:00
Aaron Ballman 462bb9fdf6 Rolling this change back because the fix doesn't fit the symptoms (even if it solves them).
llvm-svn: 160462
2012-07-18 22:38:11 +00:00
Jordan Rose 627b046c88 [analyzer] Combine all ObjC message CallEvents into ObjCMethodCall.
As pointed out by Anna, we only differentiate between explicit message sends

This also adds support for ObjCSubscriptExprs, which are basically the same
as properties in many ways. We were already checking these, but not emitting
nice messages for them.

This depends on the llvm::PointerIntPair change in r160456.

llvm-svn: 160461
2012-07-18 21:59:51 +00:00
Jordan Rose 9003d0d02f [analyzer] Rename addExtraInvalidatedRegions to get...Regions
Per Anna's comment that "add..." sounds like a method that modifies
the receiver, rather than its argument.

No functionality change.

llvm-svn: 160460
2012-07-18 21:59:46 +00:00
Jordan Rose 59e6ce922c [analyzer] Make CallEvent a value object.
We will need to be able to easily reconstruct a CallEvent from an ExplodedNode
for diagnostic purposes, and that's exactly what factory functions are for.
CallEvent objects are small enough (four pointers and a SourceLocation) that
returning them through the stack is fairly cheap. Clients who just need to use
existing CallEvents can continue to do so using const references.

This uses the same sort of "kind-field-dispatch" as SVal, though most of the
nastiness is contained in the DISPATCH and DISPATCH_ARG macros at the end of
the file. (We can't use a template for this because member-pointers to base
class methods don't call derived-class methods even when casting to the
derived class. We can't use variadic macros because they're a C99 feature.)

llvm-svn: 160459
2012-07-18 21:59:41 +00:00
Jordan Rose 074ebb3a6f [analyzer] Remove obsolete ObjCPropRef SVal kind.
ObjC properties are handled through their semantic form of ObjCMessageExprs
and their wrapper PseudoObjectExprs, and have been for quite a while. The
syntactic ObjCPropertyRefExprs do not appear in the CFG and are not visited
by ExprEngine.

No functionality change.

llvm-svn: 160458
2012-07-18 21:59:37 +00:00