summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaAttr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Serialize `#pragma detect_mismatch`.Nico Weber2016-03-021-3/+6
| | | | | | | This is like r262493, but for pragma detect_mismatch instead of pragma comment. The two pragmas have similar behavior, so use the same approach for both. llvm-svn: 262506
* Serialize `#pragma comment`.Nico Weber2016-03-021-17/+6
| | | | | | | | | | | | | | `#pragma comment` was handled by Sema calling a function on ASTConsumer, and CodeGen then implementing this function and writing things to its output. Instead, introduce a PragmaCommentDecl AST node and hang one off the TranslationUnitDecl for every `#pragma comment` line, and then use the regular serialization machinery. (Since PragmaCommentDecl has codegen relevance, it's eagerly deserialized.) http://reviews.llvm.org/D17799 llvm-svn: 262493
* Introduce -fsanitize-stats flag.Peter Collingbourne2016-01-161-1/+1
| | | | | | | | | This is part of a new statistics gathering feature for the sanitizers. See clang/docs/SanitizerStats.rst for further info and docs. Differential Revision: http://reviews.llvm.org/D16175 llvm-svn: 257971
* Implement section pragma feedback on r205810Reid Kleckner2015-03-041-0/+3
| | | | | | | Mostly short-circuits some conditionals. Adds target validation of sections passed to these pragmas. llvm-svn: 231317
* The prefix 'Ms-' should be 'MS-'David Majnemer2015-02-021-1/+1
| | | | | | | Clang is otherwise consistent that Microsoft be abbreviated as MS, not Ms. llvm-svn: 227842
* MS Compat: mark globals emitted in read-only sections constHans Wennborg2014-10-161-10/+10
| | | | | | | | | | | | | | | | | | | | They cannot be written to, so marking them const makes sense and may improve optimisation. As a side-effect, SectionInfos has to be moved from Sema to ASTContext. It also fixes this problem, that occurs when compiling ATL: warning LNK4254: section 'ATL' (C0000040) merged into '.rdata' (40000040) with different attributes The ATL headers are putting variables in a special section that's marked read-only. However, Clang currently can't model that read-onlyness in the IR. But, by making the variables const, the section does become read-only, and the linker warning is avoided. Differential Revision: http://reviews.llvm.org/D5812 llvm-svn: 219960
* Return true from UnifySection when emitting a diagnosticEhsan Akhgari2014-09-221-1/+1
| | | | | | | | | | | | Test Plan: I noticed this through code inspection. The callers use the return value to remove the SectionAttr if a diagnostic is emitted, but I don't think the failure to do so is observable right now. Reviewers: rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5438 llvm-svn: 218265
* Fix some cases where StringRef was being passed by const reference. Remove ↵Craig Topper2014-08-301-2/+2
| | | | | | const from some other StringRefs since its implicitly const already. llvm-svn: 216825
* -fms-extensions: Implement half of #pragma init_segReid Kleckner2014-07-221-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This pragma is very rare. We could *hypothetically* lower some uses of it down to @llvm.global_ctors, but given that GlobalOpt isn't able to optimize prioritized global ctors today, there's really no point. If we wanted to do this in the future, I would check if the section used in the pragma started with ".CRT$XC" and had up to two characters after it. Those two characters could form the 16-bit initialization priority that we support in @llvm.global_ctors. We would have to teach LLVM to lower prioritized global ctors on COFF as well. This should let us compile some silly uses of this pragma in WebKit / Blink. Reviewers: rsmith, majnemer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4549 llvm-svn: 213593
* [C++11] Use 'nullptr'. Sema edition.Craig Topper2014-05-261-9/+9
| | | | llvm-svn: 209613
* Implemented support for "pragma clang optimize on/off", based on attribute ↵Dario Domizioli2014-05-231-0/+28
| | | | | | | | | | | | | | | | 'optnone'. This patch implements support for selectively disabling optimizations on a range of function definitions through a pragma. The implementation is that all function definitions in the range are decorated with attribute 'optnone'. #pragma clang optimize off // All function definitions in here are decorated with 'optnone'. #pragma clang optimize on // Compilation resumes as normal. llvm-svn: 209510
* Fix a bunch of mislayered clang/Lex includes from SemaAlp Toker2014-05-031-1/+1
| | | | llvm-svn: 207896
* [MS-ABI] Add support for #pragma section and related pragmasWarren Hunt2014-04-081-0/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the msvc pragmas section, bss_seg, code_seg, const_seg and data_seg as well as support for __declspec(allocate()). Additionally it corrects semantics and adds diagnostics for __attribute__((section())) and the interaction between the attribute and the msvc pragmas and declspec. In general conflicts should now be well diganosed within and among these features. In supporting the pragmas new machinery for uniform lexing for msvc pragmas was introduced. The new machinery always lexes the entire pragma and stores it on an annotation token. The parser is responsible for parsing the pragma when the handling the annotation token. There is a known outstanding bug in this implementation in C mode. Because these attributes and pragmas apply _only_ to definitions, we process them at the time we detect a definition. Due to tentative definitions in C, we end up processing the definition late. This means that in C mode, everything that ends up in a BSS section will end up in the _last_ BSS section rather than the one that was live at the time of tentative definition, even if that turns out to be the point of actual definition. This issue is not known to impact anything as of yet because we are not aware of a clear use or use case for #pragma bss_seg but should be fixed at some point. Differential Revision=http://reviews.llvm.org/D3065#inline-16241 llvm-svn: 205810
* [C++11] Expand and eliminate the LLVM_ENUM_INT_TYPE() macroAlp Toker2014-03-021-1/+1
| | | | llvm-svn: 202606
* MS ABI: Implement #pragma vtordisp() and clang-cl /vdNReid Kleckner2014-02-121-5/+36
| | | | | | | | | | | | | | | | | These features are new in VS 2013 and are necessary in order to layout std::ostream correctly. Currently we have an ABI incompatibility when self-hosting with the 2013 stdlib in our convertible_fwd_ostream wrapper in gtest. This change adds another implicit attribute, MSVtorDispAttr, because implicit attributes are currently the best way to make sure the information stays on class templates through instantiation. Reviewers: majnemer Differential Revision: http://llvm-reviews.chandlerc.com/D2746 llvm-svn: 201274
* MS ABI: Add support for the -vm{b,g,s,m,v} flagsDavid Majnemer2014-02-111-1/+1
| | | | | | | | | These flags control the inheritance model initially used by the translation unit. Differential Revision: http://llvm-reviews.chandlerc.com/D2741 llvm-svn: 201175
* MS ABI: Add support for #pragma pointers_to_membersDavid Majnemer2014-02-101-0/+7
| | | | | | | | | | | | | | | | | | | Introduce a notion of a 'current representation method' for pointers-to-members. When starting out, this is set to 'best case' (representation method is chosen by examining the class, selecting the smallest representation that would work given the class definition or lack thereof). This pragma allows the translation unit to dictate exactly what representation to use, similar to how the inheritance model keywords operate. N.B. PCH support is forthcoming. Differential Revision: http://llvm-reviews.chandlerc.com/D2723 llvm-svn: 201105
* Fix a -Wmicrosoft warning about an unrepresentable enum valueReid Kleckner2014-02-031-1/+1
| | | | | | In MSVC, enums are always signed unless you explicitly specify the type. llvm-svn: 200719
* Distinguish between attributes explicitly written at the request of the ↵Aaron Ballman2014-01-161-7/+6
| | | | | | | | user, and attributes implicitly generated to assist in bookkeeping by the compiler. This is done so by table generating a CreateImplicit method for each attribute. Additionally, remove the optional nature of the spelling list index when creating attributes. This is supported by table generating a Spelling enumeration when the spellings for an attribute are distinct enough to warrant it. llvm-svn: 199378
* Tablegen now generates a StringSwitch for attributes containing enumeration ↵Aaron Ballman2013-09-111-13/+4
| | | | | | arguments to map strings to the proper enumeration value. This makes error checking more consistent and reduces the amount of hand-written code required. llvm-svn: 190545
* Omit llvm:: before StringRef and SmallString. We have using directive in ↵Robert Wilhelm2013-08-101-3/+2
| | | | | | include/clang/Basic/LLVM.h. llvm-svn: 188139
* Adding support for MSVC #pragma detect_mismatch functionality by emitting a ↵Aaron Ballman2013-06-041-0/+6
| | | | | | FAILIFMISMATCH linker command into the object file. llvm-svn: 183178
* Suffixing #pragma comment(lib) library names with .lib if necessary. This ↵Aaron Ballman2013-05-241-2/+1
| | | | | | matches MSVC behavior, as well as allows us to properly link libraries such as the ones provided by the MSDN examples. llvm-svn: 182647
* Forward #pragma comment(lib/linker) through as flags metadataReid Kleckner2013-05-081-0/+21
| | | | | | | | | | | | | | | | | | | | | | Summary: Most of this change is wiring the pragma all the way through from the lexer, parser, and sema to codegen. I considered adding a Decl AST node for this, but it seemed too heavyweight. Mach-O already uses a metadata flag called "Linker Options" to do this kind of auto-linking. This change follows that pattern. LLVM knows how to forward the "Linker Options" metadata into the COFF .drectve section where these flags belong. ELF support is not implemented, but possible. This is related to auto-linking, which is http://llvm.org/PR13016. CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D723 llvm-svn: 181426
* Add a new 'type_visibility' attribute to allow users toJohn McCall2013-02-201-1/+1
| | | | | | | | | | | | | | control the visibility of a type for the purposes of RTTI and template argument restrictions independently of how visibility propagates to its non-type member declarations. Also fix r175326 to not ignore template argument visibility on a template explicit instantiation when a member has an explicit attribute but the instantiation does not. The type_visibility work is rdar://11880378 llvm-svn: 175587
* Disable caching of visibility.Rafael Espindola2013-01-121-1/+0
| | | | | | | | | | | | | | The testcase in pr14929 shows that this is extremely hard to do. If we choose to apply the attribute, that causes the visibility of some decls to change and that can happen really late (during codegen). Current gcc warns and ignores the attribute in this testcase with a warning. This suggest that the correct solution is to find a point in the compilation where we can compute the visibility and * assert it was never computed before * reject any attempts to compute it again in the future (with warnings). llvm-svn: 172305
* Add 171048 back but invalidate the cache of all redeclarations when settingRafael Espindola2012-12-251-1/+3
| | | | | | | | | | | | | | | | | | the body of a functions. The problem was that hasBody looks at the entire chain and causes problems to -fvisibility-inlines-hidden if the cache was not invalidated. Original message: Cache visibility of decls. This unifies the linkage and visibility caching. I first implemented this when working on pr13844, but the previous fixes removed the performance advantage of this one. This is still a step in the right direction for making linkage and visibility cheap to use. llvm-svn: 171053
* Revert r171048, "Cache visibility of decls."NAKAMURA Takumi2012-12-251-3/+1
| | | | | | It broke stage2. llvm-svn: 171050
* Cache visibility of decls.Rafael Espindola2012-12-251-1/+3
| | | | | | | | | | | This unifies the linkage and visibility caching. I first implemented this when working on pr13844, but the previous fixes removed the performance advantage of this one. This is still a step in the right direction for making linkage and visibility cheap to use. llvm-svn: 171048
* Revert r170500. It over-zealously converted *ALL* things named Attributes, ↵Bill Wendling2012-12-201-1/+1
| | | | | | which is wrong here. llvm-svn: 170721
* Rename the 'Attributes' class to 'Attribute'. It's going to represent a ↵Bill Wendling2012-12-191-1/+1
| | | | | | single attribute in the future. llvm-svn: 170500
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-1/+1
| | | | | | | | | | | | | 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
* Permanently end the whole "pragma got handled by the parser too early"Eli Friedman2012-10-041-15/+8
| | | | | | | mess by handling all pragmas which the parser touches uniformly. <rdar://problem/12248901>, etc. llvm-svn: 165195
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-1/+1
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Reject mismatched "#pragma GCC visibility push" and "#pragma GCC visibility ↵Rafael Espindola2012-02-011-12/+33
| | | | | | pop". llvm-svn: 149559
* Remove redundant argument.Rafael Espindola2012-01-211-2/+2
| | | | llvm-svn: 148628
* Remove unnecessary default cases in switches over enums.David Blaikie2012-01-171-3/+0
| | | | | | This allows -Wswitch-enum to find switches that need updating when these enums are modified. llvm-svn: 148281
* Add explicit attributes to mark functions as having had theirJohn McCall2011-09-301-0/+12
| | | | | | | | | | | CoreFoundation object-transfer properties audited, and add a #pragma to cause them to be automatically applied to functions in a particular span of code. This has to be implemented largely in the preprocessor because of the requirement that the region be entirely contained in a single file; that's hard to impose from the parser without registering for a ton of callbacks. llvm-svn: 140846
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-1/+1
| | | | llvm-svn: 140367
* Change all references of type ExprTy to Expr and get rid of the typedefs.Richard Trieu2011-09-091-1/+1
| | | | llvm-svn: 139347
* Add ms_struct attribute on record typeeFariborz Jahanian2011-04-261-0/+6
| | | | | | (and ignore it for now) - wip. llvm-svn: 130224
* Recognize gcc's ms_struct pragma (and ignore for now).Fariborz Jahanian2011-04-251-0/+4
| | | | | | This is wip. llvm-svn: 130138
* On Mac OS X, the presence of an 'availability' attribute for thatDouglas Gregor2011-03-261-1/+1
| | | | | | | | | platform implies default visibility. To achieve these, refactor our lookup of explicit visibility so that we search for both an explicit VisibilityAttr and an appropriate AvailabilityAttr, favoring the VisibilityAttr if it is present. llvm-svn: 128336
* Move support for "#pragma STDC FP_CONTRACT" to Parser; add Sema actionsPeter Collingbourne2011-02-141-0/+14
| | | | llvm-svn: 125474
* Allow #pragma unused to be used on global variables like gcc. Fixes ↵Argyrios Kyrtzidis2011-01-271-2/+2
| | | | | | rdar://8793832. llvm-svn: 124383
* Convert "#pragma unused(...)" into tokens for the parser.Argyrios Kyrtzidis2011-01-171-27/+21
| | | | | | | This allows us to cache a "#pragma unused" that occurs inside an inline C++ member function. Fixes rdar://8829590&8770988. llvm-svn: 123666
* Treat visibility on an enclosing namespace as a non-explicit source ofJohn McCall2010-12-101-7/+14
| | | | | | | | | | | visibility. Fixes PR8713. I've disabled a test which was testing that you can #pragma pop visibility to get out of a namespace's visibility attribute. We should probably just diagnose that as an error unless it's instrumental to someone's system headers. llvm-svn: 121459
* Make #pragma unused work for static local variables.Douglas Gregor2010-11-091-1/+1
| | | | llvm-svn: 118500
* Warn if a variable marked with the "unused" attribute is used. Patch by ↵Anders Carlsson2010-10-221-0/+4
| | | | | | Darin Adler! llvm-svn: 117184
* One who seeks knowledge learns something new every day.John McCall2010-08-261-5/+5
| | | | | | | | | One who seeks the Tao unlearns something new every day. Less and less remains until you arrive at non-action. When you arrive at non-action, nothing will be left undone. llvm-svn: 112244
OpenPOWER on IntegriCloud