Commit Graph

2529 Commits

Author SHA1 Message Date
Daniel Jasper 9be2c5cf17 Add clang-format binary to cfe.
llvm-svn: 177506
2013-03-20 09:53:23 +00:00
Argyrios Kyrtzidis 014349cc8c [libclang] Modify clang_getCursorType to be able to handle a function template decl.
llvm-svn: 177359
2013-03-18 23:54:50 +00:00
Jordan Rose 529e239aee [analyzer] Fix scan-build's -stats mode.
We were failing to match the output line, which led to us collecting no
stats at all, which led to a divide-by-zero error.

Fixes PR15510.

llvm-svn: 177084
2013-03-14 17:18:30 +00:00
Argyrios Kyrtzidis 3c5305c15e [Modules] Resolve top-headers of modules lazily.
This allows resolving top-header filenames of modules to FileEntries when
we need them, not eagerly.

Note that that this breaks ABI for libclang functions
clang_Module_getTopLevelHeader / clang_Module_getNumTopLevelHeaders
but this is fine because they are experimental and not widely used yet.

llvm-svn: 176975
2013-03-13 21:13:43 +00:00
Argyrios Kyrtzidis 1b5b1ce4f8 [libclang] Fix a test and a warning on windows.
Patch by Guy Benyei!

llvm-svn: 176806
2013-03-11 16:03:17 +00:00
Benjamin Kramer b23fc91cdc Driver: do not strip file extensions when printing diagnostics.
Before: clang-3: error: no input files
After:  clang-3.3: error: no input files

This means that we'll also print clang.exe on windows, but I don't see a problem
with that.

llvm-svn: 176788
2013-03-10 13:16:18 +00:00
Argyrios Kyrtzidis 51c3318b01 [libclang] Change clang_findReferencesInFile and clang_findIncludesInFile to return an enum,
as suggested by Jordan.

llvm-svn: 176732
2013-03-08 22:47:41 +00:00
Argyrios Kyrtzidis 951f61fae2 [libclang] Modify clang_findReferencesInFile and clang_findIncludesInFile to return a value.
Possible values are:
 1  : if a parameter was invalid
 -1 : if the callback returned CXVisit_Break,
 otherwise returns 0.

llvm-svn: 176716
2013-03-08 20:42:33 +00:00
Argyrios Kyrtzidis 503c83ad81 [libclang] Introduce clang_findIncludesInFile, that can be used to retrieve all #import/#include directives in a specific file.
It passes to the visitor, that the caller provides, CXCursor_InclusionDirective cursors for
all the include directives in a particular file.

llvm-svn: 176682
2013-03-08 02:32:34 +00:00
Argyrios Kyrtzidis 733136952e [libclang] When calling the function of CXCursorAndRangeVisitor, don't forget to
stop visitation if it returns CXVisit_Break.

llvm-svn: 176681
2013-03-08 02:32:29 +00:00
Argyrios Kyrtzidis ba4b5f8646 [libclang] Add Logger::operator<< overloads for CXCursor and FileEntry.
llvm-svn: 176680
2013-03-08 02:32:26 +00:00
Argyrios Kyrtzidis 37f2ab4824 [libclang] When logging a CXTranslationUnit that came from an AST file, print out the filename.
llvm-svn: 176511
2013-03-05 20:21:14 +00:00
Jordan Rose 838b72f6b5 scan-build: explicitly say "No bugs found" if there are no reports.
Patch by Martin Storsjo!

llvm-svn: 176472
2013-03-05 02:33:08 +00:00
Stefanus Du Toit b331850194 Fix typos: [Dd]iagnosic -> [Dd]iagnostic
These all appear in comments or (ironically) diagnostics output.

llvm-svn: 176383
2013-03-01 21:41:22 +00:00
Fariborz Jahanian 828b8d2415 doxygen command. Add 'attention' command to list of similar
doxygen commands. // rdar://12379053

llvm-svn: 176127
2013-02-26 22:12:16 +00:00
Argyrios Kyrtzidis fead64be9b [preprocessor] Use MacroDirective in the preprocessor callbacks to make available the
full information about the macro (e.g if it was imported and where).

