]> granicus.if.org Git - clang/log
clang
12 years agoCorrect comment. The return type was changed to const Type* in r123814. Patch by...
Dmitri Gribenko [Tue, 12 Jun 2012 01:21:44 +0000 (01:21 +0000)]
Correct comment.  The return type was changed to const Type* in r123814.  Patch by David Röthlisberger.

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

12 years agoRemove unused variable.
Dmitri Gribenko [Tue, 12 Jun 2012 00:43:19 +0000 (00:43 +0000)]
Remove unused variable.

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

12 years agoRevert "[analyzer] Treat LValueBitCasts like regular pointer bit casts."
Jordan Rose [Tue, 12 Jun 2012 00:20:22 +0000 (00:20 +0000)]
Revert "[analyzer] Treat LValueBitCasts like regular pointer bit casts."

This does not actually give us the right behavior for reinterpret_cast
of references. Reverting so I can think about it some more.

This reverts commit 50a75a6e26a49011150067adac556ef978639fe6.

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

12 years ago[analyzer] Treat LValueBitCasts like regular pointer bit casts.
Jordan Rose [Mon, 11 Jun 2012 23:20:52 +0000 (23:20 +0000)]
[analyzer] Treat LValueBitCasts like regular pointer bit casts.

These casts only appear in very well-defined circumstances, in which the
target of a reinterpret_cast or a function formal parameter is an lvalue
reference. According to the C++ standard, the following are equivalent:

 reinterpret_cast<T&>( x)
*reinterpret_cast<T*>(&x)

[expr.reinterpret.cast]p11

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

12 years ago[analyzer] WWW: Add FAQ to the menu.
Anna Zaks [Mon, 11 Jun 2012 22:35:53 +0000 (22:35 +0000)]
[analyzer] WWW: Add FAQ to the menu.

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

12 years agoAdd PPC support for translating gcc-style -mcpu options into LLVM -target-cpu options.
Hal Finkel [Mon, 11 Jun 2012 22:35:19 +0000 (22:35 +0000)]
Add PPC support for translating gcc-style -mcpu options into LLVM -target-cpu options.

This functionality is based on what is done on ARM, and enables selecting PPC CPUs
in a way compatible with gcc's driver. Also, mirroring gcc (and what is done on x86),
-mcpu=native support was added. This uses the host cpu detection from LLVM
(which will also soon be updated by refactoring code currently in backend).

In order for this to work, the target needs a list of valid CPUs -- we now accept all CPUs accepted by LLVM.
A few preprocessor defines for common CPU types have been added.

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

12 years ago[analyzer] WWW: FAQ - fix the assertion use example.
Anna Zaks [Mon, 11 Jun 2012 22:09:48 +0000 (22:09 +0000)]
[analyzer] WWW: FAQ - fix the assertion use example.

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

12 years ago[analyzer] The FAQ question style shouldn't be the same as code_example.
Anna Zaks [Mon, 11 Jun 2012 22:09:46 +0000 (22:09 +0000)]
[analyzer] The FAQ question style shouldn't be the same as code_example.

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

12 years ago[analyzer] WWW: Add table of contents, fixed code examples.
Anna Zaks [Mon, 11 Jun 2012 22:09:44 +0000 (22:09 +0000)]
[analyzer] WWW: Add table of contents, fixed code examples.

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

12 years ago[analyzer] WWW: Mention that we do not support "noreturn" for methods.
Anna Zaks [Mon, 11 Jun 2012 22:09:41 +0000 (22:09 +0000)]
[analyzer] WWW: Mention that we do not support "noreturn" for methods.

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

12 years agoMake CodeGenFunction::EmitMSAsmStmt throw a fatal error as MS-style inline
Chad Rosier [Mon, 11 Jun 2012 21:52:25 +0000 (21:52 +0000)]
Make CodeGenFunction::EmitMSAsmStmt throw a fatal error as MS-style inline
assembly is completely untested and unsupported.

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

12 years agoEtch out the code path for MS-style inline assembly.
Chad Rosier [Mon, 11 Jun 2012 20:47:18 +0000 (20:47 +0000)]
Etch out the code path for MS-style inline assembly.

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

12 years ago[analyzer] Add ObjCLoopChecker: objects from NSArray et al are non-nil.
Jordan Rose [Mon, 11 Jun 2012 16:40:41 +0000 (16:40 +0000)]
[analyzer] Add ObjCLoopChecker: objects from NSArray et al are non-nil.

While collections containing nil elements can still be iterated over in an
Objective-C for-in loop, the most common Cocoa collections -- NSArray,
NSDictionary, and NSSet -- cannot contain nil elements. This checker adds
that assumption to the analyzer state.

