Commit Graph

14584 Commits

Author SHA1 Message Date
Fariborz Jahanian 46ed4d978e Objective-C parsing [qoi]: Recover gracefully with good diagnostic
when class implementation declaration adds protocol qualifier
list. // rdar://12233858

llvm-svn: 180228
2013-04-24 23:23:47 +00:00
Fariborz Jahanian 6a41337132 Objective-C arc: Improve disgnostics when 'weak'
property cannot be synthesized because its backing
ivar does not support weak references.
// rdar://13676793

llvm-svn: 180211
2013-04-24 19:13:05 +00:00
Chad Rosier cba3b88da5 [driver] Add a hasFlag API that accepts a positive alias.
Part of rdar://13622687

llvm-svn: 180203
2013-04-24 18:01:26 +00:00
Fariborz Jahanian eb3f1007d8 Objective-C: When reporting on missing property accessor implementation in
categories, do not report when they are declared in primary class,
class's protocol, or one of it super classes. This is because,
its class is going to implement them. // rdar://13713098

llvm-svn: 180198
2013-04-24 17:06:38 +00:00
Ted Kremenek c0b98663e9 Revert "Remove CXCursorSet and related APIs. There are no known clients."
Apparently there are...

llvm-svn: 180176
2013-04-24 07:17:12 +00:00
Ted Kremenek bedcd85645 Add test case for -Wdeprecated-objc-pointer-introspection, and
tweak warning to suggest that it is just a bad thing to do.

llvm-svn: 180175
2013-04-24 06:52:20 +00:00
Ted Kremenek 616986f859 Remove CXCursorSet and related APIs. There are no known clients.
llvm-svn: 180174
2013-04-24 06:52:14 +00:00
Anna Zaks 4e16b29c13 [analyzer] Refactor BugReport::getLocation and PathDiagnosticLocation::createEndOfPath for greater code reuse
The 2 functions were computing the same location using different logic (each one had edge case bugs that the other
one did not). Refactor them to rely on the same logic.

The location of the warning reported in text/command line output format will now match that of the plist file.

There is one change in the plist output as well. When reporting an error on a BinaryOperator, we use the location of the
operator instead of the beginning of the BinaryOperator expression. This matches our output on command line and
looks better in most cases.

llvm-svn: 180165
2013-04-23 23:57:43 +00:00
Argyrios Kyrtzidis c2233beba4 [libclang] Introduce a CXCursor_ObjCSelfExpr cursor, which is the equivalent of CXCursor_CXXThisExpr for C++ code.
rdar://13717006

llvm-svn: 180127
2013-04-23 17:57:17 +00:00
Richard Trieu d0d87b5972 Warn that scoped enumerations are a C++11 extenstion when compiling in
C++98 mode.  This improves on the previous diagnostic message of:

error: expected identifier or '{'
llvm-svn: 180076
2013-04-23 02:47:36 +00:00
Ted Kremenek ebeabab9a9 Add a warning for Objective-C pointer introspection, which is solely the job of the Objective-C runtime.
llvm-svn: 180062
2013-04-22 22:46:52 +00:00
Chad Rosier b18a285525 [ms-inline asm] Refactor/clean up the SemaLookup interface. No functional
change indended.
Part of rdar://13663589

llvm-svn: 180027
2013-04-22 17:01:37 +00:00
Richard Smith d9f663b510 C++1y constexpr extensions, round 1: Allow most forms of declaration and
statement in constexpr functions. Everything which doesn't require variable
mutation is also allowed as an extension in C++11. 'void' becomes a literal
type to support constexpr functions which return 'void'.

llvm-svn: 180022
2013-04-22 15:31:51 +00:00
Richard Smith 034185c2f9 The 'constexpr implies const' rule for non-static member functions is gone in
C++1y, so stop adding the 'const' there. Provide a compatibility warning for
code relying on this in C++11, with a fix-it hint. Update our lazily-written
tests to add the const, except for those ones which were testing our
implementation of this rule.

