Commit Graph

50073 Commits

Author SHA1 Message Date
Rafael Espindola 2a008784d3 Use the simpler version of llvm::sys::fs::remove when possible.
llvm-svn: 198957
2014-01-10 21:32:14 +00:00
Richard Smith c0a5d5bc4f Downgrade bogus ExtWarn on duplicate 'friend' specifier to a Warning, and add a
Warning for a duplicate 'constexpr' specifier.

llvm-svn: 198956
2014-01-10 21:27:55 +00:00
Jordan Rose 1a866cd54b [analyzer] Model getters of known-@synthesized Objective-C properties.
...by synthesizing their body to be "return self->_prop;", with an extra
nudge to RetainCountChecker to still treat the value as +0 if we have no
other information.

This doesn't handle weak properties, but that's mostly correct anyway,
since they can go to nil at any time. This also doesn't apply to properties
whose implementations we can't see, since they may not be backed by an
ivar at all. And finally, this doesn't handle properties of C++ class type,
because we can't invoke the copy constructor. (Sema has actually done this
work already, but the AST it synthesizes is one the analyzer doesn't quite
handle -- it has an rvalue DeclRefExpr.)

Modeling setters is likely to be more difficult (since it requires
handling strong/copy), but not impossible.

<rdar://problem/11956898>

llvm-svn: 198953
2014-01-10 20:06:06 +00:00
Fariborz Jahanian 26cb6d90b8 ObjectiveC. Remove warning on mismatched methods
which may belong to unrelated classes. It was
primarily intended for miuse of @selector expression.
But warning is too noisy and will be issued when
an actual @selector is used. // rdar://15740134

llvm-svn: 198952
2014-01-10 19:27:21 +00:00
Jakob Stoklund Olesen 0e38aade94 Implement -m32 and -m64 with llvm::Triple functions.
Don't repeat the 32 <-> 64 architecture mapping incompletely.

llvm-svn: 198943
2014-01-10 15:25:23 +00:00
Alp Toker 9f1d619c07 Remove unexpected code completion handling from ConsumeToken()
With this change tok::code_completion is finally handled exclusively as a
special token kind like other tokens that need special treatment.

All callers have been updated to use the specific token consumption methods and
the parser has a clear idea the current token isn't special by the time
ConsumeToken() gets called, so this has been unreachable for some time.

ConsumeAnyToken() behaviour is unchanged and will continue to support
unexpected code completion as part of the special token path.

This survived an amount of fuzzing and validation, but please ping the list if
you hit a code path that previously relied on the old unexpected handler and
now asserts.

llvm-svn: 198942
2014-01-10 14:37:02 +00:00
Kristof Beyls fb38729d78 Enable -fuse-init-array for all AArch64 ELF targets by default, not just linux.
llvm-svn: 198940
2014-01-10 13:44:34 +00:00
Rafael Espindola 26d0f7ce7d Use 'w' instead of 'c' to represent the win32 mangling.
This change was requested to avoid confusion if we ever support non windows
coff systems.

llvm-svn: 198939
2014-01-10 13:42:17 +00:00
Alp Toker b630b9d20a Update LangOpt descriptions
Based on recent discussions, attempt to provide a clearer distinction between
MicrosoftMode and MicrosoftExt. This still doesn't feel perfect but gives a
better idea which is which.

Also update the CPlusPlus11 description which got missed in r171367.

C++0x is dead, long live C++0x!

llvm-svn: 198936
2014-01-10 11:19:45 +00:00
Alp Toker 9765056178 TryConsume parser cleanups
Also move some comments into the block they were meant to describe.

llvm-svn: 198935
2014-01-10 11:19:30 +00:00
Daniel Jasper 4d7a97adfc clang-format: Slightly adapt line break in edge case.
Before:
  SomeMap[std::pair(aaaaaaaaaaaa, bbbbbbbbbbbbbbb)]
      .insert(ccccccccccccccccccccccc);

After:
  SomeMap[std::pair(aaaaaaaaaaaa, bbbbbbbbbbbbbbb)].insert(
      ccccccccccccccccccccccc);

This seems to be about 3:1 more common in Google and Chromium style and I found
only a handful of instances inside the LLVM codebase.

llvm-svn: 198924
2014-01-10 08:40:17 +00:00
Jakob Stoklund Olesen 73cb84c271 Use the right dynamic linker for SPARC Linux executables.
llvm-svn: 198923
2014-01-10 08:18:34 +00:00
Kostya Serebryany a6afef7a51 reapply r198858: Disable LeakSanitizer in TableGen binaries, see PR18325; this time LeakSanitizerIsTurnedOffForTheCurrentProcess is used instead of __lsan_is_turned_off
llvm-svn: 198922
2014-01-10 08:05:42 +00:00
Daniel Jasper b1c19f8987 clang-format: Understand ObjC boxed expressions.
Before:
  [dictionary setObject:@(1)forKey:@"number"];
After:
  [dictionary setObject:@(1) forKey:@"number"];

llvm-svn: 198920
2014-01-10 07:44:53 +00:00
Jakob Stoklund Olesen b3f938ee87 Locate GCC installations on SPARC systems.
llvm-svn: 198918
2014-01-10 06:53:02 +00:00
Richard Trieu c38786be00 Make the tautological out of range warning use Sema::DiagRuntimeBehavior so that
the warning will not trigger on code protected by compile time checks.