This was the cause of some minor false positives concerning CFRelease calls
on objects in an NSArray.

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

12 years ago[analyzer] When looking for a known class, only traverse the hierarchy once.
Jordan Rose [Mon, 11 Jun 2012 16:40:37 +0000 (16:40 +0000)]
[analyzer] When looking for a known class, only traverse the hierarchy once.

This has a small hit in the case where only one class is interesting
(NilArgChecker) but is a big improvement when looking for one of several
interesting classes (VariadicMethodTypeChecker), in which the most common
case is that there is no match.

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

12 years agoEnable -Wunused-private-field with -Wunused.
Benjamin Kramer [Mon, 11 Jun 2012 16:06:57 +0000 (16:06 +0000)]
Enable -Wunused-private-field with -Wunused.

It found a lot of cruft in LLVM that I removed last week and I couldn't find any
false positives. Time to give it more testing.

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

12 years agoWe were computing the visibility and linkage of template parameters, but
Rafael Espindola [Mon, 11 Jun 2012 14:29:58 +0000 (14:29 +0000)]
We were computing the visibility and linkage of template parameters, but
only using the linkage.

Use and test both, documenting that considering the visibility and linkage
of template parameters is a difference from gcc.

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

12 years ago[clang.py] Implement SourceLocation.from_offset
Gregory Szorc [Mon, 11 Jun 2012 11:11:48 +0000 (11:11 +0000)]
[clang.py] Implement SourceLocation.from_offset

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

12 years agoAdd XOP shift and compare intrinsics.
Craig Topper [Mon, 11 Jun 2012 07:01:43 +0000 (07:01 +0000)]
Add XOP shift and compare intrinsics.

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

12 years agoDocumentation cleanup, fixing Doxygen markup. Mostly this avoids common terms
James Dennett [Mon, 11 Jun 2012 06:19:40 +0000 (06:19 +0000)]
Documentation cleanup, fixing Doxygen markup. Mostly this avoids common terms
such as "protocol" and "expression" being implicitly turned into links to
mistakenly-generated Doxygen pages:
- Escaping @ symbols when Doxygen would otherwise incorrectly interpret them;
- Escaping # symbols when they're not intended as explicit Doxygen link
  requests, such as when discussing preprocessor directives;
- In one odd case, unescaping @ in @__experimental_modules_import, because
  Doxygen wrote '\@' to the output in that case, causing the example in the
  description of ImportDecl to be wrong; and
- Fixing a typo: @breif -> @brief.

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

12 years agoConst'ify CompilerInvocation::toArgs().
Argyrios Kyrtzidis [Mon, 11 Jun 2012 03:34:26 +0000 (03:34 +0000)]
Const'ify CompilerInvocation::toArgs().

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

12 years agoPR12964: __int128 and unsigned __int128 are promoted integral types, be sure to
Richard Smith [Sun, 10 Jun 2012 08:00:26 +0000 (08:00 +0000)]
PR12964: __int128 and unsigned __int128 are promoted integral types, be sure to
consider them when enumerating builtin operator candidates.

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

12 years agoAdd XOP vprot* instruction intrinsics
Craig Topper [Sun, 10 Jun 2012 07:47:32 +0000 (07:47 +0000)]
Add XOP vprot* instruction intrinsics

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

12 years agoRemove CXXRecordDecl flags which are unused after r158289.
Richard Smith [Sun, 10 Jun 2012 07:07:24 +0000 (07:07 +0000)]
Remove CXXRecordDecl flags which are unused after r158289.

We need an efficient mechanism to determine whether a defaulted default
constructor is constexpr, in order to determine whether a class is a literal
type, so keep the incrementally-built form on CXXRecordDecl. Remove the
on-demand computation of same, so that we only have one method for determining
whether a default constructor is constexpr. This doesn't affect correctness,
since default constructor lookup is much simpler than selecting a constructor
for copying or moving.

We don't need a corresponding mechanism for defaulted copy or move constructors,
since they can't affect whether a type is a literal type. Conversely, checking
whether such functions are constexpr can require non-trivial effort, so we defer
such checks until the copy or move constructor is required.

Thus we now only compute whether a copy or move constructor is constexpr on
demand, and only compute whether a default constructor is constexpr in advance.
This is unfortunate, but seems like the best solution.

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

12 years agoFix PR13052 properly, by performing special member lookup to determine whether
Richard Smith [Sun, 10 Jun 2012 05:43:50 +0000 (05:43 +0000)]
Fix PR13052 properly, by performing special member lookup to determine whether
an explicitly-defaulted default constructor would be constexpr. This is
necessary in weird (but well-formed) cases where a class has more than one copy
or move constructor.

