]> granicus.if.org Git - clang/log
clang
12 years ago-Wuninitialized: Split the classification of DeclRefExprs as initialization or
Richard Smith [Tue, 17 Jul 2012 00:06:14 +0000 (00:06 +0000)]
-Wuninitialized: Split the classification of DeclRefExprs as initialization or
use out of TransferFunctions, and compute it in advance rather than on-the-fly.

This allows us to handle compound assignments with DeclRefExprs on the RHS
correctly, and also makes it trivial to treat const& function parameters as not
initializing the argument. The patch also makes both of those changes.

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

12 years ago[analyzer] Handle new-expressions with initializers for scalars.
Jordan Rose [Mon, 16 Jul 2012 23:38:09 +0000 (23:38 +0000)]
[analyzer] Handle new-expressions with initializers for scalars.

<rdar://problem/11818967>

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

12 years agoWeaken Unicode fixit test to work even if the character is printed escaped.
Jordan Rose [Mon, 16 Jul 2012 22:18:33 +0000 (22:18 +0000)]
Weaken Unicode fixit test to work even if the character is printed escaped.

This should fix the failure on Windows.

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

12 years agoFix BlockCommandComment::classof() to return true for objects of derived classes.
Dmitri Gribenko [Mon, 16 Jul 2012 22:13:46 +0000 (22:13 +0000)]
Fix BlockCommandComment::classof() to return true for objects of derived classes.

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

12 years agoThis test appears to fail on win32.
Ted Kremenek [Mon, 16 Jul 2012 21:43:16 +0000 (21:43 +0000)]
This test appears to fail on win32.

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

12 years agoAdd hack (provided by Jonathan Sauer) to fall back to assuming Xcode is installed...
Ted Kremenek [Mon, 16 Jul 2012 21:39:29 +0000 (21:39 +0000)]
Add hack (provided by Jonathan Sauer) to fall back to assuming Xcode is installed in /Developer
when using Python < 2.7.0.  This is the case on Snow Leopard, where the tools are always
installed in /Developer.  This isn't a proper fix for really figuring out where Xcode
is installed, but should work to fix an obvious problem on Snow Leopard.

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

12 years agoThis test appears to be passing on win32.
Ted Kremenek [Mon, 16 Jul 2012 21:17:01 +0000 (21:17 +0000)]
This test appears to be passing on win32.

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

12 years agoDon't crash when emitting fixits following Unicode characters.
Jordan Rose [Mon, 16 Jul 2012 20:52:12 +0000 (20:52 +0000)]
Don't crash when emitting fixits following Unicode characters.

This code is very sensitive to the difference between "columns" as printed
and "bytes" (SourceManager columns). All variables are now named explicitly
and our assumptions are (hopefully) documented as both comment and assertion.

Whether parseable fixits should use byte offsets or Unicode character counts
is pending discussion on the mailing list; currently the implementation uses
bytes (and has no problems on lines containing multibyte characters).
This has been added to the user manual.

<rdar://problem/11877454>

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

12 years agoSimplify float comparison checks by using early return.
David Blaikie [Mon, 16 Jul 2012 20:47:22 +0000 (20:47 +0000)]
Simplify float comparison checks by using early return.

Found while investigating PR13330

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

12 years agoFix copy-paste mistake for CMake dependency.
Ted Kremenek [Mon, 16 Jul 2012 20:22:15 +0000 (20:22 +0000)]
Fix copy-paste mistake for CMake dependency.

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

12 years ago[analyzer] Make CmpRuns external-user friendly.
Anna Zaks [Mon, 16 Jul 2012 20:21:42 +0000 (20:21 +0000)]
[analyzer] Make CmpRuns external-user friendly.

CmpRuns can be used for static analyzer bug report comparison. However,
we want to make sure external users do not rely on the way bugs are
represented (plist files). Make sure that we have a user
friendly/documented API for CmpRuns script.

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

12 years agoLooks like libTooling might also depend on ClangDiagnosticCommon.
Ted Kremenek [Mon, 16 Jul 2012 19:44:15 +0000 (19:44 +0000)]
Looks like libTooling might also depend on ClangDiagnosticCommon.

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

