Commit Graph

49746 Commits

Author SHA1 Message Date
Alp Toker 5294e6e094 Don't reserve __builtin_types_compatible_p as a C++ keyword
Even g++ considers this a valid C++ identifier and it should only have been
visible in C mode.

Also drop the associated low-value diagnostic.

llvm-svn: 197995
2013-12-25 01:47:02 +00:00
Jiangning Liu 38799b1471 Add some missing test cases for ACLE intrinsics of AArch64 NEON.
llvm-svn: 197994
2013-12-25 01:23:43 +00:00
Nico Weber 428a93b8ab Add a FIXME to a failing test.
(See discussion in the bug for why this isn't XFAILed.)

llvm-svn: 197991
2013-12-24 20:48:13 +00:00
Daniel Jasper 234379fbf6 clang-format: (WebKit) Disallow 1-line constructors with initializers.
Before:
  Constructor() : a(a) {}

After:
  Constructor()
      : a(a)
  {
  }

This style guide is pretty precise about this.

llvm-svn: 197980
2013-12-24 13:31:25 +00:00
Alp Toker ec543279db Support and use token kinds as diagnostic arguments
Introduce proper facilities to render token spellings using the diagnostic
formatter.

Replaces most of the hard-coded diagnostic messages related to expected tokens,
which all shared the same semantics but had to be multiply defined due to
variations in token order or quote marks.

The associated parser changes are largely mechanical but they expose
commonality in whole chunks of the parser that can now be factored away.

This commit uses C++11 typed enums along with a speculative legacy fallback
until the transition is complete.

Requires corresponding changes in LLVM r197895.

llvm-svn: 197972
2013-12-24 09:48:30 +00:00
Alp Toker 61d41af46b Document the Message parameter of getCustomDiagID()
A lot of callers have been using this facility incorrectly.

llvm-svn: 197920
2013-12-23 21:00:35 +00:00
Adrian Prantl 5028dc0fca remove dead code.
llvm-svn: 197916
2013-12-23 19:10:57 +00:00
Alp Toker 5c494cbe98 Fix another misuse of getCustomDiagID()
There's no need to escape strings and generate new DiagIDs for each message.

llvm-svn: 197915
2013-12-23 17:59:59 +00:00
NAKAMURA Takumi d32e3ef349 clang/Analysis/FlowSensitive/DataflowSolver.h: <functional> should be just a STL header.
llvm-svn: 197912
2013-12-23 16:34:51 +00:00
Aaron Ballman 0390908588 Consolidating some mode attribute diagnostics. No functional changes intended.
llvm-svn: 197911
2013-12-23 15:23:11 +00:00
Daniel Jasper 9a26e77311 clang-format: Fix invalid write discovered by ASAN.
Introduced in r197900.

llvm-svn: 197906
2013-12-23 11:25:40 +00:00
Alp Toker b09e5af914 Add a missing pipe in the test from r197896
Spotted by Edward

llvm-svn: 197903
2013-12-23 08:50:43 +00:00
Alp Toker a8b02c2e46 TextDiagnosticBuffer: Fix copy-paste mistake in r197856
The TextDiagnosticBuffer is meant to scrub SourceLocations as the input/output
SourceManagers may be different.

To be safe this commit restores the original behaviour though in practice
all current users seem to share a single SM.

Would be nice to replace TextDiagnosticBuffer now that more capable interfaces
like CaptureDiagnosticConsumer / StoredDiagnosticConsumer exist.

llvm-svn: 197902
2013-12-23 07:47:48 +00:00
Daniel Jasper b88b25feec clang-format: Fix various problems in formatting ObjC blocks.
Among other things, this fixes llvm.org/PR15269.

llvm-svn: 197900
2013-12-23 07:29:06 +00:00
Hao Liu f96fd37888 [AArch64]The compare to zero intrinsics should be implemented by 'icmp/fcmp' and 'sext' not 'zext'. Modify the implementation by replacing zext with sext.
llvm-svn: 197898
2013-12-23 02:44:00 +00:00
Alp Toker 054f33c801 Make some f_Group definitions anonymous and test an alternative spelling
These names weren't referred to anywhere in the source so don't need a written
name.

Depends on the TableGen fix for anonymous records in LLVM r197869.

llvm-svn: 197896
2013-12-22 22:38:57 +00:00
Aaron Ballman 888e935978 Removing the alloc_size attribute. The attribute was semantically handled, but silently ignored. Most of this feature was already reverted in June 2012 (r159016), this just cleans up the pieces left over.
llvm-svn: 197866
2013-12-21 17:15:13 +00:00
Aaron Ballman bf7b1ee385 The const and nothrow attributes can be handled by the simple attribute handler. This removes a silent dropping of the attributes when they are duplicated on a Decl.
llvm-svn: 197864
2013-12-21 16:49:29 +00:00
Alp Toker bc043f27f4 Fix getCustomDiagID() usage in CodeGen and TextDiagnosticBuffer
DiagIDs are a cached resource generally only constructed from compile-time
constant or stable format strings.

Escaping arbitrary messages and constructing DiagIDs from them didn't make
sense.

llvm-svn: 197856
2013-12-21 05:20:03 +00:00
Alp Toker 9477f9e52f Fix getCustomDiagID() usage in example code
This was setting a bad example. DiagIDs are a limited resource and the message
argument is evaluated as a format string.

llvm-svn: 197855
2013-12-21 05:19:58 +00:00
Richard Trieu 2f024f432d Add -Winfinite-recursion to Clang
This new warning detects when a function will recursively call itself on every
code path though that function.  This catches simple recursive cases such as:

void foo() {
  foo();
}

As well as more complex functions like:

void bar() {
  if (test()) {
    bar();
    return;
  } else {
    bar();
  }
  return;
}

This warning uses the CFG.  As with other CFG-based warnings, this is off
by default.  Due to false positives, this warning is also disabled for
templated functions.

llvm-svn: 197853
2013-12-21 02:33:43 +00:00
NAKAMURA Takumi 38b8c938e8 [CMake] clang/lib/Headers: Install just-generated ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h, instead of copied arm_neon.h.
llvm-svn: 197852
2013-12-21 01:56:00 +00:00
Alp Toker a5d645976f Assert that tag decls are never marked (in)valid after definition is complete
Sema relies on this assumption.

Follow-up to r197848.

llvm-svn: 197850
2013-12-21 01:10:54 +00:00
Richard Trieu 0732beb21f Use this one little trick to prevent optimizers from removing an
intentional stack overflow.

llvm-svn: 197849
2013-12-21 01:04:02 +00:00
Nico Weber 7607fce112 Don't mark record decls invalid when one of its methods is invalid, PR18284.
Without this patch, record decls with invalid out-of-line method delcs would
sometimes be marked invalid, but not always.  With this patch, they are
consistently never marked invalid.

(The code to do this was added in
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20100809/033154.html
, but the test from that revision is still passing.)

As far as I can tell, this was the only place where a class was marked invalid
after its definition was complete.

llvm-svn: 197848
2013-12-21 00:49:51 +00:00
Reid Kleckner b60a3d5bc1 Eliminate the ItaniumVTableContext object from CodeGenVTables
Now CodeGenVTables has only one VTableContext object, which is either
Itanium or Microsoft.

Fixes a FIXME with no functionality change intended.

Ideally we could avoid the downcasts by pushing the things that
reference the Itanium vtable context into ItaniumCXXABI.cpp, but we're
not there yet.

llvm-svn: 197845
2013-12-20 23:58:52 +00:00
David Blaikie 3275dc4586 DebugInfo: Do not include implicit members (implicit special members, template instantiations, etc) in the list of members of a structure.
These members will still be lazily added to the relevant DWARF DIEs in
LLVM but when enumerating the members they will not appear. This allows
DWARF type units to be more consistent - the type unit will never
contain these special members (so all instances of the type should have
the same DIEs without some having some special members and others having
others) and the special members will be added to the skeletal
declaration that appears in the relevant compile_unit.

llvm-svn: 197844
2013-12-20 23:19:47 +00:00
Alp Toker 556b3d69c0 Remove obsolete preamble FIXME
The MD5 is checked since r197755 which is as good as comparing buffer contents
in this context.

llvm-svn: 197842
2013-12-20 22:27:20 +00:00
Rafael Espindola d5e81e59b5 Override the datalayout in a module with -triple.
This matches llc's behavior.

Before this patch clang would create a TargetInfo base on -triple but a llvm
CodeGen based on the triple in the module.

llvm-svn: 197837
2013-12-20 22:01:25 +00:00
Reid Kleckner d2d1cc5156 Compare canonical return types when generating MS C++ ABI vtable thunks
This was part of the cause for PR17655.  We were generating thunks when
we shouldn't have.  I suspect that if we tweak the test case for PR17655
to actually require thunks, we can reproduce the same crash.

llvm-svn: 197836
2013-12-20 21:44:05 +00:00
Alp Toker f4e2238119 Move the TargetMachine instance into EmitAssemblyHelper
Cleanup in preparation for enhanced DataLayout checking.

llvm-svn: 197832
2013-12-20 20:26:53 +00:00
Hans Wennborg e0053474b9 clang-cl: Support /P and /E (preprocess to file or stdout)
llvm-svn: 197827
2013-12-20 18:40:46 +00:00
Adrian Prantl 4efc805402 Remove an outdated statement about debugging optimized code.
llvm-svn: 197820
2013-12-20 17:39:42 +00:00
Adrian Prantl f418b10972 Document the -fno-limit-debug-info switch in the man page.
llvm-svn: 197819
2013-12-20 17:39:35 +00:00
Daniel Jasper 92669ee45c Enable layering check in unavailable modules.
If a header file belonging to a certain module is not found on the
filesystem, that header gets marked as unavailable. Now, the layering
warning (-fmodules-decluse) should still warn about headers of this
module being wrongfully included. Currently, headers belonging to those
modules are just treated as not belonging to modules at all which means
they can be included freely from everywhere.

To implement this (somewhat) cleanly, I have moved most of the layering
checks into the ModuleMap. This will also help with showing FixIts
later.

llvm-svn: 197805
2013-12-20 12:09:36 +00:00
Daniel Jasper 04b6a081fc clang-format: Better support for multi-line wide string literals.
Before:
  SomeFunction(L"A" L"B");

After:
  SomeFunction(L"A"
               L"B");

llvm-svn: 197785
2013-12-20 06:22:01 +00:00
Argyrios Kyrtzidis 78f80710de [analyzer] Use DataRecursiveASTVisitor for the AnalysisConsumer.
llvm-svn: 197767
2013-12-20 02:02:58 +00:00
Argyrios Kyrtzidis 561fe54a1a Move tools/libclang/RecursiveASTVisitor.h -> include/clang/AST/DataRecursiveASTVisitor.h
This is to make it available so the static analyzer can use it.

llvm-svn: 197766
2013-12-20 02:02:54 +00:00
Argyrios Kyrtzidis b0188f246a [libclang/python] Add CompilationDatabase.getAllCompileCommands to the python bindings.
Patch by Laszlo Nagy!

llvm-svn: 197765
2013-12-20 01:34:00 +00:00
Jordan Rose 99e80c14b3 Serialize source range info for TypeTraitExpr.
This caused some crazy crashes involving std::unordered_map being
deserialized from a PCH file and then template instantiation requiring
an explicit instantiation location; unfortunately I don't really know
how to come up with a minimal test case.

llvm-svn: 197764
2013-12-20 01:26:47 +00:00
Dmitri Gribenko 3ec8ee72c5 Correctly compute the size in bytes of PreambleFileHash.MD5
llvm-svn: 197762
2013-12-20 01:07:30 +00:00
Dmitri Gribenko 514102d24f Add a test I forgot to svn add in r197755
llvm-svn: 197756
2013-12-20 00:21:47 +00:00
Dmitri Gribenko 4765252dcb ASTUnit::getMainBufferWithPrecompiledPreamble: use MD5 hash of the remapped
files to tell if they were changed since the last time we have computed the
preamble

We used to check only the buffer size, so if the new remapped buffer has the
same size as the previous one, we would think that the buffer did not change,
and we did not rebuild the preambule, which sometimes caused us to crash.

llvm-svn: 197755
2013-12-20 00:16:25 +00:00
Dmitri Gribenko 40798d30fb Simplify code
llvm-svn: 197748
2013-12-19 23:25:59 +00:00
Jordan Rose 821f102985 [analyzer] Fix test in previous commit to account for compiler warning.
--analyze passes -w, but -cc1 -analyze doesn't. Oops!

llvm-svn: 197741
2013-12-19 23:05:40 +00:00
Ted Kremenek 1654511884 Wordsmith "maybe" into "may be" in diagnostic, and move warning under flag.
llvm-svn: 197736
2013-12-19 22:47:11 +00:00
Jordan Rose 7ae3362458 [analyzer] Always use 'bool' as the SValBuilder condition type in C++.
We have assertions for this, but a few edge cases had snuck through where
we were still unconditionally using 'int'.

<rdar://problem/15703011>

llvm-svn: 197733
2013-12-19 22:32:39 +00:00
Ted Kremenek ec690e960e Remove dead code identified by Aaron Ballman.
llvm-svn: 197730
2013-12-19 22:23:12 +00:00
Aaron Ballman 37c5f5da32 After discussing with John McCall, removing the ns_bridged attribute as it is unused.
llvm-svn: 197729
2013-12-19 22:12:51 +00:00
Daniel Jasper 5a611397a2 clang-format: Add special case for leading comments in braced lists.
A comment following the "{" of a braced list seems to almost always
refer to the first element of the list and thus should be aligned
to it.

Before (with Cpp11 braced list style):
  SomeFunction({  // Comment 1
                   "first entry",
                   // Comment 2
                   "second entry"});
After:
  SomeFunction({// Comment 1
                "first entry",
                // Comment 2
                "second entry"});

llvm-svn: 197725
2013-12-19 21:41:37 +00:00