Cleanup of now-unused parts of CXXRecordDecl to follow.

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

12 years agoPR13064: Store whether an in-class initializer uses direct or copy
Richard Smith [Sun, 10 Jun 2012 03:12:00 +0000 (03:12 +0000)]
PR13064: Store whether an in-class initializer uses direct or copy
initialization, and use that information to produce the right kind of
initialization during template instantiation.

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

12 years agoMore XOP intrinsics
Craig Topper [Sun, 10 Jun 2012 02:46:15 +0000 (02:46 +0000)]
More XOP intrinsics

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

12 years agoBegin adding XOP intrinsics
Craig Topper [Sun, 10 Jun 2012 00:39:38 +0000 (00:39 +0000)]
Begin adding XOP intrinsics

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

12 years agoFix the top-of-file comment in Attr.h to say that it's about attributes, not
James Dennett [Sat, 9 Jun 2012 23:00:13 +0000 (23:00 +0000)]
Fix the top-of-file comment in Attr.h to say that it's about attributes, not
expressions.

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

12 years agoAdd XOP feature flag.
Craig Topper [Sat, 9 Jun 2012 22:24:14 +0000 (22:24 +0000)]
Add XOP feature flag.

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

12 years agoAdd CSS style for FAQ questions, and restate FAQ questions as actual questions.
Ted Kremenek [Sat, 9 Jun 2012 20:10:45 +0000 (20:10 +0000)]
Add CSS style for FAQ questions, and restate FAQ questions as actual questions.

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

12 years agoWordsmith a bit, and turn </h1> into </h4> when appropriate.
Ted Kremenek [Sat, 9 Jun 2012 20:10:42 +0000 (20:10 +0000)]
Wordsmith a bit, and turn </h1> into </h4> when appropriate.

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

12 years ago[clang.py] Implement Cursor.is_static_method
Gregory Szorc [Sat, 9 Jun 2012 16:21:34 +0000 (16:21 +0000)]
[clang.py] Implement Cursor.is_static_method

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

12 years agoReorder ParsedTemplateArg's members to reduce padding on x86_64.
Benjamin Kramer [Sat, 9 Jun 2012 15:15:27 +0000 (15:15 +0000)]
Reorder ParsedTemplateArg's members to reduce padding on x86_64.

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

12 years agoReplace a char counting helper function with std::count.
Benjamin Kramer [Sat, 9 Jun 2012 13:18:14 +0000 (13:18 +0000)]
Replace a char counting helper function with std::count.

No functionality change.

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

12 years agoReplace constant-sized BitVector with std::bitset.
Benjamin Kramer [Sat, 9 Jun 2012 12:56:12 +0000 (12:56 +0000)]
Replace constant-sized BitVector with std::bitset.

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

12 years ago[libclang] When doing the cursor visitation make sure declarations
Argyrios Kyrtzidis [Sat, 9 Jun 2012 03:03:02 +0000 (03:03 +0000)]
[libclang] When doing the cursor visitation make sure declarations
in the same line do not override getting a cursor for the previous declaration.

e.g:

int x, y;
@synthesize prop1, prop2;

pointing at 'x'/'prop1' would give 'y'/'prop2' because their source ranges overlap.

rdar://11361113

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

12 years ago[analyzer] FAQ page fixup
Anna Zaks [Sat, 9 Jun 2012 01:05:01 +0000 (01:05 +0000)]
[analyzer] FAQ page fixup

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

12 years ago[analyzer] Add FAQ and How to Deal with Common False Positives page
Anna Zaks [Sat, 9 Jun 2012 01:04:54 +0000 (01:04 +0000)]
[analyzer] Add FAQ and How to Deal with Common False Positives page

Still not linked in; comments and additions are very welcome.

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

12 years ago[C++11 Compat] Fix breaking change in C++11 pair copyctor.
Michael J. Spencer [Fri, 8 Jun 2012 23:47:12 +0000 (23:47 +0000)]
[C++11 Compat] Fix breaking change in C++11 pair copyctor.

While this code is valid C++98, it is not valid C++11. The problem can be
reduced to:

class MDNode;

class DIType {
  operator MDNode*() const {return 0;}
};

class WeakVH {
  WeakVH(MDNode*) {}
};

int main() {
  DIType di;
  std::pair<void*, WeakVH> p(std::make_pair((void*)0, di)));
}

