Commit Graph

44321 Commits

Author SHA1 Message Date
Daniel Jasper bc0fa39d69 Align comments to surrounding unformatted comments.
Before:
int a; // not formatted
// formatting this line only

After:
int a; // not formatted
       // formatting this line only

This makes clang-format stable independent of whether the whole
file or single lines are formatted in most cases.

llvm-svn: 177739
2013-03-22 16:25:51 +00:00
Reid Kleckner 9cffbc1873 [cxxabi] Get ptrdiff_t from the CodeGenModule instead of caching it
As the comment says, it's a little silly to cache it in the ABI code.

llvm-svn: 177738
2013-03-22 16:13:10 +00:00
Daniel Jasper 4172375713 Update docs after moving clang-format from clang-tools-extra to cfe.
llvm-svn: 177729
2013-03-22 12:44:20 +00:00
Daniel Jasper be0d173099 Add clang-format to the corresponding Makefile.
llvm-svn: 177727
2013-03-22 11:43:51 +00:00
Daniel Jasper 399d1ee5a0 More precisely recognize ObjC method declarations.
Otherwise, +/- and the beginning of constants can be recognized
incorrectly.

Before:  #define A - 1
After:   #define A -1
llvm-svn: 177725
2013-03-22 10:44:43 +00:00
Dmitri Gribenko 22ee0c17a6 Documentation: fix a typo and formatting
llvm-svn: 177722
2013-03-22 10:25:15 +00:00
Daniel Jasper 689ae01244 Fix DeclRefExpr::getFoundDecl() for usages by reference.
llvm-svn: 177721
2013-03-22 10:01:35 +00:00
Daniel Jasper 5521365248 Make clang-format understand more line comments.
Apparently one needs to set LangOptions.LineComment.

Before "//* */" got reformatted to "/ /* */" as the lexer was returning
the token sequence (slash, comment). This could also lead to weird other
stuff, e.g. for people that like to using comments like:
//****************

llvm-svn: 177720
2013-03-22 10:01:29 +00:00
Douglas Gregor aeb2a3c3a2 Add future directions for modules
llvm-svn: 177707
2013-03-22 07:08:56 +00:00
Douglas Gregor 485996c696 More modules documentation, including the straw-man import declaration syntax and "how to modularize a platform".
llvm-svn: 177706
2013-03-22 07:05:07 +00:00
Alexey Bataev a769e07232 OpenMP threadprivate directive parsing and semantic analysis
llvm-svn: 177705
2013-03-22 06:34:35 +00:00
Douglas Gregor de0beaa8f8 More documentation on the module map language.
llvm-svn: 177704
2013-03-22 06:21:35 +00:00
Alexey Bataev 353fba6cdd test commit
llvm-svn: 177701
2013-03-22 05:24:29 +00:00
John McCall cda8083309 Warn about attempts to reinterpret_cast between two types that are
hierarchy-related at a possibly nonzero offset.

Patch by Alexander Zinenko!

llvm-svn: 177698
2013-03-22 02:58:14 +00:00
John McCall eaef89b197 Fix a crash-on-valid where a block capture copy expression was
picking up cleanups from earlier in the statement.  Also fix a
crash-on-invalid where a reference to an invalid decl from an
enclosing scope was causing an expression to fail to build, but
only *after* a cleanup was registered from that statement,
causing an assertion downstream.

The crash-on-valid is rdar://13459289.

llvm-svn: 177692
2013-03-22 02:10:40 +00:00
Richard Smith 48366f7af9 ubsan: Pass floating-point arguments to the runtime by value if they fit the
value argument. If not, be sure we don't accidentally use a dynamic alloca.

llvm-svn: 177690
2013-03-22 00:47:07 +00:00
Douglas Gregor 96efb4a442 <rdar://problem/13479214> Make Clang's <stddef.h> robust against system headers defining size_t/ptrdiff_t/wchar_t.
Clang's <stddef.h> provides definitions for the C standard library
types size_t, ptrdiff_t, and wchar_t. However, the system's C standard
library headers tend to provide the same typedefs, and the two
generally avoid each other using the macros
_SIZE_T/_PTRDIFF_T/_WCHAR_T. With modules, however, we need to see
*all* of the places where these types are defined, so provide the
typedefs (ignoring the macros) when modules are enabled.

llvm-svn: 177686
2013-03-22 00:10:49 +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
David Blaikie af802be01b Update debug info test case for more incoming DIBuilder changes
Switching the DIFile field in DISubprogram to refer to the raw
filename/directory pair instead of a DIFile.

llvm-svn: 177676
2013-03-21 23:07:47 +00:00
David Blaikie c89bfbec19 Update debug info test case for an incoming change to DIBuilder in LLVM
(this will produce some transient test failure/skew)

