summaryrefslogtreecommitdiffstats
path: root/Source/cmConditionEvaluator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Format include directive blocks and ordering with clang-formatBrad King2016-04-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sort include directives within each block (separated by a blank line) in lexicographic order (except to prioritize `sys/types.h` first). First run `clang-format` with the config file: --- SortIncludes: false ... Commit the result temporarily. Then run `clang-format` again with: --- SortIncludes: true IncludeCategories: - Regex: 'sys/types.h' Priority: -1 ... Commit the result temporarily. Start a new branch and cherry-pick the second commit. Manually resolve conflicts to preserve indentation of re-ordered includes. This cleans up the include ordering without changing any other style. Use the following command to run `clang-format`: $ git ls-files -z -- \ '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' | egrep -z -v '(Lexer|Parser|ParserHelper)\.' | egrep -z -v '^Source/cm_sha2' | egrep -z -v '^Source/(kwsys|CursesDialog/form)/' | egrep -z -v '^Utilities/(KW|cm).*/' | egrep -z -v '^Tests/Module/GenerateExportHeader' | egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' | xargs -0 clang-format -i This selects source files that do not come from a third-party. Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
* Source: Stabilize include orderBrad King2016-04-291-0/+1
| | | | | Each source file has a logical first include file. Include it in an isolated block so that tools that sort includes do not move them.
* Merge topic 'preallocate-condition-keywords'Brad King2016-04-111-4/+4
|\ | | | | | | | | aff4a5fa cmConditionEvaluator: Use pre-allocated keywords in more places
| * cmConditionEvaluator: Use pre-allocated keywords in more placesBrad King2016-04-081-4/+4
| | | | | | | | Inspired-by: Harry Mallon <Harry@codexdigital.com>
* | Merge topic 'preallocate-condition-keywords'Brad King2016-03-311-31/+58
|\ \ | |/ | | | | | | 5c324294 cmConditionEvaluator: Pre-allocate keyword strings
| * cmConditionEvaluator: Pre-allocate keyword stringsBrad King2016-03-291-31/+58
| | | | | | | | | | | | Calls to `IsKeyword("...")` cause runtime construction of std::string. Avoid possible repeated allocation by pre-allocating keyword strings during initialization.
* | cmConditionEvaluator: Remove GetConditionContext methodBrad King2016-03-291-12/+0
| | | | | | | | | | All it does is call cmListFileContext::FromCommandContext, so move this to the call sites.
* | cmConditionEvaluator: Drop unnecessary path conversionBrad King2016-03-291-8/+1
|/ | | | | | | | | | In commit v3.4.0-rc2~1^2 (cmIfCommand: Issue CMP0054 warning with appropriate context, 2015-10-20) we added construction of a cmListFileContext with conversion of the calling file path. This code path runs on every condition (e.g. `if()`) and so the path conversion has a noticeable performance cost. Fortunately the only use of this context is for insertion into cmMakefile::CMP0054ReportedIds so we do not need to convert the path. Simply drop the conversion.
* cmConditionEvaluator: Fix matching of `CMAKE_MATCH_*` values (#15944)Brad King2016-02-011-0/+10
| | | | | | | | | | | While evaluating `if(MATCHES)` we get a `const char*` pointer to the string to be matched. On code like if(CMAKE_MATCH_COUNT MATCHES "Y") the string to be matched may be owned by our own result variables. We must move the value to our own buffer before clearing them. Otherwise we risk reading freed storage.
* cmIfCommand: Issue CMP0054 warning with appropriate context. (#15802)Stephen Kelly2015-10-201-5/+35
| | | | | | | | | | | | | | | Commit v3.4.0-rc1~494^2~4 (cmMakefile: Add API for elseif to create backtrace., 2015-05-29) removed the use of cmMakefileCall to push/pop execution context in favor of a new way to create backtraces. However, a call to cmMakefile::GetExecutionContext is still invoked to issue a contextual CMP0054 warning through cmConditionEvaluator. As the elseif is not part of the call stack, this resulted in trying to access an empty vector. Avoid the attempt at getting execution context when evaluating elseif by constructing a context and backtrace on behalf of the cmConditionEvaluator in all cases.
* if: Add "TEST <test>" conditionMatt McCormick2015-08-031-1/+25
| | | | | | | | if(TEST TestNameThatExists) will return true if a test with the name TestNameThatExists has been added with add_test. The syntax is similar to if(TARGET TargetName). Since use of "TEST" as an argument to if() could previously be interpreted as a non-keyword argument, add policy CMP0064 to treat it as a keyword as NEW behavior.
* cmConditionEvaluator: Remove superfluous spaces in expressionsSebastian Schuberth2015-07-271-8/+8
|
* cmMakefile: Simplify CMP0054 handling.Stephen Kelly2015-05-181-8/+2
|
* cmMakefile: Add access to the top-level execution context.Stephen Kelly2015-05-181-2/+2
| | | | | This is cheaper than getting the whole backtrace, and the cmListFileBacktrace will not always be composed of cmListFileContext objects.
* Port to static cmPolicies API.Stephen Kelly2015-05-041-12/+6
|
* if: Implement new IN_LIST operatorNils Gladitz2015-04-301-1/+37
|
* Port cmCommand consumers to cmState.Stephen Kelly2015-04-151-1/+3
|
* Merge topic 'drop-ancient-workarounds'Brad King2015-01-121-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0f7bdd61 Remove VS 6 special case. 5e92c826 Remove some obsolete stuff. 15e42bb2 cmStandardIncludes: Remove obsolete cmOStringStream. 931e055d Port all cmOStringStream to std::ostringstream. f194a009 Remove unused cmIStringStream class. 3ec1bb15 cmStandardIncludes: Remove std namespace hack. bb3bce70 cmStandardIncludes: Remove ANSI_FOR_SCOPE hack. 28fa4923 cmStandardIncludes: Remove iostreams workaround for obsolete Compaq compiler. 837a8a63 cmStandardIncludes: Drop Comeau-related workaround. 4030ddfd Remove Borland-related undef. 17d6a6fd cmStandardIncludes: Remove comment about Borland. 26fb5011 Drop SGI as a CMake host compiler.
| * Port all cmOStringStream to std::ostringstream.Stephen Kelly2015-01-111-3/+3
| | | | | | | | All compilers hosting CMake support the std class.
* | Use insert instead of a loop in some cases.Stephen Kelly2015-01-111-8/+2
|/ | | | | | Limit this change to inserting into a vector from a vector. A follow up change can use insert for inserting into a set.
* cmMakefile: store the number of last matches in a CMake varBen Boeckel2014-12-031-3/+2
| | | | | | | | | With PushScope and PopScope, keeping track of another bit of data for each scope isn't easy. Instead, store it as another CMake variable so it gets implicitly tracked along with everything else. This works in a revert of commit 7d674b5f0b28a610333644d417c2e8cb796cc9e4.
* Revert "ClearMatches: Only clear matches which were actually set" (#15261)Ben Boeckel2014-11-261-2/+3
| | | | | | | | | | | This reverts commit v3.1.0-rc1~557^2~2 (ClearMatches: Only clear matches which were actually set, 2014-03-12). The optimization did not track the match count in the same scope as the variables, allowing possible inconsistency. Resolve conflicts in Source/cmIfCommand.cxx, Source/cmMakefile.cxx, and Source/cmMakefile.h by moving the changes to the new location of the code involved.
* If: Introduce policy CMP0054 - don't dereference quoted variables in if()Nils Gladitz2014-09-111-79/+157
|
* If: Extract cmConditionEvaluator from if() implementationNils Gladitz2014-09-111-0/+692