summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParsePragma.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [Parse] ArrayRefize PragmaLoopHintInfo. No functionality change.Benjamin Kramer2015-08-051-10/+4
| | | | llvm-svn: 244024
* Add assume_safety option for pragma loop vectorize and interleave.Tyler Nowicki2015-06-111-3/+6
| | | | | | | | Specifying #pragma clang loop vectorize(assume_safety) on a loop adds the mem.parallel_loop_access metadata to each load/store operation in the loop. This metadata tells loop access analysis (LAA) to skip memory dependency checking. llvm-svn: 239572
* Correct Loop Hint Diagnostic MessageTyler Nowicki2015-06-081-3/+4
| | | | | | When pragma clang loop unroll() is specified without an argument the diagnostic message should inform that user that 'full' and 'disable' are valid arguments (not 'enable'). llvm-svn: 239363
* [OPENMP] Allow use of macros in OpenMP directives/clauses.Alexey Bataev2015-05-051-1/+1
| | | | llvm-svn: 236493
* Adds a warning for unrecognized argument to #pragma comment() on PS4.Yunzhong Gao2015-03-231-8/+16
| | | | | | | | | | | PS4 target recognizes the #pragma comment() syntax as in -fms-extensions, but only handles the case of #pragma comment(lib). This patch adds a warning if any other arguments are encountered. This patch also refactors the code in ParsePragma.cpp a little bit to make it more obvious that some codes are being shared between -fms-extensions and PS4. llvm-svn: 233015
* Parse: Don't assume tokens have a lengthDavid Majnemer2015-03-191-1/+22
| | | | | | | Don't crash if the last token in a bad inline method body is an annotation token. llvm-svn: 232694
* Enable pragma comment processing for PS4. Original patch by Yunzhong Gao!Alex Rosenberg2015-01-281-0/+6
| | | | llvm-svn: 227336
* Parse: Ignore "long" and "short" in #pragma sectionDavid Majnemer2014-10-221-1/+15
| | | | | | This fixes PR21337. llvm-svn: 220429
* MS Compat: mark globals emitted in read-only sections constHans Wennborg2014-10-161-13/+14
| | | | | | | | | | | | | | | | | | | | 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
* Fixed a problem in r19589.Tyler Nowicki2014-10-121-2/+2
| | | | | | Several systems failed to compile the array allocation of the TokenArray. llvm-svn: 219590
* Allow constant expressions in pragma loop hints.Tyler Nowicki2014-10-121-47/+96
| | | | | | | | Previously loop hints such as #pragma loop vectorize_width(#) required a constant. This patch allows a constant expression to be used as well. Such as a non-type template parameter or an expression (2 * c + 1). Reviewed by Richard Smith llvm-svn: 219589
* Parse: Don't attempt to act on #pragma init_seg when not targeting MSVCDavid Majnemer2014-08-141-0/+6
| | | | | | | | | | It doesn't really make sense to try and do stuff with #pragma init_seg when targeting non-Microsoft platforms; notions like library vs user initializers don't exist for other targets. This fixes PR20639. llvm-svn: 215618
* Initializing the loop hint option token again.Aaron Ballman2014-08-011-0/+1
| | | | llvm-svn: 214504
* Initializing the loop hint option token.Aaron Ballman2014-08-011-1/+3
| | | | llvm-svn: 214502
* Loop hint pragmas sometimes do not contain an identifier option (such as ↵Aaron Ballman2014-07-311-1/+5
| | | | | | | | #pragma unroll(4)). Check explicitly that the token we stored was an identifier. Amends r214432 llvm-svn: 214446
* Add a state variable to the loop hint attribute.Tyler Nowicki2014-07-311-42/+70
| | | | | | | | | | This patch is necessary to support constant expressions which replaces the integer value in the loop hint attribute with an expression. The integer value was also storing the pragma’s state for options like vectorize(enable/disable) and the pragma unroll and nounroll directive. The state variable is introduced to hold the state of those options/pragmas. This moves the validation of the state (keywords) from SemaStmtAttr handler to the loop hint annotation token handler. Resubmit with changes to try to fix the build-bot issue. Reviewed by Aaron Ballman llvm-svn: 214432
* Revert r214333, "Add a state variable to the loop hint attribute."NAKAMURA Takumi2014-07-311-69/+42
| | | | | | It brought undefined behavior. llvm-svn: 214376
* Add a state variable to the loop hint attribute.Tyler Nowicki2014-07-301-42/+69
| | | | | | | | This patch is necessary to support constant expressions which replaces the integer value in the loop hint attribute with an expression. The integer value was also storing the pragma’s state for options like vectorize(enable/disable) and the pragma unroll and nounroll directive. The state variable is introduced to hold the state of those options/pragmas. This moves the validation of the state (keywords) from SemaStmtAttr handler to the loop hint annotation token handler. Reviewed by Aaron Ballman llvm-svn: 214333
* Add support for #pragma nounroll.Mark Heffernan2014-07-241-9/+22
| | | | llvm-svn: 213885
* In unroll pragma syntax and loop hint metadata, change "enable" forms to a ↵Mark Heffernan2014-07-231-7/+12
| | | | | | new form using the string "full". llvm-svn: 213771
* -fms-extensions: Implement half of #pragma init_segReid Kleckner2014-07-221-4/+53
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Add support for '#pragma unroll'.Mark Heffernan2014-07-211-54/+158
| | | | llvm-svn: 213574
* Fix parsing certain kinds of strings in the MS section pragmasReid Kleckner2014-07-181-50/+99
| | | | | | | | | We were crashing on the relevant test case inputs. Also, refactor this code a bit so we can report failure and slurp the pragma tokens without returning a diagnostic id. This is more consistent with the rest of the parser and sema code. llvm-svn: 213337
* Fix PR20069: bad loop pragma arguments crash FEEli Bendersky2014-06-191-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes a crash when handling malformed arguments to loop pragmas such as: "#pragma clang loop vectorize(()". Essentially any argument which is not an identifier or constant resulted in a crash. This patch also changes a couple of the error messages which weren't quite correct. New behavior with this patch vs old behavior: #pragma clang loop vectorize(1) OLD: error: missing keyword; expected 'enable' or 'disable' NEW: error: invalid argument; expected 'enable' or 'disable' #pragma clang loop vectorize() OLD: error: expected ')' NEW: error: missing argument to loop pragma 'vectorize' #pragma clang loop vectorize_width(bad) OLD: error: missing value; expected a positive integer value NEW: error: invalid argument; expected a positive integer value #pragma clang loop vectorize(bad) OLD: invalid keyword 'bad'; expected 'enable' or 'disable' NEW: error: invalid argument; expected 'enable' or 'disable' http://reviews.llvm.org/D4197 Patch by Mark Heffernan llvm-svn: 211292
* Hide the concept of diagnostic levels from lex, parse and semaAlp Toker2014-06-151-3/+2
| | | | | | | | | | | | | | | | The compilation pipeline doesn't actually need to know about the high-level concept of diagnostic mappings, and hiding the final computed level presents several simplifications and other potential benefits. The only exceptions are opportunistic checks to see whether expensive code paths can be avoided for diagnostics that are guaranteed to be ignored at a certain SourceLocation. This commit formalizes that invariant by introducing and using DiagnosticsEngine::isIgnored() in place of individual level checks throughout lex, parse and sema. llvm-svn: 211005
* First commit. Modified FIXME comment.Tyler Nowicki2014-06-131-2/+2
| | | | llvm-svn: 210918
* DiagnosticsEngine: update severity setters to new terminologyAlp Toker2014-06-121-3/+2
| | | | llvm-svn: 210764
* Complete the switch from mappings to declarative diagnostic severitiesAlp Toker2014-06-121-1/+1
| | | | | | | | | This begins to address cognitive dissonance caused by treating the Note diagnostic level as a severity in the diagnostic engine. No change in functionality. llvm-svn: 210758
* Add loop unroll pragma supportEli Bendersky2014-06-111-3/+18
| | | | | | | | http://reviews.llvm.org/D4089 Patch by Mark Heffernan. llvm-svn: 210667
* Fix DOS-style newlines.Eli Bendersky2014-06-061-187/+187
| | | | | | | | | A previous patch r210330 (and possibly another) introduced DOS-style newlines into a UNIX newline formatted file. Patch by Mark Heffernan (http://reviews.llvm.org/D4046) llvm-svn: 210369
* Adding a new #pragma for the vectorize and interleave optimization hints.Aaron Ballman2014-06-061-33/+187
| | | | | | Patch thanks to Tyler Nowicki! llvm-svn: 210330
* Implemented support for "pragma clang optimize on/off", based on attribute ↵Dario Domizioli2014-05-231-0/+53
| | | | | | | | | | | | | | | | '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
* [C++11] Use 'nullptr'. Parser edition.Craig Topper2014-05-211-3/+3
| | | | llvm-svn: 209275
* [MS-ABI] Add support for #pragma section and related pragmasWarren Hunt2014-04-081-9/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* -fms-extensions: Error out on #pragma init_segReid Kleckner2014-04-031-0/+18
| | | | | | | | | | | | | By ignoring this pragma with a warning, we're essentially miscompiling the user's program. WebKit / Blink use this pragma to disable dynamic initialization and finalization of some static data, and running the dtors crashes the program. Error out for now, so that /fallback compiles the TU correctly with MSVC. This pragma should be implemented some time this month, and we can remove this hack. llvm-svn: 205554
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-121-32/+32
| | | | | | class. llvm-svn: 203641
* Revert the removal of PPCallbacks::PragmaComment() in r201821Reid Kleckner2014-02-201-0/+9
| | | | | | | | The pp-trace clang tool was using it successfully. We can still delete the callbacks in Frontend/PrintPreprocessedOutput.cpp because they were effectively dead. llvm-svn: 201825
* Expand macros in pragmas with -fms-extensions and -EReid Kleckner2014-02-201-9/+0
| | | | | | | | | | | | | | gcc never expands macros in pragmas and MSVC always expands macros before processing pragmas. Clang usually allows macro expansion, except in a handful of pragmas, most of which are handled by the lexer. Also remove PPCallbacks for pragmas that are currently handled in the parser. Without a Parser, such as with clang -E, these callbacks would never be called. Fixes PR18576. llvm-svn: 201821
* Hide pragma handler classes in ParsePragma.cppReid Kleckner2014-02-201-1/+202
| | | | | | | | | | | | | | This reduces the number of files we need to touch to add a new pragma, and reduces the number of externally visible symbols in clang. Make the handlers structs instead of classes because the vast majority have no private members. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D2834 llvm-svn: 201820
* Fix uninitialized read in vtordisp pragma code.Reid Kleckner2014-02-131-3/+3
| | | | llvm-svn: 201280
* MS ABI: Implement #pragma vtordisp() and clang-cl /vdNReid Kleckner2014-02-121-1/+101
| | | | | | | | | | | | | | | | | 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-8/+11
| | | | | | | | | 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/+101
| | | | | | | | | | | | | | | | | | | 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
* Basic: Clean up malformed pragma diagnosticsDavid Majnemer2014-02-101-1/+1
| | | | | | | Create a new diagnostic, -Wignored-pragmas and use it to handle any case where a pragma would have a side effect but is ignored. llvm-svn: 201102
* Support and use token kinds as diagnostic argumentsAlp Toker2013-12-241-3/+3
| | | | | | | | | | | | | | | | | | | Introduce proper facilities to render token spellings using the diagnostic formatter. Replaces most of the hard-coded diagnostic messages related to expected tokens, which all shared the same semantics but had to be multiply defined due to variations in token order or quote marks. The associated parser changes are largely mechanical but they expose commonality in whole chunks of the parser that can now be factored away. This commit uses C++11 typed enums along with a speculative legacy fallback until the transition is complete. Requires corresponding changes in LLVM r197895. llvm-svn: 197972
* Callback support for OpenCL extension pragmas.Pekka Jaaskelainen2013-10-121-0/+5
| | | | | | Patch from Rami Ylimäki and Mikael Lepistö! llvm-svn: 192531
* Adding support for MSVC #pragma detect_mismatch functionality by emitting a ↵Aaron Ballman2013-06-041-0/+57
| | | | | | FAILIFMISMATCH linker command into the object file. llvm-svn: 183178
* Forward #pragma comment(lib/linker) through as flags metadataReid Kleckner2013-05-081-7/+16
| | | | | | | | | | | | | | | | | | | | | | 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
* Move PragmaCommentHandler to lib/Parse in preparation for calling SemaReid Kleckner2013-05-061-0/+66
| | | | | | | | | | | | | | Summary: No functionality change. The existing tests for this pragma only verify that we can preprocess it. Reviewers: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D751 llvm-svn: 181246
* Move CapturedStmt parameters to CapturedDeclBen Langmuir2013-05-031-1/+2
| | | | | | | | | | | Move the creation of CapturedStmt parameters out of CodeGen and into Sema, making it easier to customize the outlined function. The ImplicitParamDecls are stored in the CapturedDecl using an ASTContext-allocated array. Differential Revision: http://llvm-reviews.chandlerc.com/D722 llvm-svn: 181043
OpenPOWER on IntegriCloud