]> granicus.if.org Git - clang/log
clang
12 years ago[analyzer] The result of && or || is always a 1 or 0.
Jordan Rose [Mon, 20 Aug 2012 17:04:45 +0000 (17:04 +0000)]
[analyzer] The result of && or || is always a 1 or 0.

Forgetting to at least cast the result was giving us Loc/NonLoc problems
in SValBuilder (hitting an assertion). But the standard (both C and C++)
does actually guarantee that && and || will result in the actual values
1 and 0, typed as 'int' in C and 'bool' in C++, and we can easily model that.

PR13461

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162209 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse correct matcher name in the comment.
Dmitri Gribenko [Mon, 20 Aug 2012 16:48:14 +0000 (16:48 +0000)]
Use correct matcher name in the comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162206 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix comments and variable naming:
Manuel Klimek [Mon, 20 Aug 2012 16:37:20 +0000 (16:37 +0000)]
Fix comments and variable naming:
- use InnerMatcher consistently, fix style violations on the way
- doxygenify code snippets across all comments
- start doxygenifying code references in text
- addeed missing Usable as: sections

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162205 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[cindex.py] Cache the number of chunks in CompletionString
Tobias Grosser [Mon, 20 Aug 2012 10:38:16 +0000 (10:38 +0000)]
[cindex.py] Cache the number of chunks in CompletionString

Without this patch, lib.clang_getNumCompletionChunks is called at
each _iteration_ of a 'for chunk in CompletionString' loop. Now we
call it just once.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162200 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoBetter wording for reference self-initialization warning.
Hans Wennborg [Mon, 20 Aug 2012 08:52:22 +0000 (08:52 +0000)]
Better wording for reference self-initialization warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162198 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[cindex.py] Add CachedProperty to CompletionChunk
Tobias Grosser [Sun, 19 Aug 2012 22:26:15 +0000 (22:26 +0000)]
[cindex.py] Add CachedProperty to CompletionChunk

Suggested by:  Francisco Lopes  <oblita@gmail.com>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162191 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[clang.py] Add CachedProperty decorator
Gregory Szorc [Sun, 19 Aug 2012 21:17:46 +0000 (21:17 +0000)]
[clang.py] Add CachedProperty decorator

It isn't used anywhere yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162190 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[cindex.py] Use spaces, not tabs for indentation
Tobias Grosser [Sat, 18 Aug 2012 23:52:41 +0000 (23:52 +0000)]
[cindex.py] Use spaces, not tabs for indentation

Reported by: Francisco Lopes  <oblita@gmail.com>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162182 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[cindex.py] Dispose code completion results properly
Tobias Grosser [Sat, 18 Aug 2012 23:04:08 +0000 (23:04 +0000)]
[cindex.py] Dispose code completion results properly

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162181 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAllow -verify to be used with files that don't have an associated FileEntry.
Jordan Rose [Sat, 18 Aug 2012 16:58:52 +0000 (16:58 +0000)]
Allow -verify to be used with files that don't have an associated FileEntry.

In Debug builds, VerifyDiagnosticConsumer checks any files with diagnostics
to make sure we got the chance to parse them for directives (expected-warning
and friends). This check previously relied on every parsed file having a
FileEntry, which broke the cling interpreter's test suite.

This commit changes the extra debug checking to mark a file as unparsed
as soon as we see a diagnostic from that file. At the very end, any files
that are still marked as unparsed are checked for directives, and a fatal
error is emitted (as before) if we find out that there were directives we
missed. -verify directives should always live in actual parsed files, not
in PCH or AST files.

Patch by Andy Gibbs, with slight modifications by me.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162171 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSilence a sign compare warning that only occurs on 32 bit platforms.
Benjamin Kramer [Sat, 18 Aug 2012 10:33:09 +0000 (10:33 +0000)]
Silence a sign compare warning that only occurs on 32 bit platforms.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162168 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen mangling a negative number, remember that negating it does not
John McCall [Sat, 18 Aug 2012 04:51:52 +0000 (04:51 +0000)]
When mangling a negative number, remember that negating it does not
always yield a positive number.  Just print the negated result as an
unsigned number.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162163 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPR41111, PR5925, PR13210: Teach tentative parsing to annotate identifiers and
Richard Smith [Sat, 18 Aug 2012 00:55:03 +0000 (00:55 +0000)]
PR41111, PR5925, PR13210: Teach tentative parsing to annotate identifiers and
nested names as id-expressions, using the annot_primary_expr annotation, where
possible. This removes some redundant lookups, and also allows us to
typo-correct within tentative parsing, and to carry on disambiguating past an
identifier which we can determine will fail lookup as both a type and as a
non-type, allowing us to disambiguate more declarations (and thus offer
improved error recovery for such cases).