12 years agoAdd libEdit dependency on ClangDiagnosticCommon. Hopefully this will unbreak the...
Ted Kremenek [Mon, 16 Jul 2012 18:53:42 +0000 (18:53 +0000)]
Add libEdit dependency on ClangDiagnosticCommon.  Hopefully this will unbreak the VS build.

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

12 years agoMIPS: Implement __builtin_mips_shll_qb builtin function overloading.
Simon Atanasyan [Mon, 16 Jul 2012 18:52:02 +0000 (18:52 +0000)]
MIPS: Implement __builtin_mips_shll_qb builtin function overloading.
This function has two versions. The first one is used for a register operand.
The second one is used for an immediate number.

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

12 years agoFix rejects-valid: explicit specialization of redeclared deleted function template.
David Blaikie [Mon, 16 Jul 2012 18:50:45 +0000 (18:50 +0000)]
Fix rejects-valid: explicit specialization of redeclared deleted function template.

Review by Richard Smith.

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

12 years agomodern objective-c translator: conditionally include
Fariborz Jahanian [Mon, 16 Jul 2012 16:21:45 +0000 (16:21 +0000)]
modern objective-c translator: conditionally include
<string.h>. // rdar://11847319

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

12 years agoFixing an MSVC warning -- the compiler did not like the cast added to work around...
Aaron Ballman [Mon, 16 Jul 2012 15:45:33 +0000 (15:45 +0000)]
Fixing an MSVC warning -- the compiler did not like the cast added to work around a g++ bug (it would claim to possibly emit incorrect code).

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

12 years agoFixing an obvious bug in a test.
Alexander Kornienko [Mon, 16 Jul 2012 13:31:37 +0000 (13:31 +0000)]
Fixing an obvious bug in a test.

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

12 years agoThe new clang-ast-dump tool for selective AST dumping. Moved common command-line...
Alexander Kornienko [Mon, 16 Jul 2012 12:46:48 +0000 (12:46 +0000)]
The new clang-ast-dump tool for selective AST dumping. Moved common command-line tool stuff to CommandLineClangTool

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

12 years agoAdd two more missing parameters in diagnostics.
Daniel Jasper [Mon, 16 Jul 2012 12:12:45 +0000 (12:12 +0000)]
Add two more missing parameters in diagnostics.

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

12 years agoFix diagnostic adding missing parameter.
Daniel Jasper [Mon, 16 Jul 2012 11:51:49 +0000 (11:51 +0000)]
Fix diagnostic adding missing parameter.

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

12 years agoPrevent unused-variable warning in optimized builds.
Daniel Jasper [Mon, 16 Jul 2012 10:25:15 +0000 (10:25 +0000)]
Prevent unused-variable warning in optimized builds.

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

12 years agoAdd refactoring callbacks to make common kinds of refactorings easy.
Daniel Jasper [Mon, 16 Jul 2012 09:18:17 +0000 (09:18 +0000)]
Add refactoring callbacks to make common kinds of refactorings easy.

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

12 years agoAdd correct parenthesis range to CXXConstructExprs inside
Daniel Jasper [Mon, 16 Jul 2012 08:05:07 +0000 (08:05 +0000)]
Add correct parenthesis range to CXXConstructExprs inside
CXXFunctionalCastExprs.

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

12 years agoPlace checker build at alternate URL.
Ted Kremenek [Mon, 16 Jul 2012 04:18:35 +0000 (04:18 +0000)]
Place checker build at alternate URL.

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

12 years agoMore for PR11848: a pack expansion type isn't necessarily type-dependent (its
Richard Smith [Mon, 16 Jul 2012 01:59:26 +0000 (01:59 +0000)]
More for PR11848: a pack expansion type isn't necessarily type-dependent (its
pattern might be an alias template which doesn't use its arguments). It's always
instantiation-dependent, though.

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

12 years agoPR13365: Fix code which was trying to treat an array of DeducedTemplateArgument
Richard Smith [Mon, 16 Jul 2012 01:09:10 +0000 (01:09 +0000)]
PR13365: Fix code which was trying to treat an array of DeducedTemplateArgument
as an array of its base class TemplateArgument. Switch the const
TemplateArgument* parameters of InstantiatingTemplate's constructors to
ArrayRef<TemplateArgument> to prevent this from happening again in the future.

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

