Differential D15764 Diff 42447 plugins/custom-definesandincludes/compilerprovider/settingsmanager.cpp
Changeset View
Changeset View
Standalone View
Standalone View
plugins/custom-definesandincludes/compilerprovider/settingsmanager.cpp
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | 64 | { | |||
---|---|---|---|---|---|
66 | case Utils::C: | 66 | case Utils::C: | ||
67 | return QStringLiteral("parserArgumentsC"); | 67 | return QStringLiteral("parserArgumentsC"); | ||
68 | case Utils::Cpp: | 68 | case Utils::Cpp: | ||
69 | return QStringLiteral("parserArguments"); | 69 | return QStringLiteral("parserArguments"); | ||
70 | case Utils::OpenCl: | 70 | case Utils::OpenCl: | ||
71 | return QStringLiteral("parserArgumentsOpenCL"); | 71 | return QStringLiteral("parserArgumentsOpenCL"); | ||
72 | case Utils::Cuda: | 72 | case Utils::Cuda: | ||
73 | return QStringLiteral("parserArgumentsCuda"); | 73 | return QStringLiteral("parserArgumentsCuda"); | ||
74 | // TODO: is there a need for "parserArgumentsObjC[++]" and if so how/where | ||||
75 | // if not, merge the ObjC cases with the C/C++ cases. | ||||
aaronpuchert: Do you want to be able to define custom parser arguments? As above, are there multiple… | |||||
From what I've seen there are basically as many ObjC(++) standards as there are C(++) standards. There are a few ObjC-specific compiler options (which are illegal for C/C++), for instance concerning ObjC exceptions. I'm not certain they change anything for the parser though (esp. not the parser in its current form). So I'm tempted to say that for now we could and should simply use the C/C++ options for ObjC/ObjC++ and re-evaluate if and when the need for specific options arises. rjvbb: From what I've seen there are basically as many ObjC(++) standards as there are C(++) standards. | |||||
aaronpuchert: Ok, I think that's fine for now. | |||||
74 | case Utils::ObjC: | 76 | case Utils::ObjC: | ||
77 | return QStringLiteral("parserArgumentsC"); | ||||
78 | case Utils::ObjCpp: | ||||
79 | return QStringLiteral("parserArguments"); | ||||
75 | case Utils::Other: | 80 | case Utils::Other: | ||
76 | break; | 81 | break; | ||
77 | } | 82 | } | ||
78 | Q_UNREACHABLE(); | 83 | Q_UNREACHABLE(); | ||
79 | } | 84 | } | ||
80 | 85 | | |||
81 | QString parseAmbiguousAsCPP() | 86 | QString parseAmbiguousAsCPP() | ||
82 | { | 87 | { | ||
Show All 11 Lines | |||||
94 | 99 | | |||
95 | ParserArguments createDefaultArguments() | 100 | ParserArguments createDefaultArguments() | ||
96 | { | 101 | { | ||
97 | ParserArguments arguments; | 102 | ParserArguments arguments; | ||
98 | arguments[Utils::C] = QStringLiteral("-ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=c99"); | 103 | arguments[Utils::C] = QStringLiteral("-ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=c99"); | ||
99 | arguments[Utils::Cpp] = QStringLiteral("-ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=c++11"); | 104 | arguments[Utils::Cpp] = QStringLiteral("-ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=c++11"); | ||
100 | arguments[Utils::OpenCl] = QStringLiteral("-ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -cl-std=CL1.1"); | 105 | arguments[Utils::OpenCl] = QStringLiteral("-ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -cl-std=CL1.1"); | ||
101 | arguments[Utils::Cuda] = QStringLiteral("-ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=c++11"); | 106 | arguments[Utils::Cuda] = QStringLiteral("-ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=c++11"); | ||
102 | arguments[Utils::ObjC] = QStringLiteral("-ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=c99"); | 107 | // For now, use the same arguments for ObjC(++) as for C(++). -Wall enables a number | ||
108 | // of language-specific warnings, removing the need to add them explicitly. | ||||
Since we didn't copy the C string for ObjC, we should similarly not tie Cpp and ObjCpp together. Unless there is a good reason to do that. But then we should do the same for C and ObjC. aaronpuchert: Since we didn't copy the `C` string for `ObjC`, we should similarly not tie `Cpp` and `ObjCpp`… | |||||
109 | // (https://embeddedartistry.com/blog/2017/3/7/clang-weverything) | ||||
110 | arguments[Utils::ObjC] = arguments[Utils::C]; | ||||
111 | arguments[Utils::ObjCpp] = arguments[Utils::Cpp]; | ||||
103 | arguments.parseAmbiguousAsCPP = true; | 112 | arguments.parseAmbiguousAsCPP = true; | ||
104 | 113 | | |||
105 | return arguments; | 114 | return arguments; | ||
106 | } | 115 | } | ||
107 | 116 | | |||
108 | const ParserArguments& defaultArguments() | 117 | const ParserArguments& defaultArguments() | ||
109 | { | 118 | { | ||
110 | static ParserArguments arguments = createDefaultArguments(); | 119 | static ParserArguments arguments = createDefaultArguments(); | ||
▲ Show 20 Lines • Show All 323 Lines • ▼ Show 20 Line(s) | 423 | if (mimeType == QStringLiteral("text/x-csrc") || | |||
434 | return C; | 443 | return C; | ||
435 | } | 444 | } | ||
436 | 445 | | |||
437 | if (mimeType == QStringLiteral("text/x-c++src") || | 446 | if (mimeType == QStringLiteral("text/x-c++src") || | ||
438 | mimeType == QStringLiteral("text/x-c++hdr") ) { | 447 | mimeType == QStringLiteral("text/x-c++hdr") ) { | ||
439 | return Cpp; | 448 | return Cpp; | ||
440 | } | 449 | } | ||
441 | 450 | | |||
451 | if (mimeType == QStringLiteral("text/x-objc++src")) { | ||||
452 | return ObjCpp; | ||||
453 | } | ||||
454 | | ||||
442 | if (mimeType == QStringLiteral("text/x-objcsrc")) { | 455 | if (mimeType == QStringLiteral("text/x-objcsrc")) { | ||
443 | return ObjC; | 456 | return ObjC; | ||
444 | } | 457 | } | ||
445 | 458 | | |||
446 | if (mimeType == QStringLiteral("text/x-opencl-src")) { | 459 | if (mimeType == QStringLiteral("text/x-opencl-src")) { | ||
447 | return OpenCl; | 460 | return OpenCl; | ||
448 | } | 461 | } | ||
449 | 462 | | |||
Show All 10 Lines |
Do you want to be able to define custom parser arguments? As above, are there multiple standards or language versions of ObjC++? I'd guess so if it is based on C++.