This also introduces to the parser the notion of a tentatively-declared name,
which is an identifier which we *might* have seen a declaration for in a
tentative parse (but only if we end up disambiguating the tokens as a
declaration). This is necessary to correctly disambiguate cases where a
variable is used within its own initializer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162159 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAST Matchers tests: test that member() matches member allocation functions:
Dmitri Gribenko [Sat, 18 Aug 2012 00:41:04 +0000 (00:41 +0000)]
AST Matchers tests: test that member() matches member allocation functions:
declare size_t in system-independent way.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162158 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Treat C++ 'throw' as a sink.
Jordan Rose [Sat, 18 Aug 2012 00:30:23 +0000 (00:30 +0000)]
[analyzer] Treat C++ 'throw' as a sink.

Our current handling of 'throw' is all CFG-based: it jumps to a 'catch' block
if there is one and the function exit block if not. But this doesn't really
get the right behavior when a function is inlined: execution will continue on
the caller's side, which is always the wrong thing to do.

Even within a single function, 'throw' completely skips any destructors that
are to be run. This is essentially the same problem as @finally -- a CFGBlock
that can have multiple entry points, whose exit points depend on whether it
was entered normally or exceptionally.

Representing 'throw' as a sink matches our current (non-)handling of @throw.
It's not a perfect solution, but it's better than continuing analysis in an
inconsistent or even impossible state.

<rdar://problem/12113713>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162157 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Treat @throw as a sink (stop processing).
Jordan Rose [Sat, 18 Aug 2012 00:30:20 +0000 (00:30 +0000)]
[analyzer] Treat @throw as a sink (stop processing).

The CFG approximates @throw as a return statement, but that's not good
enough in inlined functions. Moreover, since Objective-C exceptions are
usually considered fatal, we should be suppressing leak warnings like we
do for calls to noreturn functions (like abort()).

The comments indicate that we were probably intending to do this all along;
it may have been inadvertantly changed during a refactor at one point.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162156 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Remove obsolete GenericNodeBuilderRefCount from RetainCountChecker.
Jordan Rose [Sat, 18 Aug 2012 00:30:16 +0000 (00:30 +0000)]
[analyzer] Remove obsolete GenericNodeBuilderRefCount from RetainCountChecker.

This was once an adapter class between callbacks that had CheckerContexts
and those that don't, but for a while now it's essentially just been a
wrapper around a ProgramPointTag. We can just pass the tag around instead.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162155 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Use PointerUnion to implement ExplodedNode::NodeGroup.
Jordan Rose [Sat, 18 Aug 2012 00:30:10 +0000 (00:30 +0000)]
[analyzer] Use PointerUnion to implement ExplodedNode::NodeGroup.

We shouldn't be reinventing our own wheels. This also paves the way for
marking different kinds of sinks.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162154 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAST Matchers tests: test that member() matches member allocation functions.
Dmitri Gribenko [Sat, 18 Aug 2012 00:29:27 +0000 (00:29 +0000)]
AST Matchers tests: test that member() matches member allocation functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162153 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoReapply:
Eric Christopher [Fri, 17 Aug 2012 22:54:57 +0000 (22:54 +0000)]
Reapply:

Make isa part of objc_object at metadata generation time.