12 years agoRelated to PR11848 and core-21989: switch ContainsUnexpandedParameterPack from
Richard Smith [Mon, 16 Jul 2012 00:20:35 +0000 (00:20 +0000)]
Related to PR11848 and core-21989: switch ContainsUnexpandedParameterPack from
being a property of a canonical type to being a property of the fully-sugared
type. This should only make a difference in the case where an alias template
ignores one of its parameters, and that parameter is an unexpanded parameter
pack.

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

12 years agoRevert change accidentally committed in r160240.
Richard Smith [Sun, 15 Jul 2012 23:30:50 +0000 (23:30 +0000)]
Revert change accidentally committed in r160240.

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

12 years agoPR13368: Halve the instantiation depth of this test again. Apparently, FreeBSD
Richard Smith [Sun, 15 Jul 2012 23:29:50 +0000 (23:29 +0000)]
PR13368: Halve the instantiation depth of this test again. Apparently, FreeBSD
has a much lower default stack limit than the systems I have access to.

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

12 years agoUpdate Clang to reflect the move of MDBuilder in r160237.
Chandler Carruth [Sun, 15 Jul 2012 23:28:01 +0000 (23:28 +0000)]
Update Clang to reflect the move of MDBuilder in r160237.

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

12 years agoAdd test case for tweaks to clang driver.
David Chisnall [Sun, 15 Jul 2012 21:18:01 +0000 (21:18 +0000)]
Add test case for tweaks to clang driver.

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

12 years agoFix spelling of anyOf matcher and add missing test.
Daniel Jasper [Sun, 15 Jul 2012 19:57:12 +0000 (19:57 +0000)]
Fix spelling of anyOf matcher and add missing test.

Patch by Sam Panzer!

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

12 years agoEnable new linker behaviour on FreeBSD.
David Chisnall [Sun, 15 Jul 2012 12:53:06 +0000 (12:53 +0000)]
Enable new linker behaviour on FreeBSD.

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

12 years agoWithout this patch clang warns on
Rafael Espindola [Sun, 15 Jul 2012 01:33:40 +0000 (01:33 +0000)]
Without this patch clang warns on

struct __attribute__((visibility("hidden"))) zed {
};
struct __attribute__((visibility("hidden"))) zed;

Which is a bit silly and got a lot noisier now that we correctly handle
visibility pragmas. This patch fixes that and also has some extra quality
improvements:

* We now produce an error instead of a warning for

struct __attribute__((visibility("hidden"))) zed {
};
struct __attribute__((visibility("default"))) zed;

* The "after definition" warning now points to the new attribute that is
  ignored instead of pointing to the declaration.

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

12 years agoMake const the argument of getDefinition.
Rafael Espindola [Sun, 15 Jul 2012 01:05:36 +0000 (01:05 +0000)]
Make const the argument of getDefinition.

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

12 years agoUse llvm::APSInt::isSameValue to compare for the same value.
Eric Christopher [Sun, 15 Jul 2012 00:24:00 +0000 (00:24 +0000)]
Use llvm::APSInt::isSameValue to compare for the same value.

Finishes rdar://11875995

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

12 years agoReplace IsSameValue with the llvm::APSInt/llvm::APInt versions
Eric Christopher [Sun, 15 Jul 2012 00:23:57 +0000 (00:23 +0000)]
Replace IsSameValue with the llvm::APSInt/llvm::APInt versions
that we just copied from here and replace all uses.

Part of rdar://11875995

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

12 years agoCapitalize comment.
Eric Christopher [Sat, 14 Jul 2012 19:29:12 +0000 (19:29 +0000)]
Capitalize comment.

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

12 years agoRefine CFG so that '&&' and '||' don't lead to extra confluence points when used...
Ted Kremenek [Sat, 14 Jul 2012 05:04:10 +0000 (05:04 +0000)]
Refine CFG so that '&&' and '||' don't lead to extra confluence points when used in a branch, but
instead push the terminator for the branch down into the basic blocks of the subexpressions of '&&' and '||'
respectively.  This eliminates some artifical control-flow from the CFG and results in a more
compact CFG.

Note that this patch only alters the branches 'while', 'if' and 'for'.  This was complex enough for
one patch.  The remaining branches (e.g., do...while) can be handled in a separate patch, but they
weren't immediately tackled because they were less important.

