Commit Graph

2540 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis b2792972a2 [libclang] Make clang_Cursor_getArgument work with call-exprs.
Patch by Matthias Kleine!

llvm-svn: 178475
2013-04-01 17:38:59 +00:00
Argyrios Kyrtzidis 828f4d4b9f [libclang] If libclang logging is enabled, print all compiler diagnostics to stderr instead of capturing them.
llvm-svn: 178373
2013-03-29 21:51:44 +00:00
Argyrios Kyrtzidis 41686481f4 [cmake] Add clang-headers as a dependency of libclang and if we have to copy them
for the IDE case, also create a symlink inside the libclang.dylib directory.

llvm-svn: 178372
2013-03-29 21:51:40 +00:00
Chad Rosier 05c71aa745 Update the error handing static functions for r178161.
Part of rdar://13296693

llvm-svn: 178162
2013-03-27 18:28:23 +00:00
Chad Rosier ab003df656 Remove a FIXME that's not planned to be fixed. We only generated crash
diagnostics for the first failing command.

llvm-svn: 178086
2013-03-26 23:25:41 +00:00
Argyrios Kyrtzidis b6210dff97 [Preprocessor/Modules] Separate the macro directives kinds into their own MacroDirective's subclasses.
For each macro directive (define, undefine, visibility) have a separate object that gets chained
to the macro directive history. This has several benefits:

-No need to mutate a MacroDirective when there is a undefine/visibility directive. Stuff like
 PPMutationListener become unnecessary.
-No need to keep extra source locations for the undef/visibility locations for the define directive object
 (which is the majority of the directives)
-Much easier to hide/unhide a section in the macro directive history.
-Easier to track the effects of the directives across different submodules.

llvm-svn: 178037
2013-03-26 17:17:01 +00:00
Chandler Carruth 456ab006a4 Manually specify the link dependencies. Turns out that all the work on
LLVMBuild stuff didn't actually provide a single place for dependencies,
it just added a third place.

llvm-svn: 177989
2013-03-26 03:45:48 +00:00
Chandler Carruth b45836a231 The IRReader header is now part of its own library. Update the include
line and the library dependencies to reflect this.

llvm-svn: 177972
2013-03-26 02:25:54 +00:00
Daniel Jasper be0d173099 Add clang-format to the corresponding Makefile.
llvm-svn: 177727
2013-03-22 11:43:51 +00:00
Alexey Bataev a769e07232 OpenMP threadprivate directive parsing and semantic analysis
llvm-svn: 177705
2013-03-22 06:34:35 +00:00
Jordan Rose 83662f75ad [analyzer] scan-build: emit errors on stderr, and exit(1) instead of exit(0).
PR14963

llvm-svn: 177678
2013-03-21 23:14:26 +00:00
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