Noticed on inspection.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162145 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen code completion is enabled, don't do any work in
Douglas Gregor [Fri, 17 Aug 2012 22:17:36 +0000 (22:17 +0000)]
When code completion is enabled, don't do any work in
Sema::ActOnEndOfTranslationUnit(). This is a (minor) optimization.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162144 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoc: privide deprecated warning when __private_extern__ storage
Fariborz Jahanian [Fri, 17 Aug 2012 21:44:55 +0000 (21:44 +0000)]
c: privide deprecated warning when __private_extern__ storage
specifier is unsed in a declaration; as it may not make the symbol
local to linkage unit as intended. Suggest using "hidden" visibility
attribute instead. // rdar://7703982

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162138 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Update comment.
Chad Rosier [Fri, 17 Aug 2012 21:27:25 +0000 (21:27 +0000)]
[ms-inline asm] Update comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162134 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPart of PR13618: visit the TypeLoc when RecursiveASTVisitor visits a CompoundLiteralExpr.
Richard Smith [Fri, 17 Aug 2012 21:23:17 +0000 (21:23 +0000)]
Part of PR13618: visit the TypeLoc when RecursiveASTVisitor visits a CompoundLiteralExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162133 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Extract AsmStmt handling into a separate file, so as to not
Chad Rosier [Fri, 17 Aug 2012 21:19:40 +0000 (21:19 +0000)]
[ms-inline asm] Extract AsmStmt handling into a separate file, so as to not
pollute SemaStmt with extraneous asm handling logic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162132 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomake this test case 64bit test. It fails due to
Fariborz Jahanian [Fri, 17 Aug 2012 20:23:06 +0000 (20:23 +0000)]
make this test case 64bit test. It fails due to
'int' vs. 'long' issue with i386.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162125 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Make BlockDataRegions typed, so that they have DynamicTypeInfo.
Jordan Rose [Fri, 17 Aug 2012 20:16:34 +0000 (20:16 +0000)]
[analyzer] Make BlockDataRegions typed, so that they have DynamicTypeInfo.

Fixes <rdar://problem/12119814>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162123 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove -Wbad-function-cast from -Wall.
Fariborz Jahanian [Fri, 17 Aug 2012 18:50:02 +0000 (18:50 +0000)]
Remove -Wbad-function-cast from -Wall.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162117 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agodarwin/driver: Support using SDKROOT to define the default for -isysroot.
Daniel Dunbar [Fri, 17 Aug 2012 18:43:50 +0000 (18:43 +0000)]
darwin/driver: Support using SDKROOT to define the default for -isysroot.
 - The SDKROOT environment variable is the de facto way to set the default SDK
   for a number of tools, join forces with them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162116 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAST Matchers: introduce functionTemplate(), classTemplate() and
Dmitri Gribenko [Fri, 17 Aug 2012 18:42:47 +0000 (18:42 +0000)]
AST Matchers: introduce functionTemplate(), classTemplate() and
isExplicitTemplateSpecialization() matchers which do what their name says.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162115 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFixed crash and added a test and a minor output problem
Alexander Kornienko [Fri, 17 Aug 2012 17:38:39 +0000 (17:38 +0000)]
Fixed crash and added a test and a minor output problem

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162110 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoc: implement gcc's -Wbad-function-cast which warns
Fariborz Jahanian [Fri, 17 Aug 2012 17:22:34 +0000 (17:22 +0000)]
c: implement gcc's -Wbad-function-cast which warns
on unsafe cast of a c-function call. This is
a C-only option.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162109 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDefine __builtin_ffs[ll] with a signed argument instead of unsigned.
Benjamin Kramer [Fri, 17 Aug 2012 16:39:13 +0000 (16:39 +0000)]
Define __builtin_ffs[ll] with a signed argument instead of unsigned.

GCC documents these as unsigned, but defines them as signed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162106 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Instantiate the MCStreamer as a NullStream. We're parsing
Chad Rosier [Fri, 17 Aug 2012 16:38:04 +0000 (16:38 +0000)]
[ms-inline asm] Instantiate the MCStreamer as a NullStream.  We're parsing
instruction, not emitting them, so a NullStream is fine.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162105 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd release notes for type safety attributes.
Dmitri Gribenko [Fri, 17 Aug 2012 16:01:54 +0000 (16:01 +0000)]
Add release notes for type safety attributes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162102 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix broken check lines.
Benjamin Kramer [Fri, 17 Aug 2012 12:28:21 +0000 (12:28 +0000)]
Fix broken check lines.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162096 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWarn about self-initialization of references.
Hans Wennborg [Fri, 17 Aug 2012 10:12:33 +0000 (10:12 +0000)]
Warn about self-initialization of references.