This was not detected by any of the bots we have because they either compile
C++98 with libstdc++ (which allows it), or C++11 with libc++ (which incorrectly
allows it). I ran into the problem when compiling with VS 2012 RC.

Thanks to Richard for explaining the issue.

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

12 years agoCorrect method name in comment: from LexRawToken to LexFromRawLexer, according
Dmitri Gribenko [Fri, 8 Jun 2012 23:19:37 +0000 (23:19 +0000)]
Correct method name in comment: from LexRawToken to LexFromRawLexer, according
to a change done long ago in r57393.

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

12 years agoConvert comments to proper Doxygen comments.
Dmitri Gribenko [Fri, 8 Jun 2012 23:13:42 +0000 (23:13 +0000)]
Convert comments to proper Doxygen comments.

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

12 years agoWarn in ObjC++ when an 'auto' variable deduces type 'id'.
Jordan Rose [Fri, 8 Jun 2012 22:46:07 +0000 (22:46 +0000)]
Warn in ObjC++ when an 'auto' variable deduces type 'id'.

This could happen for cases like this:

- (NSArray *)getAllNames:(NSArray *)images {
  NSMutableArray *results = [NSMutableArray array];
  for (auto img in images) {
    [results addObject:img.name];
  }
  return results;
}

Here the property access will fail because 'img' has type 'id', rather than,
say, NSImage.

This warning will not fire in templated code, since the 'id' could have
come from a template parameter.

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

12 years agoAdd a test for r158229 (overlapping fixits). This was PR10696!
Jordan Rose [Fri, 8 Jun 2012 22:46:04 +0000 (22:46 +0000)]
Add a test for r158229 (overlapping fixits). This was PR10696!

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

12 years agoPR13051: Only suggest the 'template' and 'operator' keywords when performing
Richard Smith [Fri, 8 Jun 2012 21:35:42 +0000 (21:35 +0000)]
PR13051: Only suggest the 'template' and 'operator' keywords when performing
typo-correction after a scope specifier.

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

12 years agoDisallow using ObjC literals in direct comparisons (== and friends).
Jordan Rose [Fri, 8 Jun 2012 21:14:25 +0000 (21:14 +0000)]
Disallow using ObjC literals in direct comparisons (== and friends).

Objective-C literals conceptually always create new objects, but may be
optimized by the compiler or runtime (constant folding, singletons, etc).
Comparing addresses of these objects is relying on this optimization
behavior, which is really an implementation detail.

In the case of == and !=, offer a fixit to a call to -isEqual:, if the
method is available. This fixit is directly on the error so that it is
automatically applied.

Most of the time, this is really a newbie mistake, hence the fixit.

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

12 years agoIf fixits appear to overlap, move the second one over in the output.
Jordan Rose [Fri, 8 Jun 2012 21:14:19 +0000 (21:14 +0000)]
If fixits appear to overlap, move the second one over in the output.

This occurs when you have two insertions and the first one is so long that the
second fixit's column is before the first fixit ends. The edits themselves
don't actually overlap, but our command-line preview does.

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

12 years agoPR13051: If a constructor is explicitly defaulted, it isn't marked as being
Richard Smith [Fri, 8 Jun 2012 21:09:22 +0000 (21:09 +0000)]
PR13051: If a constructor is explicitly defaulted, it isn't marked as being
constexpr until we get to the end of the class definition. When that happens,
be sure to remember that the class actually does have a constexpr constructor.

This is a stopgap solution, which still doesn't cover the case of a class with
multiple copy constructors (only some of which are constexpr). We should be
performing constructor lookup when implicitly defining a constructor in order
to determine whether all constructors it invokes are constexpr.

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

12 years agoRemove a commented out variable declaration. This was originally a debugging
Richard Trieu [Fri, 8 Jun 2012 20:10:05 +0000 (20:10 +0000)]
Remove a commented out variable declaration.  This was originally a debugging
variable which wasn't removed when the original patch was committed.

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

12 years ago[analyzer] MallocSizeofChecker false positive: when sizeof is argument
Anna Zaks [Fri, 8 Jun 2012 18:44:43 +0000 (18:44 +0000)]
[analyzer] MallocSizeofChecker false positive: when sizeof is argument
to addition.

We should not to warn in case the malloc size argument is an
addition containing 'sizeof' operator - it is common to use the pattern
to pack values of different sizes into a buffer.

Ex:

uint8_t *buffer = (uint8_t*)malloc(dataSize + sizeof(length));

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

12 years agoDisable _Pragma during HTML macro rewriting to keep from crashing.
Jordan Rose [Fri, 8 Jun 2012 18:06:21 +0000 (18:06 +0000)]
Disable _Pragma during HTML macro rewriting to keep from crashing.