llvm-svn: 198913
2014-01-10 04:38:09 +00:00
Jakob Stoklund Olesen 91a8e03af0 Give the linker the right ELF type for SPARC targets.
llvm-svn: 198912
2014-01-10 03:51:33 +00:00
Jakob Stoklund Olesen 2490e553c0 Pass -32/-64 to the assembler when building for sparc/sparc64.
llvm-svn: 198911
2014-01-10 03:51:29 +00:00
Warren Hunt f4518def33 [ms-abi] Handle __declspec(align) on bitfields "properly"
__declspec(align), when applied to bitfields affects their perferred 
alignment instead of their required alignment.  We don't know why.  
Also, #pragma pack(n) turns packing *off* if n is greater than the 
pointer size.  This is now observable because of the impact of 
declspec(align) on bitfields.

llvm-svn: 198907
2014-01-10 01:28:05 +00:00
NAKAMURA Takumi ae6f9d4460 CGRecordLayoutBuilder.cpp: Clarify if-else. [-Wdangling-else]
llvm-svn: 198906
2014-01-10 00:54:50 +00:00
Fariborz Jahanian 65b1377911 ObjectiveC. 1) Warn when @dynamic (as well as synthesize)
property has the naming convention that implies 'ownership'.
2) improve on diagnostic and make it property specific.
3) fix the line number in the case of default property
synthesis. // rdar://15757510

llvm-svn: 198905
2014-01-10 00:53:48 +00:00
Richard Smith 7073a2da15 Reapply r198845, reverted in r198849, with a fix to make it valid C++98, not
just valid C++11 =)

Original commit message:

PR18427: Use an appropriately-aligned buffer in APValue, to avoid a crash on
SPARC, where uint64_t apparently requires higher alignment than void*.

llvm-svn: 198903
2014-01-10 00:40:45 +00:00
Warren Hunt 640015cbc3 [ms-abi] Fixing CGRecordLayoutBuilder w.r.t. MS NonVirutalBase Layout
The MS abi lays out *all* non-virtual bases with leading vfptrs before 
laying out non-virutal bases without vfptrs.  This guarantees that the 
primary base is laid out first.  r198818 fixed RecordLayoutBuilder to 
produce compatiable layouts.  This patch fixes CGRecordLayoutBuilder to 
be able to consume those layouts and produce meaningful output without 
tripping any asserts about assumed incoming layout.

A test case is included that shows CGRecordLayoutBuilder in fact 
produces output in the compatiable order.

llvm-svn: 198900
2014-01-09 23:51:31 +00:00
Aaron Ballman a4bb4b9f0b Updating documentation for the __has_attribute changes landed in r198897.
llvm-svn: 198899
2014-01-09 23:11:13 +00:00
Aaron Ballman 0fa06d879a __has_attribute now understands target-specific attributes. So when you ask whether an ARM target has the "interrupt" attribute, it will return true for ARM and MSP430 targets, and false for others.
llvm-svn: 198897
2014-01-09 22:57:44 +00:00
Aaron Ballman ab7691c4ce Removing the notion of TargetAttributesSema and replacing it with one where the parsed attributes are responsible for knowing their target-specific nature, instead of letting Sema figure it out. This is necessary so that __has_attribute can eventually determine whether a parsed attribute applies to the given target or not.
llvm-svn: 198896
2014-01-09 22:48:32 +00:00
Alp Toker 98571fd9b7 Fix ast-dump-color.cpp test following r198883
The commit added a source location that used to be missing from the AST.

llvm-svn: 198892
2014-01-09 21:43:39 +00:00
Rafael Espindola 3cc5c2df9b Use getPointerSizeInBits.
I introduced this bug in 198815. Thanks for Mark Lacey for noticing.
Unfortunately, I have no idea how to test this code.

llvm-svn: 198891
2014-01-09 21:32:51 +00:00
Ben Langmuir de04923344 Preserve -fretain-comments-from-system-headers in modules
Preserves the setting of -fretain-comments-from-system-headers when
building/saving/loading module files. This allows code completion to pick up
documentation comments from system modules.

llvm-svn: 198890
2014-01-09 20:53:49 +00:00
Ted Kremenek ce0e3f8a09 Have attribute 'objc_precise_lifetime' suppress -Wunused.
Fixes <rdar://problem/15596883>

In ARC, __attribute__((objc_precise_lifetime)) guarantees that the
object stored in it will survive to the end of the variable's formal
lifetime.  It is therefore useful even if it completely unused.

llvm-svn: 198888
2014-01-09 20:19:45 +00:00
Aaron Ballman 7c1fcf8b2c Attempting to appease the build bots on systems with ansi escape sequences.
llvm-svn: 198887
2014-01-09 20:12:12 +00:00
Alp Toker 96af9886ef Revert "Disable LeakSanitizer in TableGen binaries, see PR18325"
To declare or define reserved identifers is undefined behaviour in standard
C++. This needs to be addressed in compiler-rt before it can be used in LLVM.

See the list discussion for details.

This reverts commit r198858.

llvm-svn: 198885
2014-01-09 19:43:17 +00:00
Aaron Ballman 15b27b97b7 Removing a bit of custom parsing functionality used by the thread safety analysis APIs. Now using tablegen to determine whether an attribute's arguments should be parsed in an unevaluated context instead of relying on a separate, hard-coded list of attributes.
llvm-svn: 198883
2014-01-09 19:39:35 +00:00
Daniel Jasper 174b012524 clang-format: Add @s when breaking NSString literals.
While it is allowed to not have an @ on subsequent lines, it seems
general practice to add them. If undesired, the code author can easily
remove them again and clang-format won't re-add them.

llvm-svn: 198871
2014-01-09 14:18:12 +00:00
Daniel Jasper dc32c1bf3a clang-format: Understand #pragma mark
Before:
  #pragma mark Any non - hyphenated or hyphenated string(including parentheses).
