Commit Graph

526 Commits

Author SHA1 Message Date
Lubos Lunak ba5ee4da1d avoid bogus warnings about "unknown" pragmas with -frewrite-includes (pr#14831)
llvm-svn: 186764
2013-07-20 14:30:01 +00:00
Lubos Lunak 4c22f6a695 fix sometimes incorrect line numbers in -frewrite-includes mode (pr#14795)
Every #include is surrounded by #if 0 in order to comment it out, which adds
lines. That is fixed up right after, but that all can be inside #if part
that is not processed, so fix up also after every end of a conditional part.

llvm-svn: 186763
2013-07-20 14:23:27 +00:00
Rafael Espindola 16125fb652 Update for llvm API change.
llvm-svn: 186448
2013-07-16 19:44:23 +00:00
Rafael Espindola 18627115f4 Use llvm::sys::fs::createUniqueFile.
Include a test that clang now produces output files with permissions matching
the umask.

llvm-svn: 185727
2013-07-05 21:13:58 +00:00
Rafael Espindola a36e78ef5d Use llvm::sys::fs::createTemporaryFile.
llvm-svn: 185717
2013-07-05 20:00:06 +00:00
Craig Topper 5603df45df Use SmallVectorImpl& for function arguments instead of SmallVector.
llvm-svn: 185715
2013-07-05 19:34:19 +00:00
Craig Topper 2341c0d3b2 Use SmallVectorImpl instead of SmallVector for iterators and references to avoid specifying the vector size unnecessarily.
llvm-svn: 185610
2013-07-04 03:08:24 +00:00
Benjamin Kramer fbf914ceb0 Port HTMLDiagnostics to PathV2. No intended functionality change.
llvm-svn: 183849
2013-06-12 18:13:05 +00:00
Alexander Kornienko 33a35dff83 Added Lexer::getBufferEnd().
Summary:
There's Lexer::getBufferStart(), and we need getBufferEnd() to access
the whole input buffer in clang::format::reformat. We don't want to
rely on the fact that the Lexer::BufferEnd always points to '\0', as there can
be embedded '\0's as well.

Reviewers: jordan_rose

Reviewed By: jordan_rose

CC: cfe-commits

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

llvm-svn: 183236
2013-06-04 16:58:03 +00:00
David Blaikie 7d17010db5 Use only explicit bool conversion operator
The most common (non-buggy) case are where such objects are used as
return expressions in bool-returning functions or as boolean function
arguments. In those cases I've used (& added if necessary) a named
function to provide the equivalent (or sometimes negative, depending on
convenient wording) test.

DiagnosticBuilder kept its implicit conversion operator owing to the
prevalent use of it in return statements.

One bug was found in ExprConstant.cpp involving a comparison of two
PointerUnions (PointerUnion did not previously have an operator==, so
instead both operands were converted to bool & then compared). A test
is included in test/SemaCXX/constant-expression-cxx1y.cpp for the fix
(adding operator== to PointerUnion in LLVM).

llvm-svn: 181869
2013-05-15 07:37:26 +00:00
Argyrios Kyrtzidis d391046930 Have SourceManager::getLocForEndOfFile() point at the "EOF" location of the FileID.
This fixes a crash due to SourceManager::getLocForEndOfFile() returning an off-by-one location
when the the FileID is for an empty file.

rdar://13803893

llvm-svn: 181285
2013-05-07 04:29:22 +00:00
Douglas Gregor 30071cead9 Remove DiagnosticConsumer::clone(), a bad idea that is now unused.
llvm-svn: 181070
2013-05-03 23:07:45 +00:00
Benjamin Kramer b10e615c44 rewrite-includes: Rewrite __has_include(_next) to get rid of a host dependency.
This broke e.g. compiling a crash report from a glibc system on Darwin. Sadly,
the implementation had to game the lexer a lot as we're not using a real
preprocessor here. It also doesn't handle special cases like arbitrary macros in
__has_include, but since this macro isn't common outside of clang's headers we
can get away with that.

Fixes PR14422.

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

llvm-svn: 179616
2013-04-16 19:08:41 +00:00
Argyrios Kyrtzidis cf22d1f3ab [frontend] -frewrite-includes: turn implicit module imports into @imports.
rdar://13610250

llvm-svn: 179145
2013-04-10 01:53:50 +00:00
Argyrios Kyrtzidis 953ef33f59 [frontend] -frewrite-includes: if there was no inclusion, don't add lineinfo that indicates return from another file.
llvm-svn: 179143
2013-04-10 01:53:37 +00:00
Rafael Espindola 6ae7e50be4 Add 178663 back.
http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb went back green
before it processed the reverted 178663, so it could not have been the culprit.

Revert "Revert 178663."

This reverts commit 4f8a3eb2ce5d4ba422483439e20c8cbb4d953a41.

llvm-svn: 178682
2013-04-03 19:27:57 +00:00
Rafael Espindola 985a3abee4 Revert 178663.
Looks like it broke http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb

Revert "Don't compute a patched/semantic storage class."

This reverts commit 8f187f62cb0487d31bc4afdfcd47e11fe9a51d05.

llvm-svn: 178681
2013-04-03 19:22:20 +00:00
Fariborz Jahanian 3a65ce3a56 Objective-C modern rewriter. Fixes a bug
rewriting typedef for a qualified object type
and also when two declarations happen to be on the
same line. // rdar://13562505

llvm-svn: 178680
2013-04-03 19:11:21 +00:00
Rafael Espindola adea16bd9e Don't compute a patched/semantic storage class.
For variables and functions clang used to store two storage classes. The one
"as written" in the code and a patched one, which, for example, propagates
static to the following decls.

This apparently is from the days clang lacked linkage computation. It is now
redundant and this patch removes it.

llvm-svn: 178663
2013-04-03 15:50:00 +00:00
Jordan Rose 755a2ffd79 Add some assertions to appease the static analyzer.
No functionality change.

llvm-svn: 177185
2013-03-15 21:41:35 +00:00
Jordan Rose 5c38272c1a ArrayRef-ize ASTContext::getFunctionType and Sema::BuildFunctionType.
No (intended) functionality change.

llvm-svn: 176726
2013-03-08 21:51:21 +00:00
Dmitri Gribenko 20b16ace16 Use trailing documentation comments properly
Patch by Alexander Zinenko.

llvm-svn: 175376
2013-02-16 22:21:38 +00:00
Fariborz Jahanian b0fdab26d1 objective-C modern translator: Fixes a mistranslation
of @throw statement by finding location of the ';'
correctly. // rdar://13186010

llvm-svn: 174898
2013-02-11 19:30:33 +00:00
Jordan Rose a7d03840e6 Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.
Nearly all of these changes are one-to-one replacements; the few that
aren't have to do with custom identifier validation.

llvm-svn: 174768
2013-02-08 22:30:41 +00:00
Fariborz Jahanian 4254cdb7ed objective-C modern translation: Fix another random translation bug
involving property getter expressions on rhs of property setter.
// rdar://13138459

llvm-svn: 174729
2013-02-08 18:57:50 +00:00
Fariborz Jahanian e8730a3558 objective-C modern translator. Fixes a trivial
rewriting bug where #ifdef ended up on the same
line as the attribute declaration.

llvm-svn: 174719
2013-02-08 17:15:07 +00:00
Fariborz Jahanian e4c7e855f1 objective-C modern translator. Generate #line
info in the translated code under -g only.
// rdar://13138170

llvm-svn: 174684
2013-02-08 00:27:34 +00:00
Fariborz Jahanian e499613d60 objective-C modern translator. More fixups for
modern meta-data abi translation. Still wip.
// rdar://13138459

llvm-svn: 174672
2013-02-07 22:50:40 +00:00
Fariborz Jahanian 57dd66baa4 objective-C modern translator. Fix up the translated
metadata to handle ivar bitfields. This is wip.
// rdar://13138459

llvm-svn: 174573
2013-02-07 01:53:15 +00:00
Douglas Gregor 048fbfa302 Rework the traversal of Objective-C categories and extensions to
consider (sub)module visibility.

The bulk of this change replaces myriad hand-rolled loops over the
linked list of Objective-C categories/extensions attached to an
interface declaration with loops using one of the four new category
iterator kinds:

  visible_categories_iterator: Iterates over all visible categories
  and extensions, hiding any that have their "hidden" bit set. This is
  by far the most commonly used iterator.

  known_categories_iterator: Iterates over all categories and
  extensions, ignoring the "hidden" bit. This tends to be used for
  redeclaration-like traversals.

  visible_extensions_iterator: Iterates over all visible extensions,
  hiding any that have their "hidden" bit set.

  known_extensions_iterator: Iterates over all extensions, whether
  they are visible to normal name lookup or not.

The effect of this change is that any uses of the visible_ iterators
will respect module-import visibility. See the new tests for examples.

Note that the old accessors for categories and extensions are gone;
there are *Raw() forms for some of them, for those (few) areas of the
compiler that have to manipulate the linked list of categories
directly. This is generally discouraged.

Part two of <rdar://problem/10634711>.
 

llvm-svn: 172665
2013-01-16 23:00:23 +00:00
Dmitri Gribenko f857950d39 Remove useless 'llvm::' qualifier from names like StringRef and others that are
brought into 'clang' namespace by clang/Basic/LLVM.h

llvm-svn: 172323
2013-01-12 19:30:44 +00:00
Chad Rosier ac00fbcbd2 Fix indent and remove parameter with a matching default value.
llvm-svn: 171545
2013-01-04 22:40:33 +00:00
Roman Divacky 241f45118b Remove duplicate includes.
llvm-svn: 170903
2012-12-21 17:07:08 +00:00
Bill Wendling 4442605f18 Revert r170500. It over-zealously converted *ALL* things named Attributes, which is wrong here.
llvm-svn: 170721
2012-12-20 19:22:21 +00:00
Bill Wendling 7967fc14b9 Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.
llvm-svn: 170500
2012-12-19 07:18:12 +00:00
Eli Friedman 07bab73c7f Using CanQualType::getAs<ArrayType> is unsafe; fix the code currently using it,
and make sure additional uses don't get introduced.  <rdar://problem/12858424>.

llvm-svn: 170081
2012-12-13 01:43:21 +00:00
Chandler Carruth 3a02247dc9 Sort all of Clang's files under 'lib', and fix up the broken headers
uncovered.

This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.

I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.

llvm-svn: 169237
2012-12-04 09:13:33 +00:00
Benjamin Kramer 2a812288c7 Make helper classes anonymous. Make helper functions static instead of private members so the anonymous class doesn't leak out.
No functionality change.

llvm-svn: 169099
2012-12-01 20:58:01 +00:00
Benjamin Kramer 444a1304ad Include pruning and general cleanup.
llvm-svn: 169095
2012-12-01 17:12:56 +00:00
Benjamin Kramer d7d2b1fe45 Don't include Type.h in DeclarationName.h.
Recursively prune some includes.

llvm-svn: 169094
2012-12-01 16:35:25 +00:00
Benjamin Kramer ea70eb30a0 Pull the Attr iteration parts out of Attr.h, so including DeclBase.h doesn't pull in all the generated Attr code.
Required to pull some functions out of line, but this shouldn't have a perf impact.
No functionality change.

llvm-svn: 169092
2012-12-01 15:09:41 +00:00
Fariborz Jahanian 998f0a3360 objective-C blocks: Make sure that identical logic is used
in deciding a copy/dispose field is needed in a byref structure
and when generating the copy/dispose helpers. In certain
cases, these fields were being added but no copy/dispose was
being generated. This was uncovered in ARC, but not in MRR.
// rdar://12759433

llvm-svn: 168825
2012-11-28 23:12:17 +00:00
Benjamin Kramer d6e8a7964d Make libASTMatchers link its dependencies. libRewriteFrontend depends on libRewriteCore.
LLVM_USED_LIBS does nothing here.

llvm-svn: 168172
2012-11-16 17:30:58 +00:00
Fariborz Jahanian 83dadc7dd7 objective-C modern translator. Start the line
directive on a new line.

llvm-svn: 167542
2012-11-07 18:15:53 +00:00
Fariborz Jahanian e030a63868 modern ObjC translator. Insert line number for @synchronized statements.
llvm-svn: 167511
2012-11-07 00:43:05 +00:00
Fariborz Jahanian b6933bc1d0 objective-C modern rewriter. Insert line numbers in
translated code where new code makes the lines be off.
This is wip.

llvm-svn: 167500
2012-11-06 23:25:49 +00:00
NAKAMURA Takumi b46a05cdf9 RewriteModernObjC.cpp: Use Lexer::Stringify() on the file name of #line directive to escape Win32 path separator '\\'.
llvm-svn: 167497
2012-11-06 22:45:31 +00:00
Fariborz Jahanian aa4a242f53 Modern objective-C translator: Start adding line info to the
translated source where it is needed. wip.

llvm-svn: 167469
2012-11-06 17:30:23 +00:00
Douglas Gregor 811db4eac4 Make DiagnosticOptions intrusively reference-counted, and make sure
the various stakeholders bump up the reference count. In particular,
the diagnostics engine now keeps the DiagnosticOptions object alive.

llvm-svn: 166508
2012-10-23 22:26:28 +00:00
Sean Silva e2bb2ff576 Remove pointless classof()'s.
Updates to llvm/Support/Casting.h have rendered these classof()'s
irrelevant.

llvm-svn: 165770
2012-10-11 23:31:23 +00:00