The preprocessor's handling of diagnostic push/pops is stateful, so
encountering pragmas during a re-parse causes problems. HTMLRewrite
already filters out normal # directives including #pragma, so it's
clear it's not expected to be interpreting pragmas in this mode.

This fix adds a flag to Preprocessor to explicitly disable pragmas.
The "right" fix might be to separate pragma lexing from pragma
parsing so that we can throw away pragmas like we do preprocessor
directives, but right now it's important to get the fix in.

Note that this has nothing to do with the "hack" of re-using the
input preprocessor in HTMLRewrite. Even if we someday copy the
preprocessor instead of re-using it, the copy would (and should) include
the diagnostic level tables and have the same problems.

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

12 years agoSwitch LineTableInfo to use FileID instead of int for file references,
Douglas Gregor [Fri, 8 Jun 2012 16:40:28 +0000 (16:40 +0000)]
Switch LineTableInfo to use FileID instead of int for file references,
from Tom Honermann!

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

12 years ago[libclang] Don't crash when saving a PCH from a prefix header
Argyrios Kyrtzidis [Fri, 8 Jun 2012 05:48:06 +0000 (05:48 +0000)]
[libclang] Don't crash when saving a PCH from a prefix header
that does not exist.

rdar://11607033

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

12 years ago[libclang] Add a triple to test/Index/index-decls.m
Argyrios Kyrtzidis [Fri, 8 Jun 2012 03:54:16 +0000 (03:54 +0000)]
[libclang] Add a triple to test/Index/index-decls.m

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

12 years ago[libclang/AST]
Argyrios Kyrtzidis [Fri, 8 Jun 2012 02:16:11 +0000 (02:16 +0000)]
[libclang/AST]
AST: For auto-synthesized ivars give them the location of the related
property (previously they had no source location). This allows them
to be indexed by libclang.

libclang: Make sure synthesized ivars are indexed before the methods that
may reference them.

Fixes rdar://11607001.

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

12 years ago[analyzer] Use "issue hash" in CmpRuns; followup on r158180
Anna Zaks [Fri, 8 Jun 2012 01:50:49 +0000 (01:50 +0000)]
[analyzer] Use "issue hash" in CmpRuns; followup on r158180

(For the future: It would be more efficient to produce a hash key with
the embedded function info inside the compiler.)

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

12 years agoAllow friend declarations of defaulted special member functions. Only
Richard Smith [Fri, 8 Jun 2012 01:30:54 +0000 (01:30 +0000)]
Allow friend declarations of defaulted special member functions. Only
definitions of such members are prohibited, not mere declarations.

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

12 years agoFix up the 'typename' suggestion logic introduced in r157085, based on
Kaelyn Uhrain [Fri, 8 Jun 2012 01:07:26 +0000 (01:07 +0000)]
Fix up the 'typename' suggestion logic introduced in r157085, based on
feedback from Doug Gregor.

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

12 years agoPR13047: Fix various abuses of clang::Type in the MS mangler, to make it work
Richard Smith [Fri, 8 Jun 2012 00:37:04 +0000 (00:37 +0000)]
PR13047: Fix various abuses of clang::Type in the MS mangler, to make it work
in the presence of type sugar.

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

12 years agoFix typo "CursorKind.CONDITONAL_OPERATOR" in Python bindings, from
Douglas Gregor [Fri, 8 Jun 2012 00:16:27 +0000 (00:16 +0000)]
Fix typo "CursorKind.CONDITONAL_OPERATOR" in Python bindings, from
Manish Verma!

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

12 years agoRename a test case to a more generic name. This is a completely useless
Chandler Carruth [Fri, 8 Jun 2012 00:06:56 +0000 (00:06 +0000)]
Rename a test case to a more generic name. This is a completely useless
test, but David Sehr is looking at spiffing it up and adding some proper
tests for our alloca codegen.

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

12 years ago[analyzer] Add experimental "issue hash" to the plist diagnostic.
Anna Zaks [Fri, 8 Jun 2012 00:04:43 +0000 (00:04 +0000)]
[analyzer] Add experimental "issue hash" to the plist diagnostic.

CmpRuns.py can be used to compare issues from different analyzer runs.
Since it uses the issue line number to unique 2 issues, adding a new
line to the beginning of a file makes all issues in the file reported as
new.

The hash will be an opaque value which could be used (along with the
function name) by CmpRuns to identify the same issues. This way, we only
fail to identify the same issue from two runs if the function it appears
in changes (not perfect, but much better than nothing).

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

