Commit Graph

40733 Commits

Author SHA1 Message Date
Rafael Espindola 35ca7d9ddf Use getArch instead of getArchName + string compare.
llvm-svn: 165370
2012-10-07 04:44:33 +00:00
Rafael Espindola e8bd4e50e4 Use getArch instead of getArchName.
The darwin change should be a nop since Triple::getArchTypeForDarwinArchName
doesn't know about amd64.

If things like amd64-mingw32 are to be rejected, we should print a error
earlier on instead of silently using the wrong abi.

Remove old comment that looks out of place, this is "in clang".

llvm-svn: 165368
2012-10-07 03:23:40 +00:00
Dmitri Gribenko 67df63f69d List of potential checkers: smart pointer checker: actually, unique_ptr<T[]>
will do the right thing for new[] allocated memory.  Thanks David!

llvm-svn: 165365
2012-10-06 17:23:59 +00:00
Dmitri Gribenko 760cbe65fd Clang static analyzer docs: fix a couple of HTML markup issues and non-UTF-8
characters.

llvm-svn: 165364
2012-10-06 17:14:39 +00:00
Dmitri Gribenko a124d76ed1 List of potential checkers: more C++11 details for the smart pointer checker.
llvm-svn: 165363
2012-10-06 16:59:15 +00:00
Benjamin Kramer a801f4a81d Expose __builtin_bswap16.
GCC has always supported this on PowerPC and 4.8 supports it on all platforms,
so it's a good idea to expose it in clang too. LLVM supports this on all targets.

llvm-svn: 165362
2012-10-06 14:42:22 +00:00
Ted Kremenek 68e2c7bee3 Place warn_impcast_different_enum_types in a new warning group, -Wenum-conversion, that is a subgroup of -Wconversion.
llvm-svn: 165361
2012-10-06 05:25:43 +00:00
Ted Kremenek 76b8ac466e Add link to potential future checkers.
llvm-svn: 165360
2012-10-06 05:11:15 +00:00
Ted Kremenek 4bb7eb1c20 Add list of potential checkers. Provided by Anton Yartsev!
llvm-svn: 165359
2012-10-06 05:09:43 +00:00
Jordan Rose 69583bfefd [analyzer] Tweak test to run the retain-count checker even on non-Darwin.
This should fix the bots.

llvm-svn: 165358
2012-10-06 02:06:17 +00:00
Jordan Rose adb5354c2c ParentMap: Restore the ability to update an existing map.
The Clang ASTs are a DAG, not a pure tree. However, ParentMap has to
choose a single parent for each object. In the main (only?) cases in
which the AST forms a DAG, it protects from multiple traversal by using
OpaqueValueExprs. Previously, ParentMap would just unconditionally look
through all OpaqueValueExprs when building its map.

In order to make this behavior better for the analyzer's diagnostics,
ParentMap was changed to not set a statement's parent if there already
was one in the map. However, ParentMap is supposed to allow updating
existing mappings by calling addStmt once again. This change makes the
"transparency" of OpaqueValueExprs explicit, and disables it when it
is not desired, rather than checking the current contents of the map.

This new code seems like a big change, but it should actually have
essentially the same performance as before. Only OpaqueValueExprs and
their users (PseudoObjectExpr and BinaryConditionalOperator) will
have any different behavior.

There should be no user-visible functionality change, though a test
has been added for the current behavior of BinaryConditionalOperator
source locations and accompanying Xcode arrows (which are not so great...).

llvm-svn: 165355
2012-10-06 01:19:36 +00:00
Jordan Rose c8a78a37bb [analyzer] Handle implicit statements used for end-of-path nodes' source locs.
Some implicit statements, such as the implicit 'self' inserted for "free"
Objective-C ivar access, have invalid source locations. If one of these
statements is the location where an issue is reported, we'll now look at
the enclosing statements for a valid source location.

<rdar://problem/12446776>

llvm-svn: 165354
2012-10-06 01:19:30 +00:00
Argyrios Kyrtzidis ba30d92504 [libclang] Fix the comments, as suggested by Dmitri.
llvm-svn: 165353
2012-10-06 01:18:38 +00:00
Argyrios Kyrtzidis 6a80e7564f [libclang] Don't disable the preprocessing record while indexing so as
to not mess up with module building.