It is possible that this patch introduces some subtle bugs, particularly w.r.t. to destructor placement.
I've tried to audit these changes, but it is also known that the destructor logic needs some refinement
in the area of '||' and '&&' regardless (i.e., their are known bugs).

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

12 years agoHoist CFG builder logic for '&&' and '||' into helper method. No funcationlity change.
Ted Kremenek [Sat, 14 Jul 2012 05:04:06 +0000 (05:04 +0000)]
Hoist CFG builder logic for '&&' and '||' into helper method.  No funcationlity change.

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

12 years agoRemove unused method declaration.
Ted Kremenek [Sat, 14 Jul 2012 05:04:04 +0000 (05:04 +0000)]
Remove unused method declaration.

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

12 years agoSort prototypes. No functionality change.
Ted Kremenek [Sat, 14 Jul 2012 05:04:01 +0000 (05:04 +0000)]
Sort prototypes.  No functionality change.

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

12 years agoUpdate Sema diagnostic messages to take advantage of template type diffing.
Richard Trieu [Sat, 14 Jul 2012 00:49:02 +0000 (00:49 +0000)]
Update Sema diagnostic messages to take advantage of template type diffing.

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

12 years agoAdd a per target max vector alignment field (e.g., 32-byte alignment for x86 due to
Chad Rosier [Fri, 13 Jul 2012 23:57:43 +0000 (23:57 +0000)]
Add a per target max vector alignment field (e.g., 32-byte alignment for x86 due to
AVX).  Currently, if no aligned attribute is specified the alignment of a vector is
inferred from its size.  Thus, very large vectors will be over-aligned with no
benefit.  Target owners should set this target max.

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

12 years agoPR13360: When deciding the earliest point which inevitably leads to an
Richard Smith [Fri, 13 Jul 2012 23:33:44 +0000 (23:33 +0000)]
PR13360: When deciding the earliest point which inevitably leads to an
uninitialized variable use, walk back over branches where we've reached all the
non-null successors, not just cases where we've reached all successors.

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

12 years agoMove option test earlier in the function.
Rafael Espindola [Fri, 13 Jul 2012 23:26:43 +0000 (23:26 +0000)]
Move option test earlier in the function.

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

12 years agoThis is one of the first steps at moving to replace target-dependent
Joel Jones [Fri, 13 Jul 2012 23:26:27 +0000 (23:26 +0000)]
This is one of the first steps at moving to replace target-dependent
intrinsics with target-indepdent intrinsics.  The first instruction(s) to be
handled are the vector versions of count leading zeros (ctlz).

The changes here are to clang so that it generates a target independent
vector ctlz when it sees an ARM dependent vector ctlz.  The changes in llvm
are to match the target independent vector ctlz and in VMCore/AutoUpgrade.cpp
to update any existing bc files containing ARM dependent vector ctlzs with
target-independent ctlzs.  There are also changes to an existing test case in
llvm for ARM vector count instructions and a new test for the bitcode upgrade.

<rdar://problem/11831778>

There is deliberately no test for the change to clang, as so far as I know, no
consensus has been reached regarding how to test neon instructions in clang;
q.v. <rdar://problem/8762292>

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

12 years agoComment.h: reword comments
Dmitri Gribenko [Fri, 13 Jul 2012 22:36:49 +0000 (22:36 +0000)]
Comment.h: reword comments

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

12 years agoModify tree printing mode for template type diffing. If a diagnostic has
Richard Trieu [Fri, 13 Jul 2012 21:18:32 +0000 (21:18 +0000)]
Modify tree printing mode for template type diffing.  If a diagnostic has
multiple %diff's, only print the first tree and fallback to inline printing
for the rest of the diagnostic.

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

12 years agoadd support for conditional expressions in Expr::HasSideEffects()
Nuno Lopes [Fri, 13 Jul 2012 20:48:52 +0000 (20:48 +0000)]
add support for conditional expressions in Expr::HasSideEffects()
This fixes a bug in __builtin_object_size() codegen

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

12 years agoMove a bunch of the attribute warnings under the IgnoreAttributes group. Cleaned...
Tanya Lattner [Fri, 13 Jul 2012 20:45:35 +0000 (20:45 +0000)]
Move a bunch of the attribute warnings under the IgnoreAttributes group. Cleaned up test case.

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

12 years agoComment AST nodes: rename getXXXCount() methods to getNumXXXs() to be in line with...
Dmitri Gribenko [Fri, 13 Jul 2012 19:02:42 +0000 (19:02 +0000)]
Comment AST nodes: rename getXXXCount() methods to getNumXXXs() to be in line with Statement AST nodes.

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

12 years agoApply visibility pragmas to class template declarations. This is needed because
Rafael Espindola [Fri, 13 Jul 2012 18:04:45 +0000 (18:04 +0000)]
Apply visibility pragmas to class template declarations. This is needed because
we might use the declaration to build a type before seeing the definition.

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

12 years agoUse -fvisibility-inlines-hidden in inline functions too. This matches gcc
Rafael Espindola [Fri, 13 Jul 2012 14:25:36 +0000 (14:25 +0000)]
Use -fvisibility-inlines-hidden in inline functions too. This matches gcc
behavior since gcc pr30066. Thanks to Benjamin Kramer for pointing it out.

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

12 years agoMove helper class into an anonymous namespace.
Benjamin Kramer [Fri, 13 Jul 2012 13:25:11 +0000 (13:25 +0000)]
Move helper class into an anonymous namespace.

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

12 years agoMention -ftls-model in release notes and manual.
Hans Wennborg [Fri, 13 Jul 2012 12:47:15 +0000 (12:47 +0000)]
Mention -ftls-model in release notes and manual.

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

12 years agoAllows retrieving all files in a CompilationDatabase.
Manuel Klimek [Fri, 13 Jul 2012 12:31:45 +0000 (12:31 +0000)]
Allows retrieving all files in a CompilationDatabase.

Patch by Tobias Koenig, some test changes by myself.

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

12 years agoProvide a special-case diagnostic when two class member functions instantiate
Richard Smith [Fri, 13 Jul 2012 04:12:04 +0000 (04:12 +0000)]
Provide a special-case diagnostic when two class member functions instantiate
to the same signature. Fix a bug in the type printer which would cause this
diagnostic to print wonderful types like 'const const int *'.

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

12 years agoFix a bug in my previous commit. The problem is not that we were not using the
Rafael Espindola [Fri, 13 Jul 2012 01:19:08 +0000 (01:19 +0000)]
Fix a bug in my previous commit. The problem is not that we were not using the
canonical decl for the template, but that we were not merging attributes for
templates at all!

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

12 years agoAttaching comments to declarations during parsing: handle more Objective-C declarations.
Dmitri Gribenko [Fri, 13 Jul 2012 01:06:46 +0000 (01:06 +0000)]
Attaching comments to declarations during parsing: handle more Objective-C declarations.

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

12 years agoAlso remove include directory for libComments.
Dmitri Gribenko [Fri, 13 Jul 2012 00:56:30 +0000 (00:56 +0000)]
Also remove include directory for libComments.

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

12 years agoRemove empty lib/Comments directory.
Dmitri Gribenko [Fri, 13 Jul 2012 00:55:39 +0000 (00:55 +0000)]
Remove empty lib/Comments directory.

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

12 years agoComment parsing: repaint the bikesched: rename 'HTML open tags' to 'HTML start tags...
Dmitri Gribenko [Fri, 13 Jul 2012 00:44:24 +0000 (00:44 +0000)]
Comment parsing: repaint the bikesched: rename 'HTML open tags' to 'HTML start tags' and 'HTML close tags' to 'HTML end tags' according to HTML spec.

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

12 years agoMake concepts of optional and forbidden end tags separate. Thanks Jordan for pointin...
Dmitri Gribenko [Thu, 12 Jul 2012 23:37:09 +0000 (23:37 +0000)]
Make concepts of optional and forbidden end tags separate.  Thanks Jordan for pointing this!

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

12 years agoUse the canonical template decl when trying to find if it has a visibility
Rafael Espindola [Thu, 12 Jul 2012 20:05:04 +0000 (20:05 +0000)]
Use the canonical template decl when trying to find if it has a visibility
attribute.

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

12 years agoUpdates the example to the latest incarnation of clang-check and
Manuel Klimek [Thu, 12 Jul 2012 18:32:50 +0000 (18:32 +0000)]
Updates the example to the latest incarnation of clang-check and
adds a paragraph on builtin headers.

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

12 years agoAlways initialize variable. If opening quote is the last character in comment, we...
Dmitri Gribenko [Thu, 12 Jul 2012 16:34:32 +0000 (16:34 +0000)]
Always initialize variable.  If opening quote is the last character in comment, we will be using an uninitialized value.  There is already a test for that in unittests/AST/CommentLexer.cpp, but it seems like we were lucky with the value that got loaded into the variable so the test passed.

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

12 years agoUpdated -help message in clang-check.
Alexander Kornienko [Thu, 12 Jul 2012 14:34:23 +0000 (14:34 +0000)]
Updated -help message in clang-check.

Summary: Provide more information on usage in -help

Test Plan: ran once

Reviewers: klimek, chandlerc, djasper

Reviewed By: klimek

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D5

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

12 years ago[Windows] Split the back reference tests into two separate files as the templates...
Timur Iskhodzhanov [Thu, 12 Jul 2012 14:33:58 +0000 (14:33 +0000)]
[Windows] Split the back reference tests into two separate files as the templates are getting hairy

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

12 years agotest/CodeGen/rdrand-builtins.c: Define __MM_MALLOC_H before including <*mmintrin...
NAKAMURA Takumi [Thu, 12 Jul 2012 10:36:27 +0000 (10:36 +0000)]
test/CodeGen/rdrand-builtins.c: Define __MM_MALLOC_H before including <*mmintrin.h> .

Rawr!

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

12 years agoDon't include mm_malloc.h in test, it pulls in system headers on msvc.
Benjamin Kramer [Thu, 12 Jul 2012 09:56:18 +0000 (09:56 +0000)]
Don't include mm_malloc.h in test, it pulls in system headers on msvc.

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

12 years ago[Windows] Use thiscall as the default calling convention for class methods. PR12785
Timur Iskhodzhanov [Thu, 12 Jul 2012 09:50:54 +0000 (09:50 +0000)]
[Windows] Use thiscall as the default calling convention for class methods. PR12785

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

12 years agoAdd _rdrand{16,32,64}_step intrinsics to immintrin.h
Benjamin Kramer [Thu, 12 Jul 2012 09:33:03 +0000 (09:33 +0000)]
Add _rdrand{16,32,64}_step intrinsics to immintrin.h

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

12 years agoThis commit combines three patches to the ASTMatchers.
Daniel Jasper [Thu, 12 Jul 2012 08:50:38 +0000 (08:50 +0000)]
This commit combines three patches to the ASTMatchers.

One adds matchers for the various parts of a for loop (initializer, condition,
increment), as well as extending the hasBody matcher to work for while and
do-while loops. The second patch adds an isInteger matcher for types.
The third patch fixes a bug in allOf, where a few of the name chages
(AllOf --> allOf) had been missed.

All matchers come with unit tests.

Patches by Sam Panzer!

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

12 years agoBe lax about trailing whitespace when checking fixit formatting, this depends on...
Benjamin Kramer [Thu, 12 Jul 2012 08:34:31 +0000 (08:34 +0000)]
Be lax about trailing whitespace when checking fixit formatting, this depends on locale settings.

If a non-unicode locale is used, the unicode character is escaped and any
byte that is in the escaped representation but not the semicolon will
become whitespace.

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

12 years agoPR13312: Don't crash when printing a fixit that ends in a unicode character.
Benjamin Kramer [Thu, 12 Jul 2012 08:20:49 +0000 (08:20 +0000)]
PR13312: Don't crash when printing a fixit that ends in a unicode character.

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

12 years ago[clang.py] Implement Token API
Gregory Szorc [Thu, 12 Jul 2012 07:21:12 +0000 (07:21 +0000)]
[clang.py] Implement Token API

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

12 years ago[clang.py] Add TranslationUnit.get_{file,source_location,source_range}
Gregory Szorc [Thu, 12 Jul 2012 05:05:56 +0000 (05:05 +0000)]
[clang.py] Add TranslationUnit.get_{file,source_location,source_range}

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

12 years ago[clang.py] Refactor how ctypes functions are registered
Gregory Szorc [Thu, 12 Jul 2012 04:56:46 +0000 (04:56 +0000)]
[clang.py] Refactor how ctypes functions are registered

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

12 years agoProcess #pragma visibility early in the parsing of class definitions. Fixes
Rafael Espindola [Thu, 12 Jul 2012 04:47:34 +0000 (04:47 +0000)]
Process #pragma visibility early in the parsing of class definitions. Fixes
pr13338.

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

12 years agoIgnore visibility attributes after definitions. This matches newer (4.7) gcc's
Rafael Espindola [Thu, 12 Jul 2012 04:32:30 +0000 (04:32 +0000)]
Ignore visibility attributes after definitions. This matches newer (4.7) gcc's
behavior and is the first step in fixing pr13338.

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

12 years agoRevert r160052, "Default to -std=c++11 on Windows.", for now.
NAKAMURA Takumi [Thu, 12 Jul 2012 03:14:56 +0000 (03:14 +0000)]
Revert r160052, "Default to -std=c++11 on Windows.", for now.

Failing Tests (3):
    Clang :: Index/complete-cxx-inline-methods.cpp
    Clang :: Index/recursive-cxx-member-calls.cpp
    Clang :: SemaTemplate/inject-templated-friend-post.cpp

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

12 years agoAdd the ObjFW runtime. Patch by Jonathan Schleifer!
John McCall [Thu, 12 Jul 2012 02:07:58 +0000 (02:07 +0000)]
Add the ObjFW runtime.  Patch by Jonathan Schleifer!

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

12 years agoAST/CommentSema.cpp: Fix signess in abs() to appease msvc. It would not make sense...
NAKAMURA Takumi [Thu, 12 Jul 2012 00:45:08 +0000 (00:45 +0000)]
AST/CommentSema.cpp: Fix signess in abs() to appease msvc. It would not make sense to pass (unsigned)-(unsigned) to abs().

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

12 years agoclang/lib/Basic/CMakeLists.txt: Add missing dependency, ClangDiagnosticComment.
NAKAMURA Takumi [Thu, 12 Jul 2012 00:27:55 +0000 (00:27 +0000)]
clang/lib/Basic/CMakeLists.txt: Add missing dependency, ClangDiagnosticComment.

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

12 years ago[analyzer] Don't inline virtual calls unless we can devirtualize properly.
Jordan Rose [Thu, 12 Jul 2012 00:16:25 +0000 (00:16 +0000)]
[analyzer] Don't inline virtual calls unless we can devirtualize properly.

Previously we were using the static type of the base object to inline
methods, whether virtual or non-virtual. Now, we try to see if the base
object has a known type, and if so ask for its implementation of the method.

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

12 years agoAdd OpenCL metadata for kernel arg names. This output is controlled via a flag as...
Tanya Lattner [Wed, 11 Jul 2012 23:02:10 +0000 (23:02 +0000)]
Add OpenCL metadata for kernel arg names. This output is controlled via a flag as noted in the OpenCL Spec.
Includes a test case.

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

12 years agoDon't try to do RVO on block variables that refer to an enclosing local.
Nico Weber [Wed, 11 Jul 2012 22:50:15 +0000 (22:50 +0000)]
Don't try to do RVO on block variables that refer to an enclosing local.

Fixes PR13314, clang crashing on blocks refering to an enclosing local
when the enclosing function returns void.

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

12 years agoStop instantiating a class if we hit a static_assert failure. Also, if the
Richard Smith [Wed, 11 Jul 2012 22:37:56 +0000 (22:37 +0000)]
Stop instantiating a class if we hit a static_assert failure. Also, if the
static_assert fails when parsing the template, don't diagnose it again on every
instantiation.

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

12 years agoFix warning.
Richard Smith [Wed, 11 Jul 2012 22:33:59 +0000 (22:33 +0000)]
Fix warning.

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

12 years agoEnable comment parsing and semantic analysis to emit diagnostics. A few
Dmitri Gribenko [Wed, 11 Jul 2012 21:38:39 +0000 (21:38 +0000)]
Enable comment parsing and semantic analysis to emit diagnostics.  A few
diagnostics implemented -- see testcases.

I created a new TableGen file for comment diagnostics,
DiagnosticCommentKinds.td, because comment diagnostics don't logically
fit into AST diagnostics file.  But I don't feel strongly about it.

This also implements support for self-closing HTML tags in comment
lexer and parser (for example, <br />).

In order to issue precise diagnostics CommentSema needs to know the
declaration the comment is attached to.  There is no easy way to find a decl by
comment, so we match comments and decls in lockstep: after parsing one
declgroup we check if we have any new, not yet attached comments.  If we do --
then we do the usual comment-finding process.

It is interesting that this automatically handles trailing comments.
We pick up not only comments that precede the declaration, but also
comments that *follow* the declaration -- thanks to the lookahead in
the lexer: after parsing the declgroup we've consumed the semicolon
and looked ahead through comments.

Added -Wdocumentation-html flag for semantic HTML errors to allow the user to
disable only HTML warnings (but not HTML parse errors, which we emit as
warnings in -Wdocumentation).

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

12 years agoIntroduce a flag in SourceManager to treat non-system source files
Argyrios Kyrtzidis [Wed, 11 Jul 2012 20:59:04 +0000 (20:59 +0000)]
Introduce a flag in SourceManager to treat non-system source files
as "volatile", meaning there's a high enough chance that they may
change while we are trying to use them.

This flag is only enabled by libclang.
Currently "volatile" source files will be stat'ed immediately
before opening them, because the file size stat info
may not be accurate since when we got it (e.g. from the PCH).
This avoids crashes when trying to reference mmap'ed memory
from a file whose size is not what we expect.

Note that there's still a window for a racing issue to occur
but the window for it should be way smaller than before.
We can consider later on to avoid mmap completely on such files.

rdar://11612916

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

12 years agoStart testing some commented-out cases of badly-formed __has_include.
Jordan Rose [Wed, 11 Jul 2012 20:12:19 +0000 (20:12 +0000)]
Start testing some commented-out cases of badly-formed __has_include.

Filed PR13334 for the cases that cause the compiler to crash, and
PR13335 for the cases where we should be recovering more gracefully.

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

12 years agoAllow -verify directives to be filtered by preprocessing.
Jordan Rose [Wed, 11 Jul 2012 19:58:23 +0000 (19:58 +0000)]
Allow -verify directives to be filtered by preprocessing.

This is accomplished by making VerifyDiagnosticsConsumer a CommentHandler,
which then only reads the -verify directives that are actually in live
blocks of code. It also makes it simpler to handle -verify directives that
appear in header files, though we still have to manually reparse some files
depending on how they are generated.

This requires some test changes. In particular, all PCH tests now have their
-verify directives outside the "header" portion of the file, using the @line
syntax added in r159978. Other tests have been modified mostly to make it
clear what is being tested, and to prevent polluting the expected output with
the directives themselves.

Patch by Andy Gibbs! (with slight modifications)

The new Frontend/verify-* tests exercise the functionality of this commit,
as well as r159978, r159979, and r160053 (Andy's other -verify enhancements).

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

12 years agoMove CompileAssert into namespace clang::ast_matchers:: to avoid naming
Daniel Jasper [Wed, 11 Jul 2012 19:22:37 +0000 (19:22 +0000)]
Move CompileAssert into namespace clang::ast_matchers:: to avoid naming
collisions until it is properly integrated in llvm/Support.

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

12 years agoAdd a hook to supply a custom CompilationDatabase. To add a custom CompilationDatabas...
Daniel Jasper [Wed, 11 Jul 2012 19:13:13 +0000 (19:13 +0000)]
Add a hook to supply a custom CompilationDatabase. To add a custom CompilationDatabase, make it implement findCompilationDatabaseForDirectory in CustomCompilationDatabase.h and set USE_COSTUM_COMPILATION_DATABASE.

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

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

12 years ago[driver] Fix so that clang can find correct path prefix for libc object files
Chad Rosier [Wed, 11 Jul 2012 19:08:21 +0000 (19:08 +0000)]
[driver] Fix so that clang can find correct path prefix for libc object files
from GNU binutils supporting multi-arch folder for ARM target.
Patch by Jiangning Liu <jiangning.liu@arm.com>.

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

12 years agoHandle #pragma visibility in explicit specializations and enums.
Rafael Espindola [Wed, 11 Jul 2012 18:14:09 +0000 (18:14 +0000)]
Handle #pragma visibility in explicit specializations and enums.

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

12 years agoMention -fms-compatibility and -fdelayed-template-parsing in UsersManual.
Nico Weber [Wed, 11 Jul 2012 16:56:28 +0000 (16:56 +0000)]
Mention -fms-compatibility and -fdelayed-template-parsing in UsersManual.

Also mention that -std=c++11 is now on by default on windows.

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