12 years ago[analyze] Change some of the malloc tests to use clang_analyzer_eval.
Anna Zaks [Fri, 8 Jun 2012 00:04:40 +0000 (00:04 +0000)]
[analyze] Change some of the malloc tests to use clang_analyzer_eval.

Thanks, Jordan.

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

12 years agoTeach the FixIt in DiagnoseInvalidRedeclaration how to replace the written
Kaelyn Uhrain [Thu, 7 Jun 2012 23:57:12 +0000 (23:57 +0000)]
Teach the FixIt in DiagnoseInvalidRedeclaration how to replace the written
nested name specifiers in addition to the function's identifier when the
correction has a different nested name specifier.

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

12 years agoIgnore corrections to functions with bodies when deciding which
Kaelyn Uhrain [Thu, 7 Jun 2012 23:57:08 +0000 (23:57 +0000)]
Ignore corrections to functions with bodies when deciding which
correction to use for an invalid function redeclaration.

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

12 years agoMinor comments and changes to clang-completion-mode.el, from David Wood!
Douglas Gregor [Thu, 7 Jun 2012 22:33:29 +0000 (22:33 +0000)]
Minor comments and changes to clang-completion-mode.el, from David Wood!

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

12 years ago[analyzer] Fixit for r158136.
Anna Zaks [Thu, 7 Jun 2012 20:18:08 +0000 (20:18 +0000)]
[analyzer] Fixit for r158136.

I falsely assumed that the memory spaces are equal when we reach this
point, they might not be when memory space of one or more is stack or
Unknown. We don't want a region from Heap space alias something with
another memory space.

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

12 years agoUser better API for vla in compund literals.
Fariborz Jahanian [Thu, 7 Jun 2012 18:15:55 +0000 (18:15 +0000)]
User better API for vla in compund literals.
// rdar://11485774

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

12 years agoAdd ext_vector type code for builtins, from John Garvin!
Douglas Gregor [Thu, 7 Jun 2012 18:08:25 +0000 (18:08 +0000)]
Add ext_vector type code for builtins, from John Garvin!

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

12 years agoFix many doxygen formatting errors.
Chandler Carruth [Thu, 7 Jun 2012 17:55:42 +0000 (17:55 +0000)]
Fix many doxygen formatting errors.

This patch affects docs only, and includes formatting changes only
(though those include some fixes for broken Doxygen markup that caused
some content to be missing from generated pages).  It avoids generating
many spurious pages such as
http://clang.llvm.org/doxygen/classRepresents.html, but likely not all
yet.

Patch by James Dennett.

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

12 years agoWhen emitting compund literal of vla pointer elements, make
Fariborz Jahanian [Thu, 7 Jun 2012 17:07:15 +0000 (17:07 +0000)]
When emitting compund literal of vla pointer elements, make
sure to emit vla size to prevent an irgen crash.
// rdar://11485774

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

12 years agoReuse APInt's getNumWords, which gets rounding right (my ad-hoc solution missed it).
Benjamin Kramer [Thu, 7 Jun 2012 15:54:03 +0000 (15:54 +0000)]
Reuse APInt's getNumWords, which gets rounding right (my ad-hoc solution missed it).

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

12 years agoPlug a long standing memory leak in TemplateArgument.
Benjamin Kramer [Thu, 7 Jun 2012 15:09:51 +0000 (15:09 +0000)]
Plug a long standing memory leak in TemplateArgument.

The integral APSInt value is now stored in a decomposed form and the backing
store for large values is allocated via the ASTContext. This way its not
leaked as TemplateArguments are never destructed when they are allocated in
the ASTContext. Since the integral data is immutable it is now shared between
instances, making copying TemplateArguments a trivial operation.

Currently getting the integral data out of a TemplateArgument requires creating
a new APSInt object. This is cheap when the value is small but can be expensive
if it's not. If this turns out to be an issue a more efficient accessor could
be added.

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

12 years agotest/Frontend/rewrite-includes.c: Tweak for win32's pathsep.
NAKAMURA Takumi [Thu, 7 Jun 2012 14:21:02 +0000 (14:21 +0000)]
test/Frontend/rewrite-includes.c: Tweak for win32's pathsep.

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

12 years agoMove sideeffecting call out of assert().
Benjamin Kramer [Thu, 7 Jun 2012 09:57:21 +0000 (09:57 +0000)]
Move sideeffecting call out of assert().

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

12 years ago[analyzer] Anti-aliasing: different heap allocations do not alias
Anna Zaks [Thu, 7 Jun 2012 03:57:32 +0000 (03:57 +0000)]
[analyzer] Anti-aliasing: different heap allocations do not alias