It was not worth trying to combine indexing without preprocessing record
and building modules with one because:

-just importing a module/PCH that was built with a pp record, enables it anyway
-the performance gain of indexing without the preprocessing record is insignificant.

llvm-svn: 165352
2012-10-06 01:18:35 +00:00
Alex Rosenberg 6a41c3c005 Fix another spot where this test varied for a Release build.
llvm-svn: 165347
2012-10-05 23:56:20 +00:00
Alex Rosenberg 17710a3b9a Make test resilient to Release build temp names.
llvm-svn: 165345
2012-10-05 23:33:39 +00:00
Alex Rosenberg ba036126cf Propagate calling convention for aliases and weakrefs.
llvm-svn: 165343
2012-10-05 23:12:53 +00:00
Alex Rosenberg eba9c5c259 FileCheckize test
llvm-svn: 165342
2012-10-05 23:12:48 +00:00
DeLesley Hutchins 1fe885614d Thread-safety analysis: allow attributes on constructors to refer to 'this'.
llvm-svn: 165339
2012-10-05 22:38:19 +00:00
Ted Kremenek 450f9f29b2 Add color output to 'diagtool tree' to show what warnings are enabled by default.
llvm-svn: 165338
2012-10-05 22:07:14 +00:00
Aaron Ballman 57f590e674 Changing line endings from Windows to Unix. No functional changes.
llvm-svn: 165329
2012-10-05 19:46:32 +00:00
Michael Liao 4a7f8c23e0 Add intrinsic of MULX in BMI2 header
llvm-svn: 165325
2012-10-05 18:50:09 +00:00
Abramo Bagnara 4910701339 Added forgotten break.
llvm-svn: 165298
2012-10-05 04:43:29 +00:00
Eli Friedman 9018ef709e Make sure to generate the right kind of MDNode for enum forward declarations.
PR14029, clang part.

llvm-svn: 165289
2012-10-05 01:49:33 +00:00
Richard Smith f501cc313e Workaround for libstdc++4.6 <atomic> bug: make comment more explicit about what's going on, per Sean Silva's suggestion.
llvm-svn: 165286
2012-10-05 01:46:25 +00:00
David Blaikie 15f17cbbd8 Implement -Wshift-op-parentheses for: a << b + c
This appears to be consistent with GCC's implementation of the same warning
under -Wparentheses. Suppressing a << b + c for cases where 'a' is a user
defined type for compatibility with C++ stream IO. Otherwise suggest
parentheses around the addition or subtraction subexpression.

(this came up when MSVC was complaining (incorrectly, so far as I can tell)
about a perceived violation of this within the LLVM codebase, PR14001)

llvm-svn: 165283
2012-10-05 00:41:03 +00:00
Argyrios Kyrtzidis dc78f3e7a9 [libclang] Now that we have a CXModule object, pass it to the
importedASTFile indexing callback.

llvm-svn: 165281
2012-10-05 00:22:40 +00:00
Argyrios Kyrtzidis 2b9b5bb697 [libclang] Introduce new C functions that provide information about modules:
clang_Cursor_getModule
clang_Module_getParent
clang_Module_getName
clang_Module_getFullName
clang_Module_getNumTopLevelHeaders
clang_Module_getTopLevelHeader

llvm-svn: 165280
2012-10-05 00:22:37 +00:00
Argyrios Kyrtzidis c597c8c48b [Modules] Introduce Module::TopHeaders which is a set of top-level headers
that are associated with a (sub)module.

llvm-svn: 165279
2012-10-05 00:22:33 +00:00
Argyrios Kyrtzidis abc721ab4d [preprocessing record] Have PPEntityID be independent of the size of the
loaded entities vector, otherwise its meaning will change when a module
is imported and the vector size changes.

llvm-svn: 165278
2012-10-05 00:22:28 +00:00
Argyrios Kyrtzidis 50e5b1dab3 [libclang] Introduce CXCursor_ModuleImportDecl cursor kind, used for a module
import declaration.