Initializing a reference with itself, e.g. "int &a = a;" seems like a
very bad idea.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162093 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake the spacing of the code completion result for NSDictionary
Douglas Gregor [Fri, 17 Aug 2012 05:40:05 +0000 (05:40 +0000)]
Make the spacing of the code completion result for NSDictionary
literals match the spacing introduced by the ObjC modernizer. Fixes
the rest of <rdar://problem/11889572>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162084 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen we need the complete set of visible declarations from a
Douglas Gregor [Fri, 17 Aug 2012 05:26:33 +0000 (05:26 +0000)]
When we need the complete set of visible declarations from a
declaration context, check whether the primary context---not the
current context---has any external visible declarations. Fixes
PR13616.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162083 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't do jump-scope checking when code completion is enabled. It's
Douglas Gregor [Fri, 17 Aug 2012 05:12:08 +0000 (05:12 +0000)]
Don't do jump-scope checking when code completion is enabled. It's
both a waste of time, and prone to crash due to the use of the
error-recovery path in parser. Fixes <rdar://problem/12103608>, which
has been driving me nuts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162081 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTemporarily revert r162066 and r162062 to see if it brings the gdb
Eric Christopher [Fri, 17 Aug 2012 04:42:07 +0000 (04:42 +0000)]
Temporarily revert r162066 and r162062 to see if it brings the gdb
bots back.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162080 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix undefined behavior in debug info emission: operator* on WeakVH returns a
Richard Smith [Fri, 17 Aug 2012 04:17:54 +0000 (04:17 +0000)]
Fix undefined behavior in debug info emission: operator* on WeakVH returns a
reference, so &* on an empty WeakVH binds a reference to a dereferenced null
pointer. So don't do that; we have a perfectly good implicit conversion to
Value*.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162079 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix test so that it doesn't keep failing forever when it's failed once.
Richard Smith [Fri, 17 Aug 2012 04:05:25 +0000 (04:05 +0000)]
Fix test so that it doesn't keep failing forever when it's failed once.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162077 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSwitch PTH format from a 7 byte magic number to an 8 byte one, to avoid
Richard Smith [Fri, 17 Aug 2012 03:55:43 +0000 (03:55 +0000)]
Switch PTH format from a 7 byte magic number to an 8 byte one, to avoid
misaligned reads throughout the file. Bump PTH format version to 10.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162076 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix -Wl,--no-demangle to actually pass the flag to the linker on Linux instead
Nick Lewycky [Fri, 17 Aug 2012 03:39:16 +0000 (03:39 +0000)]
Fix -Wl,--no-demangle to actually pass the flag to the linker on Linux instead
of silently dropping it on the floor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162075 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't forget to apply #pragma pack to partial and explicit specializations of
Richard Smith [Fri, 17 Aug 2012 03:20:55 +0000 (03:20 +0000)]
Don't forget to apply #pragma pack to partial and explicit specializations of
class templates. This fixes misalignment issues in llvm/Support/Endian.h when
built by Clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162074 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Add an internal reference document describing IPA and CallEvent.
Jordan Rose [Fri, 17 Aug 2012 02:11:35 +0000 (02:11 +0000)]
[analyzer] Add an internal reference document describing IPA and CallEvent.

This attempts to be a higher-level description of our inlining heuristics
and decision trees than the source, where the work is spread out between
ExprEngine (mostly in ExprEngineCallAndReturn.cpp) and CallEvent, with a
few other classes participating as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162073 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Unbreak the static analyzer buildbot.
Anna Zaks [Fri, 17 Aug 2012 01:09:13 +0000 (01:09 +0000)]
[analyzer] Unbreak the static analyzer buildbot.