Add a concept of symbolic memory region belonging to heap memory space.
When comparing symbolic regions allocated on the heap, assume that they
do not alias.

Use symbolic heap region to suppress a common false positive pattern in
the malloc checker, in code that relies on malloc not returning the
memory aliased to other malloc allocations, stack.

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

12 years agoAttach fixits for CFBridgingRetain/Release outside any casts.
Jordan Rose [Thu, 7 Jun 2012 01:10:35 +0000 (01:10 +0000)]
Attach fixits for CFBridgingRetain/Release outside any casts.

Before, the note showed the location where you could insert __bridge variants,
but the actual fixit edit came after the cast.

No functionality change.

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

12 years agoInsert a space if necessary when suggesting CFBridgingRetain/Release.
Jordan Rose [Thu, 7 Jun 2012 01:10:31 +0000 (01:10 +0000)]
Insert a space if necessary when suggesting CFBridgingRetain/Release.

This was a problem for people who write 'return(result);'

Also fix ARCMT's corresponding code, though there's no test case for this
because implicit casts like this are rejected by the migrator for being
ambiguous, and explicit casts have no problem.

<rdar://problem/11577346>

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

12 years ago[arcmt] At an unbridged cast error, if we're returning a load-of-ivar from a +0 method,
Argyrios Kyrtzidis [Thu, 7 Jun 2012 00:44:06 +0000 (00:44 +0000)]
[arcmt] At an unbridged cast error, if we're returning a load-of-ivar from a +0 method,
automatically insert a __bridge cast.

radar://11560638

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

12 years agoreverse r158117.
Fariborz Jahanian [Wed, 6 Jun 2012 23:21:58 +0000 (23:21 +0000)]
reverse r158117.

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

12 years agoWhen doing arithmatic on vla pointer, make sure
Fariborz Jahanian [Wed, 6 Jun 2012 22:58:50 +0000 (22:58 +0000)]
When doing arithmatic on vla pointer, make sure
to emit vla size to prevent an irgen crash.
// rdar://11485774

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

12 years agoFix test/SemaObjC/cocoa-api-usage.m that broke via r158114.
Argyrios Kyrtzidis [Wed, 6 Jun 2012 22:32:07 +0000 (22:32 +0000)]
Fix test/SemaObjC/cocoa-api-usage.m that broke via r158114.

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

12 years ago[objcmt] When in ARC mode, also convert "[[.. alloc] init]" messages to literals,
Argyrios Kyrtzidis [Wed, 6 Jun 2012 22:23:12 +0000 (22:23 +0000)]
[objcmt] When in ARC mode, also convert "[[.. alloc] init]" messages to literals,
since the change from +1 to +0 will be handled fine by ARC.

rdar://11606358

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

12 years agoPuts the linktime dependencies into stupid-ld-required order, as proposed by Jordan...
Manuel Klimek [Wed, 6 Jun 2012 21:30:34 +0000 (21:30 +0000)]
Puts the linktime dependencies into stupid-ld-required order, as proposed by Jordan Rose.

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

12 years agoSwitches the RewriterTestContext away from PathV1.
Manuel Klimek [Wed, 6 Jun 2012 21:28:13 +0000 (21:28 +0000)]
Switches the RewriterTestContext away from PathV1.
Now the ToolingTests all work on Windows, and they also clean up their temporary directory if they don't crash.

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

12 years agoWhenever we have a BalancedDelimiterTracker, we have a 'nested' scope
Douglas Gregor [Wed, 6 Jun 2012 21:18:07 +0000 (21:18 +0000)]
Whenever we have a BalancedDelimiterTracker, we have a 'nested' scope
where '>' is going to behave as an operator (and not as a '>' closing
a template argument list).

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

12 years agoAllow CorrectTypo to add/modify nested name qualifiers to typos that
Kaelyn Uhrain [Wed, 6 Jun 2012 20:54:51 +0000 (20:54 +0000)]
Allow CorrectTypo to add/modify nested name qualifiers to typos that
are otherwise too short to try to correct.

The TODOs added to two of the tests are for existing deficiencies in the
typo correction code that could be exposed by using longer identifiers.

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

12 years ago[analyzer] Provide debug descriptions for all memory space regions.
Jordan Rose [Wed, 6 Jun 2012 20:47:00 +0000 (20:47 +0000)]
[analyzer] Provide debug descriptions for all memory space regions.

Patch by Guillem Marpons!

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