llvm-svn: 177673
2013-03-21 22:28:46 +00:00
Douglas Gregor 23c7d67de2 <rdar://problem/13477190> Give the Clang module cache directory some structure, so it's easier to find.
We now put the Clang module cache in
<system-temp-directory>/org.llvm.clang/ModuleCache. Perhaps some day
there will be other caches under <system-temp-directory>/org.llvm.clang>.

llvm-svn: 177671
2013-03-21 21:48:48 +00:00
David Blaikie 9db060485c Fix indentation
llvm-svn: 177665
2013-03-21 21:35:15 +00:00
Fariborz Jahanian 1446b34629 Objective-C: Tighten the rules when warning
is issused for on overriding 'readwrite'
property which is not auto-synthesized.
Buttom line is that if hueristics determine
that there will be a user implemented setter,
no warning will be issued. // rdar://13388503

llvm-svn: 177662
2013-03-21 20:50:53 +00:00
David Blaikie 8ad22a37af Generalize debug info tests to be forward compatible with future DISubprogram changes
llvm-svn: 177659
2013-03-21 20:20:15 +00:00
Aaron Ballman 63352de02e This ugly regex is required because on Windows, the paths come out as \\ delimited instead of / delimited. Fixes a test breakage since r176894.
llvm-svn: 177658
2013-03-21 20:12:19 +00:00
Benjamin Kramer 3d0235e16e Remove unused variable.
llvm-svn: 177657
2013-03-21 19:47:38 +00:00
Benjamin Kramer 5fbe2629ff Avoid warnings from compilers that think you can drop off the end of a fully covered switch.
llvm-svn: 177656
2013-03-21 19:45:46 +00:00
Aaron Ballman 3fd576f7d6 Delayed template parsing is not supported by the AST serialization system yet, so turning it off. This fixes a test breakage caused by r177336.
llvm-svn: 177655
2013-03-21 19:38:59 +00:00
Jordan Rose e4bdb1016e [analyzer] Print return values from debug.DumpCalls checker.
Debug utility only, no functionality change.

llvm-svn: 177649
2013-03-21 18:16:59 +00:00
Alexander Kornienko 547a9f5264 Better block comment formatting.
Summary:
1. When splitting one-line block comment, use indentation and *s.
2. Remove trailing whitespace from all lines of a comment, not only the ones being splitted.
3. Add backslashes for all lines if a comment is used insed a preprocessor directive.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 177635
2013-03-21 12:28:10 +00:00
Alexander Potapenko 5700f40d80 [ASan] Let the users to invoke `clang -fsanitize=address` to link binaries targeting the iOS simulator.
llvm-svn: 177633
2013-03-21 10:49:06 +00:00
Bob Wilson c962f9a624 Fix a typo.
llvm-svn: 177626
2013-03-21 06:09:09 +00:00
Douglas Gregor 0339a64a40 <rdar://problem/13037793> Allow the names of modules to differ from the name of their subdirectory in the include path.
llvm-svn: 177621
2013-03-21 01:08:50 +00:00
John McCall 433c2e64f8 Further weaken block conversion rules to permit blocks with
enum return type to be converted to blocks with any integer type
of the same size.

rdar://13463504

llvm-svn: 177613
2013-03-21 00:10:07 +00:00
Manman Ren 8aa84081e9 Add more testing cases for tbaa.struct
Testing cases for structs of structs and unions of structs.

llvm-svn: 177612
2013-03-21 00:09:50 +00:00
David Blaikie d54bb5c192 Debug info - generalize namespace test to not depend on a DW_TAG_file_type entry
This isn't necessary & with the next change to LLVM the DW_TAG_file_type entry
won't be emitted at all - only the raw filename/directory pair, so match on
that directly instead.

llvm-svn: 177609
2013-03-20 23:57:15 +00:00
Richard Smith cff3cde28b Split ubsan runtime into three pieces (clang part):
* libclang_rt-san-* is sanitizer_common, and is linked in only if no other
   sanitizer runtime is present.
 * libclang_rt-ubsan-* is the piece of the runtime which doesn't depend on
   a C++ ABI library, and is always linked in.
 * libclang_rt-ubsan_cxx-* is the piece of the runtime which depends on a
   C++ ABI library, and is only linked in when linking a C++ binary.

This change also switches us to using -whole-archive for the ubsan runtime
(which is made possible by the above split), and switches us to only linking
the sanitizer runtime into the main binary and not into DSOs (which is made
possible by using -whole-archive).

The motivation for this is to only link a single copy of sanitizer_common
into any binary. This is becoming important now because we want to share
more state between multiple sanitizers in the same process (for instance,
we want a single shared output mutex).

The Darwin ubsan runtime is unchanged; because we use a DSO there, we don't
need this complexity.

llvm-svn: 177605
2013-03-20 23:49:07 +00:00
Reid Kleckner 831b71e0b5 [ms-cxxabi] Mangle function pointer template arguments correctly
Reviewers: rjmccall

CC: timurrrr, llvm-commits

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