llvm-svn: 165277
2012-10-05 00:22:24 +00:00
Chad Rosier 3fd3330a62 Test case for r165275.
llvm-svn: 165276
2012-10-04 23:59:54 +00:00
Richard Smith 9f9e5826f2 If we flow off the end of a value-returning function:
- outside C++, return undef (behavior is not undefined unless the value is used)
 - in C++, with -fcatch-undefined-behavior, perform an appropriate trap
 - in C++, produce an 'unreachable' (behavior is undefined immediately)

llvm-svn: 165273
2012-10-04 23:52:29 +00:00
Richard Smith 84b163cf66 libstdc++-4.6 needs the same common_type fix as libstdc++-4.7. Other than that,
Clang can now cope with its eccentricities in C++11 mode.

llvm-svn: 165265
2012-10-04 22:23:07 +00:00
Richard Smith 45bb8855e0 Egriegious hack to support libstdc++4.6's broken <atomic> header, which defines
a non-inline namespace, then reopens it as inline to try to add its symbols to
the surrounding namespace. In this one special case, permit the namespace to be
reopened as inline, and patch up the name lookup tables to match.

llvm-svn: 165263
2012-10-04 22:13:39 +00:00
Abramo Bagnara aeeb989cc4 Fixed FunctionTypeLoc source range.
llvm-svn: 165259
2012-10-04 21:42:10 +00:00
Abramo Bagnara 0d4fce1c2e Fixed instantiated operators source range.
llvm-svn: 165258
2012-10-04 21:40:42 +00:00
Abramo Bagnara 856c4076a4 Fixed friend decl source range.
llvm-svn: 165257
2012-10-04 21:39:47 +00:00
Abramo Bagnara 71f32c14b1 Fixed ParamDecl source range for implicit typed k&r parameters.
llvm-svn: 165256
2012-10-04 21:38:29 +00:00
Bill Schmidt 7af848bf1f Fix the CodeGen/ppc64-varargs-struct.c test case to tolerate release builds.
llvm-svn: 165247
2012-10-04 20:33:57 +00:00
Bill Schmidt a7b7f7256e Add a test case for r156143, which enabled general varargs support for the
64-bit PPC SVR4 ABI.

The test verifies passing of structures, items with 16-byte alignment, and
small items that are passed right-justified in the parameter save area slot.

llvm-svn: 165245
2012-10-04 20:18:38 +00:00
Benjamin Kramer 058666a8d0 Driver: Link crtfastmath.o if it's available and -ffast-math is specified.
crtfastmath.o contains routines to set the floating point flags to a faster,
unsafe mode. Linking it in speeds up code dealing with denormals significantly
(PR14024).

For now this is only enabled on linux where I can test it and crtfastmath.o is
widely available. We may want to provide a similar file with compiler-rt
eventually and/or enable it on other platforms too.

llvm-svn: 165240
2012-10-04 19:42:20 +00:00
Michael Han 360d225ae9 Fix scope location when parsing GNU attributes.
For GNU attributes, instead of reusing attribute source 
location for the scope location, use SourceLocation() since 
GNU attributes don not have scope tokens. 

llvm-svn: 165234
2012-10-04 16:42:52 +00:00
Preston Gurd 5ea246cf13 Revert 165129
llvm-svn: 165231
2012-10-04 15:26:04 +00:00
Benjamin Kramer 4f23bee060 Prefer StringRef::startswith to the strncmp/strlen contraption.
This may be slightly more efficient and is definitely more readable.

llvm-svn: 165217
2012-10-04 10:06:38 +00:00
Logan Chien cd679fda6c Fix typo in comments.
llvm-svn: 165216
2012-10-04 08:08:56 +00:00
Axel Naumann c6848efaac Fix r165005: The lexical DeclContext is not the right place to make a decision about whether we need to call tryAddTopLevelDecl or not. That call should be made when the DeclContext's redeclaration context is the translation unit.
llvm-svn: 165215
2012-10-04 07:34:43 +00:00
Nick Lewycky 37eb038a66 Add missing comment for mangling.
llvm-svn: 165202
2012-10-04 04:58:17 +00:00
Lang Hames 4c8559e0a1 Fail early with a clear assert if an operation with multiple uses somehow ends
up being contracted during codegen.

llvm-svn: 165197
2012-10-04 03:23:25 +00:00
Lang Hames 05a3e31a21 Test file-scoped FP_CONTRACT pragma.
llvm-svn: 165196
2012-10-04 03:07:37 +00:00