We no longer associate the correct HTML file with plist diagnostic.
Fall out from r162028.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162071 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAvoid binding a reference to a dereferenced null pointer, if we try to emit a
Richard Smith [Fri, 17 Aug 2012 00:55:32 +0000 (00:55 +0000)]
Avoid binding a reference to a dereferenced null pointer, if we try to emit a
diagnostic before we have a source manager.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162070 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix misaligned DeclGroup allocation.
Richard Smith [Fri, 17 Aug 2012 00:34:00 +0000 (00:34 +0000)]
Fix misaligned DeclGroup allocation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162069 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't form a null reference when checking for validity of an anonymous
Richard Smith [Fri, 17 Aug 2012 00:12:27 +0000 (00:12 +0000)]
Don't form a null reference when checking for validity of an anonymous
elaborated type specifier in template instantiation: such a specifier is always
valid because it must be specified within the definition of the type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162068 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd support for "type safety" attributes that allow checking that 'void *'
Dmitri Gribenko [Fri, 17 Aug 2012 00:08:38 +0000 (00:08 +0000)]
Add support for "type safety" attributes that allow checking that 'void *'
function arguments and arguments for variadic functions are of a particular
type which is determined by some other argument to the same function call.

Usecases include:
* MPI library implementations, where these attributes enable checking that
  buffer type matches the passed MPI_Datatype;
* for HDF5 library there is a similar usecase as MPI;
* checking types of variadic functions' arguments for functions like
  fcntl() and ioctl().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162067 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd some caching here for the builtin types.
Eric Christopher [Thu, 16 Aug 2012 23:50:46 +0000 (23:50 +0000)]
Add some caching here for the builtin types.

rdar://12117935

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162066 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove FIXME, the constraints contain more options than the
Eric Christopher [Thu, 16 Aug 2012 23:50:43 +0000 (23:50 +0000)]
Remove FIXME, the constraints contain more options than the
current available documentation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162065 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a missing 'break' to ensure that we reject inline assembly
Eric Christopher [Thu, 16 Aug 2012 23:50:41 +0000 (23:50 +0000)]
Add a missing 'break' to ensure that we reject inline assembly
constraints we don't recognize.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162064 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRandom string removal.
Eric Christopher [Thu, 16 Aug 2012 23:50:37 +0000 (23:50 +0000)]
Random string removal.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162063 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake isa part of objc_object at metadata generation time.
Eric Christopher [Thu, 16 Aug 2012 23:50:35 +0000 (23:50 +0000)]
Make isa part of objc_object at metadata generation time.

Noticed on inspection.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162062 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix misaligned allocation of TemplateParameterList objects.
Richard Smith [Thu, 16 Aug 2012 22:51:34 +0000 (22:51 +0000)]
Fix misaligned allocation of TemplateParameterList objects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162056 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Comment.
Chad Rosier [Thu, 16 Aug 2012 22:47:10 +0000 (22:47 +0000)]
[ms-inline asm] Comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162055 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Extract a helper function, getSpelling(). Also use this on
Chad Rosier [Thu, 16 Aug 2012 22:40:32 +0000 (22:40 +0000)]
[ms-inline asm] Extract a helper function, getSpelling().  Also use this on
tokens we don't know how to handle; this should aid when debugging.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162053 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjective-C++: issue diagnostic when ivar type is
Fariborz Jahanian [Thu, 16 Aug 2012 22:38:41 +0000 (22:38 +0000)]
objective-C++: issue diagnostic when ivar type is
an abstract c++ class. // rdar://12095239

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162052 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] If we don't know how to handle a token then assume this is not a
Chad Rosier [Thu, 16 Aug 2012 22:30:02 +0000 (22:30 +0000)]
[ms-inline asm] If we don't know how to handle a token then assume this is not a
simple asm.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162051 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Add a helper function, isMSAsmKeyword().
Chad Rosier [Thu, 16 Aug 2012 22:25:38 +0000 (22:25 +0000)]
[ms-inline asm] Add a helper function, isMSAsmKeyword().