After:
  #pragma mark Any non-hyphenated or hyphenated string (including parentheses).

llvm-svn: 198870
2014-01-09 13:56:49 +00:00
Daniel Jasper 0160347b22 clang-format: Some tweaks to braces list formatting:
- Format a braced list with one element per line if it has nested
  braced lists.
- Use a column layout only when the list has 6+ elements (instead of the
  current 4+ elements).

llvm-svn: 198869
2014-01-09 13:42:56 +00:00
Pekka Jaaskelainen 3587b32e1c The OpenCL specification states that images are allocated
from the global address space (6.5.1 of the OpenCL 1.2 specification).
This makes clang construct the image arguments in the global address 
space and generate the argument metadata with the correct address space 
descriptor. 

Patch by Pedro Ferreira!

llvm-svn: 198868
2014-01-09 13:37:30 +00:00
NAKAMURA Takumi af4480a121 check-clang: Add dependencies to PrintFunctionNames and SampleAnalyzerPlugin, for r198747 and r198820.
llvm-svn: 198867
2014-01-09 13:26:02 +00:00
Kostya Serebryany bc60254543 Disable LeakSanitizer in TableGen binaries, see PR18325
llvm-svn: 198858
2014-01-09 09:26:26 +00:00
Kostya Serebryany ba4acedb69 Fix leak in lib/CodeGen/CGException.cpp, PR18318
Summary: This fixes the leak described in http://llvm.org/bugs/show_bug.cgi?id=18318

Reviewers: chandlerc, dblaikie

Reviewed By: chandlerc

CC: cfe-commits

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

llvm-svn: 198857
2014-01-09 09:22:32 +00:00
Argyrios Kyrtzidis 006a05bcac In areVectorOperandsLaxBitCastable() allow bitcast between a vector and scalar.
rdar://15779837.

llvm-svn: 198856
2014-01-09 07:58:22 +00:00
Argyrios Kyrtzidis 62a85daecd Revert "PR18427: Use an appropriately-aligned buffer in APValue, to avoid a crash on"
It broke building.
This reverts commit r198845.

llvm-svn: 198849
2014-01-09 05:01:04 +00:00
Richard Smith e2f4a2744c PR18427: Use an appropriately-aligned buffer in APValue, to avoid a crash on
SPARC, where uint64_t apparently requires higher alignment than void*.

llvm-svn: 198845
2014-01-09 03:29:54 +00:00
Chandler Carruth 439991d7e3 Update Clang's CFGBlock interface to conform to the strange part of
LLVM's Value interface which is used in LLVM's DominatorTree analysis
and which changed in LLVM r198836.

The DominatorTree analysis is actually a generic graph analysis and
should be moved to LLVM's support library to clarify that Clang and
others are using it with arbitrary graphs. Further, it seems likely that
it should be using something other than printAsOperand, but this is
a simpler build fix. I'll clean this up later.

llvm-svn: 198840
2014-01-09 02:56:16 +00:00
David Blaikie 461f1eaaa1 Fix the clang -Werror build after r198818
llvm-svn: 198837
2014-01-09 02:34:06 +00:00
Richard Smith 83b11aae18 PR18401: Fix assert by implementing the current proposed direction of core
issue 1430. Don't allow a pack expansion to be used as an argument to an alias
template unless the corresponding parameter is a parameter pack.

llvm-svn: 198833
2014-01-09 02:22:22 +00:00
Warren Hunt b700566a3a [ms-abi] Fixed failing lit test.
This test adjustment was missing from the previous patch.

llvm-svn: 198822
2014-01-09 00:48:32 +00:00
Alp Toker 099d4ee125 Add a test for Static Analyzer checker plugins
llvm-svn: 198820
2014-01-09 00:47:40 +00:00
Warren Hunt d640d7d96e [ms-abi] Refactor Microsoft Record Layout
This patch refactors microsoft record layout to be more "natural".  The 
most dominant change is that vbptrs and vfptrs are injected after the 
fact.  This simplifies the implementation and the math for the offest 
for the first base/field after the vbptr.

llvm-svn: 198818
2014-01-09 00:30:56 +00:00
Rafael Espindola 0d84069e17 Used the DataLayout methods instead of the Module methods.
llvm-svn: 198815
2014-01-09 00:17:51 +00:00
Alp Toker bb4b86af83 Implement isCXX11FinalKeyword() in terms of isCXX11VirtSpecifier()
It's not worth keeping two copies of the identifier init and comparison code
just to save a pointer coparison.

This should reduce further once we get proper contextual keywords in the token
stream, so having the identifier checks in one place is a step towards that.

Cleanup only.

llvm-svn: 198814
2014-01-09 00:13:52 +00:00
Aaron Ballman 8c7817ebb1 Attempting a fix the build bots should be happier with. Amends 198804.
llvm-svn: 198805
2014-01-08 23:26:53 +00:00
Aaron Ballman 199a78935e Silencing an MSVC warning about control reaching the end of a non-void function.
llvm-svn: 198804
2014-01-08 23:08:41 +00:00
Alp Toker d839c82ac9 Ensure that ENABLE_SHARED is substituted for use in Windows builds
We (perhaps over-cautiously) disable the new plugin tests on static Windows
builds right now, matching what LLVM core does. This change was needed for the
lit check to work.

Thanks to Warren Hunt for spotting this.

llvm-svn: 198782
2014-01-08 20:06:24 +00:00
Argyrios Kyrtzidis 9308f0ae80 [Serialization] In ASTReader::getInputFile record it when we didn't find the file to avoid looking it up again.
Hopefully addresses rdar://14514222.