llvm-svn: 175978
2013-02-24 00:05:14 +00:00
Peter Collingbourne 47f9f2d1e6 Revert r175912, "Add support for coldcc to clang" at John's request.
llvm-svn: 175936
2013-02-23 00:06:18 +00:00
Peter Collingbourne f32b3f2c55 Add support for coldcc to clang
llvm-svn: 175912
2013-02-22 19:24:35 +00:00
David Blaikie f005d3c1a2 Suppress -Wswitch to unbreak the build.
This may need to be fixed more intelligently - I don't have enough context to
be sure what the appropriate fix is right now.

llvm-svn: 175902
2013-02-22 17:44:58 +00:00
Michael Han 84324357b8 [Sema] Semantic analysis for empty-declaration and attribute-declaration.
Introduce a new AST Decl node "EmptyDecl" to model empty-declaration. Have attributes from attribute-declaration appertain
to the EmptyDecl node by creating the AST representations of these attributes and attach them to the EmptyDecl node so these
attributes can be sema checked just as attributes attached to "normal" declarations.

llvm-svn: 175900
2013-02-22 17:15:32 +00:00
Benjamin Kramer 9170e914fc Streamify getNameForDiagnostic and remove the string versions of PrintTemplateArgumentList.
llvm-svn: 175894
2013-02-22 15:46:01 +00:00
Benjamin Kramer d504096c12 scan-build: Remove debug print.
PR15329.

llvm-svn: 175889
2013-02-22 12:07:39 +00:00
Ted Kremenek 2dca31e1ed [scan-build] Add quotes around clang executable name to handle path withs spaces. Fixes <rdar://problem/13254727>
llvm-svn: 175790
2013-02-21 20:28:59 +00:00
Ted Kremenek 9ddfa89bed [scan-build] fix xcode version parsing to handle dot releases. Fixes <rdar://problem/13265300>.
llvm-svn: 175781
2013-02-21 19:33:30 +00:00
Chad Rosier 3e263e40e9 [driver] Handle the processing of the QA_OVERRIDE_GCC3_OPTIONS and CCC_ADD_ARGS
before the DiagnosticsEngine is instantiated.  Otherwise, warning options are
not handled correctly.
rdar://13254743

llvm-svn: 175779
2013-02-21 18:56:55 +00:00
NAKAMURA Takumi c2b5d1f9b9 CIndex.cpp: Appease g++-4.4. "if (Optional<unsigned> Minor = In.getMinor())" did not work as expected.
llvm-svn: 175711
2013-02-21 02:32:34 +00:00
David Blaikie 7a30dc53c5 Use None rather than Optional<T>() where possible.
llvm-svn: 175705
2013-02-21 01:47:18 +00:00
Ted Kremenek 0332558894 Strip 'llvm' from 'llvm::Optional' uses.
llvm-svn: 175701
2013-02-21 01:29:01 +00:00
Argyrios Kyrtzidis 09c9e811de [preprocessor] Split the MacroInfo class into two separate concepts, MacroInfo class
for the data specific to a macro definition (e.g. what the tokens are), and
MacroDirective class which encapsulates the changes to the "macro namespace"
(e.g. the location where the macro name became active, the location where it was undefined, etc.)

(A MacroDirective always points to a MacroInfo object.)