These require special handling, which we don't currently handle.  This is being
put in place to ensure we don't do invalid symbol table lookups or try to parse
invalid assembly.  The test cases just makes sure the latter isn't happening.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162050 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemoved unused LParenLoc parameter to ActOnCXXForRangeStmt
Sam Panzer [Thu, 16 Aug 2012 21:47:25 +0000 (21:47 +0000)]
Removed unused LParenLoc parameter to ActOnCXXForRangeStmt

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162048 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjective-C: make -Wcast-of-sel-type the default.
Fariborz Jahanian [Thu, 16 Aug 2012 20:16:46 +0000 (20:16 +0000)]
objective-C: make  -Wcast-of-sel-type the default.
// rdar://12107381

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162045 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCommentCommandTraits: rename BeginName -> StartName for consistency.
Dmitri Gribenko [Thu, 16 Aug 2012 20:16:11 +0000 (20:16 +0000)]
CommentCommandTraits: rename BeginName -> StartName for consistency.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162044 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Perform symbol table lookup on variables. The idea is to use
Chad Rosier [Thu, 16 Aug 2012 19:52:25 +0000 (19:52 +0000)]
[ms-inline asm] Perform symbol table lookup on variables.  The idea is to use
this information to determine valid MC operands.  This will also be used for
semantic analysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162043 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFixup test case for Release builds.
Chad Rosier [Thu, 16 Aug 2012 18:47:29 +0000 (18:47 +0000)]
Fixup test case for Release builds.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162038 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjective-C: deprecate casts of ObjC's SEL
Fariborz Jahanian [Thu, 16 Aug 2012 18:33:47 +0000 (18:33 +0000)]
objective-C: deprecate casts of ObjC's SEL
expressions except to void, void * and their
qualified versions. // rdar://12107381

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162036 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAttaching comments to declarations: parse the comment in context of the
Dmitri Gribenko [Thu, 16 Aug 2012 18:19:43 +0000 (18:19 +0000)]
Attaching comments to declarations: parse the comment in context of the
declaration it was attached to.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162033 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove #if 0 that has been around for a long time.
Ted Kremenek [Thu, 16 Aug 2012 17:45:32 +0000 (17:45 +0000)]
Remove #if 0 that has been around for a long time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162030 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove "range_iterator" from PathDiagnosticPiece and just use ArrayRef<SourceRange...
Ted Kremenek [Thu, 16 Aug 2012 17:45:29 +0000 (17:45 +0000)]
Remove "range_iterator" from PathDiagnosticPiece and just use ArrayRef<SourceRange> for ranges.  This
removes conceptual clutter, and can allow us to easy migrate to C++11 style for-range loops if we
ever move to using C++11 in Clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162029 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAllow multiple PathDiagnosticConsumers to be used with a BugReporter at the same...
Ted Kremenek [Thu, 16 Aug 2012 17:45:23 +0000 (17:45 +0000)]
Allow multiple PathDiagnosticConsumers to be used with a BugReporter at the same time.

This fixes several issues:

- removes egregious hack where PlistDiagnosticConsumer would forward to HTMLDiagnosticConsumer,
but diagnostics wouldn't be generated consistently in the same way if PlistDiagnosticConsumer
was used by itself.