llvm-svn: 179969
2013-04-21 01:08:50 +00:00
Richard Smith 74d0c1eeef Disable VLA diagnostic in C++1y mode, and add some tests.
Still to do here:
  - we have a collection of syntactic accepts-invalids to diagnose
  - support non-PODs in VLAs, including dynamic initialization /
    destruction
  - runtime checks (and throw std::bad_array_length) for bad bound
  - support VLA capture by reference in lambdas
  - properly support VLAs in range-based for (don't recompute bound)

llvm-svn: 179962
2013-04-20 23:28:26 +00:00
Richard Smith 852c9db72b C++1y: Allow aggregates to have default initializers.
Add a CXXDefaultInitExpr, analogous to CXXDefaultArgExpr, and use it both in
CXXCtorInitializers and in InitListExprs to represent a default initializer.

There's an additional complication here: because the default initializer can
refer to the initialized object via its 'this' pointer, we need to make sure
that 'this' points to the right thing within the evaluation.

llvm-svn: 179958
2013-04-20 22:23:05 +00:00
Simon Atanasyan 08450bd55c Supports Sourcery CodeBench Mips toolchain directories tree.
Sourcery CodeBench and modern FSF Mips toolchains require a bit more
complicated algorithm to calculate headers, libraries and sysroot paths
than implemented by Clang driver now. The main problem is that all these
paths depend on a set of command line arguments additionally to a target
triple value. For example, let $TC is a toolchain installation directory.
If we compile big-endian 32-bit mips code, crtbegin.o is in the
$TC/lib/gcc/mips-linux-gnu/4.7.2 folder and the toolchain's linker requires
--sysroot=$TC/mips-linux-gnu/libc argument. If we compile little-endian
32-bit soft-float mips code, crtbegin.o is in the
$TC/lib/gcc/mips-linux-gnu/4.7.2/soft-float/el folder and the toolchain's
linker requires --sysroot=$TC/mips-linux-gnu/libc/soft-float/el argument.

1. Calculate MultiarchSuffix using all necessary command line options and
   use this MultiarchSuffix to detect crtbegin.o location in the
   GCCInstallationDetector::ScanLibDirForGCCTriple() routine.
2. If a user does not provide --sysroot argument to the driver explicitly,
   calculate new sysroot value based on command line options. Then use this
   calculated sysroot path:
   a. To populate a file search paths list in the Linux::Linux() constructor.
   b. To find Mips toolchain specific include headers directories
      in the Linux::AddClangSystemIncludeArgs() routine.
   c. To provide -–sysroot argument for a linker.

Note:
- The FSF's tree slightly differs (folder names) and is not supported
  yet.
- New addExternCSystemIncludeIfExits() routine is a temporary solution.
  I plan to move path existence check to the addExternCSystemInclude()
  routine by a separate commit.

The patch reviewed by Rafael Espindola.
http://llvm-reviews.chandlerc.com/D644

llvm-svn: 179934
2013-04-20 08:15:03 +00:00
Anna Zaks 6c0c47ede5 [analyzer] Ensure BugReporterTracking works on regions with pointer arithmetic
Introduce a new helper function, which computes the first symbolic region in
the base region chain. The corresponding symbol has been used for assuming that
a pointer is null. Now, it will also be used for checking if it is null.

This ensures that we are tracking a null pointer correctly in the BugReporter.

llvm-svn: 179916
2013-04-20 01:15:42 +00:00
Anna Zaks 390fb10a9b [analyzer] Flip printPretty and printPrettyAsExpr as per suggestion from Jordan (r179572)
llvm-svn: 179915
2013-04-20 01:15:36 +00:00
Richard Smith c5c27f2a1f Note that we support (and in fact have supported since the dawn of time itself)
C++1y binary literals.

llvm-svn: 179883
2013-04-19 20:47:20 +00:00
Adrian Prantl c60dc718c0 Emit the underlying type in the debug info for all kinds of fixed enums
instead of only C++11-scoped-with-class-tag enums.

rdar://problem/13463793

llvm-svn: 179879
2013-04-19 19:56:39 +00:00
Adrian Prantl 6847fe3686 s/C++0x/C++11/
llvm-svn: 179878
2013-04-19 19:56:35 +00:00
Richard Smith 2fd1d7aee3 Implement CodeGen for C++11 thread_local, following the Itanium ABI specification as discussed on cxx-abi-dev.
llvm-svn: 179858
2013-04-19 16:42:07 +00:00
Argyrios Kyrtzidis 982934e7d4 [libclang] Fix copy-paste error in comment.
llvm-svn: 179823
2013-04-19 00:51:52 +00:00
Argyrios Kyrtzidis 23814e4f49 [libclang] Introduce clang_Cursor_isVariadic, which returns non-zero if the given cursor is a variadic function or method.
rdar://13667150

llvm-svn: 179819
2013-04-18 23:53:05 +00:00
Argyrios Kyrtzidis 9d9bc01e42 [libclang] Introduce clang_Cursor_getObjCDeclQualifiers, to query for 'ObjC Qualifiers' written next to the return and
parameter types in an ObjC method declarations.

rdar://13676977

llvm-svn: 179816
2013-04-18 23:29:12 +00:00
Argyrios Kyrtzidis 9adfd8aabb [libclang] Introduce clang_Cursor_getObjCPropertyAttributes to query the written attributes in a property declaration.
rdar://13684512

llvm-svn: 179803
2013-04-18 22:15:49 +00:00
Fariborz Jahanian 65ff01bccb Adds a new doxygen tag needed. // rdar://12379053
llvm-svn: 179770
2013-04-18 16:45:57 +00:00
Benjamin Kramer 06022fc91a Add llvm_unreachable at end of fully covered switch to pacify GCC.
llvm-svn: 179753
2013-04-18 10:44:27 +00:00
Anna Zaks 54f4d01bd3 [analyzer] Allow TrackConstraintBRVisitor to work when the value it’s tracking is not live in the last node of the path
We always register the visitor on a node in which the value we are tracking is live and constrained. However,
the visitation can restart at a node, later on the path, in which the value is under constrained because
it is no longer live. Previously, we just silently stopped tracking in that case.

llvm-svn: 179731
2013-04-17 22:29:47 +00:00
Argyrios Kyrtzidis 9aca3c61c0 [Modules] Use global index to improve typo correction performance
Typo correction for an unqualified name needs to walk through all of the identifier tables of all modules.
When we have a global index, just walk its identifier table only.

rdar://13425732

llvm-svn: 179730
2013-04-17 22:10:55 +00:00
Nico Weber 7e2da79efa Add support for gcc's spelling of -fcolor-diagnostics.
See http://gcc.gnu.org/onlinedocs/gcc/Language-Independent-Options.html

llvm-svn: 179728
2013-04-17 21:52:44 +00:00
Richard Smith 3cb4c63073 DR974: Lambdas can have default arguments.
llvm-svn: 179688
2013-04-17 16:25:20 +00:00
Andy Gibbs 9c2ccd622f Implemented #pragma GCC warning/error in the same mould as #pragma message.
llvm-svn: 179687
2013-04-17 16:16:16 +00:00
Douglas Gregor 19a41f161b Fix PR15291: noreturn adjustment in overload resolution for function templates, from Alexander Zinenko!
llvm-svn: 179680
2013-04-17 08:45:07 +00:00
Andy Gibbs fcc699aee8 Extended VerifyDiagnosticConsumer to also verify source file for diagnostic.
VerifyDiagnosticConsumer previously would not check that the diagnostic and
its matching directive referenced the same source file.  Common practice was
to create directives that referenced other files but only by line number,
and this led to problems such as when the file containing the directive
didn't have enough lines to match the location of the diagnostic in the
other file, leading to bizarre file formatting and other oddities.

This patch causes VerifyDiagnosticConsumer to match source files as well as
line numbers.  Therefore, a new syntax is made available for directives, for
example:

// expected-error@file:line {{diagnostic message}}

This extends the @line feature where "file" is the file where the diagnostic
is generated.  The @line syntax is still available and uses the current file
for the diagnostic.  "file" can be specified either as a relative or absolute
path - although the latter has less usefulness, I think!  The #include search
paths will be used to locate the file and if it is not found an error will be
generated.

The new check is not optional: if the directive is in a different file to the
diagnostic, the file must be specified.  Therefore, a number of test-cases
have been updated with regard to this.

This closes out PR15613.

llvm-svn: 179677
2013-04-17 08:06:46 +00:00
Richard Trieu fe042e6aab Add warning group -Woverloaded-shift-op-parentheses to -Wparentheses. This
will fire on code such as:

  cout << x == 0;

which the compiler will intrepret as

  (cout << x) == 0;

This warning comes with two fixits attached to notes, one for parentheses to
silence the warning, and another to evaluate the comparison first.

llvm-svn: 179662
2013-04-17 02:12:45 +00:00
Argyrios Kyrtzidis d3da6e01e8 Enhance the ObjC global method pool to record whether there were 0, 1, or >= 2 methods (with a particular selector) inside categories.
This is done by extending ObjCMethodList (which is only used by the global method pool) to have 2 extra bits of information.
We will later take advantage of this info in global method pool for the overridden methods calculation.

llvm-svn: 179652
2013-04-17 00:08:58 +00:00
Ted Kremenek 8a28295895 Factor CheckerManager to be able to pass AnalyzerOptions to checkers
during checker registration.  There are no immediate clients of this,
but this provides a way for checkers to query the options table
at startup instead.

llvm-svn: 179626
2013-04-16 21:10:05 +00:00
Ted Kremenek 3296ff13db Remove unused "getConfig()" method. A new way is to have high-level
APIs that access the configuration table without clients reasoning
about the string table.  The string table is an implementation
detail.

llvm-svn: 179625
2013-04-16 21:10:02 +00:00
Michael Gottesman 43844b5459 [1/6] ARM Neon Intrinsic Tablegen Test Generator.
Changes necessary to arm_neon.td for the generation of Neon tests.

This is the first of six patches to add to the arm neon tablegen
generator the capability of generating tests to verify that the various
ARM intrinsics are implemented properly.

The changes include such items as:
  1. Adding attributes to the Inst record so that additional metadata that is only
     needed for the tests can be specified in TableGen.
  2. Adding wrapper classes for operator (i.e. ``Op'') intrinsics which before
     were simply notates as Inst. This allows us to classify what sort of test
     to generate for said intrinsic and further since the classes do not effect
     the behavior of the Inst base class, allow for normal functioning.

Reviewed by Bob Wilson.

llvm-svn: 179624
2013-04-16 21:08:04 +00:00
Tareq A. Siraj 6dfa25a19f Sema for Captured Statements
Add CapturedDecl to be the DeclContext for CapturedStmt, and perform semantic
analysis. Currently captures all variables by reference.

TODO: templates

Author: Ben Langmuir <ben.langmuir@intel.com>

Differential Revision: http://llvm-reviews.chandlerc.com/D433

llvm-svn: 179618
2013-04-16 19:37:38 +00:00
Tareq A. Siraj 24110cc733 Implement CapturedStmt AST
CapturedStmt can be used to implement generic function outlining as described in
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-January/027540.html.

CapturedStmt is not exposed to the C api.

Serialization and template support are pending.

Author: Wei Pan <wei.pan@intel.com>

Differential Revision: http://llvm-reviews.chandlerc.com/D370

llvm-svn: 179615
2013-04-16 18:53:08 +00:00
Tareq A. Siraj 0de0dd4923 Parser support for #pragma clang __debug captured
This patch implements parsing ‘#pragma clang __debug’ as a first step for
implementing captured statements. Captured statements are a mechanism for
doing outlining in the AST.
see http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-January/027540.html.

Currently returns StmtEmpty

Author: Andy Zhang <andy.zhang@intel.com>

Differential Revision: http://llvm-reviews.chandlerc.com/D369

llvm-svn: 179614
2013-04-16 18:41:26 +00:00
Daniel Dunbar e246fbe40b [Modules] Convert module specific -fno-modules-autolink into -fno-autolink.
- There is no reason to have a modules specific flag for disabling
   autolinking. Instead, convert the existing flag into -fno-autolink (which
   should cover other autolinking code generation paths like #pragmas if and
   when we support them).

llvm-svn: 179612
2013-04-16 18:21:19 +00:00
Douglas Gregor 012efe22bc Fix PR4296: Add parser detection/error recovery for nested functions, from Serve Pavlov!
llvm-svn: 179603
2013-04-16 16:01:32 +00:00
John McCall 5e77d76c95 Basic support for Microsoft property declarations and
references thereto.

Patch by Tong Shen!

llvm-svn: 179585
2013-04-16 07:28:30 +00:00
Anna Zaks 7460deb15d [analyzer] Add pretty printing to CXXBaseObjectRegion.
llvm-svn: 179573
2013-04-15 22:38:04 +00:00
Anna Zaks e2e8ea62df [analyzer] Address code review for r179395
Mostly refactoring + handle the nested fields by printing the innermost field only.

llvm-svn: 179572
2013-04-15 22:37:59 +00:00
Argyrios Kyrtzidis fe7a59d9c2 Revert "Speed-up ObjCMethodDecl::getOverriddenMethods()."
This reverts commit r179436.

Due to caching, it was possible that we could miss overridden methods that
were introduced by categories later on.

Along with reverting the commit I also included a test case that would have caught this.

llvm-svn: 179547
2013-04-15 18:47:22 +00:00