Usually a macro definition (MacroInfo) is where a macro name becomes active (MacroDirective) but
splitting the concepts allows us to better model the effect of modules to the macro namespace
(also as a bonus it allows better modeling of push_macro/pop_macro #pragmas).
Modules can have their own macro history, separate from the local (current translation unit)
macro history; MacroDirectives will be used to model the macro history (changes to macro namespace).

For example, if "@import A;" imports macro FOO, there will be a new local MacroDirective created
to indicate that "FOO" became active at the import location. Module "A" itself will contain another
MacroDirective in its macro history (at the point of the definition of FOO) and both MacroDirectives
will point to the same MacroInfo object.

Introducing the separation of macro concepts is the first part towards better modeling of module macros.

llvm-svn: 175585
2013-02-20 00:54:57 +00:00
David Blaikie 6adc78e0df Replace TypeLoc llvm::cast support to be well-defined.
The TypeLoc hierarchy used the llvm::cast machinery to perform undefined
behavior by casting pointers/references to TypeLoc objects to derived types
and then using the derived copy constructors (or even returning pointers to
derived types that actually point to the original TypeLoc object).

Some context is in this thread:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056804.html
Though it's spread over a few months which can be hard to read in the mail
archive.

llvm-svn: 175462
2013-02-18 22:06:02 +00:00
Dmitri Gribenko 7d09808818 libclang: don't store nul-terminated strings as StringRefs,
if the nul-terminatedness property is important for clients.

Also, don't return the same CXString multiple times.  This did not create a
correctness issue in practice because the CXString was of an CXS_Unmanaged
kind, and destruction was a no-op.

llvm-svn: 175455
2013-02-18 19:50:38 +00:00
Dmitri Gribenko 19b79c8bf9 libclang: remove reinterpret_casts by using SourceLocation::getPtrEncoding
llvm-svn: 175333
2013-02-16 01:07:48 +00:00
Dmitri Gribenko 0035372bb7 libclang: add clang_getTypeSpelling(CXType CT)
Adds a function clang_getTypeSpelling(CXType CT) that returns
a CXString containing the underlying type.

Patch by Ben Gertzfield.

llvm-svn: 175299
2013-02-15 21:15:49 +00:00
Dmitri Gribenko 6b8fca1275 libclang: remove reinterpret_casts by using SourceLocation::getFromPtrEncoding
directly instead of casting a pointer to an integer

llvm-svn: 175206
2013-02-14 20:07:36 +00:00
Ted Kremenek 3cfba5bf13 Teach ccc-analyze to pass on -iquote with no spaces between it an the argument.
llvm-svn: 175115
2013-02-14 00:32:25 +00:00
Bill Wendling 41529c13c4 Use 'RC_XBS' instead of 'RC_BUILDIT' to catch all times when it's built in the Apple way.
llvm-svn: 175070
2013-02-13 19:44:17 +00:00
Argyrios Kyrtzidis 5d47a9b253 [libclang] Fix annotation of a range where the begin or end location
is inside a macro argument.

Previously we would give up and not annotate anything in the range.
rdar://11891550

llvm-svn: 175062
2013-02-13 18:33:28 +00:00
Dmitri Gribenko efbbd1e90c libclang: use CXCursor getters to simplify code
llvm-svn: 174809
2013-02-09 14:12:09 +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
Argyrios Kyrtzidis a2ed813afd [libclang] Attribute visitation happens out-of-source-order, make sure
we annotate properly when there is an attribute and not skip type specs
if the attribute is after the declaration.

rdar://13129077

llvm-svn: 174689
2013-02-08 01:12:25 +00:00
Dmitri Gribenko 0b62f8a632 libclang: reduce CXString abuse
ContainerUSR is not really a CXString, but it should own the underlying memory
buffer.  Thus, it is better to change the type to std::string.  This will not
introduce extra copying overhead, since the workaround that is being removed
was already making a copy.

llvm-svn: 174647
2013-02-07 19:09:22 +00:00
NAKAMURA Takumi 288c42e936 libclang: CursorVisitor::VisitBuiltinTypeLoc(): Add OCLSampler. [-Wswitch]
llvm-svn: 174606
2013-02-07 12:47:42 +00:00
Guy Benyei 610541989a Add OpenCL samplers as Clang builtin types and check sampler related restrictions.
llvm-svn: 174601
2013-02-07 10:55:47 +00:00
Dmitri Gribenko 2aedfbd177 Comment to XML conversion: replace string comparison with command ID comparison
llvm-svn: 174290
2013-02-03 17:48:05 +00:00
Dmitri Gribenko 18aa3bb819 libclang: wrap CXString implementation into 'namespace cxstring'
This removes quite a few 'cxstring::' qualifications where they are obvious.

llvm-svn: 174286
2013-02-03 13:54:26 +00:00
Dmitri Gribenko 7489521eec libclang: remove 'using namespace cxstring'
llvm-svn: 174285
2013-02-03 13:52:47 +00:00
Dmitri Gribenko bf7bf10d45 libclang: migrate IndexingDeclVisitor to ConstDeclVisitor
llvm-svn: 174284
2013-02-03 13:42:20 +00:00
Dmitri Gribenko d73f73b0dd libclang: remove unneeded const_cast
llvm-svn: 174283
2013-02-03 13:26:20 +00:00
Dmitri Gribenko 82700578d4 libclang: migrate USRGenerator to ConstDeclVisitor
llvm-svn: 174281
2013-02-03 13:21:23 +00:00
Dmitri Gribenko dd7dacfff9 libclang: remove unneeded const_casts
llvm-svn: 174280
2013-02-03 13:19:54 +00:00