12 years agoFix Makefile: Options.td depends on CC1Options.td.
Jordan Rose [Wed, 6 Jun 2012 20:46:55 +0000 (20:46 +0000)]
Fix Makefile: Options.td depends on CC1Options.td.

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

12 years agoRevert Decl's iterators back to pointer value_type rather than reference value_type
David Blaikie [Wed, 6 Jun 2012 20:45:41 +0000 (20:45 +0000)]
Revert Decl's iterators back to pointer value_type rather than reference value_type

In addition, I've made the pointer and reference typedef 'void' rather than T*
just so they can't get misused. I would've omitted them entirely but
std::distance likes them to be there even if it doesn't use them.

This rolls back r155808 and r155869.

Review by Doug Gregor incorporating feedback from Chandler Carruth.

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

12 years agoRemove the last dead private member in clang.
Benjamin Kramer [Wed, 6 Jun 2012 20:15:08 +0000 (20:15 +0000)]
Remove the last dead private member in clang.

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

12 years agoAdd a -rewrite-includes option, which is similar to -rewrite-macros, but only expands...
David Blaikie [Wed, 6 Jun 2012 18:52:13 +0000 (18:52 +0000)]
Add a -rewrite-includes option, which is similar to -rewrite-macros, but only expands #include directives.

Patch contributed by Lubos Lunak (l.lunax@suse.cz).
Review by Matt Beaumont-Gay (matthewbg@google.com).

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

12 years agoEscape \n and \r in doxycomment.
David Blaikie [Wed, 6 Jun 2012 18:43:20 +0000 (18:43 +0000)]
Escape \n and \r in doxycomment.

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

12 years agoDocuments linking requirements for libtooling.
Manuel Klimek [Wed, 6 Jun 2012 17:51:31 +0000 (17:51 +0000)]
Documents linking requirements for libtooling.

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

12 years agoRemove unused private member variables found by clang's new -Wunused-private-field.
Benjamin Kramer [Wed, 6 Jun 2012 17:32:50 +0000 (17:32 +0000)]
Remove unused private member variables found by clang's new -Wunused-private-field.

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

12 years agoAdd pedantic warning -Wempty-translation-unit (C11 6.9p1).
Jordan Rose [Wed, 6 Jun 2012 17:25:21 +0000 (17:25 +0000)]
Add pedantic warning -Wempty-translation-unit (C11 6.9p1).

In standard C since C89, a 'translation-unit' is syntactically defined to have
at least one "external-declaration", which is either a decl or a function
definition. In Clang the latter gives us a declaration as well.

The tricky bit about this warning is that our predefines can contain external
declarations (__builtin_va_list and the 128-bit integer types). Therefore our
AST parser now makes sure we have at least one declaration that doesn't come
from the predefines buffer.

Also, remove bogus warning about empty source files. This doesn't catch source
files that only contain comments, and never fired anyway because of our
predefines.

PR12665 and <rdar://problem/9165548>

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

12 years agoZap the /Za compiler switch from MSVC projects, the option is considered harmful...
Francois Pichet [Wed, 6 Jun 2012 12:00:10 +0000 (12:00 +0000)]
Zap the /Za compiler switch from MSVC projects, the option is considered harmful even by Microsoft people and clang won't build using the MSVC 2012 RC if not removed.

Only 1 minor code change was necessary: can't use cdecl as variable name anymore.

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

12 years agoIntroduce -Wunused-private-field. If enabled, this warning detects
Daniel Jasper [Wed, 6 Jun 2012 08:32:04 +0000 (08:32 +0000)]
Introduce -Wunused-private-field. If enabled, this warning detects
unused private fields of classes that are fully defined in the current
translation unit.

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

12 years agoDisable path pruning for UndefResultChecker. It turns out we usually want to see...
Ted Kremenek [Wed, 6 Jun 2012 06:25:37 +0000 (06:25 +0000)]
Disable path pruning for UndefResultChecker.  It turns out we usually want to see more of the path
to discover how a value was used uninitialized.

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

12 years agoA non-explicit constructor template with a second parameter that is a
Douglas Gregor [Tue, 5 Jun 2012 23:44:51 +0000 (23:44 +0000)]
A non-explicit constructor template with a second parameter that is a
parameter pack is a converting constructor. Fixes PR13003.

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

12 years agoPlistDiagnostics: force the ranges for control-flow edges to be single locations...
Ted Kremenek [Tue, 5 Jun 2012 22:00:52 +0000 (22:00 +0000)]
PlistDiagnostics: force the ranges for control-flow edges to be single locations, forcing
adjacent edges to have compatible ranges.  This simplifies the layout logic for some clients.

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