llvm-svn: 198781
2014-01-08 19:13:34 +00:00
Jordan Rose 656fdd55dd [analyzer] Warn about double-delete in C++ at the second delete...
...rather somewhere in the destructor when we try to access something and
realize the object has already been deleted. This is necessary because
the destructor is processed before the 'delete' itself.

Patch by Karthik Bhat!

llvm-svn: 198779
2014-01-08 18:46:55 +00:00
Benjamin Kramer e21cb74224 clang-format: Don't hang forever when encountering a stray "}" in an @implementation block.
PR18406.

llvm-svn: 198770
2014-01-08 15:59:42 +00:00
Daniel Jasper 7620b6628b clang-format: Fix spacing in Cpp11 braced lists:
Before:
  vector<int> foo{ ::SomeFunction()};

After:
  vector<int> foo{::SomeFunction()};

llvm-svn: 198769
2014-01-08 15:41:13 +00:00
Aaron Ballman b8c0adeac8 Treating the RegParmAttr as a TypeAttr because that is what it is.
Patch reviewed by Rafael Espindola.

llvm-svn: 198765
2014-01-08 13:23:01 +00:00
Alp Toker cdb4e2b783 Define ENABLE_CLANG_EXAMPLES instead of relying on BUILD_EXAMPLES
This is a further build fix attempt for r198747 on some Makefile builders where
the value wasn't set at all.

llvm-svn: 198764
2014-01-08 13:00:32 +00:00
Alp Toker a9fb3e94cf Prospective build fix for the Makefile system
llvm-svn: 198751
2014-01-08 12:03:17 +00:00
Alp Toker 70ff5d7378 Build fix following r198747
Convert CMake CLANG_BUILD_EXAMPLES to a boolean value for consumption by
Python, otherwise the raw config string gets passed through which may not be
0/1.

The if/else matches the technique used to solve the problem in LLVM's own
CMakeLists.txt.

llvm-svn: 198750
2014-01-08 11:55:49 +00:00
Rafael Espindola cf63c0d2d8 Use -std=gnu89 in tools/c-index-test/CMakeLists.txt
With the old use of -std=c89 off_t is not defined and the build fails.

This seems to be another variation of
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40278.

llvm-svn: 198748
2014-01-08 11:44:42 +00:00
Alp Toker 120dd1afaf Add tests for clang plugins
Somehow the entire plugin infrastructure went wholly untested until now.

The only plugins available for use in testing are the examples, so plugin tests
will only be run if CLANG_BUILD_EXAMPLES is enabled in the build.

(The examples should really be enabled by default, not just to aid testing but
also to prevent bitrot in some key user-facing code. I'll propose that
shortly.)

Requires supporting changes in LLVM r198746.

llvm-svn: 198747
2014-01-08 11:38:47 +00:00
Jiangning Liu ca88f88330 For AArch64, support builtin neon vector type with 'long' as base element type.
llvm-svn: 198741
2014-01-08 07:51:48 +00:00
Richard Smith 26d11be738 RP18408: If a member template is used as a template template argument, it does
not cause the template specialization to have no linkage.

llvm-svn: 198726
2014-01-08 01:51:59 +00:00
Richard Smith 8bcc086e58 PR18400: ignore cv-qualifiers on the underlying type of an enumeration.
llvm-svn: 198723
2014-01-08 01:16:19 +00:00
Quentin Colombet 528ea63804 [Driver] Fix a typo in the setting of the arch name when -arch x86_64h is used.
<rdar://problem/15711488>

llvm-svn: 198722
2014-01-08 01:02:06 +00:00
Richard Smith 649c7b069f PR18234: Mark a tag definition as invalid early if it appears in a
type-specifier in C++. Some checks will assert in this case otherwise (in
particular, the access specifier may be missing if this happens inside a class
definition, due to a violation of an AST invariant).

llvm-svn: 198721
2014-01-08 00:56:48 +00:00
Adrian Prantl 56741e29d4 Re-applying r198699 after reverting r198461.
Debug info: Implement a cleaner version of r198461. For symmetry with
C and C++ don't emit an extra lexical scope for the compound statement
that is the body of an Objective-C method.

llvm-svn: 198715
2014-01-07 22:05:55 +00:00
Adrian Prantl e83b130def Revert "Debug info: Ensure that the last stop point in a function is still within"
This reverts commit r198461.

llvm-svn: 198714
2014-01-07 22:05:52 +00:00
Adrian Prantl c6758879b3 Revert "Debug info: Implement a cleaner version of r198461. For symmetry with"
This reverts commit 198699 so we can get a cleaner patch.

llvm-svn: 198713
2014-01-07 22:05:45 +00:00
Jordan Rose a63f229509 [analyzer] Files with .c extensions are still C++ files if the compiler is CXX.
PR18339

llvm-svn: 198711
2014-01-07 21:39:51 +00:00
Jordan Rose 514f935411 [analyzer] Pointers escape into +[NSValue valueWithPointer:]...
...even though the argument is declared "const void *", because this is
just a way to pass pointers around as objects. (Though NSData is often
a better one.)

PR18262

llvm-svn: 198710
2014-01-07 21:39:48 +00:00
Jordan Rose 6ad4cb4eca [analyzer] Remove unused ARCNotOwnedSymbol retain count return effect.
RetainCountChecker has to track returned object values to know if they are
retained or not. Under ARC, even methods that return +1 are tracked by the
system and should be treated as +0. However, this effect behaves exactly
like NotOwned(ObjC), i.e. a generic Objective-C method that actually returns
+0, so we don't need a special case for it.