- emitting diagnostics to the terminal (using clang's diagnostic machinery) is no longer a special
case, just another PathDiagnosticConsumer.  This also magically resolved some duplicate warnings,
as we now use PathDiagnosticConsumer's diagnostic pruning, which has scope for the entire translation
unit, not just the scope of a BugReporter (which is limited to a particular ExprEngine).

As an interesting side-effect, diagnostics emitted to the terminal also have their trailing "." stripped,
just like with diagnostics emitted to plists and HTML.  This required some tests to be updated, but now
the tests have higher fidelity with what users will see.

There are some inefficiencies in this patch.  We currently generate the report graph (from the ExplodedGraph)
once per PathDiagnosticConsumer, which is a bit wasteful, but that could be pulled up higher in the
logic stack.  There is some intended duplication, however, as we now generate different PathDiagnostics (for the same issue)
for different PathDiagnosticConsumers.  This is necessary to produce the diagnostics that a particular
consumer expects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162028 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMatchers related to DeclStmt for matching the count of declarations, a particular...
Sam Panzer [Thu, 16 Aug 2012 17:20:59 +0000 (17:20 +0000)]
Matchers related to DeclStmt for matching the count of declarations, a particular declaration within the statement, and single-Decl DeclStmts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162027 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Start tracking which tokens are registers and which are
Chad Rosier [Thu, 16 Aug 2012 17:10:59 +0000 (17:10 +0000)]
[ms-inline asm] Start tracking which tokens are registers and which are
variables, function or label references.  The former is a potential clobber.
The latter is either an input or an output.  Unfortunately, it's difficult to
test this patch at the moment, but the added test case will eventually do so.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162026 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMatchers which correspond to CastExpr, IgnoreImpCasts, IgnoreParenCasts, and IgnorePa...
Sam Panzer [Thu, 16 Aug 2012 16:58:10 +0000 (16:58 +0000)]
Matchers which correspond to CastExpr, IgnoreImpCasts, IgnoreParenCasts, and IgnoreParenImpCasts

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162025 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoStore SourceManager pointer on PrintingPolicy in the case where we're dumping,
Richard Smith [Thu, 16 Aug 2012 03:56:14 +0000 (03:56 +0000)]
Store SourceManager pointer on PrintingPolicy in the case where we're dumping,
and remove ASTContext reference (which was frequently bound to a dereferenced
null pointer) from the recursive lump of printPretty functions. In so doing,
fix (at least) one case where we intended to use the 'dump' mode, but that
failed because a null ASTContext reference had been passed in.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162011 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't constant-fold when pretty-printing alignment attribute. This fixes a
Richard Smith [Thu, 16 Aug 2012 02:43:29 +0000 (02:43 +0000)]
Don't constant-fold when pretty-printing alignment attribute. This fixes a
potential crasher -- Context is sometimes a null reference (!!) here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162007 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTest commit: deleted whitespace on blank line
Sam Panzer [Thu, 16 Aug 2012 02:38:47 +0000 (02:38 +0000)]
Test commit: deleted whitespace on blank line

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162006 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix misaligned allocation of QualifiedTempateName and DependentTemplateName.
Richard Smith [Thu, 16 Aug 2012 01:19:31 +0000 (01:19 +0000)]
Fix misaligned allocation of QualifiedTempateName and DependentTemplateName.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162005 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove names from the CHECK lines.
Tanya Lattner [Thu, 16 Aug 2012 00:22:16 +0000 (00:22 +0000)]
Remove names from the CHECK lines.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162003 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoConvert loads and stores of vec3 to vec4 to achieve better code generation. Add test...
Tanya Lattner [Thu, 16 Aug 2012 00:10:13 +0000 (00:10 +0000)]
Convert loads and stores of vec3 to vec4 to achieve better code generation. Add test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162002 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Add inputs and outputs to AST. No functional change.
Chad Rosier [Thu, 16 Aug 2012 00:06:53 +0000 (00:06 +0000)]
[ms-inline asm] Add inputs and outputs to AST.  No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162000 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Look through all casts when trying to track constraints.
Jordan Rose [Thu, 16 Aug 2012 00:03:33 +0000 (00:03 +0000)]
[analyzer] Look through all casts when trying to track constraints.

Previously, we were losing path notes (in both text and plist form)
because the interesting DeclRefExpr was buried in a cast.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161999 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDevirtualize calls on glvalues produced by class member access expressions.
Richard Smith [Wed, 15 Aug 2012 22:59:28 +0000 (22:59 +0000)]
Devirtualize calls on glvalues produced by class member access expressions.
Based on a patch by Yin Ma!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161998 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoThread safety analysis: prevent a compiler error in cases where a
DeLesley Hutchins [Wed, 15 Aug 2012 22:41:04 +0000 (22:41 +0000)]
Thread safety analysis:  prevent a compiler error in cases where a
late-parsed attribute is attached to an invalid declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161997 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] If we call a C++ method on an object, assume it's non-null.
Jordan Rose [Wed, 15 Aug 2012 21:56:23 +0000 (21:56 +0000)]
[analyzer] If we call a C++ method on an object, assume it's non-null.

This is analogous to our handling of pointer dereferences: if we
dereference a pointer that may or may not be null, we assume it's non-null
from then on.

While some implementations of C++ (including ours) allow you to call a
non-virtual method through a null pointer of object type, it is technically
disallowed by the C++ standard, and should not prune out any real paths in
practice.

  [class.mfct.non-static]p1: A non-static member function may be called
    for an object of its class type, or for an object of a class derived
    from its class type...
  (a null pointer value does not refer to an object)