llvm-svn: 177589
2013-03-20 22:29:42 +00:00
Jordan Rose 3b6af191d8 [analyzer] Appease buildbots: include template arguments in base class ref.
llvm-svn: 177583
2013-03-20 21:44:17 +00:00
James Dennett 83942a9bf8 Documentation cleanup for MacroInfo.
* Clarify what MacroInfo::isBuiltinMacro means, as it really means something
  more like "isMagicalMacro" or "requiresProcessingBeforeExpansion" -- the
  macros defined in "<built-in>" are not considered built-in by this function;
* Escape __LINE__ as \__LINE__ in Doxygen comments so that the underscores
  don't get replaced by *bold* output;
* Turn comments in MacroInfo.cpp into non-Doxygen comments, so that they
  don't result in duplicated/badly formatted Doxygen output;
* Clean up a bunch of \brief formatting, and add a \file comment for
  MacroInfo.h.

llvm-svn: 177581
2013-03-20 21:30:03 +00:00
Douglas Gregor fb9126578e <rdar://problem/12368093> Extend module maps with a 'conflict' declaration, and warn when a newly-imported module conflicts with an already-imported module.
llvm-svn: 177577
2013-03-20 21:10:35 +00:00
Jordan Rose 28c68a2d07 [analyzer] Don't invalidate globals when there's no call involved.
This fixes some mistaken condition logic in RegionStore that caused
global variables to be invalidated when /any/ region was invalidated,
rather than only as part of opaque function calls. This was only
being used by CStringChecker, and so users will now see that strcpy()
and friends do not invalidate global variables.

Also, add a test case we don't handle properly: explicitly-assigned
global variables aren't being invalidated by opaque calls. This is
being tracked by <rdar://problem/13464044>.

llvm-svn: 177572
2013-03-20 20:36:01 +00:00
Jordan Rose 5d22fcb257 [analyzer] Track malloc'd memory into struct fields.
Due to improper modelling of copy constructors (specifically, their
const reference arguments), we were producing spurious leak warnings
for allocated memory stored in structs. In order to silence this, we
decided to consider storing into a struct to be the same as escaping.
However, the previous commit has fixed this issue and we can now properly
distinguish leaked memory that happens to be in a struct from a buffer
that escapes within a struct wrapper.

Originally applied in r161511, reverted in r174468.
<rdar://problem/12945937>

llvm-svn: 177571
2013-03-20 20:35:57 +00:00
Jordan Rose 5413aaa791 [analyzer] Invalidate regions indirectly accessible through const pointers.
In this case, the value of 'x' may be changed after the call to indirectAccess:

  struct Wrapper {
    int *ptr;
  };

  void indirectAccess(const Wrapper &w);

  void test() {
    int x = 42;
    Wrapper w = { x };

    clang_analyzer_eval(x == 42); // TRUE
    indirectAccess(w);
    clang_analyzer_eval(x == 42); // UNKNOWN
  }

This is important for modelling return-by-value objects in C++, to show
that the contents of the struct are escaping in the return copy-constructor.

<rdar://problem/13239826>

llvm-svn: 177570
2013-03-20 20:35:53 +00:00
Jordan Rose 153c81b7c4 [analyzer] Remove strip of ElementRegion in CallEvent::invalidateRegions.
This is a bit of old code trying to deal with the fact that functions that
take pointers often use them to access an entire array via pointer
arithmetic. However, RegionStore already conservatively assumes you can use
pointer arithmetic to access any part of a region.

Some day we may want to go back to handling this specifically for calls,
but we can do that in the future.

No functionality change.

llvm-svn: 177569
2013-03-20 20:35:48 +00:00
David Blaikie 431153cf2a refactoring file/directory for namespace debug info
(this is a paired commit with an LLVM change to DIBuilder - expect some
buildbot skew/fallout)

llvm-svn: 177565
2013-03-20 19:38:29 +00:00
David Blaikie 9e38bde14d Enhance debug info namespace test to check for context/scope reference
The #line directive is mostly for backend testing (keeping these files matching
should simplify maintenance somewhat) though the corresponding backend test
improvement/update doesn't verify the file information directly just yet.
Coming in a later iteration.

llvm-svn: 177559
2013-03-20 19:10:57 +00:00
Fariborz Jahanian 0b171939dc Do the error recovery for @end only.
I am not sure how much we can improve for
when a randon ObjC keyword is thrown into the
ivar decl. block. // rdar://6854840

llvm-svn: 177553
2013-03-20 18:45:49 +00:00
Sean Silva 99c9d9810b [docs] Point inquisitive users to existing module.map files.
llvm-svn: 177552
2013-03-20 18:37:47 +00:00
Sean Silva 28e0def9f3 [docs] Prominently note that modules are expemental.
And ask for people to try it out and send us bug reports!

llvm-svn: 177551
2013-03-20 18:37:42 +00:00