No functionality change.

llvm-svn: 198709
2014-01-07 21:39:41 +00:00
Aaron Ballman 92e28e876d Updating the documentation about how to add attributes based on the rather extensive refactorings that have happened over the past several months.
llvm-svn: 198705
2014-01-07 20:12:20 +00:00
Nico Weber 7c81c4a354 [cmake] Write Version.inc at cmake time, not at build time.
In SVN checkouts, clang_revision_tag is rerun on every build, even if nothing
else is dirty.  After this change, Version.inc is only written at cmake time,
so that empty builds run 0 build steps (like r191784 apparently did for git).

llvm-svn: 198704
2014-01-07 20:10:39 +00:00
Adrian Prantl f5ff0dc29b Debug info: Implement a cleaner version of r198461. For symmetry with
C and C++ don't emit an extra lexical scope for the compound statement
that is the body of an Objective-C method.

rdar://problem/15010825

llvm-svn: 198699
2014-01-07 19:24:24 +00:00
Nico Weber b00d66e6ac Shorten the output of `clang-format --version`, include revision number.
Before:
  $ clang-format  --version
  LLVM (http://llvm.org/):
    LLVM version 3.5svn
    Optimized build with assertions.
    Built Jan  3 2014 (14:28:46).
    Default target: x86_64-apple-darwin13.0.0
    Host CPU: core-avx-i

Now:
  $ bin/clang-format --version
  clang-format version 3.5 (198452)

llvm-svn: 198694
2014-01-07 16:27:35 +00:00
Rafael Espindola b098f5c7b8 Remove unused include.
llvm-svn: 198692
2014-01-07 15:11:31 +00:00
Chandler Carruth 58c0d69689 Update Clang for the move of headers in r198688.
llvm-svn: 198689
2014-01-07 12:34:48 +00:00
Chandler Carruth 5553d0d4ca Sort all the #include lines with LLVM's utils/sort_includes.py which
encodes the canonical rules for LLVM's style. I noticed this had drifted
quite a bit when cleaning up LLVM, so wanted to clean up Clang as well.

llvm-svn: 198686
2014-01-07 11:51:46 +00:00
Argyrios Kyrtzidis d07dcdb958 For areVectorOperandsLaxBitCastable(), only return false if both opearands are vector types
and add a diagnostic when the operand is a vector and non-scalar value.

rdar://15722301

llvm-svn: 198680
2014-01-07 07:59:31 +00:00
Chandler Carruth acafded69c Fix a -Wparentheses warning from GCC that caught a badly formed assert.
I have no idea why Clang's warning doesn't fire here, looks like a Clang
bug. I'll investigate that separately.

llvm-svn: 198677
2014-01-07 06:52:12 +00:00
Justin Bogner 529f6dd89b CodeGen: Include llvm/Config/config.h for strtoll on Windows
llvm-svn: 198672
2014-01-07 03:43:15 +00:00
Alp Toker cc22327348 Fix 'unkown' typo in test -target from r198321
llvm-svn: 198671
2014-01-07 02:47:19 +00:00
Adrian Prantl d09906ff9c update comment.
llvm-svn: 198670
2014-01-07 02:40:59 +00:00
Alp Toker f990cefc7e Bring back magic constants in the digraph diagnostic
This backs out changes in commit r198605 and part of r198604, replacing the
original tok::kw_template with a slightly more obvious placeholder
tok::unknown.

llvm-svn: 198666
2014-01-07 02:35:33 +00:00
Adrian Prantl a763447124 Implement a new -fstandalone-debug option. rdar://problem/15685848
It controls everything that -flimit-debug-info used to, plus the
vtable type optimization. The old -fno-limit-debug-info option is now an
alias to -fstandalone-debug and vice versa.

Standalone is the default on Darwin until dtrace is updated to work with
non-standalone debug info (rdar://problem/15758808).

Note: I kept the LimitedDebugInfo name in CodeGenOptions::DebugInfoKind
because NoStandaloneDebugInfo sounded even more confusing.

llvm-svn: 198655
2014-01-07 01:19:08 +00:00
Fariborz Jahanian f1a66de5b9 ObjectiveC. Computation of offsets when doing @encode type encoding
is only used in an assert. Do not do it if assert is not on.

llvm-svn: 198652
2014-01-07 01:02:50 +00:00
NAKAMURA Takumi f0f82175c8 clang/test/CodeGenCXX/instr-profile.cpp: Appease -Asserts.
FIXME: Don't seek bb labels, like "if.else"
llvm-svn: 198651
2014-01-07 00:59:39 +00:00
Justin Bogner ea278c3249 CodeGen: Sentences end with a period
llvm-svn: 198649
2014-01-07 00:20:28 +00:00
Ted Kremenek b2166d8ef3 Properly sort CMake list. NFC.
llvm-svn: 198645
2014-01-06 23:20:52 +00:00
Justin Bogner ef512b9929 CodeGen: Initial instrumentation based PGO implementation
llvm-svn: 198640
2014-01-06 22:27:43 +00:00
Justin Bogner 6a9d2cfadd Driver: Accept -fprofile-instr-use and -fprofile-instr-generate
These flags will be used for instrumentation based PGO.

llvm-svn: 198639
2014-01-06 22:27:36 +00:00
Alp Toker b3f9501b25 Prospective MSVC 2010 build fix
Try to fix Compiler Error C2011 following r198607 by removing enum from 'enum
TokenKind' parameter types.

llvm-svn: 198621
2014-01-06 15:52:13 +00:00
Alp Toker e9ab39da86 Correct underlying integer type of enum TokenKind
This matches up the underlying type against the actual storage type 'unsigned
short' and lets us get rid of some casts while we're at it.

Effort is made to keep this building in pre-C++11 but as with other features
Token will be less efficiently packed in in legacy configurations.

llvm-svn: 198607
2014-01-06 12:54:51 +00:00
Alp Toker 01d65e1387 Simplify diagnostic tag type using the token kind formatter
As far as the parser is concerned the tag type is always a keyword.

llvm-svn: 198606
2014-01-06 12:54:41 +00:00
Alp Toker addd3669d4 Don't use magic constants in the digraph diagnostic
llvm-svn: 198605
2014-01-06 12:54:32 +00:00
Alp Toker a231ad2216 Support diagnostic formatting of keyword tokens
Implemented with a new getKeywordSpelling() accessor. Unlike getTokenName() the
result of this function is stable and may be used in diagnostic output.

Uses of this feature are split out into the subsequent commit.

llvm-svn: 198604
2014-01-06 12:54:18 +00:00
Alp Toker 6d35eab5a6 Rename getTokenSimpleSpelling() to getPunctuatorSpelling()
That's what it does, what the documentation says it does and what callers
expect it to do.

llvm-svn: 198603
2014-01-06 12:54:07 +00:00
Alp Toker b9fa512954 Highlight the previous underlying enum type when diagnosing a mismatch
enum-scoped.cpp:93:6: error: enumeration redeclared with different underlying type 'short' (was 'int')
  enum Redeclare6 : short;
       ^
enum-scoped.cpp:92:6: note: previous declaration is here
  enum Redeclare6 : int;
       ^            ~~~

The redeclaration source range is still missing but this is a step forward,
potentially edging towards a FixIt.

llvm-svn: 198601
2014-01-06 11:31:18 +00:00
Alp Toker 8c44db50d6 Diagnose enum redeclarations properly
In all three checks, the note indicates a previous declaration and never a 'use'.

Before:

  enum-scoped.cpp:92:6: note: previous use is here
    enum Redeclare6 : int;
         ^

After:

  enum-scoped.cpp:92:6: note: previous declaration is here
    enum Redeclare6 : int;
         ^

llvm-svn: 198600
2014-01-06 11:31:06 +00:00
Alp Toker 6e97a69200 Use token kind instead of '%select{.|->}0' in diagnostic
llvm-svn: 198599
2014-01-06 11:30:41 +00:00
Alp Toker 637b347ed0 Apply some LLVM_READONLY / LLVM_READNONE on diagnostic functions
llvm-svn: 198598
2014-01-06 11:30:15 +00:00
Joey Gouly 16cb99dd15 [OpenCL] Produce an error if an address space is used on the return
type of a function.

llvm-svn: 198597
2014-01-06 11:26:18 +00:00
Aaron Ballman 0e468c02bc This helper method isn't needed, and it's unsafe for it to use StringRef in the first place. Replaced the unsafe code with the proper accessor.
llvm-svn: 198569
2014-01-05 21:08:29 +00:00
Daniel Jasper 1a148b4922 clang-format: Spacing inside enum braces.
Before (in Google style):
  enum ShortEnum {A, B, C};

After:
  enum ShortEnum { A, B, C };

llvm-svn: 198559
2014-01-05 13:23:23 +00:00
Daniel Jasper 9697281eec clang-format: Allow formatting short enums on a single line.
Before:
  enum ShortEnum {
    A,
    B,
    C
  };

After:
  enum ShortEnum { A, B, C };

This seems to be the predominant choice in LLVM/Clang as well as in
Google style.

llvm-svn: 198558
2014-01-05 12:38:10 +00:00
Alp Toker 8db6e7a972 Fix 'declartion' typos
llvm-svn: 198549
2014-01-05 06:38:57 +00:00
Alp Toker ab1b1dcea7 Pre-declare '::type_info' in MicrosoftMode only, not MicrosoftExt
It was previously enabled in both but should only have been part of the drop-in
quirks mode that is 'MicrosoftMode' given that it's only useful for
compatibility with the Microsoft headers/runtime.

llvm-svn: 198548
2014-01-05 06:38:18 +00:00
Alp Toker c090ae763a Tweak the parse recovery in r198540
Cover a hypothetical case when we might not have reached the final argument
declaration for some reason during recovery, and split out for readability.

llvm-svn: 198542
2014-01-05 04:17:27 +00:00
Alp Toker eec8101b9b Fix bungled parse recovery in K&R function declarations
void knrNoSemi(i) int i { }

Adherents of The C Programming Language unfortunate enough to miss a semicolon
as above would be met with a cascade of errors spanning the remainder of the
TU.

This patch introduces a beautiful parse error recovery, complete with helpful
FixIt to restore sanity.

Before (output redacted for brevity):

  error: 'error' diagnostics seen but not expected:
    File declarators.c Line 119: declaration does not declare a parameter
    File declarators.c Line 123: declaration does not declare a parameter
    File declarators.c Line 127: parameter named 'func_E12' is missing
    File declarators.c Line 127: expected ';' at end of declaration
    File declarators.c Line 133: parameter named 'func_E13' is missing
    File declarators.c Line 133: expected ';' at end of declaration
    File declarators.c Line 139: parameter named 'func_E14' is missing
    File declarators.c Line 139: expected ';' at end of declaration
    File declarators.c Line 145: parameter named 'func_E15' is missing
    File declarators.c Line 145: expected ';' at end of declaration
    File declarators.c Line 150: expected function body after function declarator
    File declarators.c Line 119: declaration of 'enum E11' will not be visible outside of this function
    File declarators.c Line 123: declaration of 'enum E12' will not be visible outside of this function
    File declarators.c Line 133: ISO C forbids forward references to 'enum' types
    File declarators.c Line 133: declaration of 'enum E13' will not be visible outside of this function
    File declarators.c Line 139: ISO C forbids forward references to 'enum' types
    File declarators.c Line 139: declaration of 'enum E14' will not be visible outside of this function
    File declarators.c Line 145: ISO C forbids forward references to 'enum' types
    File declarators.c Line 145: declaration of 'enum E15' will not be visible outside of this function
    ...

After:

  declarators.c:103:24: error: expected ';' at end of declaration
  void knrNoSemi(i) int i { }
                         ^
                         ;

Patch found in a sealed envelope dated 1978 with the message "Do not open until
January 2014"

llvm-svn: 198540
2014-01-05 03:27:57 +00:00
Alp Toker 094e521e3f Parse: Token consumption modernization and loop de-nesting
Cleanup only.

llvm-svn: 198539
2014-01-05 03:27:11 +00:00
Alp Toker 59226f7811 Revert "ToolingTest.cpp: Fix r158592, runToolOnCode.FindsNoTopLevelDeclOnEmptyCode on msvc. LangOpts.MicrosoftExt still appends "class type_info;"."
type_info has been made an implicitly predeclared type in r198497 and will no
longer appear as a user-declared type so we can remove this old hack.

This reverts commit r158595.

llvm-svn: 198502
2014-01-04 15:58:28 +00:00
Alp Toker e1fab52688 Move MS predefined type_info out of InitializePredefinedMacros
Instead of keeping it in amongst the macros, build the declaration at Sema init
the same way we do with other predeclared and builtin types.

In practice this means the declaration is marked implicit and therefore won't
show up as an unwanted user-declared type in tooling which has been a
frequently reported issue (though I haven't been able to cook up a test).

llvm-svn: 198497
2014-01-04 15:25:02 +00:00
Alp Toker ef6b007dc5 Only mark dump() function definitions 'used' in debug builds
This has the dual effect of (1) enabling more dead-stripping in release builds
and (2) ensuring that debug helper functions aren't stripped away in debug
builds, as they're intended to be called from the debugger.

Note that the attribute is applied to definitions rather than declarations in
headers going forward because it's now conditional on NDEBUG:

  /// \brief Mark debug helper function definitions like dump() that should not be
  /// stripped from debug builds.

Requires corresponding macro added in LLVM r198456.

llvm-svn: 198489
2014-01-04 13:47:14 +00:00
Argyrios Kyrtzidis d03fc4d4e1 Add an additional check in test/Sema/ext_vector_casts.c
llvm-svn: 198479
2014-01-04 06:27:45 +00:00
Ted Kremenek 776409286b [analyzer] Remove IdempotentOperations checker.
This checker has not been updated to work with interprocedural analysis,
and actually contains both logical correctness issues but also
memory bugs.  We can resuscitate it from version control once there
is focused interest in making it a real viable checker again.

llvm-svn: 198476
2014-01-04 05:52:11 +00:00
Argyrios Kyrtzidis eb68f6a9de [Sema] When checking if a bitcast is appropriate between vector types, take into
consideration the num-of-elements*width-of-element width.

Disallow casts when such width is not equal between the vector types otherwise
we may end up with an invalid LLVM bitcast.

rdar://15722308.

llvm-svn: 198474
2014-01-04 03:31:22 +00:00
Richard Trieu 658eb68e82 Ignore qualified templated functions for -Winfinite-recursion. This treats
functions like Foo<5>::run() the same way as run<5>() for this warning.

llvm-svn: 198470
2014-01-04 01:57:42 +00:00
Reid Kleckner 5f08094106 [ms-cxxabi] Improve vbtable name mangling accuracy
Summary:
This makes us more compatible with MSVC 2012+ and fixes PR17748 where we
would give two tables the same name.

Rather than doing a fresh depth-first traversal of the inheritance graph
for every record's vbtables, now we memoize vbtable paths for each
record.  By doing memoization, we end up considering virtual bases of
subobjects that come later in the depth-first traversal.  Where
previously we would have ignored a virtual base that we'd already seen,
we now consider it for name mangling purposes without emitting a
duplicate vbtable for it.

Reviewers: majnemer

CC: cfe-commits

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

llvm-svn: 198462
2014-01-03 23:42:00 +00:00
Adrian Prantl 96e70d9148 Debug info: Ensure that the last stop point in a function is still within
the lexical block formed by the compound statement that is the function
body.

rdar://problem/15010825

llvm-svn: 198461
2014-01-03 23:34:30 +00:00
Aaron Ballman 69714e78e0 Refactored Builtin::Context::isPrintfLike and isScanfLike into a helper function. The implementations are identical, except for the format arguments being searched for.
No functional changes intended.

llvm-svn: 198446
2014-01-03 20:10:54 +00:00
Argyrios Kyrtzidis 98045c1a23 Fix 80 col violation.
llvm-svn: 198444
2014-01-03 19:53:09 +00:00
Argyrios Kyrtzidis d8a35325a2 Pass the decl directly to the diagnostic, no need to call getDeclName().
llvm-svn: 198442
2014-01-03 19:39:23 +00:00
Aaron Ballman 68af21c975 Fixing a FIXME; the RetTy template parameter is always bool in practice, and so it has been removed. No functional changes intended.
llvm-svn: 198440
2014-01-03 19:26:43 +00:00
Rafael Espindola c418ae93a8 Update for llvm's DataLayout including mangling information.
llvm-svn: 198439
2014-01-03 19:22:05 +00:00
Aaron Ballman 1d17bde708 Marked the default constructor as an LLVM_DELETED_FUNCTION.
llvm-svn: 198435
2014-01-03 18:51:47 +00:00
Aaron Ballman 75ee4cc830 Removed one of the string versions of getQualifiedNameAsString, and switched over to using printQualifiedName where possible. No functional changes intended.
llvm-svn: 198433
2014-01-03 18:42:48 +00:00
Argyrios Kyrtzidis 2080d90f37 [objc] Refactor and improve functionality for the -Wunused-property-ivar warning.
- Remove the additions to ObjCMethodDecl & ObjCIVarDecl that were getting de/serialized and consolidate
  all functionality for the checking for this warning in Sema::DiagnoseUnusedBackingIvarInAccessor
- Don't check immediately after the method body is finished, check when the @implementation is finished.
  This is so we can see if the ivar was referenced by any other method, even if the method was defined after the accessor.
- Don't silence the warning if any method is called from the accessor silence it if the accessor delegates to another method via self.

rdar://15727325

llvm-svn: 198432
2014-01-03 18:32:18 +00:00
Rafael Espindola 29db13a753 Reformat the description strings. No functionality change.
llvm-svn: 198430
2014-01-03 18:13:17 +00:00
Aaron Ballman 7cb6741b3b We haven't cared about VS 2005 in a long time, and VS 2003 in even longer.
llvm-svn: 198429
2014-01-03 18:10:25 +00:00
Aaron Ballman b190f974c9 Fixed a FIXME; created a print method for Selectors that accepts a raw_ostream, and started using it in places it made sense.
No functional changes intended, just API cleanliness.

llvm-svn: 198428
2014-01-03 17:59:55 +00:00
Alexander Kornienko 6de39492da Make clang::ento::CreateAnalysisConsumer a part of a public interface of the static analyzer.
Summary:
This allows for a better alternative to the FrontendAction hack used in
clang-tidy in order to get static analyzer's ASTConsumer.

Reviewers: jordan_rose, krememek

Reviewed By: jordan_rose

CC: cfe-commits

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

llvm-svn: 198426
2014-01-03 17:23:10 +00:00
Aaron Ballman 2cfbc00506 Simplifying the mutual exclusion check now that the diagnostics engine knows how to handle Attr objects directly. Updates an associated test case due to the attribute name being properly quoted again.
llvm-svn: 198424
2014-01-03 16:23:46 +00:00
Joey Gouly b6eb314c3a [OpenCL] Add test case for previous commit.
llvm-svn: 198422
2014-01-03 15:11:57 +00:00
Aaron Ballman d1e6e141c1 Using the proper helper function instead of manually doing this work. No functional changes intended.
llvm-svn: 198421
2014-01-03 15:02:58 +00:00
Aaron Ballman b9bb201194 Removing some more unnecessary manual quotes from diagnostics.
llvm-svn: 198420
2014-01-03 14:54:10 +00:00
Aaron Ballman 691e2274f6 Removing an unneeded typecast. getScopeRep() already returns a NestedNameSpecifier.
llvm-svn: 198419
2014-01-03 14:48:20 +00:00
Aaron Ballman 1fb3955cee Removing some more unnecessary manual quotes from diagnostics.
llvm-svn: 198418
2014-01-03 14:23:03 +00:00
Joey Gouly 96b94e610b [OpenCL] Variables in the constant address space must be initialized.
llvm-svn: 198417
2014-01-03 14:16:55 +00:00
Aaron Ballman 5dff61d322 Removing some more unnecessary manual quotes from diagnostics.
llvm-svn: 198416
2014-01-03 14:06:37 +00:00
Aaron Ballman 4a97967b5f It turns out the problem was a bit more wide-spread. Removing a lot of unneeded typecasts. getScopeRep() already returns a NestedNameSpecifier.
No functional changes intended.

llvm-svn: 198414
2014-01-03 13:56:08 +00:00
Aaron Ballman 5fe6c805dc Removing an unneeded typecast. getScopeRep() already returns a NestedNameSpecifier.
llvm-svn: 198413
2014-01-03 13:45:46 +00:00
Aaron Ballman fee0cd45fe Removing some more unnecessary manual quotes from diagnostics. Updated the related test case to ensure correctness.
llvm-svn: 198412
2014-01-03 13:34:55 +00:00
Daniel Jasper 352dae199a clang-format: Recognize single-line macro usages inside macros.
Before:
  #define LIST(L)                                                     \
    L(FirstElement) L(SecondElement) L(ThirdElement) L(FourthElement) \
        L(FifthElement)

After:
  #define LIST(L)    \
    L(FirstElement)  \
    L(SecondElement) \
    L(ThirdElement)  \
    L(FourthElement) \
    L(FifthElement)

llvm-svn: 198407
2014-01-03 11:50:46 +00:00
Aaron Ballman 6d086d7dc1 Removing some more unnecessary manual quotes from diagnostics.
llvm-svn: 198395
2014-01-03 02:20:27 +00:00
Aaron Ballman 25dc1e1d19 Removing some more unnecessary manual quotes from attribute diagnostics.
llvm-svn: 198392
2014-01-03 02:14:08 +00:00
Aaron Ballman c0550740f0 Removing some more unnecessary manual quotes from attribute diagnostics.
llvm-svn: 198391
2014-01-03 02:07:43 +00:00