We can also make the same assumption about function pointers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161992 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Use a set container to remove redundant clobbers.
Chad Rosier [Wed, 15 Aug 2012 21:55:19 +0000 (21:55 +0000)]
[ms-inline asm] Use a set container to remove redundant clobbers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161991 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Address a FIXME by computing the number of asm statements when
Chad Rosier [Wed, 15 Aug 2012 21:08:52 +0000 (21:08 +0000)]
[ms-inline asm] Address a FIXME by computing the number of asm statements when
building the AsmString.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161988 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Even if we are not inlining a virtual call, still invalidate!
Jordan Rose [Wed, 15 Aug 2012 21:05:15 +0000 (21:05 +0000)]
[analyzer] Even if we are not inlining a virtual call, still invalidate!

Fixes a mistake introduced in r161916.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161987 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] MSVC parses multiple __asm statements on a single line as one
Chad Rosier [Wed, 15 Aug 2012 21:03:27 +0000 (21:03 +0000)]
[ms-inline asm] MSVC parses multiple __asm statements on a single line as one
statement.  For example,

  if (x)
    __asm out dx, ax  __asm out dx, ax

results in a single inline asm statement (i.e., both "out dx, ax" statements are
predicated on if(x)).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161986 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Correctly devirtualize virtual method calls in constructors.
Jordan Rose [Wed, 15 Aug 2012 20:07:17 +0000 (20:07 +0000)]
[analyzer] Correctly devirtualize virtual method calls in constructors.

This is the other half of C++11 [class.cdtor]p4 (the destructor side
was added in r161915). This also fixes an issue with post-call checks
where the 'this' value was already being cleaned out of the state, thus
being omitted from a reconstructed CXXConstructorCall.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161981 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAllow 'static' and type qualifiers in K&R parameter type lists.
Matt Beaumont-Gay [Wed, 15 Aug 2012 19:53:19 +0000 (19:53 +0000)]
Allow 'static' and type qualifiers in K&R parameter type lists.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161980 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Don't emit newlines as these are ignored by the AsmParser
Chad Rosier [Wed, 15 Aug 2012 19:12:42 +0000 (19:12 +0000)]
[ms-inline asm] Don't emit newlines as these are ignored by the AsmParser
anyways.  Also, simplify some conditional logic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161977 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd ASTMatcher for matching extern "C" function declarations.
Daniel Jasper [Wed, 15 Aug 2012 18:52:19 +0000 (18:52 +0000)]
Add ASTMatcher for matching extern "C" function declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161974 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPatch to warn about __private_extern__ on tentative definitions
Fariborz Jahanian [Wed, 15 Aug 2012 18:42:26 +0000 (18:42 +0000)]
Patch to warn about __private_extern__ on tentative definitions
as it does something unexpected (but gcc compatible).
Suggest use of __attribute__((visibility("hidden")))
on declaration instead. // rdar://7703982

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161972 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix for PR#13606: http://llvm.org/bugs/show_bug.cgi?id=13606
John Criswell [Wed, 15 Aug 2012 18:40:30 +0000 (18:40 +0000)]
Fix for PR#13606: http://llvm.org/bugs/show_bug.cgi?id=13606
Changed the alignment of an LValue to be 64 bits so that we can handle
alignment values up to half of a 64-bit address space.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161971 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Add support for clobbers in CodeGen.
Chad Rosier [Wed, 15 Aug 2012 18:12:36 +0000 (18:12 +0000)]
[ms-inline asm]  Add support for clobbers in CodeGen.

This is a reapplication of r161914 now that the scoping issue has been resolved
in r161966.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161967 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Capturing loop-scoped (std::string)Reg with a StringRef is bad.
Chad Rosier [Wed, 15 Aug 2012 18:09:18 +0000 (18:09 +0000)]
[ms-inline asm] Capturing loop-scoped (std::string)Reg with a StringRef is bad.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161966 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix base type of ASTDeclNodeLister.
Michael Han [Wed, 15 Aug 2012 17:56:58 +0000 (17:56 +0000)]
Fix base type of ASTDeclNodeLister.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161963 91177308-0d34-0410-b5e6-96231b3b80d8