Beispiel #1
0
        private String GetProcessArgument(VCFile vcFile, VCConfiguration vcConfiguration)
        {
            VCFileConfiguration vcFileConfiguration = DTE2Utils.GetVcFileConfiguration(vcFile, vcConfiguration);

            if (vcFileConfiguration == null)
            {
                ts.TraceData(TraceEventType.Error, 1, "GetProcessArgument cannot get VcFileConfiguration ");
                return("");
            }

            StringBuilder stringBuilder = new StringBuilder();

            //stringBuilder.Append(" -Xclang -analyzer-display-progress ");
            stringBuilder.Append(" --analyze ");


            //stringBuilder.Append(" -o " + GetReportFile() + " ");

            if (!vcFile.Name.EndsWith(".c"))
            {
                stringBuilder.Append(" -x c++ ");
            }
            stringBuilder.Append(DTE2Utils.GetIncludesForProject(vcConfiguration));
            stringBuilder.Append(DTE2Utils.GetDefinesForProject(vcConfiguration));
            stringBuilder.Append(DTE2Utils.GetIncludesForFile(vcFileConfiguration));
            stringBuilder.Append(DTE2Utils.GetDefinesForFile(vcFileConfiguration));
            stringBuilder.Append(GetArgumentMicrosoftCompilerSpecific());

            stringBuilder.Append(" -pedantic ");
            stringBuilder.Append(" -ferror-limit=0 ");

            stringBuilder.Append("\"" + vcFile.FullPath + "\"");
            return(stringBuilder.ToString());
        }
Beispiel #2
0
        static public Queue <VCFile> CreateFileQueue(VCProject vcProject)
        {
            ts.TraceInformation("CreateFileQueue");
            Queue <VCFile> fileQueue        = new Queue <VCFile>();
            var            vcFileCollection = (IVCCollection)vcProject.Files;

            if (vcFileCollection == null)
            {
                ts.TraceData(TraceEventType.Verbose, 1, "CreateFileList cannot get vc file collection");
                return(null);
            }

            ts.TraceInformation("CreateFileQueue #vcFileCollection " + vcFileCollection.Count);
            foreach (VCFile vcFile in vcFileCollection)
            {
                try
                {
                    VCFileConfiguration vcFileConfiguration = DTE2Utils.GetVcFileConfiguration(
                        vcFile,
                        DTE2Utils.GetVcConfiguratioForVcProject(vcProject));

                    if (vcFileConfiguration != null)
                    {
                        if ((vcFileConfiguration.ExcludedFromBuild == false) && (vcFile.FileType == eFileType.eFileTypeCppCode))
                        {
                            ts.TraceData(TraceEventType.Verbose, 1, "CreateFileList add " + vcFile.FullPath);
                            fileQueue.Enqueue(vcFile);
                        }
                        else
                        {
                            ts.TraceData(TraceEventType.Verbose, 1, "CreateFileList exclude " + vcFile.FullPath);
                        }
                    }
                }
                catch (Exception exception)
                {
                    ts.TraceData(TraceEventType.Verbose, 1, "CreateFileList exception  " + exception.Message);
                }
            }

            ts.TraceInformation("CreateFileList project " + vcProject.Name + " #files " + fileQueue.Count);
            return(fileQueue);
        }