mirror of
https://github.com/nasa/trick.git
synced 2024-12-24 15:26:41 +00:00
commit
5d0e0f65bd
@ -13,7 +13,7 @@ sub get_paths {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub get_include_paths {
|
sub get_include_paths {
|
||||||
return "$ENV{TRICK_CFLAGS} $ENV{TRICK_CXXFLAGS}" =~ /-I(\S+)/g
|
return "$ENV{TRICK_CFLAGS} $ENV{TRICK_CXXFLAGS}" =~ /-(?:I|isystem)(\S+)/g
|
||||||
}
|
}
|
||||||
|
|
||||||
sub get_defines {
|
sub get_defines {
|
||||||
|
6
test/SIM_isystem/S_define
Normal file
6
test/SIM_isystem/S_define
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include "sim_objects/default_trick_sys.sm"
|
||||||
|
|
||||||
|
##include "Foo.hh"
|
||||||
|
##include "Warning.hh"
|
||||||
|
|
||||||
|
class Sandbox : public Trick::SimObject {};
|
2
test/SIM_isystem/S_overrides.mk
Normal file
2
test/SIM_isystem/S_overrides.mk
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
MODELS := $(CURDIR)/models
|
||||||
|
TRICK_CXXFLAGS += -Wall -Wextra -I$(MODELS)/my_code -isystem$(MODELS)/third_party
|
3
test/SIM_isystem/models/my_code/Foo.cpp
Normal file
3
test/SIM_isystem/models/my_code/Foo.cpp
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
// @trick_link_dependency{Warning.cpp}
|
||||||
|
|
||||||
|
#include "Warning.hh"
|
1
test/SIM_isystem/models/my_code/Foo.hh
Normal file
1
test/SIM_isystem/models/my_code/Foo.hh
Normal file
@ -0,0 +1 @@
|
|||||||
|
// @trick_link_dependency{Foo.cpp}
|
1
test/SIM_isystem/models/third_party/Warning.cpp
vendored
Normal file
1
test/SIM_isystem/models/third_party/Warning.cpp
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include <Warning.hh>
|
7
test/SIM_isystem/models/third_party/Warning.hh
vendored
Normal file
7
test/SIM_isystem/models/third_party/Warning.hh
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// @trick_link_dependency{Warning.cpp}
|
||||||
|
|
||||||
|
/* This comment has an embedded /*, which causes a warning. */
|
||||||
|
|
||||||
|
static void foo() {
|
||||||
|
int i = 1 / 0;
|
||||||
|
}
|
@ -19,6 +19,7 @@ COMPILE_DIRS = \
|
|||||||
SIMS_NEEDING_TEST = \
|
SIMS_NEEDING_TEST = \
|
||||||
SIM_alloc_test \
|
SIM_alloc_test \
|
||||||
SIM_demo_inputfile \
|
SIM_demo_inputfile \
|
||||||
|
SIM_isystem \
|
||||||
SIM_measurement_units \
|
SIM_measurement_units \
|
||||||
SIM_parse_s_define \
|
SIM_parse_s_define \
|
||||||
SIM_target_specific_variables \
|
SIM_target_specific_variables \
|
||||||
|
@ -106,10 +106,22 @@ void HeaderSearchDirs::AddUserSearchDirs ( std::vector<std::string> & include_di
|
|||||||
if ( resolved_path != NULL ) {
|
if ( resolved_path != NULL ) {
|
||||||
//std::cout << "adding resolved_path = " << resolved_path << std::endl ;
|
//std::cout << "adding resolved_path = " << resolved_path << std::endl ;
|
||||||
hso.AddPath(resolved_path , clang::frontend::Angled, false, true);
|
hso.AddPath(resolved_path , clang::frontend::Angled, false, true);
|
||||||
// Add the path as a system path as well for those included files that are erroneously in <>
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HeaderSearchDirs::AddSystemSearchDirs ( std::vector<std::string> & isystem_dirs ) {
|
||||||
|
//std::cout << "num isystem dirs " << isystem_dirs.size() << std::endl ;
|
||||||
|
int ii ;
|
||||||
|
|
||||||
|
for ( ii = 0 ; ii < isystem_dirs.size() ; ii++ ) {
|
||||||
|
//std::cout << "isystem dirs " << isystem_dirs[ii] << std::endl ;
|
||||||
|
char * resolved_path = almostRealPath(isystem_dirs[ii].c_str()) ;
|
||||||
|
if ( resolved_path != NULL ) {
|
||||||
|
//std::cout << "adding resolved_path = " << resolved_path << std::endl ;
|
||||||
|
hso.AddPath(resolved_path , clang::frontend::System, false, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeaderSearchDirs::AddTrickSearchDirs () {
|
void HeaderSearchDirs::AddTrickSearchDirs () {
|
||||||
@ -186,8 +198,10 @@ void HeaderSearchDirs::ApplyHeaderSearchOptions () {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeaderSearchDirs::addSearchDirs ( std::vector<std::string> & include_dirs ) {
|
void HeaderSearchDirs::addSearchDirs ( std::vector<std::string> & include_dirs,
|
||||||
|
std::vector<std::string> & isystem_dirs) {
|
||||||
AddUserSearchDirs( include_dirs ) ;
|
AddUserSearchDirs( include_dirs ) ;
|
||||||
|
AddSystemSearchDirs( isystem_dirs ) ;
|
||||||
AddTrickSearchDirs() ;
|
AddTrickSearchDirs() ;
|
||||||
AddCompilerBuiltInSearchDirs() ;
|
AddCompilerBuiltInSearchDirs() ;
|
||||||
ApplyHeaderSearchOptions() ;
|
ApplyHeaderSearchOptions() ;
|
||||||
|
@ -32,9 +32,11 @@ class HeaderSearchDirs {
|
|||||||
bool in_sim_services ) ;
|
bool in_sim_services ) ;
|
||||||
|
|
||||||
/** Add all search directories to the preprocessor.
|
/** Add all search directories to the preprocessor.
|
||||||
@param include_dirs = directories incuded on the command line
|
@param include_dirs = directories included via -I on the command line
|
||||||
|
@param isystem_dirs = directories included via -isystem on the command line
|
||||||
*/
|
*/
|
||||||
void addSearchDirs ( std::vector<std::string> & include_dirs ) ;
|
void addSearchDirs ( std::vector<std::string> & include_dirs,
|
||||||
|
std::vector<std::string> & isystem_dirs ) ;
|
||||||
|
|
||||||
/** Returns true if the path argument is in a user model directory
|
/** Returns true if the path argument is in a user model directory
|
||||||
@param path = directory path to be checked
|
@param path = directory path to be checked
|
||||||
@ -133,9 +135,12 @@ class HeaderSearchDirs {
|
|||||||
/** Adds all of the built-in system paths contained in the TRICK_CXX compiler */
|
/** Adds all of the built-in system paths contained in the TRICK_CXX compiler */
|
||||||
void AddCompilerBuiltInSearchDirs () ;
|
void AddCompilerBuiltInSearchDirs () ;
|
||||||
|
|
||||||
/** Adds all of the paths specified on the command line */
|
/** Adds -I include paths */
|
||||||
void AddUserSearchDirs ( std::vector<std::string> & include_dirs ) ;
|
void AddUserSearchDirs ( std::vector<std::string> & include_dirs ) ;
|
||||||
|
|
||||||
|
/** Adds -isystem include paths */
|
||||||
|
void AddSystemSearchDirs ( std::vector<std::string> & isystem_dirs ) ;
|
||||||
|
|
||||||
/** Adds ${TRICK_HOME}/trick_source to the search directories */
|
/** Adds ${TRICK_HOME}/trick_source to the search directories */
|
||||||
void AddTrickSearchDirs () ;
|
void AddTrickSearchDirs () ;
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
/* Command line arguments. These work better as globals, as suggested in llvm/CommandLine documentation */
|
/* Command line arguments. These work better as globals, as suggested in llvm/CommandLine documentation */
|
||||||
llvm::cl::list<std::string> include_dirs("I", llvm::cl::Prefix, llvm::cl::desc("Include directory"), llvm::cl::value_desc("directory"));
|
llvm::cl::list<std::string> include_dirs("I", llvm::cl::Prefix, llvm::cl::desc("Include directory"), llvm::cl::value_desc("directory"));
|
||||||
|
llvm::cl::list<std::string> isystem_dirs("isystem", llvm::cl::Prefix, llvm::cl::desc("Include directory, suppress all warnings"), llvm::cl::value_desc("directory"));
|
||||||
llvm::cl::list<std::string> defines("D", llvm::cl::Prefix, llvm::cl::desc("Defines"), llvm::cl::value_desc("define"));
|
llvm::cl::list<std::string> defines("D", llvm::cl::Prefix, llvm::cl::desc("Defines"), llvm::cl::value_desc("define"));
|
||||||
// TODO: remove units_truth_is_scary in 2021.
|
// TODO: remove units_truth_is_scary in 2021.
|
||||||
llvm::cl::opt<bool> units_truth_is_scary("units-truth-is-scary", llvm::cl::desc("DEPRECATED: Don't print units conversion messages"));
|
llvm::cl::opt<bool> units_truth_is_scary("units-truth-is-scary", llvm::cl::desc("DEPRECATED: Don't print units conversion messages"));
|
||||||
@ -75,10 +76,6 @@ int main(int argc, char * argv[]) {
|
|||||||
*/
|
*/
|
||||||
llvm::cl::ParseCommandLineOptions(argc, argv);
|
llvm::cl::ParseCommandLineOptions(argc, argv);
|
||||||
|
|
||||||
/*if (!validAttributesVersion(attr_version)) {
|
|
||||||
return -1;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (input_file_names.empty()) {
|
if (input_file_names.empty()) {
|
||||||
std::cerr << "No header file specified" << std::endl;
|
std::cerr << "No header file specified" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
@ -149,7 +146,7 @@ int main(int argc, char * argv[]) {
|
|||||||
|
|
||||||
// Add all of the include directories to the preprocessor
|
// Add all of the include directories to the preprocessor
|
||||||
HeaderSearchDirs hsd(ci.getPreprocessor().getHeaderSearchInfo(), ci.getHeaderSearchOpts(), pp, sim_services_flag);
|
HeaderSearchDirs hsd(ci.getPreprocessor().getHeaderSearchInfo(), ci.getHeaderSearchOpts(), pp, sim_services_flag);
|
||||||
hsd.addSearchDirs(include_dirs);
|
hsd.addSearchDirs(include_dirs, isystem_dirs);
|
||||||
|
|
||||||
// Add a preprocessor callback to search for TRICK_ICG
|
// Add a preprocessor callback to search for TRICK_ICG
|
||||||
#if (LIBCLANG_MAJOR > 3) || ((LIBCLANG_MAJOR == 3) && (LIBCLANG_MINOR >= 6))
|
#if (LIBCLANG_MAJOR > 3) || ((LIBCLANG_MAJOR == 3) && (LIBCLANG_MINOR >= 6))
|
||||||
|
Loading…
Reference in New Issue
Block a user